16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 13:59:19 +02:00

Merge branch 'tmj-dev' into milek-dev

This commit is contained in:
milek7
2019-09-15 21:24:15 +02:00
22 changed files with 1095 additions and 147 deletions

View File

@@ -204,6 +204,7 @@ static int const dbrake_automatic = 8;
/*status czuwaka/SHP*/
//hunter-091012: rozdzielenie alarmow, dodanie testu czuwaka
static int const s_off = 0; //disabled
static int const s_waiting = 1; //działa
static int const s_aware = 2; //czuwak miga
static int const s_active = 4; //SHP świeci
@@ -305,6 +306,14 @@ enum TProblem // lista problemów taboru, które uniemożliwiają jazdę
pr_Ostatni = 0x80000000 // ostatnia flaga bitowa
};
enum TCompressorList // lista parametrów w programatorze sprężarek
{ // pozycje kolejne
cl_Allow = 0, // zezwolenie na pracę sprężarek
cl_SpeedFactor = 1, // mnożnik wydajności
cl_MinFactor = 2, // mnożnik progu załącznika ciśnieniowego
cl_MaxFactor = 3 // mnożnik progu wyłącznika ciśnieniowego
};
/*ogolne*/
/*lokacja*/
struct TLocation
@@ -861,6 +870,31 @@ private:
float temperatura2 { 40.0 };
};
struct spring_brake {
std::shared_ptr<TReservoir> Cylinder;
bool Activate { false }; //Input: switching brake on/off in exploitation - main valve/switch
bool ShuttOff { true }; //Input: shutting brake off during failure - valve in pneumatic container
bool Release { false }; //Input: emergency releasing rod
bool IsReady{ false }; //Output: readyness to braking - cylinder is armed, spring is tentioned
bool IsActive{ false }; //Output: brake is working
double SBP{ 0.0 }; //Output: pressure in spring brake cylinder
bool PNBrakeConnection{ false }; //Conf: connection to pneumatic brake cylinders
double MaxSetPressure { 0.0 }; //Conf: Maximal pressure for switched off brake
double ResetPressure{ 0.0 }; //Conf: Pressure for arming brake cylinder
double MinForcePressure{ 0.1 }; //Conf: Minimal pressure for zero force
double MaxBrakeForce{ 0.0 }; //Conf: Maximal tension for brake pads/shoes
double PressureOn{ -2.0 }; //Conf: Pressure changing ActiveFlag to "On"
double PressureOff{ -1.0 }; //Conf: Pressure changing ActiveFlag to "Off"
double ValveOffArea{ 0.0 }; //Conf: Area of filling valve
double ValveOnArea{ 0.0 }; //Conf: Area of dumping valve
double ValvePNBrakeArea{ 0.0 }; //Conf: Area of bypass to brake cylinders
int MultiTractionCoupler{ 127 }; //Conf: Coupling flag necessary for transmitting the command
};
public:
double dMoveLen = 0.0;
@@ -920,11 +954,13 @@ public:
std::shared_ptr<TDriverHandle> LocHandle;
std::shared_ptr<TReservoir> Pipe;
std::shared_ptr<TReservoir> Pipe2;
spring_brake SpringBrake;
TLocalBrake LocalBrake = TLocalBrake::NoBrake; /*rodzaj hamulca indywidualnego*/
TBrakePressureTable BrakePressureTable; /*wyszczegolnienie cisnien w rurze*/
TBrakePressure BrakePressureActual; //wartości ważone dla aktualnej pozycji kranu
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;
double MaxBrakeForce = 0.0; /*maksymalna sila nacisku hamulca*/
double MaxBrakePress[5]; //pomocniczy, proz, sred, lad, pp
@@ -962,6 +998,17 @@ public:
double MinCompressor = 0.0;
double MaxCompressor = 0.0;
double CompressorSpeed = 0.0;
int CompressorList[4][9]; // pozycje świateł, przód - tył, 1 .. 16
double EmergencyValveOn = 0.0;
double EmergencyValveOff = 0.0;
bool EmergencyValveOpen = false;
double EmergencyValveArea = 0.0;
double LockPipeOn = -1.0;
double LockPipeOff = -1.0;
double HandleUnlock = -3.0;
int CompressorListPosNo = 0;
int CompressorListDefPos = 1;
bool CompressorListWrap = false;
/*cisnienie wlaczania, zalaczania sprezarki, wydajnosc sprezarki*/
TBrakeDelayTable BrakeDelay; /*opoznienie hamowania/odhamowania t/o*/
double AirLeakRate{ 0.01 }; // base rate of air leak from brake system components ( 0.001 = 1 l/sec )
@@ -979,6 +1026,8 @@ public:
TSecuritySystem SecuritySystem;
TUniversalCtrlTable UniCtrlList; /*lista pozycji uniwersalnego nastawnika*/
int UniCtrlListSize = 0; /*wielkosc listy pozycji uniwersalnego nastawnika*/
bool UniCtrlIntegratedBrakePNCtrl = false; /*zintegrowany nastawnik JH obsluguje hamulec PN*/
bool UniCtrlIntegratedBrakeCtrl = false; /*zintegrowany nastawnik JH obsluguje hamowanie*/
/*-sekcja parametrow dla lokomotywy elektrycznej*/
TSchemeTable RList; /*lista rezystorow rozruchowych i polaczen silnikow, dla dizla: napelnienia*/
@@ -1169,6 +1218,9 @@ public:
double UnitBrakeForce = 0.0; /*!s siła hamowania przypadająca na jeden element*/
double Ntotal = 0.0; /*!s siła nacisku klockow*/
bool SlippingWheels = false; bool SandDose = false; /*! poslizg kol, sypanie piasku*/
bool SandDoseManual = false; /*piaskowanie reczne*/
bool SandDoseAuto = false; /*piaskowanie automatyczne*/
bool SandDoseAutoAllow = true; /*zezwolenie na automatyczne piaskowanie*/
double Sand = 0.0; /*ilosc piasku*/
double BrakeSlippingTimer = 0.0; /*pomocnicza zmienna do wylaczania przeciwposlizgu*/
double dpBrake = 0.0; double dpPipe = 0.0; double dpMainValve = 0.0; double dpLocalValve = 0.0;
@@ -1212,11 +1264,14 @@ public:
int ManualBrakePos = 0; /*nastawa hamulca recznego*/
double LocalBrakePosA = 0.0; /*nastawa hamulca pomocniczego*/
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
*/
bool AlarmChainFlag = false; // manual emergency brake
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 BrakeDelays = 0; /*nastawy mozliwe do uzyskania*/
int BrakeOpModeFlag = 0; /*nastawa trybu pracy PS/PN/EP/MED 1/2/4/8*/
@@ -1254,7 +1309,8 @@ public:
double MainsInitTimeCountdown{ 0.0 }; // current state of main circuit initialization, remaining time (in seconds) until it's ready
int MainCtrlPos = 0; /*polozenie glownego nastawnika*/
int ScndCtrlPos = 0; /*polozenie dodatkowego nastawnika*/
int LightsPos = 0;
int LightsPos = 0; /*polozenie przelacznika wielopozycyjnego swiatel*/
int CompressorListPos = 0; /*polozenie przelacznika wielopozycyjnego sprezarek*/
int ActiveDir = 0; //czy lok. jest wlaczona i w ktorym kierunku:
//względem wybranej kabiny: -1 - do tylu, +1 - do przodu, 0 - wylaczona
int MaxMainCtrlPosNoDirChange { 0 }; // can't change reverser state with master controller set above this position
@@ -1460,7 +1516,10 @@ public:
bool AddPulseForce(int Multipler);/*dla drezyny*/
bool SandboxManual( bool const State, range_t const Notify = range_t::consist );/*wlacza/wylacza reczne sypanie piasku*/
bool SandboxAuto( bool const State, range_t const Notify = range_t::consist );/*wlacza/wylacza automatyczne sypanie piasku*/
bool Sandbox( bool const State, range_t const Notify = range_t::consist );/*wlacza/wylacza sypanie piasku*/
bool SandboxAutoAllow(bool const State);/*wlacza/wylacza zezwolenie na automatyczne sypanie piasku*/
/*! zbijanie czuwaka/SHP*/
void SSReset(void);
@@ -1469,6 +1528,9 @@ public:
bool BatterySwitch(bool State);
bool EpFuseSwitch(bool State);
bool SpringBrakeActivate(bool State);
bool SpringBrakeShutOff(bool State);
bool SpringBrakeRelease();
/*! stopnie hamowania - hamulec zasadniczy*/
bool IncBrakeLevelOld(void);
@@ -1483,6 +1545,7 @@ public:
bool AlarmChainSwitch( bool const State );
bool AntiSlippingBrake(void);
bool BrakeReleaser(int state);
bool UniversalBrakeButton(int button, int state); /*uniwersalny przycisk hamulca*/
bool SwitchEPBrake(int state);
bool AntiSlippingButton(void); /*! reczny wlacznik urzadzen antyposlizgowych*/
@@ -1498,6 +1561,7 @@ public:
void CompressorCheck(double dt);/*wlacza, wylacza kompresor, laduje zbiornik*/
void UpdatePantVolume(double dt); //Ra
void UpdateScndPipePressure(double dt);
void UpdateSpringBrake(double dt);
double GetDVc(double dt);
/*funkcje obliczajace sily*/
@@ -1615,6 +1679,7 @@ private:
void LoadFIZ_Cntrl( std::string const &line );
void LoadFIZ_Blending(std::string const &line);
void LoadFIZ_DCEMUED(std::string const &line);
void LoadFIZ_SpringBrake(std::string const &line);
void LoadFIZ_Light( std::string const &line );
void LoadFIZ_Security( std::string const &line );
void LoadFIZ_Clima( std::string const &line );
@@ -1628,6 +1693,7 @@ private:
void LoadFIZ_DList( std::string const &Input );
void LoadFIZ_FFList( std::string const &Input );
void LoadFIZ_LightsList( std::string const &Input );
void LoadFIZ_CompressorList(std::string const &Input);
void LoadFIZ_PowerParamsDecode( TPowerParameters &Powerparameters, std::string const Prefix, std::string const &Input );
TPowerType LoadFIZ_PowerDecode( std::string const &Power );
TPowerSource LoadFIZ_SourceDecode( std::string const &Source );
@@ -1644,6 +1710,7 @@ private:
bool readFFList( std::string const &line );
bool readWWList( std::string const &line );
bool readLightsList( std::string const &Input );
bool readCompressorList(std::string const &Input);
void BrakeValveDecode( std::string const &s ); //Q 20160719
void BrakeSubsystemDecode(); //Q 20160719
bool EIMDirectionChangeAllow( void );

