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