@@ -53,6 +53,7 @@ public class AirSinglePipe : MSTSBrakeSystem
53
53
protected float MaxAuxilaryChargingRatePSIpS = 1.684f ;
54
54
protected float BrakeInsensitivityPSIpS = 0.07f ;
55
55
protected float EmergencyValveActuationRatePSIpS = 0 ;
56
+ protected bool LegacyEmergencyValve = false ;
56
57
protected float EmergencyDumpValveRatePSIpS = 0 ;
57
58
protected float EmergencyDumpValveTimerS = 120 ;
58
59
protected float ? EmergencyDumpStartTime ;
@@ -173,6 +174,7 @@ public override void InitializeFromCopy(BrakeSystem copy)
173
174
TripleValveSensitivityPSI = thiscopy . TripleValveSensitivityPSI ;
174
175
BrakeCylinderSpringPressurePSI = thiscopy . BrakeCylinderSpringPressurePSI ;
175
176
ServiceMaxCylPressurePSI = thiscopy . ServiceMaxCylPressurePSI ;
177
+ LegacyEmergencyValve = thiscopy . LegacyEmergencyValve ;
176
178
}
177
179
178
180
// Get the brake BC & BP for EOT conditions
@@ -341,6 +343,7 @@ public override void Save(BinaryWriter outf)
341
343
outf . Write ( ( int ) HoldingValve ) ;
342
344
outf . Write ( UniformChargingActive ) ;
343
345
outf . Write ( QuickServiceActive ) ;
346
+ outf . Write ( LegacyEmergencyValve ) ;
344
347
}
345
348
346
349
public override void Restore ( BinaryReader inf )
@@ -366,6 +369,7 @@ public override void Restore(BinaryReader inf)
366
369
HoldingValve = ( ValveState ) inf . ReadInt32 ( ) ;
367
370
UniformChargingActive = inf . ReadBoolean ( ) ;
368
371
QuickServiceActive = inf . ReadBoolean ( ) ;
372
+ LegacyEmergencyValve = inf . ReadBoolean ( ) ;
369
373
}
370
374
371
375
public override void Initialize ( bool handbrakeOn , float maxPressurePSI , float fullServPressurePSI , bool immediateRelease )
@@ -422,7 +426,10 @@ public override void Initialize()
422
426
if ( EngineRelayValveRatio == 0 ) EngineRelayValveRatio = RelayValveRatio ;
423
427
424
428
if ( ( Car as MSTSWagon ) . EmergencyReservoirPresent && EmergencyValveActuationRatePSIpS == 0 )
429
+ {
425
430
EmergencyValveActuationRatePSIpS = 15 ;
431
+ LegacyEmergencyValve = true ;
432
+ }
426
433
427
434
if ( InitialApplicationThresholdPSI == 0 )
428
435
{
@@ -473,8 +480,8 @@ public void UpdateTripleValveState(float elapsedClockSeconds)
473
480
var prevState = TripleValveState ;
474
481
var valveType = ( Car as MSTSWagon ) . BrakeValve ;
475
482
bool disableGradient = ! ( Car . Train . LeadLocomotive is MSTSLocomotive ) && Car . Train . TrainType != Orts . Simulation . Physics . Train . TRAINTYPE . STATIC ;
476
- // Small workaround to allow trains to more reliably go into emergency after uncoupling
477
- bool emergencyTripped = ( Car . Train . TrainType == Orts . Simulation . Physics . Train . TRAINTYPE . STATIC ) ?
483
+ // Legacy cars and static cars use a simpler check for emergency applications to ensure emergency applications occur despite simplified physics
484
+ bool emergencyTripped = ( Car . Train . TrainType == Orts . Simulation . Physics . Train . TRAINTYPE . STATIC || LegacyEmergencyValve ) ?
478
485
BrakeLine1PressurePSI <= 0.75f * EmergResPressurePSI * AuxCylVolumeRatio / ( AuxCylVolumeRatio + 1 ) : Math . Max ( - SmoothedBrakePipeChangePSIpS . SmoothedValue , 0 ) > EmergencyValveActuationRatePSIpS ;
479
486
480
487
if ( valveType == MSTSWagon . BrakeValveType . Distributor )
0 commit comments