mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 17:29:18 +02:00
build 170520. compressor activation for multi-unit engines, gamepad support toggle, local brake logic fix for multi-unit engines
This commit is contained in:
@@ -3063,56 +3063,104 @@ void TMoverParameters::CompressorCheck(double dt)
|
||||
CompressorFlag = false; // bez tamtego członu nie zadziała
|
||||
}
|
||||
else
|
||||
CompressorFlag = (CompressorAllow) &&
|
||||
((ConverterFlag) || (CompressorPower == 0)) && (Mains);
|
||||
CompressorFlag =
|
||||
( ( CompressorAllow )
|
||||
&& ( Mains )
|
||||
&& ( ( ConverterFlag )
|
||||
|| ( CompressorPower == 0 ) ) );
|
||||
|
||||
if( Compressor > MaxCompressor ) {
|
||||
// wyłącznik ciśnieniowy jest niezależny od sposobu zasilania
|
||||
CompressorFlag = false;
|
||||
CompressorGovernorLock = true; // prevent manual activation until the pressure goes below cut-in level
|
||||
}
|
||||
}
|
||||
else // jeśli nie załączona
|
||||
if( ( ( Compressor < MinCompressor )
|
||||
|| ( ( Compressor < MaxCompressor )
|
||||
&& ( false == CompressorGovernorLock ) ) )
|
||||
&& (LastSwitchingTime > CtrlDelay) ) {
|
||||
// załączenie przy małym ciśnieniu
|
||||
// jeśli nie załączona, a ciśnienie za małe
|
||||
// or if the switch is on and the pressure isn't maxed
|
||||
if( CompressorPower == 5 ) // jeśli zasilanie z następnego członu
|
||||
{ // zasilanie sprężarki w członie ra z członu silnikowego (sprzęg 1)
|
||||
if (Couplers[1].Connected != NULL)
|
||||
CompressorFlag =
|
||||
(Couplers[1].Connected->CompressorAllow &&
|
||||
Couplers[1].Connected->ConverterFlag && Couplers[1].Connected->Mains);
|
||||
else
|
||||
CompressorFlag = false; // bez tamtego członu nie zadziała
|
||||
}
|
||||
else if (CompressorPower == 4) // jeśli zasilanie z poprzedniego członu
|
||||
{ // zasilanie sprężarki w członie ra z członu silnikowego (sprzęg 1)
|
||||
if (Couplers[0].Connected != NULL)
|
||||
CompressorFlag =
|
||||
(Couplers[0].Connected->CompressorAllow &&
|
||||
Couplers[0].Connected->ConverterFlag && Couplers[0].Connected->Mains);
|
||||
else
|
||||
CompressorFlag = false; // bez tamtego członu nie zadziała
|
||||
}
|
||||
else
|
||||
CompressorFlag = (CompressorAllow) &&
|
||||
((ConverterFlag) || (CompressorPower == 0)) && (Mains);
|
||||
if( CompressorFlag ) {
|
||||
// jeśli została załączona
|
||||
LastSwitchingTime = 0; // to trzeba ograniczyć ponowne włączenie
|
||||
if( Compressor < MinCompressor ) {
|
||||
// if the activation took place at pressure below the cut-in level, we can reset compressor governor
|
||||
CompressorGovernorLock = false;
|
||||
|
||||
if( ( TrainType == dt_ET41 )
|
||||
|| ( TrainType == dt_ET42 ) ) {
|
||||
// for these multi-unit engines compressors turn off whenever any of them was affected by the governor
|
||||
// NOTE: this is crude implementation, TODO: re-implement when a more elegant/flexible system is in place
|
||||
if( ( Couplers[ 1 ].Connected != nullptr )
|
||||
&& ( true == TestFlag( Couplers[ 1 ].CouplingFlag, coupling::permanent ) ) ) {
|
||||
// the first unit isn't allowed to start its compressor until second unit can start its own as well
|
||||
CompressorFlag &= ( Couplers[ 1 ].Connected->CompressorGovernorLock == false );
|
||||
}
|
||||
if( ( Couplers[ 0 ].Connected != nullptr )
|
||||
&& ( true == TestFlag( Couplers[ 0 ].CouplingFlag, coupling::permanent ) ) ) {
|
||||
// the second unit isn't allowed to start its compressor until first unit can start its own as well
|
||||
CompressorFlag &= ( Couplers[ 0 ].Connected->CompressorGovernorLock == false );
|
||||
}
|
||||
}
|
||||
}
|
||||
// for b:=0 to 1 do //z Megapacka
|
||||
// with Couplers[b] do
|
||||
// if TestFlag(CouplingFlag,ctrain_scndpneumatic) then
|
||||
// Connected.CompressorFlag:=CompressorFlag;
|
||||
else {
|
||||
// jeśli nie załączona
|
||||
if( Compressor < MinCompressor ) {
|
||||
// if the pressure drops below the cut-in level, we can reset compressor governor
|
||||
CompressorGovernorLock = false;
|
||||
}
|
||||
|
||||
if( ( ( Compressor < MinCompressor )
|
||||
|| ( ( Compressor < MaxCompressor )
|
||||
&& ( false == CompressorGovernorLock ) ) )
|
||||
&& ( LastSwitchingTime > CtrlDelay ) ) {
|
||||
// załączenie przy małym ciśnieniu
|
||||
// jeśli nie załączona, a ciśnienie za małe
|
||||
// or if the switch is on and the pressure isn't maxed
|
||||
if( CompressorPower == 5 ) // jeśli zasilanie z następnego członu
|
||||
{ // zasilanie sprężarki w członie ra z członu silnikowego (sprzęg 1)
|
||||
if( Couplers[ 1 ].Connected != nullptr ) {
|
||||
CompressorFlag =
|
||||
( Couplers[ 1 ].Connected->CompressorAllow
|
||||
&& Couplers[ 1 ].Connected->ConverterFlag
|
||||
&& Couplers[ 1 ].Connected->Mains );
|
||||
}
|
||||
else {
|
||||
CompressorFlag = false; // bez tamtego członu nie zadziała
|
||||
}
|
||||
}
|
||||
else if( CompressorPower == 4 ) // jeśli zasilanie z poprzedniego członu
|
||||
{ // zasilanie sprężarki w członie ra z członu silnikowego (sprzęg 1)
|
||||
if( Couplers[ 0 ].Connected != nullptr ) {
|
||||
CompressorFlag =
|
||||
( Couplers[ 0 ].Connected->CompressorAllow
|
||||
&& Couplers[ 0 ].Connected->ConverterFlag
|
||||
&& Couplers[ 0 ].Connected->Mains );
|
||||
}
|
||||
else {
|
||||
CompressorFlag = false; // bez tamtego członu nie zadziała
|
||||
}
|
||||
}
|
||||
else {
|
||||
CompressorFlag =
|
||||
( ( CompressorAllow )
|
||||
&& ( Mains )
|
||||
&& ( ( ConverterFlag )
|
||||
|| ( CompressorPower == 0 ) ) );
|
||||
}
|
||||
|
||||
// NOTE: crude way to enforce simultaneous activation of compressors in multi-unit setups
|
||||
// TODO: replace this with a more universal activation system down the road
|
||||
if( ( TrainType == dt_ET41 )
|
||||
|| ( TrainType == dt_ET42 ) ) {
|
||||
|
||||
if( ( Couplers[1].Connected != nullptr )
|
||||
&& ( true == TestFlag( Couplers[ 1 ].CouplingFlag, coupling::permanent ) ) ) {
|
||||
// the first unit isn't allowed to start its compressor until second unit can start its own as well
|
||||
CompressorFlag &= ( Couplers[ 1 ].Connected->CompressorGovernorLock == false );
|
||||
}
|
||||
if( ( Couplers[ 0 ].Connected != nullptr )
|
||||
&& ( true == TestFlag( Couplers[ 0 ].CouplingFlag, coupling::permanent ) ) ) {
|
||||
// the second unit isn't allowed to start its compressor until first unit can start its own as well
|
||||
CompressorFlag &= ( Couplers[ 0 ].Connected->CompressorGovernorLock == false );
|
||||
}
|
||||
}
|
||||
|
||||
if( CompressorFlag ) {
|
||||
// jeśli została załączona
|
||||
LastSwitchingTime = 0; // to trzeba ograniczyć ponowne włączenie
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (CompressorFlag)
|
||||
if ((EngineType == DieselElectric) && (CompressorPower > 0))
|
||||
CompressedVolume += dt * CompressorSpeed * (2.0 * MaxCompressor - Compressor) /
|
||||
|
||||
Reference in New Issue
Block a user