mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +02:00
build 170502. minor fixes for brakes subsystem, distribution of sandbox commands to other consist units
This commit is contained in:
@@ -377,7 +377,7 @@ struct TBoilerType {
|
||||
};
|
||||
/*rodzaj odbieraka pradu*/
|
||||
struct TCurrentCollector {
|
||||
long CollectorsNo{ 0.0 }; //musi być tu, bo inaczej się kopie
|
||||
long CollectorsNo{ 0 }; //musi być tu, bo inaczej się kopie
|
||||
double MinH{ 0.0 }; double MaxH{ 0.0 }; //zakres ruchu pantografu, nigdzie nie używany
|
||||
double CSW{ 0.0 }; //szerokość części roboczej (styku) ślizgacza
|
||||
double MinV{ 0.0 }; double MaxV{ 0.0 }; //minimalne i maksymalne akceptowane napięcie
|
||||
@@ -554,8 +554,9 @@ struct TTransmision
|
||||
enum TCouplerType { NoCoupler, Articulated, Bare, Chain, Screw, Automatic };
|
||||
|
||||
struct power_coupling {
|
||||
double outgoing{ 0.0 }; // power generated by coupling owner
|
||||
double incoming{ 0.0 }; // power supplied from outside source
|
||||
double current{ 0.0 };
|
||||
double voltage{ 0.0 };
|
||||
bool local{ false }; // whether the power comes from external or onboard source
|
||||
};
|
||||
|
||||
struct TCoupling {
|
||||
@@ -800,8 +801,8 @@ public:
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
double HVCouplers[ 2 ][ 2 ]; //przewod WN
|
||||
enum hvcoupler {
|
||||
incoming = 0,
|
||||
outgoing
|
||||
current = 0,
|
||||
voltage
|
||||
};
|
||||
#endif
|
||||
int ScanCounter = 0; /*pomocnicze do skanowania sprzegow*/
|
||||
@@ -848,7 +849,9 @@ public:
|
||||
int LocalBrakePos = 0; /*nastawa hamulca indywidualnego*/
|
||||
int ManualBrakePos = 0; /*nastawa hamulca recznego*/
|
||||
double LocalBrakePosA = 0.0;
|
||||
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 EmergencyBrakeFlag = false; /*hamowanie nagle*/
|
||||
int BrakeDelayFlag = 0; /*nastawa opoznienia ham. osob/towar/posp/exp 0/1/2/4*/
|
||||
int BrakeDelays = 0; /*nastawy mozliwe do uzyskania*/
|
||||
@@ -1040,7 +1043,7 @@ public:
|
||||
|
||||
bool AddPulseForce(int Multipler);/*dla drezyny*/
|
||||
|
||||
bool SandDoseOn(void);/*wlacza/wylacza sypanie piasku*/
|
||||
bool Sandbox( bool const State, int const Notify = command_range::consist );/*wlacza/wylacza sypanie piasku*/
|
||||
|
||||
/*! zbijanie czuwaka/SHP*/
|
||||
void SSReset(void);
|
||||
@@ -1112,7 +1115,7 @@ public:
|
||||
/*function ShowEngineRotation(VehN:int): integer; //Ra 2014-06: przeniesione do C++*/
|
||||
/*funkcje uzalezniajace sile pociagowa od predkosci: v2n, n2r, current, momentum*/
|
||||
double v2n(void);
|
||||
double current(double n, double U);
|
||||
double Current(double n, double U);
|
||||
double Momentum(double I);
|
||||
double MomentumF(double I, double Iw, int SCP);
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ int DirF(int CouplerN)
|
||||
// Q: 20160716
|
||||
// Obliczanie natężenie prądu w silnikach
|
||||
// *************************************************************************************************
|
||||
double TMoverParameters::current(double n, double U)
|
||||
double TMoverParameters::Current(double n, double U)
|
||||
{
|
||||
// wazna funkcja - liczy prad plynacy przez silniki polaczone szeregowo lub rownolegle
|
||||
// w zaleznosci od polozenia nastawnikow MainCtrl i ScndCtrl oraz predkosci obrotowej n
|
||||
@@ -338,9 +338,9 @@ Name( NameInit )
|
||||
Couplers[b].FmaxC = 1000.0;
|
||||
}
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
for( int b = 0; b < 2; ++b ) {
|
||||
HVCouplers[ b ][ 0 ] = 0.0;
|
||||
HVCouplers[ b ][ 1 ] = 0.0;
|
||||
for( int side = 0; side < 2; ++side ) {
|
||||
HVCouplers[ side ][ hvcoupler::current ] = 0.0;
|
||||
HVCouplers[ side ][ hvcoupler::voltage ] = 0.0;
|
||||
}
|
||||
#endif
|
||||
for( int b = 0; b < 3; ++b ) {
|
||||
@@ -706,15 +706,22 @@ bool TMoverParameters::CurrentSwitch(int direction)
|
||||
};
|
||||
|
||||
void TMoverParameters::UpdatePantVolume(double dt)
|
||||
{ // KURS90 - sprężarka pantografów; Ra 2014-07: teraz jest to zbiornik rozrządu, chociaż to jeszcze
|
||||
// nie tak
|
||||
{ // KURS90 - sprężarka pantografów; Ra 2014-07: teraz jest to zbiornik rozrządu, chociaż to jeszcze nie tak
|
||||
|
||||
// check the pantograph compressor while at it
|
||||
if( PantCompFlag ) {
|
||||
if( ( false == Battery )
|
||||
&& ( false == ConverterFlag ) ) {
|
||||
PantCompFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (EnginePowerSource.SourceType == CurrentCollector) // tylko jeśli pantografujący
|
||||
{
|
||||
// Ra 2014-07: zasadniczo, to istnieje zbiornik rozrządu i zbiornik pantografów - na razie mamy razem
|
||||
// Ra 2014-07: kurek trójdrogowy łączy spr.pom. z pantografami i wyłącznikiem ciśnieniowym WS
|
||||
// Ra 2014-07: zbiornika rozrządu nie pompuje się tu, tylko pantografy; potem można zamknąć
|
||||
// WS i odpalić resztę
|
||||
// NOTE: custom variant for EMU disabled because it pretty much doesn't work
|
||||
if ((TrainType == dt_EZT) ? (PantPress < ScndPipePress) :
|
||||
bPantKurek3) // kurek zamyka połączenie z ZG
|
||||
{ // zbiornik pantografu połączony ze zbiornikiem głównym - małą sprężarką się tego nie napompuje
|
||||
@@ -727,16 +734,19 @@ void TMoverParameters::UpdatePantVolume(double dt)
|
||||
}
|
||||
else
|
||||
{ // zbiornik główny odcięty, można pompować pantografy
|
||||
if (PantCompFlag && Battery) // włączona bateria i mała sprężarka
|
||||
PantVolume += dt * (TrainType == dt_EZT ? 0.003 : 0.005) *
|
||||
(2.0 * 0.45 - ((0.1 / PantVolume / 10) - 0.1)) /
|
||||
0.45; // napełnianie zbiornika pantografów
|
||||
// Ra 2013-12: Niebugocław mówi, że w EZT nabija 1.5 raz wolniej niż jak było 0.005
|
||||
if( PantCompFlag ) {
|
||||
// włączona mała sprężarka
|
||||
PantVolume +=
|
||||
dt
|
||||
// Ra 2013-12: Niebugocław mówi, że w EZT nabija 1.5 raz wolniej niż jak było 0.005
|
||||
* ( TrainType == dt_EZT ? 0.003 : 0.005 ) / std::max( 1.0, PantPress )
|
||||
* ( 0.45 - ( ( 0.1 / PantVolume / 10 ) - 0.1 ) ) / 0.45;
|
||||
}
|
||||
PantPress = std::min( (10.0 * PantVolume) - 1.0, EnginePowerSource.CollectorParameters.MaxPress ); // tu by się przydała objętość zbiornika
|
||||
PantPress = std::max( PantPress, 0.0 );
|
||||
}
|
||||
if (!PantCompFlag && (PantVolume > 0.1))
|
||||
PantVolume -= dt * 0.0003; // nieszczelności: 0.0003=0.3l/s
|
||||
if( !PantCompFlag && ( PantVolume > 0.1 ) )
|
||||
PantVolume -= dt * 0.0003 * std::max( 1.0, PantPress * 0.5 ); // nieszczelności: 0.0003=0.3l/s
|
||||
/*
|
||||
// NOTE: disabled as this is redundant with check done in dynobj.update()
|
||||
// TODO: determine if this isn't a mistake --
|
||||
@@ -1100,31 +1110,31 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap
|
||||
|| ( ( Heating )
|
||||
&& ( Couplers[ side ].CouplingFlag & ctrain_heating ) ) ) {
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
HVCouplers[ oppositeside ][ hvcoupler::outgoing ] =
|
||||
HVCouplers[ oppositeside ][ hvcoupler::voltage ] =
|
||||
std::max(
|
||||
std::abs( hvc ),
|
||||
Couplers[ side ].Connected->HVCouplers[ Couplers[ side ].ConnectedNr ][ hvcoupler::outgoing ] - HVCouplers[ side ][ hvcoupler::incoming ] * 0.02 );
|
||||
Couplers[ side ].Connected->HVCouplers[ Couplers[ side ].ConnectedNr ][ hvcoupler::voltage ] - HVCouplers[ side ][ hvcoupler::current ] * 0.02 );
|
||||
#else
|
||||
auto const &connectedcoupler = Couplers[ side ].Connected->Couplers[ Couplers[ side ].ConnectedNr ];
|
||||
Couplers[ oppositeside ].power_high.outgoing =
|
||||
Couplers[ oppositeside ].power_high.voltage =
|
||||
std::max(
|
||||
std::abs( hvc ),
|
||||
connectedcoupler.power_high.outgoing - Couplers[ side ].power_high.incoming * 0.02 );
|
||||
connectedcoupler.power_high.voltage - Couplers[ side ].power_high.current * 0.02 );
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
HVCouplers[ oppositeside ][ hvcoupler::outgoing ] = abs( hvc ) - HVCouplers[ side ][ hvcoupler::incoming ] * 0.02;
|
||||
HVCouplers[ oppositeside ][ hvcoupler::voltage ] = std::abs( hvc ) - HVCouplers[ side ][ hvcoupler::current ] * 0.02;
|
||||
#else
|
||||
Couplers[ oppositeside ].power_high.outgoing = std::abs( hvc ) - Couplers[ side ].power_high.incoming * 0.02;
|
||||
Couplers[ oppositeside ].power_high.voltage = std::abs( hvc ) - Couplers[ side ].power_high.current * 0.02;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
hvc = HVCouplers[ side::front ][ hvcoupler::outgoing ] + HVCouplers[ side::rear ][ hvcoupler::outgoing ];
|
||||
hvc = HVCouplers[ side::front ][ hvcoupler::voltage ] + HVCouplers[ side::rear ][ hvcoupler::voltage ];
|
||||
#else
|
||||
hvc = Couplers[ side::front ].power_high.outgoing + Couplers[ side::rear ].power_high.outgoing;
|
||||
hvc = Couplers[ side::front ].power_high.voltage + Couplers[ side::rear ].power_high.voltage;
|
||||
#endif
|
||||
|
||||
if( ( std::abs( PantFrontVolt ) + std::abs( PantRearVolt ) < 1.0 )
|
||||
@@ -1133,26 +1143,33 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap
|
||||
// przekazywanie pradow
|
||||
for( int side = 0; side < 2; ++side ) {
|
||||
|
||||
Couplers[ side ].power_high.local = false; // power, if any, will be from external source
|
||||
|
||||
if( ( Couplers[ side ].CouplingFlag & ctrain_power )
|
||||
|| ( ( Heating )
|
||||
&& ( Couplers[ side ].CouplingFlag & ctrain_heating ) ) ) {
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
HVCouplers[ side ][ hvcoupler::incoming ] =
|
||||
Couplers[side].Connected->HVCouplers[Couplers[side].ConnectedNr][hvcoupler::outgoing] +
|
||||
Itot * HVCouplers[side][hvcoupler::outgoing] / hvc; // obciążenie rozkladane stosownie do napiec
|
||||
auto const oppositeside = ( Couplers[side].ConnectedNr == side::front ? side::rear : side::front );
|
||||
HVCouplers[ side ][ hvcoupler::current ] =
|
||||
Couplers[side].Connected->HVCouplers[oppositeside][hvcoupler::current] +
|
||||
Itot * HVCouplers[side][hvcoupler::voltage] / hvc; // obciążenie rozkladane stosownie do napiec
|
||||
#else
|
||||
auto const &connectedcoupler = Couplers[ side ].Connected->Couplers[ Couplers[ side ].ConnectedNr ];
|
||||
Couplers[ side ].power_high.incoming =
|
||||
connectedcoupler.power_high.outgoing
|
||||
+ Itot * Couplers[ side ].power_high.outgoing / hvc; // obciążenie rozkladane stosownie do napiec
|
||||
auto const &connectedsothercoupler =
|
||||
Couplers[ side ].Connected->Couplers[
|
||||
( Couplers[ side ].ConnectedNr == side::front ?
|
||||
side::rear :
|
||||
side::front ) ];
|
||||
Couplers[ side ].power_high.current =
|
||||
connectedsothercoupler.power_high.current
|
||||
+ Itot * Couplers[ side ].power_high.voltage / hvc; // obciążenie rozkladane stosownie do napiec
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
// pierwszy pojazd
|
||||
HVCouplers[side][hvcoupler::incoming] = Itot * HVCouplers[side][hvcoupler::outgoing] / hvc;
|
||||
HVCouplers[side][hvcoupler::current] = Itot * HVCouplers[side][hvcoupler::voltage] / hvc;
|
||||
#else
|
||||
Couplers[ side ].power_high.incoming = Itot * Couplers[ side ].power_high.outgoing / hvc;
|
||||
Couplers[ side ].power_high.current = Itot * Couplers[ side ].power_high.voltage / hvc;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1160,16 +1177,24 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap
|
||||
else
|
||||
{
|
||||
for( int side = 0; side < 2; ++side ) {
|
||||
|
||||
Couplers[ side ].power_high.local = true; // power is coming from local pantographs
|
||||
|
||||
if( ( Couplers[ side ].CouplingFlag & ctrain_power )
|
||||
|| ( ( Heating )
|
||||
&& ( Couplers[ side ].CouplingFlag & ctrain_heating ) ) ) {
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
TotalCurrent += Couplers[ side ].Connected->HVCouplers[ Couplers[ side ].ConnectedNr ][ hvcoupler::incoming ];
|
||||
HVCouplers[ side ][ hvcoupler::incoming ] = 0.0;
|
||||
auto const oppositeside = ( Couplers[ side ].ConnectedNr == side::front ? side::rear : side::front );
|
||||
TotalCurrent += Couplers[ side ].Connected->HVCouplers[ oppositeside ][ hvcoupler::current ];
|
||||
HVCouplers[ side ][ hvcoupler::current ] = 0.0;
|
||||
#else
|
||||
auto const &connectedcoupler = Couplers[ side ].Connected->Couplers[ Couplers[ side ].ConnectedNr ];
|
||||
TotalCurrent += connectedcoupler.power_high.incoming;
|
||||
Couplers[ side ].power_high.incoming = 0.0;
|
||||
auto const &connectedsothercoupler =
|
||||
Couplers[ side ].Connected->Couplers[
|
||||
( Couplers[ side ].ConnectedNr == side::front ?
|
||||
side::rear :
|
||||
side::front ) ];
|
||||
TotalCurrent += connectedsothercoupler.power_high.current;
|
||||
Couplers[ side ].power_high.current = 0.0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -1528,8 +1553,7 @@ void TMoverParameters::ConverterCheck()
|
||||
{ // sprawdzanie przetwornicy
|
||||
if( ( ConverterAllow )
|
||||
&& ( false == PantPressLockActive )
|
||||
&& ( ( Mains )
|
||||
|| ( GetTrainsetVoltage() > 0.5 * EnginePowerSource.MaxVoltage ) ) ) {
|
||||
&& ( Mains ) ) {
|
||||
ConverterFlag = true;
|
||||
}
|
||||
else {
|
||||
@@ -2032,23 +2056,43 @@ bool TMoverParameters::AddPulseForce(int Multipler)
|
||||
// Q: 20160713
|
||||
// sypanie piasku
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::SandDoseOn(void)
|
||||
bool TMoverParameters::Sandbox( bool const State, int const Notify )
|
||||
{
|
||||
bool SDO;
|
||||
if (SandCapacity > 0)
|
||||
{
|
||||
SDO = true;
|
||||
if (SandDose)
|
||||
SandDose = false;
|
||||
else if (Sand > 0)
|
||||
SandDose = true;
|
||||
if (CabNo != 0)
|
||||
SendCtrlToNext("SandDoseOn", 1, CabNo);
|
||||
}
|
||||
else
|
||||
SDO = false;
|
||||
bool result{ false };
|
||||
|
||||
return SDO;
|
||||
if( SandDose != State ) {
|
||||
if( SandDose == false ) {
|
||||
// switch on
|
||||
if( Sand > 0 ) {
|
||||
SandDose = true;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// switch off
|
||||
SandDose = false;
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( Notify != command_range::local ) {
|
||||
// if requested pass the command on
|
||||
auto const couplingtype =
|
||||
( Notify == command_range::unit ?
|
||||
ctrain_controll | ctrain_depot :
|
||||
ctrain_controll );
|
||||
|
||||
if( State == true ) {
|
||||
// switch on
|
||||
SendCtrlToNext( "Sandbox", 1, CabNo, couplingtype );
|
||||
}
|
||||
else {
|
||||
// switch off
|
||||
SendCtrlToNext( "Sandbox", 0, CabNo, couplingtype );
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void TMoverParameters::SSReset(void)
|
||||
@@ -2271,7 +2315,8 @@ bool TMoverParameters::DirectionBackward(void)
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::AntiSlippingButton(void)
|
||||
{
|
||||
return (AntiSlippingBrake() || SandDoseOn());
|
||||
// NOTE: disabled the sandbox part, it's already controlled by another part of the AI routine
|
||||
return (AntiSlippingBrake() /*|| Sandbox(true)*/);
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
@@ -2865,7 +2910,7 @@ bool TMoverParameters::BrakeDelaySwitch(int BDS)
|
||||
{
|
||||
BrakeDelayFlag = BDS;
|
||||
rBDS = true;
|
||||
BrakeStatus &= 191;
|
||||
Hamulec->SetBrakeStatus( Hamulec->GetBrakeStatus() & ~64 );
|
||||
// kopowanie nastawy hamulca do kolejnego czlonu - do przemyślenia
|
||||
if (CabNo != 0)
|
||||
SendCtrlToNext("BrakeDelay", BrakeDelayFlag, CabNo);
|
||||
@@ -3108,12 +3153,17 @@ void TMoverParameters::UpdatePipePressure(double dt)
|
||||
else
|
||||
dpLocalValve =
|
||||
LocHandle->GetPF(LocalBrakePosA, Hamulec->GetBCP(), ScndPipePress, dt, 0);
|
||||
if ((BrakeHandle == FV4a) &&
|
||||
((PipePress < 2.75) && ((Hamulec->GetStatus() & b_rls) == 0)) &&
|
||||
(BrakeSubsystem == ss_LSt) && (TrainType != dt_EZT))
|
||||
|
||||
if( ( BrakeHandle == FV4a )
|
||||
&& ( ( PipePress < 2.75 )
|
||||
&& ( ( Hamulec->GetStatus() & b_rls ) == 0 ) )
|
||||
&& ( BrakeSubsystem == ss_LSt )
|
||||
&& ( TrainType != dt_EZT ) ) {
|
||||
temp = PipePress + 0.00001;
|
||||
else
|
||||
}
|
||||
else {
|
||||
temp = ScndPipePress;
|
||||
}
|
||||
Handle->SetReductor(BrakeCtrlPos2);
|
||||
|
||||
if ((BrakeOpModeFlag != bom_PS))
|
||||
@@ -3255,20 +3305,21 @@ void TMoverParameters::UpdatePipePressure(double dt)
|
||||
|
||||
if ((BrakeHandle == FVel6) && (ActiveCab != 0))
|
||||
{
|
||||
if ((Battery) && (ActiveDir != 0) &&
|
||||
(EpFuse)) // tu powinien byc jeszcze bezpiecznik EP i baterie -
|
||||
if ((Battery)
|
||||
&& (ActiveDir != 0)
|
||||
&& (EpFuse)) // tu powinien byc jeszcze bezpiecznik EP i baterie -
|
||||
// temp = (Handle as TFVel6).GetCP
|
||||
temp = Handle->GetCP();
|
||||
else
|
||||
temp = 0.0;
|
||||
Hamulec->SetEPS(temp);
|
||||
SendCtrlToNext("Brake", temp,
|
||||
CabNo); // Ra 2014-11: na tym się wysypuje, ale nie wiem, w jakich warunkach
|
||||
// Ra 2014-11: na tym się wysypuje, ale nie wiem, w jakich warunkach
|
||||
SendCtrlToNext("Brake", temp, CabNo);
|
||||
}
|
||||
|
||||
Pipe->Act();
|
||||
PipePress = Pipe->P();
|
||||
if ((BrakeStatus & 128) == 128) // jesli hamulec wyłączony
|
||||
if( ( Hamulec->GetBrakeStatus() & b_dmg ) == b_dmg ) // jesli hamulec wyłączony
|
||||
temp = 0.0; // odetnij
|
||||
else
|
||||
temp = 1.0; // połącz
|
||||
@@ -3524,8 +3575,7 @@ void TMoverParameters::ComputeTotalForce(double dt, double dt1, bool FullVer)
|
||||
LastSwitchingTime += dt1;
|
||||
if (EngineType == ElectricSeriesMotor)
|
||||
LastRelayTime += dt1;
|
||||
if( Mains && /*(abs(CabNo) < 2) &&*/ ( EngineType ==
|
||||
ElectricSeriesMotor ) ) // potem ulepszyc! pantogtrafy!
|
||||
if( Mains && /*(abs(CabNo) < 2) &&*/ ( EngineType == ElectricSeriesMotor ) ) // potem ulepszyc! pantogtrafy!
|
||||
{ // Ra 2014-03: uwzględnienie kierunku jazdy w napięciu na silnikach, a powinien być
|
||||
// zdefiniowany nawrotnik
|
||||
if( CabNo == 0 )
|
||||
@@ -3533,20 +3583,22 @@ void TMoverParameters::ComputeTotalForce(double dt, double dt1, bool FullVer)
|
||||
else
|
||||
Voltage = RunningTraction.TractionVoltage * DirAbsolute; // ActiveDir*CabNo;
|
||||
} // bo nie dzialalo
|
||||
else if( ( EngineType == ElectricInductionMotor ) ||
|
||||
( ( ( Couplers[ 0 ].CouplingFlag & ctrain_power ) == ctrain_power ) ||
|
||||
( ( Couplers[ 1 ].CouplingFlag & ctrain_power ) ==
|
||||
ctrain_power ) ) ) // potem ulepszyc! pantogtrafy!
|
||||
else if( ( EngineType == ElectricInductionMotor )
|
||||
|| ( ( ( Couplers[ side::front ].CouplingFlag & ctrain_power ) == ctrain_power )
|
||||
|| ( ( Couplers[ side::rear ].CouplingFlag & ctrain_power ) == ctrain_power ) ) ) {
|
||||
// potem ulepszyc! pantogtrafy!
|
||||
Voltage =
|
||||
std::max(
|
||||
RunningTraction.TractionVoltage,
|
||||
RunningTraction.TractionVoltage,
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
std::max( HVCouplers[side::front][hvcoupler::incoming], HVCouplers[side::rear][hvcoupler::incoming] ) );
|
||||
std::max( HVCouplers[side::front][hvcoupler::voltage], HVCouplers[side::rear][hvcoupler::voltage] ) );
|
||||
#else
|
||||
std::max( Couplers[ side::front ].power_high.incoming, Couplers[ side::rear ].power_high.incoming ) );
|
||||
std::max( Couplers[ side::front ].power_high.voltage, Couplers[ side::rear ].power_high.voltage ) );
|
||||
#endif
|
||||
else
|
||||
}
|
||||
else {
|
||||
Voltage = 0;
|
||||
}
|
||||
//if (Mains && /*(abs(CabNo) < 2) &&*/ (
|
||||
// EngineType == ElectricInductionMotor)) // potem ulepszyc! pantogtrafy!
|
||||
// Voltage = RunningTraction.TractionVoltage;
|
||||
@@ -4059,7 +4111,7 @@ double TMoverParameters::TractionForce(double dt)
|
||||
// yB: szereg dwoch sekcji w ET42
|
||||
if ((TrainType == dt_ET42) && (Imax == ImaxHi))
|
||||
Voltage = Voltage / 2.0;
|
||||
Mm = Momentum(current(enrot, Voltage)); // oblicza tez prad p/slinik
|
||||
Mm = Momentum(Current(enrot, Voltage)); // oblicza tez prad p/slinik
|
||||
|
||||
if (TrainType == dt_ET42)
|
||||
{
|
||||
@@ -4253,73 +4305,85 @@ double TMoverParameters::TractionForce(double dt)
|
||||
|
||||
case 0: {
|
||||
|
||||
if( ( Im <= ( MPTRelay[ ScndCtrlPos ].Iup * PosRatio ) ) &&
|
||||
( ScndCtrlPos < ScndCtrlPosNo ) )
|
||||
++ScndCtrlPos;
|
||||
if( ( Im >= ( MPTRelay[ ScndCtrlPos ].Idown * PosRatio ) ) && ( ScndCtrlPos > 0 ) )
|
||||
--ScndCtrlPos;
|
||||
break;
|
||||
}
|
||||
if( ( ScndCtrlPos < ScndCtrlPosNo )
|
||||
&& ( Im <= ( MPTRelay[ ScndCtrlPos ].Iup * PosRatio ) ) ) {
|
||||
++ScndCtrlPos;
|
||||
}
|
||||
if( ( ScndCtrlPos > 0 )
|
||||
&& ( Im >= ( MPTRelay[ScndCtrlPos].Idown * PosRatio ) ) ) {
|
||||
--ScndCtrlPos;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
|
||||
if( ( MPTRelay[ ScndCtrlPos ].Iup < Vel ) && ( ScndCtrlPos < ScndCtrlPosNo ) )
|
||||
++ScndCtrlPos;
|
||||
if( ( MPTRelay[ ScndCtrlPos ].Idown > Vel ) && ( ScndCtrlPos > 0 ) )
|
||||
--ScndCtrlPos;
|
||||
break;
|
||||
}
|
||||
if( ( ScndCtrlPos < ScndCtrlPosNo )
|
||||
&& ( MPTRelay[ ScndCtrlPos ].Iup < Vel ) ) {
|
||||
++ScndCtrlPos;
|
||||
}
|
||||
if( ( ScndCtrlPos > 0 )
|
||||
&& ( MPTRelay[ ScndCtrlPos ].Idown > Vel ) ) {
|
||||
--ScndCtrlPos;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: {
|
||||
|
||||
if( ( MPTRelay[ ScndCtrlPos ].Iup < Vel ) && ( ScndCtrlPos < ScndCtrlPosNo ) &&
|
||||
( EnginePower < ( tmp * 0.99 ) ) )
|
||||
++ScndCtrlPos;
|
||||
if( ( MPTRelay[ ScndCtrlPos ].Idown < Im ) && ( ScndCtrlPos > 0 ) )
|
||||
--ScndCtrlPos;
|
||||
break;
|
||||
}
|
||||
case 41:
|
||||
{
|
||||
if( ( MainCtrlPos == MainCtrlPosNo )
|
||||
&& ( tmpV * 3.6 > MPTRelay[ ScndCtrlPos ].Iup )
|
||||
&& ( ScndCtrlPos < ScndCtrlPosNo ) ) {
|
||||
++ScndCtrlPos;
|
||||
enrot = enrot * 0.73;
|
||||
}
|
||||
if( ( Im > MPTRelay[ ScndCtrlPos ].Idown )
|
||||
&& ( ScndCtrlPos > 0 ) ) {
|
||||
--ScndCtrlPos;
|
||||
if( ( ScndCtrlPos < ScndCtrlPosNo )
|
||||
&& ( MPTRelay[ ScndCtrlPos ].Iup < Vel )
|
||||
&& ( EnginePower < ( tmp * 0.99 ) ) ) {
|
||||
++ScndCtrlPos;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 45:
|
||||
{
|
||||
if( ( MainCtrlPos >= 10 ) && ( ScndCtrlPos < ScndCtrlPosNo ) ) {
|
||||
if( ( ScndCtrlPos > 0 )
|
||||
&& ( MPTRelay[ ScndCtrlPos ].Idown < Im ) ) {
|
||||
--ScndCtrlPos;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 41:
|
||||
{
|
||||
if( ( ScndCtrlPos < ScndCtrlPosNo )
|
||||
&& ( MainCtrlPos == MainCtrlPosNo )
|
||||
&& ( tmpV * 3.6 > MPTRelay[ ScndCtrlPos ].Iup ) ) {
|
||||
++ScndCtrlPos;
|
||||
enrot = enrot * 0.73;
|
||||
}
|
||||
if( ( ScndCtrlPos > 0 )
|
||||
&& ( Im > MPTRelay[ ScndCtrlPos ].Idown ) ) {
|
||||
--ScndCtrlPos;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 45:
|
||||
{
|
||||
if( ( ScndCtrlPos < ScndCtrlPosNo )
|
||||
&& ( MainCtrlPos >= 10 ) ) {
|
||||
if( ScndCtrlPos == 0 ) {
|
||||
if( Im < MPTRelay[ ScndCtrlPos ].Iup ) {
|
||||
++ScndCtrlPos;
|
||||
++ScndCtrlPos;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if( Vel > MPTRelay[ ScndCtrlPos ].Iup ) {
|
||||
++ScndCtrlPos;
|
||||
++ScndCtrlPos;
|
||||
}
|
||||
// check for cases where the speed drops below threshold for level 2 or 3
|
||||
if( ( ScndCtrlPos > 1 )
|
||||
&& ( Vel < MPTRelay[ ScndCtrlPos - 1 ].Idown ) ){
|
||||
&& ( Vel < MPTRelay[ ScndCtrlPos - 1 ].Idown ) ) {
|
||||
--ScndCtrlPos;
|
||||
}
|
||||
}
|
||||
}
|
||||
// malenie
|
||||
// malenie
|
||||
if( ( ScndCtrlPos > 0 ) && ( MainCtrlPos < 10 ) ) {
|
||||
if( ScndCtrlPos == 1 ) {
|
||||
if( Im > MPTRelay[ ScndCtrlPos - 1 ].Idown ) {
|
||||
--ScndCtrlPos;
|
||||
--ScndCtrlPos;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if( Vel < MPTRelay[ ScndCtrlPos ].Idown ) {
|
||||
--ScndCtrlPos;
|
||||
--ScndCtrlPos;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4329,13 +4393,13 @@ double TMoverParameters::TractionForce(double dt)
|
||||
}
|
||||
// ...and below position 7 field shunt drops altogether
|
||||
if( MainCtrlPos < 7 ) {
|
||||
ScndCtrlPos = 0;
|
||||
}
|
||||
ScndCtrlPos = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 46:
|
||||
{
|
||||
// wzrastanie
|
||||
case 46:
|
||||
{
|
||||
// wzrastanie
|
||||
if( ( MainCtrlPos >= 10 )
|
||||
&& ( ScndCtrlPos < ScndCtrlPosNo ) ) {
|
||||
if( ( ScndCtrlPos ) % 2 == 0 ) {
|
||||
@@ -4350,18 +4414,18 @@ double TMoverParameters::TractionForce(double dt)
|
||||
}
|
||||
}
|
||||
}
|
||||
// malenie
|
||||
// malenie
|
||||
if( ( MainCtrlPos < 10 )
|
||||
&& ( ScndCtrlPos > 0 ) ) {
|
||||
if( ( ScndCtrlPos ) % 2 == 0 ) {
|
||||
if( ( MPTRelay[ ScndCtrlPos ].Idown < Im ) ) {
|
||||
--ScndCtrlPos;
|
||||
--ScndCtrlPos;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if( ( MPTRelay[ ScndCtrlPos + 1 ].Idown < Im )
|
||||
&& ( MPTRelay[ ScndCtrlPos ].Idown > Vel ) ) {
|
||||
--ScndCtrlPos;
|
||||
--ScndCtrlPos;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4369,14 +4433,14 @@ double TMoverParameters::TractionForce(double dt)
|
||||
ScndCtrlPos = std::min( 2, ScndCtrlPos );
|
||||
}
|
||||
if( MainCtrlPos < 7 ) {
|
||||
ScndCtrlPos = 0;
|
||||
}
|
||||
ScndCtrlPos = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
} // switch RelayType
|
||||
} // switch RelayType
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -4455,26 +4519,28 @@ double TMoverParameters::TractionForce(double dt)
|
||||
dmoment = eimv[eimv_Fful];
|
||||
// else
|
||||
// dmoment:=eimc[eimc_p_F0]*0.99;
|
||||
// NOTE: the commands to operate the sandbox are likely to conflict with other similar ai decisions
|
||||
// TODO: gather these in single place so they can be resolved together
|
||||
if ((abs((PosRatio + 9.66 * dizel_fill) * dmoment * 100) >
|
||||
0.95 * Adhesive(RunningTrack.friction) * TotalMassxg))
|
||||
{
|
||||
PosRatio = 0;
|
||||
tmp = 4;
|
||||
SandDoseOn();
|
||||
Sandbox( true, command_range::local );
|
||||
} // przeciwposlizg
|
||||
if ((abs((PosRatio + 9.80 * dizel_fill) * dmoment * 100) >
|
||||
0.95 * Adhesive(RunningTrack.friction) * TotalMassxg))
|
||||
{
|
||||
PosRatio = 0;
|
||||
tmp = 9;
|
||||
SandDoseOn();
|
||||
Sandbox( true, command_range::local );
|
||||
} // przeciwposlizg
|
||||
if ((SlippingWheels))
|
||||
{
|
||||
// PosRatio = -PosRatio * 0; // serio -0 ???
|
||||
PosRatio = 0;
|
||||
tmp = 9;
|
||||
SandDoseOn();
|
||||
Sandbox( true, command_range::local );
|
||||
} // przeciwposlizg
|
||||
|
||||
dizel_fill += Max0R(Min0R(PosRatio - dizel_fill, 0.1), -0.1) * 2 *
|
||||
@@ -5682,28 +5748,28 @@ std::string TMoverParameters::EngineDescription(int what)
|
||||
// *************************************************************************************************
|
||||
double TMoverParameters::GetTrainsetVoltage(void)
|
||||
{//ABu: funkcja zwracajaca napiecie dla calego skladu, przydatna dla EZT
|
||||
/*
|
||||
return std::min(
|
||||
std::max( HVCouplers[ 1 ][ 1 ], HVCouplers[ 0 ][ 1 ] ), // local
|
||||
std::max( HVCouplers[ 1 ][ 0 ], HVCouplers[ 0 ][ 0 ] ) ); // remote
|
||||
*/
|
||||
// TODO: investigate what exactly is reported on these couplers, does it include heating?
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
// TODO: if we ever revert to this version, match the expanded alternative below
|
||||
return std::max( HVCouplers[ 1 ][ 0 ], HVCouplers[ 0 ][ 0 ] ); // incoming, external power
|
||||
return std::max(
|
||||
HVCouplers[ side::front ][ hvcoupler::voltage ],
|
||||
HVCouplers[ side::rear ][ hvcoupler::voltage ] );
|
||||
#else
|
||||
/*
|
||||
return std::max(
|
||||
Couplers[ side::front ].power_high.voltage,
|
||||
Couplers[ side::rear ].power_high.voltage );
|
||||
*/
|
||||
return std::max(
|
||||
( ( ( Couplers[side::front].Connected )
|
||||
&& ( ( Couplers[ side::front ].CouplingFlag & ctrain_power )
|
||||
|| ( ( Heating )
|
||||
&& ( Couplers[ side::front ].CouplingFlag & ctrain_heating ) ) ) ) ?
|
||||
Couplers[side::front].Connected->Couplers[ Couplers[side::front].ConnectedNr ].power_high.outgoing :
|
||||
Couplers[side::front].Connected->Couplers[ Couplers[side::front].ConnectedNr ].power_high.voltage :
|
||||
0.0 ),
|
||||
( ( ( Couplers[side::rear].Connected )
|
||||
&& ( ( Couplers[ side::rear ].CouplingFlag & ctrain_power )
|
||||
|| ( ( Heating )
|
||||
&& ( Couplers[ side::rear ].CouplingFlag & ctrain_heating ) ) ) ) ?
|
||||
Couplers[ side::rear ].Connected->Couplers[ Couplers[ side::rear ].ConnectedNr ].power_high.outgoing :
|
||||
Couplers[ side::rear ].Connected->Couplers[ Couplers[ side::rear ].ConnectedNr ].power_high.voltage :
|
||||
0.0 ) );
|
||||
#endif
|
||||
}
|
||||
@@ -8059,15 +8125,18 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
|
||||
}
|
||||
else if (Command == "BrakeDelay")
|
||||
{
|
||||
BrakeDelayFlag = static_cast<int>(floor(CValue1));
|
||||
OK = true;
|
||||
auto const brakesetting = static_cast<int>( std::floor( CValue1 ) );
|
||||
if( true == Hamulec->SetBDF( brakesetting ) ) {
|
||||
BrakeDelayFlag = brakesetting;
|
||||
OK = true;
|
||||
}
|
||||
else {
|
||||
OK = false;
|
||||
}
|
||||
}
|
||||
else if (Command == "SandDoseOn")
|
||||
else if (Command == "Sandbox")
|
||||
{
|
||||
if (SandDoseOn())
|
||||
OK = true;
|
||||
else
|
||||
OK = false;
|
||||
OK = Sandbox( CValue1 == 1, command_range::local );
|
||||
}
|
||||
else if (Command == "CabSignal") /*SHP,Indusi*/
|
||||
{ // Ra: to powinno działać tylko w członie obsadzonym
|
||||
|
||||
@@ -16,6 +16,7 @@ Copyright (C) 2007-2014 Maciej Cierniak
|
||||
#include "hamulce.h"
|
||||
#include <typeinfo>
|
||||
#include "Mover.h"
|
||||
#include "usefull.h"
|
||||
|
||||
//---FUNKCJE OGOLNE---
|
||||
|
||||
@@ -51,10 +52,10 @@ double PF_old(double P1, double P2, double S)
|
||||
|
||||
double PF( double const P1, double const P2, double const S, double const DP )
|
||||
{
|
||||
double PH = std::max(P1, P2) + 1; // wyzsze cisnienie absolutne
|
||||
double PL = P1 + P2 - PH + 2; // nizsze cisnienie absolutne
|
||||
double sg = PL / PH; // bezwymiarowy stosunek cisnien
|
||||
double FM = PH * 197 * S * Sign(P2 - P1); // najwyzszy mozliwy przeplyw, wraz z kierunkiem
|
||||
double const PH = std::max(P1, P2) + 1.0; // wyzsze cisnienie absolutne
|
||||
double const PL = P1 + P2 - PH + 2.0; // nizsze cisnienie absolutne
|
||||
double const sg = PL / PH; // bezwymiarowy stosunek cisnien
|
||||
double const FM = PH * 197.0 * S * Sign(P2 - P1); // najwyzszy mozliwy przeplyw, wraz z kierunkiem
|
||||
if (sg > 0.5) // jesli ponizej stosunku krytycznego
|
||||
if ((PH - PL) < DP) // niewielka roznica cisnien
|
||||
return (1.0 - sg) / DPL * FM * 2.0 * std::sqrt((DP) * (PH - DP));
|
||||
@@ -69,15 +70,15 @@ double PF1( double const P1, double const P2, double const S )
|
||||
{
|
||||
static double const DPS = 0.001;
|
||||
|
||||
double PH = std::max(P1, P2) + 1; // wyzsze cisnienie absolutne
|
||||
double PL = P1 + P2 - PH + 2; // nizsze cisnienie absolutne
|
||||
double sg = PL / PH; // bezwymiarowy stosunek cisnien
|
||||
double FM = PH * 197 * S * Sign(P2 - P1); // najwyzszy mozliwy przeplyw, wraz z kierunkiem
|
||||
if ((sg > 0.5)) // jesli ponizej stosunku krytycznego
|
||||
if ((sg < DPS)) // niewielka roznica cisnien
|
||||
return (1 - sg) / DPS * FM * 2 * std::sqrt((DPS) * (1 - DPS));
|
||||
double const PH = std::max(P1, P2) + 1.0; // wyzsze cisnienie absolutne
|
||||
double const PL = P1 + P2 - PH + 2.0; // nizsze cisnienie absolutne
|
||||
double const sg = PL / PH; // bezwymiarowy stosunek cisnien
|
||||
double const FM = PH * 197.0 * S * Sign(P2 - P1); // najwyzszy mozliwy przeplyw, wraz z kierunkiem
|
||||
if (sg > 0.5) // jesli ponizej stosunku krytycznego
|
||||
if (sg < DPS) // niewielka roznica cisnien
|
||||
return (1.0 - sg) / DPS * FM * 2.0 * std::sqrt((DPS) * (1.0 - DPS));
|
||||
else
|
||||
return FM * 2 * std::sqrt((sg) * (1 - sg));
|
||||
return FM * 2.0 * std::sqrt((sg) * (1.0 - sg));
|
||||
else // powyzej stosunku krytycznego
|
||||
return FM;
|
||||
}
|
||||
@@ -1184,50 +1185,50 @@ void TESt3AL2::Init( double const PP, double const HPP, double const LPP, double
|
||||
double TLSt::GetPF( double const PP, double const dt, double const Vel )
|
||||
{
|
||||
double result;
|
||||
double dv;
|
||||
double dV1;
|
||||
double temp;
|
||||
double VVP;
|
||||
double BVP;
|
||||
double BCP;
|
||||
double CVP;
|
||||
|
||||
// ValveRes.CreatePress(LBP);
|
||||
// LBP:=0;
|
||||
|
||||
BVP = BrakeRes->P();
|
||||
VVP = ValveRes->P();
|
||||
BCP = ImplsRes->P();
|
||||
CVP = CntrlRes->P();
|
||||
double const BVP{ BrakeRes->P() };
|
||||
double const VVP{ ValveRes->P() };
|
||||
double const BCP{ ImplsRes->P() };
|
||||
double const CVP{ CntrlRes->P() };
|
||||
|
||||
dv = 0;
|
||||
dV1 = 0;
|
||||
double dV{ 0.0 };
|
||||
double dV1{ 0.0 };
|
||||
|
||||
// sprawdzanie stanu
|
||||
if ((BrakeStatus & b_rls) == b_rls)
|
||||
if ((CVP < 0))
|
||||
if( ( BrakeStatus & b_rls ) == b_rls ) {
|
||||
if( CVP < 0.0 ) {
|
||||
BrakeStatus &= ~b_rls;
|
||||
}
|
||||
else
|
||||
{ // 008
|
||||
dv = PF1(CVP, BCP, 0.024) * dt;
|
||||
CntrlRes->Flow(+dv);
|
||||
// dV1:=+dV; //minus potem jest
|
||||
// ImplsRes->Flow(-dV1);
|
||||
dV = PF1( CVP, BCP, 0.024 ) * dt;
|
||||
CntrlRes->Flow( dV );
|
||||
/*
|
||||
// NOTE: attempted fix, disabled because it breaks when releaser is used while releasing breakes
|
||||
dV = PF1(CVP, VVP, 0.024) * dt;
|
||||
CntrlRes->Flow( dV );
|
||||
dV1 = dV; //minus potem jest
|
||||
ImplsRes->Flow( -dV1 );
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
VVP = ValveRes->P();
|
||||
double temp;
|
||||
// przeplyw ZS <-> PG
|
||||
if (((CVP - BCP) * BVM > 0.5))
|
||||
temp = 0;
|
||||
temp = 0.0;
|
||||
else if ((VVP > CVP + 0.4))
|
||||
temp = 0.5;
|
||||
else
|
||||
temp = 0.5;
|
||||
|
||||
dv = PF1(CVP, VVP, 0.0015 * temp / 1.8 / 2) * dt;
|
||||
CntrlRes->Flow(+dv);
|
||||
ValveRes->Flow(-0.04 * dv);
|
||||
dV1 = dV1 - 0.96 * dv;
|
||||
dV = PF1(CVP, VVP, 0.0015 * temp / 1.8 / 2) * dt;
|
||||
CntrlRes->Flow(+dV);
|
||||
ValveRes->Flow(-0.04 * dV);
|
||||
dV1 = dV1 - 0.96 * dV;
|
||||
|
||||
// luzowanie KI {G}
|
||||
// if VVP>BCP then
|
||||
@@ -1236,26 +1237,38 @@ double TLSt::GetPF( double const PP, double const dt, double const Vel )
|
||||
// dV:=PF(VVP,BCP,0.00020*(1.33-int((CVP-BCP)*BVM>0.65)))*dt
|
||||
// else dV:=0; 0.00025 P
|
||||
/*P*/
|
||||
if (VVP > BCP)
|
||||
dv = PF(VVP, BCP,
|
||||
0.00043 * (1.5 - int(((CVP - BCP) * BVM > 1) && (BrakeDelayFlag == bdelay_G))),
|
||||
0.1) *
|
||||
dt;
|
||||
else if ((CVP - BCP) < 1.5)
|
||||
dv = PF(VVP, BCP,
|
||||
0.001472 * (1.36 - int(((CVP - BCP) * BVM > 1) && (BrakeDelayFlag == bdelay_G))),
|
||||
0.1) *
|
||||
dt;
|
||||
else
|
||||
dv = 0;
|
||||
if( VVP > BCP ) {
|
||||
dV =
|
||||
PF( VVP, BCP,
|
||||
0.00043 * ( 1.5 - (
|
||||
true == ( ( ( CVP - BCP ) * BVM > 1.0 )
|
||||
&& ( BrakeDelayFlag == bdelay_G ) ) ?
|
||||
1.0 :
|
||||
0.0 ) ),
|
||||
0.1 )
|
||||
* dt;
|
||||
}
|
||||
else if( ( CVP - BCP ) < 1.5 ) {
|
||||
dV = PF( VVP, BCP,
|
||||
0.001472 * ( 1.36 - (
|
||||
true == ( ( ( CVP - BCP ) * BVM > 1.0 )
|
||||
&& ( BrakeDelayFlag == bdelay_G ) ) ?
|
||||
1.0 :
|
||||
0.0 ) ),
|
||||
0.1 )
|
||||
* dt;
|
||||
}
|
||||
else {
|
||||
dV = 0;
|
||||
}
|
||||
|
||||
ImplsRes->Flow(-dv);
|
||||
ValveRes->Flow(+dv);
|
||||
ImplsRes->Flow(-dV);
|
||||
ValveRes->Flow(+dV);
|
||||
// przeplyw PG <-> rozdzielacz
|
||||
dv = PF(PP, VVP, 0.01, 0.1) * dt;
|
||||
ValveRes->Flow(-dv);
|
||||
dV = PF(PP, VVP, 0.01, 0.1) * dt;
|
||||
ValveRes->Flow(-dV);
|
||||
|
||||
result = dv - dV1;
|
||||
result = dV - dV1;
|
||||
|
||||
// if Vel>55 then temp:=0.72 else
|
||||
// temp:=1;{R}
|
||||
@@ -1272,18 +1285,18 @@ double TLSt::GetPF( double const PP, double const dt, double const Vel )
|
||||
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.005*3*sizeBC)*dt
|
||||
dv = PFVd(BrakeCyl->P(), 0, 0.005 * 7 * SizeBC, temp) * dt;
|
||||
dV = PFVd(BrakeCyl->P(), 0, 0.005 * 7 * SizeBC, temp) * dt;
|
||||
else
|
||||
dv = 0;
|
||||
BrakeCyl->Flow(-dv);
|
||||
dV = 0;
|
||||
BrakeCyl->Flow(-dV);
|
||||
// przeplyw ZP <-> CH
|
||||
if ((BrakeCyl->P() < temp - 0.005) && (temp > 0.29))
|
||||
// dV:=PF(BVP,BrakeCyl->P(),0.002*3*sizeBC*2)*dt
|
||||
dv = -PFVa(BVP, BrakeCyl->P(), 0.002 * 7 * SizeBC * 2, temp) * dt;
|
||||
dV = -PFVa(BVP, BrakeCyl->P(), 0.002 * 7 * SizeBC * 2, temp) * dt;
|
||||
else
|
||||
dv = 0;
|
||||
BrakeRes->Flow(dv);
|
||||
BrakeCyl->Flow(-dv);
|
||||
dV = 0;
|
||||
BrakeRes->Flow(dV);
|
||||
BrakeCyl->Flow(-dV);
|
||||
|
||||
ImplsRes->Act();
|
||||
ValveRes->Act();
|
||||
@@ -2198,124 +2211,145 @@ double TFV4aM::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
||||
static int const LBDelay = 100;
|
||||
static double const xpM = 0.3; // mnoznik membrany komory pod
|
||||
|
||||
double LimPP;
|
||||
double dpPipe;
|
||||
double dpMainValve;
|
||||
double ActFlowSpeed;
|
||||
double DP;
|
||||
double pom;
|
||||
int i;
|
||||
ep = (PP / 2.0) * 1.5 + (ep / 2.0) * 0.5; // SPKS!!
|
||||
|
||||
ep = PP / 2 * 1.5 + ep / 2 * 0.5; // SPKS!!
|
||||
// ep:=pp;
|
||||
// ep:=cp/3+pp/3+ep/3;
|
||||
// ep:=cp;
|
||||
for( int idx = 0; idx < 5; ++idx ) {
|
||||
Sounds[ idx ] = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; ++i)
|
||||
Sounds[i] = 0;
|
||||
DP = 0;
|
||||
// na wszelki wypadek, zeby nie wyszlo poza zakres
|
||||
i_bcp = clamp( i_bcp, -1.999, 5.999 );
|
||||
|
||||
i_bcp = Max0R(Min0R(i_bcp, 5.999), -1.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
||||
|
||||
if ((TP > 0))
|
||||
{ // jesli czasowy jest niepusty
|
||||
// dp:=0.07; //od cisnienia 5 do 0 w 60 sekund ((5-0)*dt/75)
|
||||
double DP{ 0.0 };
|
||||
if( TP > 0.0 ) {
|
||||
// jesli czasowy jest niepusty
|
||||
DP = 0.045; // 2.5 w 55 sekund (5,35->5,15 w PG)
|
||||
TP = TP - DP * dt;
|
||||
TP -= DP * dt;
|
||||
Sounds[s_fv4a_t] = DP;
|
||||
}
|
||||
else //.08
|
||||
{
|
||||
TP = 0;
|
||||
else {
|
||||
//.08
|
||||
TP = 0.0;
|
||||
}
|
||||
|
||||
if ((XP > 0)) // jesli komora pod niepusta jest niepusty
|
||||
{
|
||||
if (XP > 0) {
|
||||
// jesli komora pod niepusta jest niepusty
|
||||
DP = 2.5;
|
||||
Sounds[s_fv4a_x] = DP * XP;
|
||||
XP = XP - dt * DP * 2; // od cisnienia 5 do 0 w 10 sekund ((5-0)*dt/10)
|
||||
XP -= dt * DP * 2.0; // od cisnienia 5 do 0 w 10 sekund ((5-0)*dt/10)
|
||||
}
|
||||
else {
|
||||
// jak pusty, to pusty
|
||||
XP = 0.0;
|
||||
}
|
||||
else //.75
|
||||
XP = 0; // jak pusty, to pusty
|
||||
|
||||
LimPP = Min0R(LPP_RP(i_bcp) + TP * 0.08 + RedAdj, HP); // pozycja + czasowy lub zasilanie
|
||||
ActFlowSpeed = BPT[lround(i_bcp) + 2][0];
|
||||
double pom;
|
||||
if( EQ( i_bcp, -1.0 ) ) {
|
||||
pom = std::min( HP, 5.4 + RedAdj );
|
||||
}
|
||||
else {
|
||||
pom = std::min( CP, HP );
|
||||
}
|
||||
|
||||
if ((EQ(i_bcp, -1)))
|
||||
pom = Min0R(HP, 5.4 + RedAdj);
|
||||
else
|
||||
pom = Min0R(CP, HP);
|
||||
|
||||
if ((pom > RP + 0.25))
|
||||
if( pom > RP + 0.25 ) {
|
||||
Fala = true;
|
||||
if ((Fala))
|
||||
if ((pom > RP + 0.3))
|
||||
// if(ep>rp+0.11)then
|
||||
XP = XP - 20 * PR(pom, XP) * dt;
|
||||
// else
|
||||
// xp:=xp-16*(ep-(ep+0.01))/(0.1)*PR(ep,xp)*dt;
|
||||
else
|
||||
}
|
||||
if( Fala ) {
|
||||
if( pom > RP + 0.3 ) {
|
||||
XP = XP - 20.0 * PR( pom, XP ) * dt;
|
||||
}
|
||||
else {
|
||||
Fala = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((LimPP > CP)) // podwyzszanie szybkie
|
||||
CP = CP + 5 * 60 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy;
|
||||
else
|
||||
CP = CP + 13 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy
|
||||
double LimPP = std::min(
|
||||
LPP_RP( i_bcp ) + TP * 0.08 + RedAdj,
|
||||
HP ); // pozycja + czasowy lub zasilanie
|
||||
|
||||
// zbiornik sterujacy
|
||||
if( LimPP > CP ) {
|
||||
// podwyzszanie szybkie
|
||||
CP +=
|
||||
5.0 * 60.0
|
||||
* std::min(
|
||||
std::abs( LimPP - CP ),
|
||||
0.05 )
|
||||
* PR( CP, LimPP )
|
||||
* dt;
|
||||
}
|
||||
else {
|
||||
CP +=
|
||||
13
|
||||
* std::min(
|
||||
std::abs( LimPP - CP ),
|
||||
0.05 )
|
||||
* PR( CP, LimPP )
|
||||
* dt;
|
||||
}
|
||||
|
||||
LimPP = pom; // cp
|
||||
dpPipe = Min0R(HP, LimPP + XP * xpM);
|
||||
double const dpPipe = std::min(HP, LimPP + XP * xpM);
|
||||
|
||||
if (dpPipe > PP)
|
||||
dpMainValve = -PFVa(HP, PP, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
||||
else
|
||||
dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
||||
double const ActFlowSpeed = BPT[ std::lround( i_bcp ) + 2 ][ 0 ];
|
||||
|
||||
if (EQ(i_bcp, -1))
|
||||
{
|
||||
if ((TP < 5))
|
||||
TP = TP + dt; // 5/10
|
||||
if ((TP < 1))
|
||||
TP = TP - 0.5 * dt; // 5/10
|
||||
// dpMainValve:=dpMainValve*2;
|
||||
//+1*PF(dpPipe,pp,ActFlowSpeed/LBDelay)//coby
|
||||
// nie przeszkadzal przy ladowaniu z zaworu obok
|
||||
double dpMainValve;
|
||||
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, 0))
|
||||
{
|
||||
if ((TP > 2))
|
||||
dpMainValve = dpMainValve * 1.5; //+0.5*PF(dpPipe,pp,ActFlowSpeed/LBDelay)//coby nie
|
||||
// przeszkadzal przy ladowaniu z zaworu obok
|
||||
if (EQ(i_bcp, -1)) {
|
||||
|
||||
if( TP < 5 ) { TP += dt; }
|
||||
if( TP < 1 ) { TP -= 0.5 * dt; }
|
||||
}
|
||||
|
||||
if (EQ(i_bcp, 0)) {
|
||||
|
||||
if( TP > 2 ) {
|
||||
dpMainValve *= 1.5;
|
||||
}
|
||||
}
|
||||
|
||||
ep = dpPipe;
|
||||
if ((EQ(i_bcp, 0) || (RP > ep)))
|
||||
RP = RP + PF(RP, ep, 0.0007) * dt; // powolne wzrastanie, ale szybsze na jezdzie;
|
||||
else
|
||||
RP = RP + PF(RP, ep, 0.000093 / 2 * 2) * dt; // powolne wzrastanie i to bardzo
|
||||
// jednak trzeba wydluzyc, bo
|
||||
// obecnie zle dziala
|
||||
if ((RP < ep) &&
|
||||
(RP <
|
||||
BPT[lround(i_bcpno) + 2][1])) // jesli jestesmy ponizej cisnienia w sterujacym (2.9 bar)
|
||||
RP = RP + PF(RP, CP, 0.005) * dt; // przypisz cisnienie w PG - wydluzanie napelniania o czas
|
||||
// potrzebny do napelnienia PG
|
||||
if( ( EQ( i_bcp, 0 )
|
||||
|| ( RP > ep ) ) ) {
|
||||
// powolne wzrastanie, ale szybsze na jezdzie;
|
||||
RP += PF( RP, ep, 0.0007 ) * dt;
|
||||
}
|
||||
else {
|
||||
// powolne wzrastanie i to bardzo
|
||||
RP += PF( RP, ep, 0.000093 / 2 * 2 ) * dt;
|
||||
}
|
||||
// jednak trzeba wydluzyc, bo obecnie zle dziala
|
||||
if( ( RP < ep )
|
||||
&& ( RP < BPT[ std::lround( i_bcpno ) + 2 ][ 1 ] ) ) {
|
||||
// jesli jestesmy ponizej cisnienia w sterujacym (2.9 bar)
|
||||
// przypisz cisnienie w PG - wydluzanie napelniania o czas potrzebny do napelnienia PG
|
||||
RP += PF( RP, CP, 0.005 ) * dt;
|
||||
}
|
||||
|
||||
if ((EQ(i_bcp, i_bcpno)) || (EQ(i_bcp, -2)))
|
||||
{
|
||||
DP = PF(0, PP, ActFlowSpeed / LBDelay);
|
||||
if( ( EQ( i_bcp, i_bcpno ) )
|
||||
|| ( EQ( i_bcp, -2 ) ) ) {
|
||||
|
||||
DP = PF( 0.0, PP, ActFlowSpeed / LBDelay );
|
||||
dpMainValve = DP;
|
||||
Sounds[s_fv4a_e] = DP;
|
||||
Sounds[s_fv4a_u] = 0;
|
||||
Sounds[s_fv4a_b] = 0;
|
||||
Sounds[s_fv4a_x] = 0;
|
||||
Sounds[s_fv4a_u] = 0.0;
|
||||
Sounds[s_fv4a_b] = 0.0;
|
||||
Sounds[s_fv4a_x] = 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dpMainValve > 0)
|
||||
Sounds[s_fv4a_b] = dpMainValve;
|
||||
else
|
||||
Sounds[s_fv4a_u] = -dpMainValve;
|
||||
else {
|
||||
|
||||
if( dpMainValve > 0.0 ) {
|
||||
Sounds[ s_fv4a_b ] = dpMainValve;
|
||||
}
|
||||
else {
|
||||
Sounds[ s_fv4a_u ] = -dpMainValve;
|
||||
}
|
||||
}
|
||||
|
||||
return dpMainValve * dt;
|
||||
@@ -2347,17 +2381,11 @@ double TFV4aM::GetPos(int i)
|
||||
|
||||
double TFV4aM::LPP_RP(double pos) // cisnienie z zaokraglonej pozycji;
|
||||
{
|
||||
int i_pos;
|
||||
int const i_pos = 2 + std::floor( pos ); // zaokraglone w dol
|
||||
|
||||
i_pos = lround(pos - 0.5) + 2; // zaokraglone w dol
|
||||
double i, j, k, l;
|
||||
i = BPT[i_pos][1];
|
||||
j = BPT[i_pos + 1][1];
|
||||
k = pos + 2 - i_pos;
|
||||
l = i + (j - i) * k;
|
||||
double r = BPT[i_pos][1] +
|
||||
(BPT[i_pos + 1][1] - BPT[i_pos][1]) * (pos + 2 - i_pos); // interpolacja liniowa
|
||||
return r;
|
||||
return
|
||||
BPT[i_pos][1]
|
||||
+ (BPT[i_pos + 1][1] - BPT[i_pos][1]) * ((pos + 2) - i_pos); // interpolacja liniowa
|
||||
}
|
||||
bool TFV4aM::EQ(double pos, double i_pos)
|
||||
{
|
||||
@@ -2366,8 +2394,7 @@ bool TFV4aM::EQ(double pos, double i_pos)
|
||||
|
||||
//---FV4a/M--- nowonapisany kran bez poprawki IC
|
||||
|
||||
double TMHZ_EN57::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
||||
{
|
||||
double TMHZ_EN57::GetPF( double i_bcp, double PP, double HP, double dt, double ep ) {
|
||||
static int const LBDelay = 100;
|
||||
|
||||
double LimPP;
|
||||
@@ -2376,13 +2403,11 @@ double TMHZ_EN57::GetPF(double i_bcp, double PP, double HP, double dt, double ep
|
||||
double ActFlowSpeed;
|
||||
double DP;
|
||||
double pom;
|
||||
int i;
|
||||
|
||||
{
|
||||
long i_end = 5;
|
||||
for (i = 0; i < i_end; ++i)
|
||||
Sounds[i] = 0;
|
||||
for( int idx = 0; idx < 5; ++idx ) {
|
||||
Sounds[ idx ] = 0;
|
||||
}
|
||||
|
||||
DP = 0;
|
||||
|
||||
i_bcp = Max0R(Min0R(i_bcp, 9.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
||||
|
||||
@@ -184,7 +184,7 @@ class TBrake {
|
||||
bool DCV = false; //podwojny zawor zwrotny
|
||||
double ASBP = 0.0; //cisnienie hamulca pp
|
||||
|
||||
int BrakeStatus = 0; //flaga stanu
|
||||
int BrakeStatus{ b_off }; //flaga stanu
|
||||
int SoundFlag = 0;
|
||||
|
||||
public:
|
||||
@@ -213,6 +213,8 @@ class TBrake {
|
||||
void SetASBP( double const Press ); //ustalenie cisnienia pp
|
||||
virtual void ForceEmptiness();
|
||||
int GetSoundFlag();
|
||||
int GetBrakeStatus() const { return BrakeStatus; }
|
||||
void SetBrakeStatus( int const Status ) { BrakeStatus = Status; }
|
||||
virtual void SetED( double const EDstate ) {}; //stan hamulca ED do luzowania
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user