View File

@@ -295,6 +295,12 @@ ActiveCab( Cab )
for (int k = 0; k < 17; ++k)
Lights[b][k] = 0;
for (int b = 0; b < 4; ++b)
for (int k = 1; k < 9; ++k)
CompressorList[ b ][ k ] = 0;
CompressorList[0][0] = 0.0;
CompressorList[1][0] = CompressorList[2][0] = CompressorList[3][0] = 1.0;
for (int b = -1; b <= MainBrakeMaxPos; ++b)
{
BrakePressureTable[b].PipePressureVal = 0.0;
@@ -1051,7 +1057,10 @@ void TMoverParameters::CollisionDetect(int const End, double const dt)
if( velocitydifference > safevelocitylimit ) {
// HACK: crude estimation for potential derail, will take place with velocity difference > 15 km/h adjusted for vehicle mass ratio
WriteLog( "Bad driving: " + Name + " and " + othervehicle->Name + " collided with velocity " + to_string( velocitydifference, 0 ) + " km/h" );
if( ( false == TestFlag( DamageFlag, dtrain_out ) )
|| ( false == TestFlag( othervehicle->DamageFlag, dtrain_out ) ) ) {
WriteLog( "Bad driving: " + Name + " and " + othervehicle->Name + " collided with velocity " + to_string( velocitydifference, 0 ) + " km/h" );
}
if( velocitydifference > safevelocitylimit * ( TotalMass / othervehicle->TotalMass ) ) {
derail( 5 );
@@ -1084,12 +1093,14 @@ void TMoverParameters::CollisionDetect(int const End, double const dt)
void
TMoverParameters::damage_coupler( int const End ) {
auto &coupler{ Couplers[ End ] };
if( coupler.CouplerType == TCouplerType::Articulated ) { return; } // HACK: don't break articulated couplings no matter what
if( SetFlag( DamageFlag, dtrain_coupling ) )
EventFlag = true;
auto &coupler { Couplers[ End ] };
if( ( coupler.CouplingFlag & ctrain_pneumatic ) == ctrain_pneumatic ) {
if( ( coupler.CouplingFlag & coupling::brakehose ) == coupling::brakehose ) {
// hamowanie nagle - zerwanie przewodow hamulcowych
AlarmChainFlag = true;
}
@@ -1100,11 +1111,11 @@ TMoverParameters::damage_coupler( int const End ) {
switch( End ) {
// break connection with other vehicle, if there's any
case 0: {
coupler.Connected->Couplers[ end::rear ].CouplingFlag = 0;
coupler.Connected->Couplers[ end::rear ].CouplingFlag = coupling::faux;
break;
}
case 1: {
coupler.Connected->Couplers[ end::front ].CouplingFlag = 0;
coupler.Connected->Couplers[ end::front ].CouplingFlag = coupling::faux;
break;
}
default: {
@@ -2311,7 +2322,7 @@ bool TMoverParameters::CabDeactivisation(void)
CabNo = 0;
DirAbsolute = ActiveDir * CabNo;
DepartureSignal = false; // nie buczeć z nieaktywnej kabiny
SecuritySystem.Status = 0; // deactivate alerter TODO: make it part of control based cab selection
SecuritySystem.Status = s_off; // deactivate alerter TODO: make it part of control based cab selection
SendCtrlToNext("CabActivisation", 0, ActiveCab); // CabNo==0!
}
@@ -2346,6 +2357,63 @@ bool TMoverParameters::AddPulseForce(int Multipler)
return APF;
}
// *************************************************************************************************
// yB: 20190909
// sypanie piasku reczne
// *************************************************************************************************
bool TMoverParameters::SandboxManual(bool const State, range_t const Notify)
{
bool result{ false };
if (SandDoseManual != State) {
if (SandDoseManual == false) {
// switch on
if (Sand > 0) {
SandDoseManual = true;
result = true;
}
}
else {
// switch off
SandDoseManual = false;
result = true;
}
}
Sandbox(SandDoseManual || SandDoseAuto, Notify);
return result;
}
// *************************************************************************************************
// yB: 20190909
// sypanie piasku automatyczne
// *************************************************************************************************
bool TMoverParameters::SandboxAuto(bool const State, range_t const Notify)
{
bool result{ false };
bool NewState = State && SandDoseAutoAllow;
if (SandDoseAuto != NewState) {
if (SandDoseAuto == false) {
// switch on
if (Sand > 0) {
SandDoseAuto = true;
result = true;
}
}
else {
// switch off
SandDoseAuto = false;
result = true;
}
}
Sandbox(SandDoseManual || SandDoseAuto, Notify);
return result;
}
// *************************************************************************************************
// Q: 20160713
// sypanie piasku
@@ -2389,6 +2457,24 @@ bool TMoverParameters::Sandbox( bool const State, range_t const Notify )
return result;
}
// *************************************************************************************************
// yB: 20190909
// włączenie / wyłączenie automatycznej piasecznicy
// *************************************************************************************************
bool TMoverParameters::SandboxAutoAllow(bool State)
{
//SendCtrlToNext("SandboxAutoAllow", int(State), CabNo, ctrain_controll);
if (SandDoseAutoAllow != State)
{
SandDoseAutoAllow = State;
return true;
}
else
return false;
}
void TMoverParameters::SSReset(void)
{ // funkcja pomocnicza dla SecuritySystemReset - w Delphi Reset()
SecuritySystem.SystemTimer = 0;
@@ -2456,7 +2542,7 @@ void TMoverParameters::SecuritySystemCheck(double dt)
RadiostopSwitch(false);
if ((SecuritySystem.SystemType > 0)
&& (SecuritySystem.Status > 0)
&& (SecuritySystem.Status != s_off)
&& (Battery)) // Ra: EZT ma teraz czuwak w rozrządczym
{
// CA
@@ -2547,8 +2633,8 @@ bool TMoverParameters::BatterySwitch(bool State)
SendCtrlToNext("BatterySwitch", 0, CabNo);
BS = true;
if ((Battery) && (ActiveCab != 0)) /*|| (TrainType==dt_EZT)*/
SecuritySystem.Status = (SecuritySystem.Status | s_waiting); // aktywacja czuwaka
if ((Battery) && (ActiveCab != 0))
SecuritySystem.Status |= s_waiting; // aktywacja czuwaka
else
SecuritySystem.Status = 0; // wyłączenie czuwaka
@@ -2572,6 +2658,57 @@ bool TMoverParameters::EpFuseSwitch(bool State)
// else SendCtrlToNext("EpFuseSwitch", 0, CabNo);
}
// *************************************************************************************************
// yB: 20190906
// włączenie / wyłączenie hamulca sprezynowego
// *************************************************************************************************
bool TMoverParameters::SpringBrakeActivate(bool State)
{
if (Battery)
{
SendCtrlToNext("SpringBrakeActivate", int(State), CabNo, SpringBrake.MultiTractionCoupler);
if (SpringBrake.Activate != State)
{
SpringBrake.Activate = State;
return true;
}
}
return false;
}
// *************************************************************************************************
// yB: 20190906
// włączenie / wyłączenie odciecia hamulca sprezynowego
// *************************************************************************************************
bool TMoverParameters::SpringBrakeShutOff(bool State)
{
if (SpringBrake.ShuttOff != State)
{
SpringBrake.ShuttOff = State;
return true;
}
else
return false;
}
// *************************************************************************************************
// yB: 20190906
// wyluzowanie hamulca sprezynowego
// *************************************************************************************************
bool TMoverParameters::SpringBrakeRelease()
{
if (SpringBrake.IsReady && SpringBrake.Cylinder->P() < SpringBrake.MinForcePressure)
{
SpringBrake.IsReady = false;
return true;
}
else
return false;
}
// *************************************************************************************************
// Q: 20160710
// kierunek do tyłu
@@ -3313,6 +3450,37 @@ bool TMoverParameters::BrakeReleaser(int state)
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
// włączenie / wyłączenie hamulca elektro-pneumatycznego
@@ -3491,12 +3659,31 @@ void TMoverParameters::UpdateBrakePressure(double dt)
// TODO: clean the method up, a lot of the code is redundant
void TMoverParameters::CompressorCheck(double dt)
{
double MaxCompressorF = CompressorList[TCompressorList::cl_MaxFactor][CompressorListPos] * MaxCompressor;
double MinCompressorF = CompressorList[TCompressorList::cl_MinFactor][CompressorListPos] * MinCompressor;
double CompressorSpeedF = CompressorList[TCompressorList::cl_SpeedFactor][CompressorListPos] * CompressorSpeed;
double AllowFactor = CompressorList[TCompressorList::cl_Allow][CompressorListPos];
//checking the impact on the compressor allowance
if (AllowFactor > 0.5) {
CompressorAllow = AllowFactor > 1.5;
}
if( VeselVolume == 0.0 ) { return; }
//EmergencyValve
EmergencyValveOpen = (Compressor > (EmergencyValveOpen ? EmergencyValveOff : EmergencyValveOn));
if (EmergencyValveOpen) {
float dV = PF(0, Compressor, EmergencyValveArea)* dt;
CompressedVolume -= dV;
}
CompressedVolume = std::max( 0.0, CompressedVolume - dt * AirLeakRate * 0.1 ); // nieszczelności: 0.001=1l/s
if( ( true == CompressorGovernorLock )
&& ( Compressor < MinCompressor ) ) {
&& ( Compressor < MinCompressorF ) ) {
// if the pressure drops below the cut-in level, we can reset compressor governor
// TBD, TODO: don't operate the lock without battery power?
CompressorGovernorLock = false;
@@ -3506,25 +3693,25 @@ void TMoverParameters::CompressorCheck(double dt)
CompressorAllow = ConverterAllow;
}
if (MaxCompressor - MinCompressor < 0.0001) {
if (MaxCompressorF - MinCompressorF < 0.0001) {
// TODO: investigate purpose of this branch and whether it can be removed as it duplicates later code
if( ( true == CompressorAllow )
&& ( true == CompressorAllowLocal )
&& ( true == Mains )
&& ( MainCtrlPowerPos() > 0 ) ) {
if( Compressor < MaxCompressor ) {
if( Compressor < MaxCompressorF ) {
if( ( EngineType == TEngineType::DieselElectric )
&& ( CompressorPower > 0 ) ) {
CompressedVolume +=
CompressorSpeed
* ( 2.0 * MaxCompressor - Compressor ) / MaxCompressor
CompressorSpeedF
* ( 2.0 * MaxCompressorF - Compressor ) / MaxCompressorF
* ( ( 60.0 * std::abs( enrot ) ) / DElist[ MainCtrlPosNo ].RPM )
* dt;
}
else {
CompressedVolume +=
CompressorSpeed
* ( 2.0 * MaxCompressor - Compressor ) / MaxCompressor
CompressorSpeedF
* ( 2.0 * MaxCompressorF - Compressor ) / MaxCompressorF
* dt;
TotalCurrent += 0.0015 * Voltage; // tymczasowo tylko obciążenie sprężarki, tak z 5A na sprężarkę
}
@@ -3576,7 +3763,7 @@ void TMoverParameters::CompressorCheck(double dt)
|| ( CompressorPower == 0 )
|| ( CompressorPower == 3 ) ) );
if( Compressor > MaxCompressor ) {
if( Compressor > MaxCompressorF ) {
// wyłącznik ciśnieniowy jest niezależny od sposobu zasilania
// TBD, TODO: don't operate the lock without battery power?
if( CompressorPower == 3 ) {
@@ -3612,8 +3799,8 @@ void TMoverParameters::CompressorCheck(double dt)
else {
// jeśli nie załączona
if( ( LastSwitchingTime > CtrlDelay )
&& ( ( Compressor < MinCompressor )
|| ( ( Compressor < MaxCompressor )
&& ( ( Compressor < MinCompressorF )
|| ( ( Compressor < MaxCompressorF )
&& ( false == CompressorGovernorLock ) ) ) ) {
// załączenie przy małym ciśnieniu
// jeśli nie załączona, a ciśnienie za małe
@@ -3688,7 +3875,7 @@ void TMoverParameters::CompressorCheck(double dt)
1.0 ) }; // shouldn't ever get here but, eh
CompressedVolume +=
CompressorSpeed
* ( 2.0 * MaxCompressor - Compressor ) / MaxCompressor
* ( 2.0 * MaxCompressorF - Compressor ) / MaxCompressorF
* enginefactor
* dt;
}
@@ -3702,8 +3889,8 @@ void TMoverParameters::CompressorCheck(double dt)
else {
// the compressor is a stand-alone device, working at steady pace
CompressedVolume +=
CompressorSpeed
* ( 2.0 * MaxCompressor - Compressor ) / MaxCompressor
CompressorSpeedF
* ( 2.0 * MaxCompressorF - Compressor ) / MaxCompressorF
* dt;
if( ( CompressorPower == 5 ) && ( Couplers[ 1 ].Connected != NULL ) ) {
@@ -3752,11 +3939,17 @@ void TMoverParameters::UpdatePipePressure(double dt)
dpLocalValve = LocHandle->GetPF(std::max(LocalBrakePosA, LocalBrakePosAEIM), Hamulec->GetBCP(), ScndPipePress, dt, 0);
else
dpLocalValve = LocHandle->GetPF(LocalBrakePosAEIM, Hamulec->GetBCP(), ScndPipePress, dt, 0);
if( ( BrakeHandle == TBrakeHandle::FV4a )
&& ( ( PipePress < 2.75 )
&& ( ( Hamulec->GetStatus() & b_rls ) == 0 ) )
&& ( BrakeSubsystem == TBrakeSubSystem::ss_LSt )
&& ( TrainType != dt_EZT ) ) {
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)
&& ((Hamulec->GetStatus() & b_rls) == 0))
&& (BrakeSubsystem == TBrakeSubSystem::ss_LSt)
&& (TrainType != dt_EZT)
&& (!UnlockPipe));
if( ( lock_old ) || ( lock_new ) ) {
temp = PipePress + 0.00001;
}
else {
@@ -3985,6 +4178,8 @@ void TMoverParameters::UpdateScndPipePressure(double dt)
TMoverParameters *c;
double dv1, dv2, dV;
UpdateSpringBrake(dt);
dv1 = 0;
dv2 = 0;
@@ -4037,6 +4232,37 @@ void TMoverParameters::UpdateScndPipePressure(double dt)
}
}
// *************************************************************************************************
// yB: 20190906
// Aktualizacja ciśnienia w hamulcu sprezynowym
// *************************************************************************************************
void TMoverParameters::UpdateSpringBrake(double dt)
{
double BP = SpringBrake.PNBrakeConnection ? BrakePress : 0;
double MSP = SpringBrake.ShuttOff ? 0 : SpringBrake.MaxSetPressure;
if (!SpringBrake.Activate)
{
double desired_press = std::min(std::max(MSP, BP), Pipe2->P());
double dv = PF(desired_press, SpringBrake.SBP, SpringBrake.ValveOffArea);
SpringBrake.Cylinder->Flow(-dv);
Pipe2->Flow(std::max(dv,0.0));
}
else
{
double dv = PF(BP, SpringBrake.SBP, SpringBrake.ValveOnArea);
SpringBrake.Cylinder->Flow(-dv);
}
if (SpringBrake.SBP > SpringBrake.ResetPressure)
SpringBrake.IsReady = true;
SpringBrake.IsActive = SpringBrake.SBP < (SpringBrake.IsActive ? SpringBrake.PressureOff : SpringBrake.PressureOn);
SpringBrake.Release = false;
SpringBrake.Cylinder->Act();
SpringBrake.SBP = SpringBrake.Cylinder->P();
}
// *************************************************************************************************
// Q: 20160715
// oblicza i zwraca przepływ powietrza pomiędzy pojazdami
@@ -4378,6 +4604,9 @@ double TMoverParameters::BrakeForce( TTrackParam const &Track ) {
K = MaxBrakeForce * ManualBrakeRatio();
}
if (SpringBrake.IsReady)
K += std::max(0.0, SpringBrake.MinForcePressure - SpringBrake.Cylinder->P()) * SpringBrake.MaxBrakeForce;
u = ((BrakePress * P2FTrans) - BrakeCylSpring) * BrakeCylMult[0] - BrakeSlckAdj;
if (u * BrakeRigEff > Ntotal) // histereza na nacisku klockow
Ntotal = u * BrakeRigEff;
@@ -5425,11 +5654,11 @@ double TMoverParameters::TractionForce( double dt ) {
if( ( SlippingWheels ) ) {
PosRatio = 0;
tmp = 10;
Sandbox( true, range_t::unit );
SandboxAuto( true, range_t::unit );
} // przeciwposlizg
else {
// switch sandbox off
Sandbox( false, range_t::unit );
SandboxAuto( false, range_t::unit );
}
eimv_pr += Max0R(Min0R(PosRatio - eimv_pr, 0.02), -0.02) * 12 *
@@ -6341,17 +6570,20 @@ void TMoverParameters::CheckEIMIC(double dt)
}
break;
case 3:
if ((UniCtrlList[MainCtrlPos].mode != BrakeCtrlPos) && (MainCtrlActualPos == MainCtrlPos)) //there was no move of controller, but brake only
if (UniCtrlIntegratedBrakePNCtrl)
{
if (BrakeCtrlPos < UniCtrlList[MainCtrlPosNo].mode)
BrakeLevelSet(UniCtrlList[MainCtrlPosNo].mode); //bottom clamping
if (BrakeCtrlPos > UniCtrlList[0].mode)
BrakeLevelSet(UniCtrlList[0].mode); //top clamping
while (BrakeCtrlPos > UniCtrlList[MainCtrlPos].mode) DecMainCtrl(1); //find nearest position
while (BrakeCtrlPos < UniCtrlList[MainCtrlPos].mode) IncMainCtrl(1); //find nearest position
if ((UniCtrlList[MainCtrlPos].mode != BrakeCtrlPos) && (MainCtrlActualPos == MainCtrlPos)) //there was no move of controller, but brake only
{
if (BrakeCtrlPos < UniCtrlList[MainCtrlPosNo].mode)
BrakeLevelSet(UniCtrlList[MainCtrlPosNo].mode); //bottom clamping
if (BrakeCtrlPos > UniCtrlList[0].mode)
BrakeLevelSet(UniCtrlList[0].mode); //top clamping
while (BrakeCtrlPos > UniCtrlList[MainCtrlPos].mode) DecMainCtrl(1); //find nearest position
while (BrakeCtrlPos < UniCtrlList[MainCtrlPos].mode) IncMainCtrl(1); //find nearest position
}
else //controller was moved
BrakeLevelSet(UniCtrlList[MainCtrlPos].mode);
}
else //controller was moved
BrakeLevelSet(UniCtrlList[MainCtrlPos].mode);
if ((MainCtrlActualPos != MainCtrlPos) || (LastRelayTime>InitialCtrlDelay))
{
@@ -6368,12 +6600,17 @@ void TMoverParameters::CheckEIMIC(double dt)
}
if (Hamulec->GetEDBCP() > 0.3 && eimic < 0) //when braking with pneumatic brake
eimic = 0; //shut off retarder
if (UniCtrlIntegratedBrakeCtrl == false)
{
eimic = (LocalBrakeRatio() > 0.01 ? -LocalBrakeRatio() : eimic);
}
}
auto const eimicpowerenabled {
( ( true == Mains ) || ( Power == 0.0 ) )
&& ( ( Doors.instances[ side::left ].open_permit == false )
&& ( Doors.instances[ side::right ].open_permit == false ) ) };
&& ( Doors.instances[ side::right ].open_permit == false ) )
&& ( !SpringBrake.IsActive ) };
eimic = clamp(eimic, -1.0, eimicpowerenabled ? 1.0 : 0.0);
}
@@ -7727,6 +7964,7 @@ bool startMPT, startMPT0;
bool startRLIST, startUCLIST;
bool startDLIST, startFFLIST, startWWLIST;
bool startLIGHTSLIST;
bool startCOMPRESSORLIST;
int LISTLINE;
bool issection( std::string const &Name, std::string const &Input ) {
@@ -8026,12 +8264,33 @@ bool TMoverParameters::readLightsList( std::string const &Input ) {
return false;
}
parser
>> Lights[ 0 ][ idx ]
>> Lights[ 1 ][ idx ];
>> Lights[0][idx]
>> Lights[1][idx];
return true;
}
bool TMoverParameters::readCompressorList(std::string const &Input) {
cParser parser(Input);
if (false == parser.getTokens(4, false)) {
WriteLog("Read CompressorList: arguments missing in line " + std::to_string(LISTLINE + 1));
return false;
}
int idx = LISTLINE++;
if (idx > 8) {
WriteLog("Read CompressorList: number of entries exceeded capacity of the data table");
return false;
}
parser
>> CompressorList[ 0 ][ idx + 1 ]
>> CompressorList[ 1 ][ idx + 1 ]
>> CompressorList[ 2 ][ idx + 1 ]
>> CompressorList[ 3 ][ idx + 1 ];
return true;
}
// *************************************************************************************************
// Q: 20160719
// *************************************************************************************************
@@ -8138,6 +8397,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
startFFLIST = false;
startWWLIST = false;
startLIGHTSLIST = false;
startCOMPRESSORLIST = false;
std::string file = chkpath + TypeName + ".fiz";
WriteLog("LOAD FIZ FROM " + file);
@@ -8226,6 +8486,11 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
startLIGHTSLIST = false;
continue;
}
if ( issection( "endCL", inputline ) ) {
startBPT = false;
startCOMPRESSORLIST = false;
continue;
}
// ...then all recognized sections...
if( issection( "Param.", inputline ) )
{
@@ -8317,7 +8582,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
if (issection("Blending:", inputline)) {
startBPT = true; LISTLINE = 0;
startBPT = false; LISTLINE = 0;
fizlines.emplace( "Blending", inputline);
LoadFIZ_Blending( inputline );
continue;
@@ -8325,12 +8590,20 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
if (issection("DCEMUED:", inputline)) {
startBPT = true; LISTLINE = 0;
startBPT = false; LISTLINE = 0;
fizlines.emplace("DCEMUED", inputline);
LoadFIZ_DCEMUED(inputline);
continue;
}
if (issection("SpringBrake:", inputline)) {
startBPT = false; LISTLINE = 0;
fizlines.emplace("SpringBrake", inputline);
LoadFIZ_SpringBrake(inputline);
continue;
}
if( issection( "Light:", inputline ) ) {
startBPT = false;
@@ -8449,6 +8722,14 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
continue;
}
if (issection("CompressorList:", inputline)) {
startBPT = false;
fizlines.emplace("CompressorList", inputline);
startCOMPRESSORLIST = true; LISTLINE = 0;
LoadFIZ_CompressorList( inputline );
continue;
}
// ...and finally, table parsers.
// NOTE: once table parsing is enabled it lasts until switched off, when another section is recognized
if( true == startBPT ) {
@@ -8487,6 +8768,10 @@ bool TMoverParameters::LoadFIZ(std::string chkpath)
readLightsList( inputline );
continue;
}
if (true == startCOMPRESSORLIST) {
readCompressorList(inputline);
continue;
}
} // while line
/*
in.close();
@@ -8728,6 +9013,15 @@ void TMoverParameters::LoadFIZ_Brake( std::string const &line ) {
extract_value( MinCompressor, "MinCP", line, "" );
extract_value( MaxCompressor, "MaxCP", line, "" );
extract_value( CompressorSpeed, "CompressorSpeed", line, "" );
extract_value( EmergencyValveOff, "MinEVP", line, "" );
extract_value( EmergencyValveOn, "MaxEVP", 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{
{ "Main", 0 },
@@ -9198,6 +9492,30 @@ void TMoverParameters::LoadFIZ_DCEMUED(std::string const &line) {
}
void TMoverParameters::LoadFIZ_SpringBrake(std::string const &line) {
double vol;
extract_value(vol, "Volume", line, "1");
if (!SpringBrake.Cylinder)
SpringBrake.Cylinder = std::make_shared<TReservoir>();
SpringBrake.Cylinder->CreateCap(vol);
extract_value(SpringBrake.MaxBrakeForce, "MBF", line, "");
extract_value(SpringBrake.MaxSetPressure, "MaxSP", line, "");
extract_value(SpringBrake.ResetPressure, "ResetP", line, "");
extract_value(SpringBrake.MinForcePressure, "MinFP", line, "");
extract_value(SpringBrake.PressureOff, "PressOff", line, "");
extract_value(SpringBrake.PressureOn, "PressOn", line, "");
extract_value(SpringBrake.ValveOffArea, "ValveOnArea", line, "");
extract_value(SpringBrake.ValveOnArea, "ValveOffArea", line, "");
extract_value(SpringBrake.ValvePNBrakeArea, "ValvePNBArea", line, "");
SpringBrake.PNBrakeConnection = SpringBrake.ValvePNBrakeArea > 0;
extract_value(SpringBrake.MultiTractionCoupler, "MTC", line, "");
SpringBrake.ShuttOff = false;
SpringBrake.Activate = false;
SpringBrake.IsReady = true;
}
void TMoverParameters::LoadFIZ_Light( std::string const &line ) {
LightPowerSource.SourceType = LoadFIZ_SourceDecode( extract_value( "Light", line ) );
@@ -9543,6 +9861,8 @@ void TMoverParameters::LoadFIZ_RList( std::string const &Input ) {
void TMoverParameters::LoadFIZ_UCList(std::string const &Input) {
extract_value(UniCtrlListSize, "Size", Input, "");
UniCtrlIntegratedBrakeCtrl = (extract_value("IntegratedBrake", Input) == "Yes");
UniCtrlIntegratedBrakePNCtrl = (extract_value("IntegratedBrakePN", Input) == "Yes");
}
@@ -9573,6 +9893,13 @@ void TMoverParameters::LoadFIZ_LightsList( std::string const &Input ) {
extract_value( LightsDefPos, "Default", Input, "" );
}
void TMoverParameters::LoadFIZ_CompressorList(std::string const &Input) {
extract_value( CompressorListPosNo, "Size", Input, "" );
extract_value( CompressorListWrap, "Wrap", Input, "" );
extract_value( CompressorListDefPos, "Default", Input, "" );
}
void TMoverParameters::LoadFIZ_PowerParamsDecode( TPowerParameters &Powerparameters, std::string const Prefix, std::string const &Line ) {
switch( Powerparameters.SourceType ) {
@@ -9930,9 +10257,16 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
Pipe2 = std::make_shared<TReservoir>(); // zabezpieczenie, bo sie PG wywala... :(
Pipe->CreateCap( ( std::max( Dim.L, 14.0 ) + 0.5 ) * Spg * 1 ); // dlugosc x przekroj x odejscia i takie tam
Pipe2->CreateCap( ( std::max( Dim.L, 14.0 ) + 0.5 ) * Spg * 1 );
if (!SpringBrake.Cylinder)
{
SpringBrake.Cylinder = std::make_shared<TReservoir>();
SpringBrake.Cylinder->CreateCap(1);
}
if( LightsPosNo > 0 )
LightsPos = LightsDefPos;
if (CompressorListPosNo > 0)
CompressorListPos = CompressorListDefPos;
// NOTE: legacy compatibility behaviour for vehicles without defined heating power source
if( ( EnginePowerSource.SourceType == TPowerSource::CurrentCollector )
@@ -10412,10 +10746,13 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
Battery = true;
else if ((CValue1 == 0))
Battery = false;
if ((Battery) && (ActiveCab != 0) /*or (TrainType=dt_EZT)*/)
/*
// TBD: makes no sense to activate alerters in entire consist
if ((Battery) && (ActiveCab != 0) )
SecuritySystem.Status = SecuritySystem.Status | s_waiting; // aktywacja czuwaka
else
SecuritySystem.Status = 0; // wyłączenie czuwaka
*/
OK = SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
}
// else if command='EpFuseSwitch' then {NBMX}
@@ -10698,6 +11035,16 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
ScndCtrlActualPos = static_cast<int>(round(CValue1));
OK = SendCtrlToNext(Command, CValue1, CValue2, Couplertype);
}
else if (Command == "SpringBrakeActivate")
{
if (Battery)
{
SpringBrake.Activate = CValue1 > 0;
OK = SendCtrlToNext(Command, CValue1, CValue2, Couplertype);
}
else
OK = true;
}
return OK; // dla true komenda będzie usunięta, dla false wykonana ponownie
}

View File

@@ -1300,7 +1300,9 @@ double TLSt::GetPF( double const PP, double const dt, double const Vel )
SoundFlag |= sf_CylU;
}
// 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 ) {
BrakeStatus &= ~b_rls;
}
@@ -1373,9 +1375,12 @@ double TLSt::GetPF( double const PP, double const dt, double const Vel )
temp = 1 - RapidTemp;
if (EDFlag > 0.2)
temp = 10000;
double tempasb = 0;
if ( ( (UniversalFlag & TUniversalBrake::ub_AntiSlipBrake) > 0)
|| ( (BrakeStatus & b_asb_unbrake) == b_asb_unbrake ) )
tempasb = ASBP;
// 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
if ((BrakeCyl->P() > temp + 0.005) || (temp < 0.28))
// 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
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;
if ((ASBP < 0.1) && ((BrakeStatus & b_asb_unbrake) == b_asb_unbrake))
{
@@ -2292,6 +2301,11 @@ void TDriverHandle::OvrldButton(bool Active)
{
ManualOvrldActive = Active;
}
void TDriverHandle::SetUniversalFlag(int flag)
{
UniversalFlag = flag;
}
//---FV4a---
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
if ((TP > 0))
if ((TP > 0)&&(CP > 4.9))
{
DP = 0.045;
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
ActFlowSpeed = 4;
if ((EQ(i_bcp, -1)))
pom = Min0R(HP, 5.4 + 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 ( ( EQ( i_bcp, -1 ) ) && ( uop > 0 ) )
pom = Min0R(HP, 5.4 + RedAdj + uop);
else
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
LimPP = pom; // cp
if (EQ(i_bcp, -1))
dpPipe = HP;
else
//if (EQ(i_bcp, -1))
// dpPipe = HP;
// else
dpPipe = Min0R(HP, LimPP);
if (dpPipe > PP)
@@ -2612,7 +2631,8 @@ double TMHZ_EN57::GetPF( double i_bcp, double PP, double HP, double dt, double e
else
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))
TP = TP + dt; // 5/10
@@ -2691,6 +2711,15 @@ double TMHZ_EN57::LPP_RP(double pos) // cisnienie z zaokraglonej pozycji;
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)
{
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
if ((TP > 0))
if ((TP > 0)&&(CP>4.9))
{
DP = 0.004;
TP = TP - DP * dt;
@@ -2742,14 +2771,19 @@ double TMHZ_K5P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
else
CP = CP + 9 * Min0R(abs(LimCP - CP), 0.05) * PR(CP, LimCP) * dt; // zbiornik sterujacy
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;
dpPipe = Min0R(HP, CP + TP + RedAdj);
if (dpPipe > PP)
dpMainValve = -PFVa(HP, PP, ActFlowSpeed / LBDelay, dpPipe, 0.4);
else
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))
TP = TP + 0.03 * dt;
@@ -2805,10 +2839,13 @@ double TMHZ_K5P::GetCP()
return CP;
}
void TMHZ_K5P::SetParams(bool AO, bool MO, double, double)
void TMHZ_K5P::SetParams(bool AO, bool MO, double OverP, double)
{
AutoOvrld = AO;
ManualOvrld = MO;
UnbrakeOverPressure = std::max(0.0, OverP);
Fala = (OverP > 0.01);
}
bool TMHZ_K5P::EQ(double pos, double i_pos)
@@ -2836,7 +2873,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
if ((TP > 0))
if ((TP > 0)&&(CP>4.9))
{
DP = 0.004;
TP = TP - DP * dt;
@@ -2864,9 +2901,14 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
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))
{
dpPipe = 5.0 + TP + RedAdj + UnbrakeOverPressure;
dpPipe = 5.0 + TP + RedAdj + uop;
ActFlowSpeed = 12;
}
@@ -2875,7 +2917,7 @@ double TMHZ_6P::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
else
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))
TP = TP + 0.03 * dt;

