mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +02:00
More flexible brake handles and universal brake buttons
This commit is contained in:
committed by
tmj-fstate
parent
a919443e40
commit
31c8b69fca
@@ -959,6 +959,7 @@ public:
|
|||||||
TBrakePressureTable BrakePressureTable; /*wyszczegolnienie cisnien w rurze*/
|
TBrakePressureTable BrakePressureTable; /*wyszczegolnienie cisnien w rurze*/
|
||||||
TBrakePressure BrakePressureActual; //wartości ważone dla aktualnej pozycji kranu
|
TBrakePressure BrakePressureActual; //wartości ważone dla aktualnej pozycji kranu
|
||||||
int ASBType = 0; /*0: brak hamulca przeciwposlizgowego, 1: reczny, 2: automat*/
|
int ASBType = 0; /*0: brak hamulca przeciwposlizgowego, 1: reczny, 2: automat*/
|
||||||
|
int UniversalBrakeButtonFlag[3] = { 0, 0, 0 }; /* mozliwe działania przycisków hamulcowych */
|
||||||
int TurboTest = 0;
|
int TurboTest = 0;
|
||||||
double MaxBrakeForce = 0.0; /*maksymalna sila nacisku hamulca*/
|
double MaxBrakeForce = 0.0; /*maksymalna sila nacisku hamulca*/
|
||||||
double MaxBrakePress[5]; //pomocniczy, proz, sred, lad, pp
|
double MaxBrakePress[5]; //pomocniczy, proz, sred, lad, pp
|
||||||
@@ -1001,6 +1002,9 @@ public:
|
|||||||
double EmergencyValveOff = 0.0;
|
double EmergencyValveOff = 0.0;
|
||||||
bool EmergencyValveOpen = false;
|
bool EmergencyValveOpen = false;
|
||||||
double EmergencyValveArea = 0.0;
|
double EmergencyValveArea = 0.0;
|
||||||
|
double LockPipeOn = -1.0;
|
||||||
|
double LockPipeOff = -1.0;
|
||||||
|
double HandleUnlock = -3.0;
|
||||||
int CompressorListPosNo = 0;
|
int CompressorListPosNo = 0;
|
||||||
int CompressorListDefPos = 1;
|
int CompressorListDefPos = 1;
|
||||||
bool CompressorListWrap = false;
|
bool CompressorListWrap = false;
|
||||||
@@ -1259,11 +1263,14 @@ public:
|
|||||||
int ManualBrakePos = 0; /*nastawa hamulca recznego*/
|
int ManualBrakePos = 0; /*nastawa hamulca recznego*/
|
||||||
double LocalBrakePosA = 0.0; /*nastawa hamulca pomocniczego*/
|
double LocalBrakePosA = 0.0; /*nastawa hamulca pomocniczego*/
|
||||||
double LocalBrakePosAEIM = 0.0; /*pozycja hamulca pomocniczego ep dla asynchronicznych ezt*/
|
double LocalBrakePosAEIM = 0.0; /*pozycja hamulca pomocniczego ep dla asynchronicznych ezt*/
|
||||||
|
bool UniversalBrakeButtonActive[3] = { false, false, false }; /* brake button pressed */
|
||||||
/*
|
/*
|
||||||
int BrakeStatus = b_off; //0 - odham, 1 - ham., 2 - uszk., 4 - odluzniacz, 8 - antyposlizg, 16 - uzyte EP, 32 - pozycja R, 64 - powrot z R
|
int BrakeStatus = b_off; //0 - odham, 1 - ham., 2 - uszk., 4 - odluzniacz, 8 - antyposlizg, 16 - uzyte EP, 32 - pozycja R, 64 - powrot z R
|
||||||
*/
|
*/
|
||||||
bool AlarmChainFlag = false; // manual emergency brake
|
bool AlarmChainFlag = false; // manual emergency brake
|
||||||
bool RadioStopFlag = false; /*hamowanie nagle*/
|
bool RadioStopFlag = false; /*hamowanie nagle*/
|
||||||
|
bool LockPipe = false; /*locking brake pipe in emergency state*/
|
||||||
|
bool UnlockPipe = false; /*unlockig brake pipe button pressed*/
|
||||||
int BrakeDelayFlag = 0; /*nastawa opoznienia ham. osob/towar/posp/exp 0/1/2/4*/
|
int BrakeDelayFlag = 0; /*nastawa opoznienia ham. osob/towar/posp/exp 0/1/2/4*/
|
||||||
int BrakeDelays = 0; /*nastawy mozliwe do uzyskania*/
|
int BrakeDelays = 0; /*nastawy mozliwe do uzyskania*/
|
||||||
int BrakeOpModeFlag = 0; /*nastawa trybu pracy PS/PN/EP/MED 1/2/4/8*/
|
int BrakeOpModeFlag = 0; /*nastawa trybu pracy PS/PN/EP/MED 1/2/4/8*/
|
||||||
@@ -1537,6 +1544,7 @@ public:
|
|||||||
bool AlarmChainSwitch( bool const State );
|
bool AlarmChainSwitch( bool const State );
|
||||||
bool AntiSlippingBrake(void);
|
bool AntiSlippingBrake(void);
|
||||||
bool BrakeReleaser(int state);
|
bool BrakeReleaser(int state);
|
||||||
|
bool UniversalBrakeButton(int button, int state); /*uniwersalny przycisk hamulca*/
|
||||||
bool SwitchEPBrake(int state);
|
bool SwitchEPBrake(int state);
|
||||||
bool AntiSlippingButton(void); /*! reczny wlacznik urzadzen antyposlizgowych*/
|
bool AntiSlippingButton(void); /*! reczny wlacznik urzadzen antyposlizgowych*/
|
||||||
|
|
||||||
|
|||||||
@@ -3440,6 +3440,37 @@ bool TMoverParameters::BrakeReleaser(int state)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// *************************************************************************************************
|
||||||
|
// yB: 20160711
|
||||||
|
// włączenie / wyłączenie uniwersalnego przycisku hamulcowego
|
||||||
|
// *************************************************************************************************
|
||||||
|
bool TMoverParameters::UniversalBrakeButton(int button, int state)
|
||||||
|
{
|
||||||
|
bool OK = true; //false tylko jeśli nie uda się wysłać, GF 20161124
|
||||||
|
UniversalBrakeButtonActive[button] = state > 0;
|
||||||
|
int flag = 0;
|
||||||
|
if (Battery) {
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
flag = flag | (UniversalBrakeButtonActive[i] ? UniversalBrakeButtonFlag[i] : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Hamulec->SetUniversalFlag(flag);
|
||||||
|
Handle->SetUniversalFlag(flag);
|
||||||
|
LocHandle->SetUniversalFlag(flag);
|
||||||
|
UnlockPipe = (flag & TUniversalBrake::ub_UnlockPipe) > 0;
|
||||||
|
|
||||||
|
//if the releaser can be activated by switch
|
||||||
|
if ( TestFlag ( UniversalBrakeButtonFlag[0] & UniversalBrakeButtonFlag[1] & UniversalBrakeButtonFlag[2],
|
||||||
|
TUniversalBrake::ub_Release ) )
|
||||||
|
{
|
||||||
|
Hamulec->Releaser( int ( TestFlag ( flag, TUniversalBrake::ub_Release ) ));
|
||||||
|
if (CabNo != 0) // rekurencyjne wysłanie do następnego
|
||||||
|
OK = SendCtrlToNext("BrakeReleaser", state, CabNo);
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
// Q: 20160711
|
// Q: 20160711
|
||||||
// włączenie / wyłączenie hamulca elektro-pneumatycznego
|
// włączenie / wyłączenie hamulca elektro-pneumatycznego
|
||||||
@@ -3898,11 +3929,17 @@ void TMoverParameters::UpdatePipePressure(double dt)
|
|||||||
dpLocalValve = LocHandle->GetPF(std::max(LocalBrakePosA, LocalBrakePosAEIM), Hamulec->GetBCP(), ScndPipePress, dt, 0);
|
dpLocalValve = LocHandle->GetPF(std::max(LocalBrakePosA, LocalBrakePosAEIM), Hamulec->GetBCP(), ScndPipePress, dt, 0);
|
||||||
else
|
else
|
||||||
dpLocalValve = LocHandle->GetPF(LocalBrakePosAEIM, Hamulec->GetBCP(), ScndPipePress, dt, 0);
|
dpLocalValve = LocHandle->GetPF(LocalBrakePosAEIM, Hamulec->GetBCP(), ScndPipePress, dt, 0);
|
||||||
if( ( BrakeHandle == TBrakeHandle::FV4a )
|
|
||||||
|
LockPipe = PipePress < (LockPipe ? LockPipeOff : LockPipeOn);
|
||||||
|
bool lock_new = (LockPipe && !UnlockPipe && (BrakeCtrlPosR > HandleUnlock)); //new simple codition based on .fiz
|
||||||
|
bool lock_old = ((BrakeHandle == TBrakeHandle::FV4a) //old complex condition based on assumptions
|
||||||
&& ((PipePress < 2.75)
|
&& ((PipePress < 2.75)
|
||||||
&& ((Hamulec->GetStatus() & b_rls) == 0))
|
&& ((Hamulec->GetStatus() & b_rls) == 0))
|
||||||
&& (BrakeSubsystem == TBrakeSubSystem::ss_LSt)
|
&& (BrakeSubsystem == TBrakeSubSystem::ss_LSt)
|
||||||
&& ( TrainType != dt_EZT ) ) {
|
&& (TrainType != dt_EZT)
|
||||||
|
&& (!UnlockPipe));
|
||||||
|
|
||||||
|
if( ( lock_old ) || ( lock_new ) ) {
|
||||||
temp = PipePress + 0.00001;
|
temp = PipePress + 0.00001;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -8964,6 +9001,12 @@ void TMoverParameters::LoadFIZ_Brake( std::string const &line ) {
|
|||||||
extract_value( EmergencyValveOff, "MinEVP", line, "" );
|
extract_value( EmergencyValveOff, "MinEVP", line, "" );
|
||||||
extract_value( EmergencyValveOn, "MaxEVP", line, "" );
|
extract_value( EmergencyValveOn, "MaxEVP", line, "" );
|
||||||
extract_value( EmergencyValveArea, "EVArea", line, "" );
|
extract_value( EmergencyValveArea, "EVArea", line, "" );
|
||||||
|
extract_value( UniversalBrakeButtonFlag[0], "UBB1", line, "");
|
||||||
|
extract_value( UniversalBrakeButtonFlag[1], "UBB2", line, "");
|
||||||
|
extract_value( UniversalBrakeButtonFlag[2], "UBB3", line, "");
|
||||||
|
extract_value( LockPipeOn, "LPOn", line, "-1");
|
||||||
|
extract_value( LockPipeOff, "LPOff", line, "-1");
|
||||||
|
extract_value( HandleUnlock, "HandlePipeUnlockPos", line, "-3");
|
||||||
{
|
{
|
||||||
std::map<std::string, int> compressorpowers{
|
std::map<std::string, int> compressorpowers{
|
||||||
{ "Main", 0 },
|
{ "Main", 0 },
|
||||||
|
|||||||
@@ -1300,7 +1300,9 @@ double TLSt::GetPF( double const PP, double const dt, double const Vel )
|
|||||||
SoundFlag |= sf_CylU;
|
SoundFlag |= sf_CylU;
|
||||||
}
|
}
|
||||||
// equivalent of checkreleaser() in the base class?
|
// equivalent of checkreleaser() in the base class?
|
||||||
if( ( BrakeStatus & b_rls ) == b_rls ) {
|
bool is_releasing = ( ( BrakeStatus & b_rls)
|
||||||
|
|| ( UniversalFlag & TUniversalBrake::ub_Release ) );
|
||||||
|
if ( is_releasing ) {
|
||||||
if( CVP < 0.0 ) {
|
if( CVP < 0.0 ) {
|
||||||
BrakeStatus &= ~b_rls;
|
BrakeStatus &= ~b_rls;
|
||||||
}
|
}
|
||||||
@@ -1373,9 +1375,12 @@ double TLSt::GetPF( double const PP, double const dt, double const Vel )
|
|||||||
temp = 1 - RapidTemp;
|
temp = 1 - RapidTemp;
|
||||||
if (EDFlag > 0.2)
|
if (EDFlag > 0.2)
|
||||||
temp = 10000;
|
temp = 10000;
|
||||||
|
double tempasb = 0;
|
||||||
|
if ( ( (UniversalFlag & TUniversalBrake::ub_AntiSlipBrake) > 0)
|
||||||
|
|| ( (BrakeStatus & b_asb_unbrake) == b_asb_unbrake ) )
|
||||||
|
tempasb = ASBP;
|
||||||
// powtarzacz — podwojny zawor zwrotny
|
// powtarzacz — podwojny zawor zwrotny
|
||||||
temp = Max0R(((CVP - BCP) * BVM + ASBP * int((BrakeStatus & b_asb_unbrake) == b_asb_unbrake)) / temp, LBP);
|
temp = Max0R( ( (CVP - BCP) * BVM + tempasb ) / temp, LBP );
|
||||||
// luzowanie CH
|
// luzowanie CH
|
||||||
if ((BrakeCyl->P() > temp + 0.005) || (temp < 0.28))
|
if ((BrakeCyl->P() > temp + 0.005) || (temp < 0.28))
|
||||||
// dV:=PF(0,BrakeCyl->P(),0.0015*3*sizeBC)*dt
|
// dV:=PF(0,BrakeCyl->P(),0.0015*3*sizeBC)*dt
|
||||||
@@ -1556,6 +1561,10 @@ double TEStED::GetPF( double const PP, double const dt, double const Vel )
|
|||||||
|
|
||||||
// powtarzacz — podwojny zawor zwrotny
|
// powtarzacz — podwojny zawor zwrotny
|
||||||
temp = Max0R(LoadC * BCP / temp * Min0R(Max0R(1 - EDFlag, 0), 1), LBP);
|
temp = Max0R(LoadC * BCP / temp * Min0R(Max0R(1 - EDFlag, 0), 1), LBP);
|
||||||
|
|
||||||
|
if ( ( UniversalFlag & TUniversalBrake::ub_AntiSlipBrake ) > 0 )
|
||||||
|
temp = std::max(temp, ASBP);
|
||||||
|
|
||||||
double speed = 1;
|
double speed = 1;
|
||||||
if ((ASBP < 0.1) && ((BrakeStatus & b_asb_unbrake) == b_asb_unbrake))
|
if ((ASBP < 0.1) && ((BrakeStatus & b_asb_unbrake) == b_asb_unbrake))
|
||||||
{
|
{
|
||||||
@@ -2292,6 +2301,11 @@ void TDriverHandle::OvrldButton(bool Active)
|
|||||||
{
|
{
|
||||||
ManualOvrldActive = Active;
|
ManualOvrldActive = Active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TDriverHandle::SetUniversalFlag(int flag)
|
||||||
|
{
|
||||||
|
UniversalFlag = flag;
|
||||||
|
}
|
||||||
//---FV4a---
|
//---FV4a---
|
||||||
|
|
||||||
double TFV4a::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
double TFV4a::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
||||||
@@ -2576,7 +2590,7 @@ double TMHZ_EN57::GetPF( double i_bcp, double PP, double HP, double dt, double e
|
|||||||
|
|
||||||
i_bcp = Max0R(Min0R(i_bcp, 9.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
i_bcp = Max0R(Min0R(i_bcp, 9.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
||||||
|
|
||||||
if ((TP > 0))
|
if ((TP > 0)&&(CP > 4.9))
|
||||||
{
|
{
|
||||||
DP = 0.045;
|
DP = 0.045;
|
||||||
if (EQ(i_bcp, 0))
|
if (EQ(i_bcp, 0))
|
||||||
@@ -2591,8 +2605,13 @@ double TMHZ_EN57::GetPF( double i_bcp, double PP, double HP, double dt, double e
|
|||||||
LimPP = Min0R(LPP_RP(i_bcp) + TP * 0.08 + RedAdj, HP); // pozycja + czasowy lub zasilanie
|
LimPP = Min0R(LPP_RP(i_bcp) + TP * 0.08 + RedAdj, HP); // pozycja + czasowy lub zasilanie
|
||||||
ActFlowSpeed = 4;
|
ActFlowSpeed = 4;
|
||||||
|
|
||||||
if ((EQ(i_bcp, -1)))
|
double uop = UnbrakeOverPressure; //unbrake over pressure in actual state
|
||||||
pom = Min0R(HP, 5.4 + RedAdj);
|
ManualOvrldActive = (UniversalFlag & TUniversalBrake::ub_HighPressure); //button is pressed
|
||||||
|
if (ManualOvrld && !ManualOvrldActive) //no overpressure for not pressed button if it does not exists
|
||||||
|
uop = 0;
|
||||||
|
|
||||||
|
if ( ( EQ( i_bcp, -1 ) ) && ( uop > 0 ) )
|
||||||
|
pom = Min0R(HP, 5.4 + RedAdj + uop);
|
||||||
else
|
else
|
||||||
pom = Min0R(CP, HP);
|
pom = Min0R(CP, HP);
|
||||||
|
|
||||||
@@ -2602,9 +2621,9 @@ double TMHZ_EN57::GetPF( double i_bcp, double PP, double HP, double dt, double e
|
|||||||
CP = CP + 13 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy
|
CP = CP + 13 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy
|
||||||
|
|
||||||
LimPP = pom; // cp
|
LimPP = pom; // cp
|
||||||
if (EQ(i_bcp, -1))
|
//if (EQ(i_bcp, -1))
|
||||||
dpPipe = HP;
|
// dpPipe = HP;
|
||||||
else
|
// else
|
||||||
dpPipe = Min0R(HP, LimPP);
|
dpPipe = Min0R(HP, LimPP);
|
||||||
|
|
||||||
if (dpPipe > PP)
|
if (dpPipe > PP)
|
||||||
@@ -2612,7 +2631,8 @@ double TMHZ_EN57::GetPF( double i_bcp, double PP, double HP, double dt, double e
|
|||||||
else
|
else
|
||||||
dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
||||||
|
|
||||||
if (EQ(i_bcp, -1))
|
if ( ( EQ(i_bcp, -1) && ( AutoOvrld ) )
|
||||||
|
||(i_bcp<0.5 && (UniversalFlag & TUniversalBrake::ub_Overload)))
|
||||||
{
|
{
|
||||||
if ((TP < 5))
|
if ((TP < 5))
|
||||||
TP = TP + dt; // 5/10
|
TP = TP + dt; // 5/10
|
||||||
@@ -2691,6 +2711,15 @@ double TMHZ_EN57::LPP_RP(double pos) // cisnienie z zaokraglonej pozycji;
|
|||||||
return 5.0;
|
return 5.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TMHZ_EN57::SetParams(bool AO, bool MO, double OverP, double)
|
||||||
|
{
|
||||||
|
AutoOvrld = AO;
|
||||||
|
ManualOvrld = MO;
|
||||||
|
UnbrakeOverPressure = std::max(0.0, OverP);
|
||||||
|
Fala = (OverP > 0.01);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
bool TMHZ_EN57::EQ(double pos, double i_pos)
|
bool TMHZ_EN57::EQ(double pos, double i_pos)
|
||||||
{
|
{
|
||||||
return (pos <= i_pos + 0.5) && (pos > i_pos - 0.5);
|
return (pos <= i_pos + 0.5) && (pos > i_pos - 0.5);
|
||||||
@@ -2716,7 +2745,7 @@ double TMHZ_K5P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
|||||||
|
|
||||||
i_bcp = Max0R(Min0R(i_bcp, 2.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
i_bcp = Max0R(Min0R(i_bcp, 2.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
||||||
|
|
||||||
if ((TP > 0))
|
if ((TP > 0)&&(CP>4.9))
|
||||||
{
|
{
|
||||||
DP = 0.004;
|
DP = 0.004;
|
||||||
TP = TP - DP * dt;
|
TP = TP - DP * dt;
|
||||||
@@ -2749,7 +2778,7 @@ double TMHZ_K5P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
|||||||
else
|
else
|
||||||
dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
||||||
|
|
||||||
if ((EQ(i_bcp, -1)&&(AutoOvrld))||(ManualOvrld && ManualOvrldActive))
|
if ((EQ(i_bcp, -1)&&(AutoOvrld))||(i_bcp<0.5 && ManualOvrldActive ))
|
||||||
{
|
{
|
||||||
if ((TP < 1))
|
if ((TP < 1))
|
||||||
TP = TP + 0.03 * dt;
|
TP = TP + 0.03 * dt;
|
||||||
@@ -2836,7 +2865,7 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
|||||||
|
|
||||||
i_bcp = Max0R(Min0R(i_bcp, 3.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
i_bcp = Max0R(Min0R(i_bcp, 3.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
||||||
|
|
||||||
if ((TP > 0))
|
if ((TP > 0)&&(CP>4.9))
|
||||||
{
|
{
|
||||||
DP = 0.004;
|
DP = 0.004;
|
||||||
TP = TP - DP * dt;
|
TP = TP - DP * dt;
|
||||||
@@ -2864,9 +2893,14 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
|||||||
|
|
||||||
dpPipe = Min0R(HP, CP + TP + RedAdj);
|
dpPipe = Min0R(HP, CP + TP + RedAdj);
|
||||||
|
|
||||||
|
double uop = UnbrakeOverPressure; //unbrake over pressure in actual state
|
||||||
|
ManualOvrldActive = (UniversalFlag & TUniversalBrake::ub_HighPressure); //button is pressed
|
||||||
|
if (ManualOvrld && !ManualOvrldActive) //no overpressure for not pressed button if it does not exists
|
||||||
|
uop = 0;
|
||||||
|
|
||||||
if (Fala && EQ(i_bcp, -1))
|
if (Fala && EQ(i_bcp, -1))
|
||||||
{
|
{
|
||||||
dpPipe = 5.0 + TP + RedAdj + UnbrakeOverPressure;
|
dpPipe = 5.0 + TP + RedAdj + uop;
|
||||||
ActFlowSpeed = 12;
|
ActFlowSpeed = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2875,7 +2909,7 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
|||||||
else
|
else
|
||||||
dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
||||||
|
|
||||||
if ((EQ(i_bcp, -1) && (AutoOvrld)) || (ManualOvrld && ManualOvrldActive))
|
if ((EQ(i_bcp, -1) && (AutoOvrld)) || ((i_bcp<0.5) && (UniversalFlag & TUniversalBrake::ub_Overload)))
|
||||||
{
|
{
|
||||||
if ((TP < 1))
|
if ((TP < 1))
|
||||||
TP = TP + 0.03 * dt;
|
TP = TP + 0.03 * dt;
|
||||||
|
|||||||
@@ -133,6 +133,16 @@ static double const BPT_394[7][2] = { {13 , 10.0} , {5 , 5.0} , {0 , -1} , {5 ,
|
|||||||
static int const i_bcpno = 6;
|
static int const i_bcpno = 6;
|
||||||
// static double const pi = 3.141592653589793; //definicja w mctools
|
// static double const pi = 3.141592653589793; //definicja w mctools
|
||||||
|
|
||||||
|
enum TUniversalBrake // możliwe działania uniwersalnego przycisku hamulca
|
||||||
|
{ // kolejne flagi
|
||||||
|
ub_Release = 0x01, // odluźniacz - ZR
|
||||||
|
ub_UnlockPipe = 0x02, // odblok PG / mostkowanie hamulca bezpieczeństwa - POJAZD
|
||||||
|
ub_HighPressure = 0x04, // impuls wysokiego ciśnienia - ZM
|
||||||
|
ub_Overload = 0x08, // przycisk asymilacji / kontrolowanego przeładowania - ZM
|
||||||
|
ub_AntiSlipBrake = 0x10, // przycisk przyhamowania przeciwposlizgowego - ZR
|
||||||
|
ub_Ostatni = 0x80000000 // ostatnia flaga bitowa
|
||||||
|
};
|
||||||
|
|
||||||
//klasa obejmujaca pojedyncze zbiorniki
|
//klasa obejmujaca pojedyncze zbiorniki
|
||||||
class TReservoir {
|
class TReservoir {
|
||||||
|
|
||||||
@@ -183,6 +193,7 @@ class TBrake {
|
|||||||
double SizeBC = 0.0; //rozmiar^2 CH (w stosunku do 14")
|
double SizeBC = 0.0; //rozmiar^2 CH (w stosunku do 14")
|
||||||
bool DCV = false; //podwojny zawor zwrotny
|
bool DCV = false; //podwojny zawor zwrotny
|
||||||
double ASBP = 0.0; //cisnienie hamulca pp
|
double ASBP = 0.0; //cisnienie hamulca pp
|
||||||
|
int UniversalFlag = 0; //flaga wcisnietych przyciskow uniwersalnych
|
||||||
|
|
||||||
int BrakeStatus{ b_off }; //flaga stanu
|
int BrakeStatus{ b_off }; //flaga stanu
|
||||||
int SoundFlag = 0;
|
int SoundFlag = 0;
|
||||||
@@ -220,6 +231,7 @@ class TBrake {
|
|||||||
int GetBrakeStatus() const { return BrakeStatus; }
|
int GetBrakeStatus() const { return BrakeStatus; }
|
||||||
void SetBrakeStatus( int const Status ) { BrakeStatus = Status; }
|
void SetBrakeStatus( int const Status ) { BrakeStatus = Status; }
|
||||||
virtual void SetED( double const EDstate ) {}; //stan hamulca ED do luzowania
|
virtual void SetED( double const EDstate ) {}; //stan hamulca ED do luzowania
|
||||||
|
virtual void SetUniversalFlag(int flag) { UniversalFlag = flag; } //przycisk uniwersalny
|
||||||
};
|
};
|
||||||
|
|
||||||
class TWest : public TBrake {
|
class TWest : public TBrake {
|
||||||
@@ -520,6 +532,7 @@ class TDriverHandle {
|
|||||||
bool AutoOvrld = false; //czy jest asymilacja automatyczna na pozycji -1
|
bool AutoOvrld = false; //czy jest asymilacja automatyczna na pozycji -1
|
||||||
bool ManualOvrld = false; //czy jest asymilacja reczna przyciskiem
|
bool ManualOvrld = false; //czy jest asymilacja reczna przyciskiem
|
||||||
bool ManualOvrldActive = false; //czy jest wcisniety przycisk asymilacji
|
bool ManualOvrldActive = false; //czy jest wcisniety przycisk asymilacji
|
||||||
|
int UniversalFlag = 0; //flaga wcisnietych przyciskow uniwersalnych
|
||||||
public:
|
public:
|
||||||
bool Time = false;
|
bool Time = false;
|
||||||
bool TimeEP = false;
|
bool TimeEP = false;
|
||||||
@@ -534,7 +547,7 @@ class TDriverHandle {
|
|||||||
virtual double GetEP(double pos); //pobranie sily hamulca ep
|
virtual double GetEP(double pos); //pobranie sily hamulca ep
|
||||||
virtual void SetParams(bool AO, bool MO, double, double) {}; //ustawianie jakichs parametrów dla zaworu
|
virtual void SetParams(bool AO, bool MO, double, double) {}; //ustawianie jakichs parametrów dla zaworu
|
||||||
virtual void OvrldButton(bool Active); //przycisk recznego przeladowania/asymilacji
|
virtual void OvrldButton(bool Active); //przycisk recznego przeladowania/asymilacji
|
||||||
|
virtual void SetUniversalFlag(int flag); //przycisk uniwersalny
|
||||||
inline TDriverHandle() { memset( Sounds, 0, sizeof( Sounds ) ); }
|
inline TDriverHandle() { memset( Sounds, 0, sizeof( Sounds ) ); }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -589,6 +602,7 @@ class TMHZ_EN57 : public TDriverHandle {
|
|||||||
double RP = 0.0; //zbiornik redukcyjny
|
double RP = 0.0; //zbiornik redukcyjny
|
||||||
double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
|
double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
|
||||||
bool Fala = false;
|
bool Fala = false;
|
||||||
|
double UnbrakeOverPressure = 0.0;
|
||||||
static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
|
static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
|
||||||
|
|
||||||
double LPP_RP(double pos);
|
double LPP_RP(double pos);
|
||||||
@@ -602,7 +616,7 @@ class TMHZ_EN57 : public TDriverHandle {
|
|||||||
double GetPos(int i)/*override*/;
|
double GetPos(int i)/*override*/;
|
||||||
double GetCP()/*override*/;
|
double GetCP()/*override*/;
|
||||||
double GetEP(double pos);
|
double GetEP(double pos);
|
||||||
|
void SetParams(bool AO, bool MO, double OverP, double);
|
||||||
inline TMHZ_EN57(void) :
|
inline TMHZ_EN57(void) :
|
||||||
TDriverHandle()
|
TDriverHandle()
|
||||||
{}
|
{}
|
||||||
|
|||||||
66
Train.cpp
66
Train.cpp
@@ -180,6 +180,9 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = {
|
|||||||
{ user_command::independentbrakedecreasefast, &TTrain::OnCommand_independentbrakedecreasefast },
|
{ user_command::independentbrakedecreasefast, &TTrain::OnCommand_independentbrakedecreasefast },
|
||||||
{ user_command::independentbrakeset, &TTrain::OnCommand_independentbrakeset },
|
{ user_command::independentbrakeset, &TTrain::OnCommand_independentbrakeset },
|
||||||
{ user_command::independentbrakebailoff, &TTrain::OnCommand_independentbrakebailoff },
|
{ user_command::independentbrakebailoff, &TTrain::OnCommand_independentbrakebailoff },
|
||||||
|
{ user_command::universalbrakebutton1, &TTrain::OnCommand_universalbrakebutton1 },
|
||||||
|
{ user_command::universalbrakebutton2, &TTrain::OnCommand_universalbrakebutton2 },
|
||||||
|
{ user_command::universalbrakebutton3, &TTrain::OnCommand_universalbrakebutton3 },
|
||||||
{ user_command::trainbrakeincrease, &TTrain::OnCommand_trainbrakeincrease },
|
{ user_command::trainbrakeincrease, &TTrain::OnCommand_trainbrakeincrease },
|
||||||
{ user_command::trainbrakedecrease, &TTrain::OnCommand_trainbrakedecrease },
|
{ user_command::trainbrakedecrease, &TTrain::OnCommand_trainbrakedecrease },
|
||||||
{ user_command::trainbrakeset, &TTrain::OnCommand_trainbrakeset },
|
{ user_command::trainbrakeset, &TTrain::OnCommand_trainbrakeset },
|
||||||
@@ -1166,6 +1169,60 @@ void TTrain::OnCommand_independentbrakebailoff( TTrain *Train, command_data cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_universalbrakebutton1(TTrain *Train, command_data const &Command) {
|
||||||
|
|
||||||
|
if (Command.action == GLFW_PRESS) {
|
||||||
|
// press or hold
|
||||||
|
// visual feedback
|
||||||
|
Train->ggUniveralBrakeButton1.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
|
|
||||||
|
Train->mvOccupied->UniversalBrakeButton(0,1);
|
||||||
|
}
|
||||||
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
|
// release
|
||||||
|
// visual feedback
|
||||||
|
Train->ggUniveralBrakeButton1.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
|
||||||
|
Train->mvOccupied->UniversalBrakeButton(0,0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_universalbrakebutton2(TTrain *Train, command_data const &Command) {
|
||||||
|
|
||||||
|
if (Command.action == GLFW_PRESS) {
|
||||||
|
// press or hold
|
||||||
|
// visual feedback
|
||||||
|
Train->ggUniveralBrakeButton2.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
|
|
||||||
|
Train->mvOccupied->UniversalBrakeButton(1, 1);
|
||||||
|
}
|
||||||
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
|
// release
|
||||||
|
// visual feedback
|
||||||
|
Train->ggUniveralBrakeButton2.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
|
||||||
|
Train->mvOccupied->UniversalBrakeButton(1, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TTrain::OnCommand_universalbrakebutton3(TTrain *Train, command_data const &Command) {
|
||||||
|
|
||||||
|
if (Command.action == GLFW_PRESS) {
|
||||||
|
// press or hold
|
||||||
|
// visual feedback
|
||||||
|
Train->ggUniveralBrakeButton3.UpdateValue(1.0, Train->dsbSwitch);
|
||||||
|
|
||||||
|
Train->mvOccupied->UniversalBrakeButton(2, 1);
|
||||||
|
}
|
||||||
|
else if (Command.action == GLFW_RELEASE) {
|
||||||
|
// release
|
||||||
|
// visual feedback
|
||||||
|
Train->ggUniveralBrakeButton3.UpdateValue(0.0, Train->dsbSwitch);
|
||||||
|
|
||||||
|
Train->mvOccupied->UniversalBrakeButton(2, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
if( Command.action != GLFW_RELEASE ) {
|
if( Command.action != GLFW_RELEASE ) {
|
||||||
@@ -6374,6 +6431,9 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
ggMainButton.Update();
|
ggMainButton.Update();
|
||||||
ggSecurityResetButton.Update();
|
ggSecurityResetButton.Update();
|
||||||
ggReleaserButton.Update();
|
ggReleaserButton.Update();
|
||||||
|
ggUniveralBrakeButton1.Update();
|
||||||
|
ggUniveralBrakeButton2.Update();
|
||||||
|
ggUniveralBrakeButton3.Update();
|
||||||
ggAntiSlipButton.Update();
|
ggAntiSlipButton.Update();
|
||||||
ggSandButton.Update();
|
ggSandButton.Update();
|
||||||
ggFuseButton.Update();
|
ggFuseButton.Update();
|
||||||
@@ -7568,6 +7628,9 @@ void TTrain::clear_cab_controls()
|
|||||||
ggMainOnButton.Clear();
|
ggMainOnButton.Clear();
|
||||||
ggSecurityResetButton.Clear();
|
ggSecurityResetButton.Clear();
|
||||||
ggReleaserButton.Clear();
|
ggReleaserButton.Clear();
|
||||||
|
ggUniveralBrakeButton1.Clear();
|
||||||
|
ggUniveralBrakeButton2.Clear();
|
||||||
|
ggUniveralBrakeButton3.Clear();
|
||||||
ggSandButton.Clear();
|
ggSandButton.Clear();
|
||||||
ggAntiSlipButton.Clear();
|
ggAntiSlipButton.Clear();
|
||||||
ggHornButton.Clear();
|
ggHornButton.Clear();
|
||||||
@@ -8230,6 +8293,9 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
|||||||
{ "main_on_bt:", ggMainOnButton },
|
{ "main_on_bt:", ggMainOnButton },
|
||||||
{ "security_reset_bt:", ggSecurityResetButton },
|
{ "security_reset_bt:", ggSecurityResetButton },
|
||||||
{ "releaser_bt:", ggReleaserButton },
|
{ "releaser_bt:", ggReleaserButton },
|
||||||
|
{ "universalbrake1_bt:", ggUniveralBrakeButton1 },
|
||||||
|
{ "universalbrake2_bt:", ggUniveralBrakeButton2 },
|
||||||
|
{ "universalbrake3_bt:", ggUniveralBrakeButton3 },
|
||||||
{ "sand_bt:", ggSandButton },
|
{ "sand_bt:", ggSandButton },
|
||||||
{ "autosandallow_sw:", ggAutoSandAllow },
|
{ "autosandallow_sw:", ggAutoSandAllow },
|
||||||
{ "antislip_bt:", ggAntiSlipButton },
|
{ "antislip_bt:", ggAntiSlipButton },
|
||||||
|
|||||||
6
Train.h
6
Train.h
@@ -181,6 +181,9 @@ class TTrain {
|
|||||||
static void OnCommand_independentbrakedecreasefast( TTrain *Train, command_data const &Command );
|
static void OnCommand_independentbrakedecreasefast( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_independentbrakeset( TTrain *Train, command_data const &Command );
|
static void OnCommand_independentbrakeset( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_independentbrakebailoff( TTrain *Train, command_data const &Command );
|
static void OnCommand_independentbrakebailoff( TTrain *Train, command_data const &Command );
|
||||||
|
static void OnCommand_universalbrakebutton1(TTrain *Train, command_data const &Command);
|
||||||
|
static void OnCommand_universalbrakebutton2(TTrain *Train, command_data const &Command);
|
||||||
|
static void OnCommand_universalbrakebutton3(TTrain *Train, command_data const &Command);
|
||||||
static void OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Command );
|
static void OnCommand_trainbrakeincrease( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_trainbrakedecrease( TTrain *Train, command_data const &Command );
|
static void OnCommand_trainbrakedecrease( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_trainbrakeset( TTrain *Train, command_data const &Command );
|
static void OnCommand_trainbrakeset( TTrain *Train, command_data const &Command );
|
||||||
@@ -418,6 +421,9 @@ public: // reszta może by?publiczna
|
|||||||
TGauge ggMainButton; // EZT
|
TGauge ggMainButton; // EZT
|
||||||
TGauge ggSecurityResetButton;
|
TGauge ggSecurityResetButton;
|
||||||
TGauge ggReleaserButton;
|
TGauge ggReleaserButton;
|
||||||
|
TGauge ggUniveralBrakeButton1;
|
||||||
|
TGauge ggUniveralBrakeButton2;
|
||||||
|
TGauge ggUniveralBrakeButton3;
|
||||||
TGauge ggSandButton; // guzik piasecznicy
|
TGauge ggSandButton; // guzik piasecznicy
|
||||||
TGauge ggAutoSandAllow; // przełącznik piasecznicy
|
TGauge ggAutoSandAllow; // przełącznik piasecznicy
|
||||||
TGauge ggAntiSlipButton;
|
TGauge ggAntiSlipButton;
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ commanddescription_sequence Commands_descriptions = {
|
|||||||
{ "independentbrakedecreasefast", command_target::vehicle },
|
{ "independentbrakedecreasefast", command_target::vehicle },
|
||||||
{ "independentbrakeset", command_target::vehicle },
|
{ "independentbrakeset", command_target::vehicle },
|
||||||
{ "independentbrakebailoff", command_target::vehicle },
|
{ "independentbrakebailoff", command_target::vehicle },
|
||||||
|
{ "universalbrakebutton1", command_target::vehicle },
|
||||||
|
{ "universalbrakebutton2", command_target::vehicle },
|
||||||
|
{ "universalbrakebutton3", command_target::vehicle },
|
||||||
{ "trainbrakeincrease", command_target::vehicle },
|
{ "trainbrakeincrease", command_target::vehicle },
|
||||||
{ "trainbrakedecrease", command_target::vehicle },
|
{ "trainbrakedecrease", command_target::vehicle },
|
||||||
{ "trainbrakeset", command_target::vehicle },
|
{ "trainbrakeset", command_target::vehicle },
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ enum class user_command {
|
|||||||
independentbrakedecreasefast,
|
independentbrakedecreasefast,
|
||||||
independentbrakeset,
|
independentbrakeset,
|
||||||
independentbrakebailoff,
|
independentbrakebailoff,
|
||||||
|
universalbrakebutton1,
|
||||||
|
universalbrakebutton2,
|
||||||
|
universalbrakebutton3,
|
||||||
trainbrakeincrease,
|
trainbrakeincrease,
|
||||||
trainbrakedecrease,
|
trainbrakedecrease,
|
||||||
trainbrakeset,
|
trainbrakeset,
|
||||||
|
|||||||
@@ -570,6 +570,15 @@ drivermouse_input::default_bindings() {
|
|||||||
{ "releaser_bt:", {
|
{ "releaser_bt:", {
|
||||||
user_command::independentbrakebailoff,
|
user_command::independentbrakebailoff,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
{ "universalbrake1_bt:",{
|
||||||
|
user_command::universalbrakebutton1,
|
||||||
|
user_command::none } },
|
||||||
|
{ "universalbrake2_bt:",{
|
||||||
|
user_command::universalbrakebutton2,
|
||||||
|
user_command::none } },
|
||||||
|
{ "universalbrake3_bt:",{
|
||||||
|
user_command::universalbrakebutton3,
|
||||||
|
user_command::none } },
|
||||||
{ "sand_bt:", {
|
{ "sand_bt:", {
|
||||||
user_command::sandboxactivate,
|
user_command::sandboxactivate,
|
||||||
user_command::none } },
|
user_command::none } },
|
||||||
|
|||||||
Reference in New Issue
Block a user