View File

@@ -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 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
class TReservoir {
@@ -183,6 +193,7 @@ class TBrake {
double SizeBC = 0.0; //rozmiar^2 CH (w stosunku do 14")
bool DCV = false; //podwojny zawor zwrotny
double ASBP = 0.0; //cisnienie hamulca pp
int UniversalFlag = 0; //flaga wcisnietych przyciskow uniwersalnych
int BrakeStatus{ b_off }; //flaga stanu
int SoundFlag = 0;
@@ -220,6 +231,7 @@ class TBrake {
int GetBrakeStatus() const { return BrakeStatus; }
void SetBrakeStatus( int const Status ) { BrakeStatus = Status; }
virtual void SetED( double const EDstate ) {}; //stan hamulca ED do luzowania
virtual void SetUniversalFlag(int flag) { UniversalFlag = flag; } //przycisk uniwersalny
};
class TWest : public TBrake {
@@ -520,6 +532,7 @@ class TDriverHandle {
bool AutoOvrld = false; //czy jest asymilacja automatyczna na pozycji -1
bool ManualOvrld = false; //czy jest asymilacja reczna przyciskiem
bool ManualOvrldActive = false; //czy jest wcisniety przycisk asymilacji
int UniversalFlag = 0; //flaga wcisnietych przyciskow uniwersalnych
public:
bool Time = false;
bool TimeEP = false;
@@ -534,7 +547,7 @@ class TDriverHandle {
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 OvrldButton(bool Active); //przycisk recznego przeladowania/asymilacji
virtual void SetUniversalFlag(int flag); //przycisk uniwersalny
inline TDriverHandle() { memset( Sounds, 0, sizeof( Sounds ) ); }
};
@@ -589,6 +602,7 @@ class TMHZ_EN57 : public TDriverHandle {
double RP = 0.0; //zbiornik redukcyjny
double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
bool Fala = false;
double UnbrakeOverPressure = 0.0;
static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
double LPP_RP(double pos);
@@ -602,7 +616,7 @@ class TMHZ_EN57 : public TDriverHandle {
double GetPos(int i)/*override*/;
double GetCP()/*override*/;
double GetEP(double pos);
void SetParams(bool AO, bool MO, double OverP, double);
inline TMHZ_EN57(void) :
TDriverHandle()
{}
@@ -616,6 +630,7 @@ private:
double RP = 0.0; //zbiornik redukcyjny
double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
bool Fala = false; //czy jest napelnianie uderzeniowe
double UnbrakeOverPressure = 0.0;
static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
bool EQ(double pos, double i_pos);