@@ -52,6 +52,8 @@ public class AirSinglePipe : MSTSBrakeSystem
52
52
protected float BrakeInsensitivityPSIpS = 0 ;
53
53
protected float EmergencyValveActuationRatePSIpS = 0 ;
54
54
protected float EmergencyDumpValveRatePSIpS = 0 ;
55
+ protected float EmergencyDumpValveTimerS = 120 ;
56
+ protected float ? EmergencyDumpStartTime ;
55
57
protected float EmergResChargingRatePSIpS = 1.684f ;
56
58
protected float EmergAuxVolumeRatio = 1.4f ;
57
59
protected string DebugType = string . Empty ;
@@ -118,6 +120,7 @@ public override void InitializeFromCopy(BrakeSystem copy)
118
120
BrakeInsensitivityPSIpS = thiscopy . BrakeInsensitivityPSIpS ;
119
121
EmergencyValveActuationRatePSIpS = thiscopy . EmergencyValveActuationRatePSIpS ;
120
122
EmergencyDumpValveRatePSIpS = thiscopy . EmergencyDumpValveRatePSIpS ;
123
+ EmergencyDumpValveTimerS = thiscopy . EmergencyDumpValveTimerS ;
121
124
EmergResChargingRatePSIpS = thiscopy . EmergResChargingRatePSIpS ;
122
125
EmergAuxVolumeRatio = thiscopy . EmergAuxVolumeRatio ;
123
126
TwoPipes = thiscopy . TwoPipes ;
@@ -235,6 +238,7 @@ public override void Parse(string lowercasetoken, STFReader stf)
235
238
case "wagon(ortsbrakeinsensitivity" : BrakeInsensitivityPSIpS = stf . ReadFloatBlock ( STFReader . UNITS . PressureRateDefaultPSIpS , null ) ; break ;
236
239
case "wagon(ortsemergencyvalveactuationrate" : EmergencyValveActuationRatePSIpS = stf . ReadFloatBlock ( STFReader . UNITS . PressureRateDefaultPSIpS , 15f ) ; break ;
237
240
case "wagon(ortsemergencydumpvalverate" : EmergencyDumpValveRatePSIpS = stf . ReadFloatBlock ( STFReader . UNITS . PressureRateDefaultPSIpS , 15f ) ; break ;
241
+ case "wagon(ortsemergencydumpvalvetimer" : EmergencyDumpValveTimerS = stf . ReadFloatBlock ( STFReader . UNITS . Time , 120.0f ) ; break ;
238
242
case "wagon(ortsmainrespipeauxrescharging" : MRPAuxResCharging = this is AirTwinPipe && stf . ReadBoolBlock ( true ) ; break ;
239
243
}
240
244
}
@@ -346,6 +350,7 @@ public override void LocoInitializeMoving() // starting conditions when starting
346
350
347
351
public void UpdateTripleValveState ( float elapsedClockSeconds )
348
352
{
353
+ var prevState = TripleValveState ;
349
354
var valveType = ( Car as MSTSWagon ) . BrakeValve ;
350
355
if ( valveType == MSTSWagon . BrakeValveType . Distributor )
351
356
{
@@ -377,6 +382,15 @@ public void UpdateTripleValveState(float elapsedClockSeconds)
377
382
{
378
383
TripleValveState = ValveState . Release ;
379
384
}
385
+ if ( TripleValveState == ValveState . Emergency )
386
+ {
387
+ if ( prevState != ValveState . Emergency )
388
+ {
389
+ EmergencyDumpStartTime = ( float ) Car . Simulator . GameTime ;
390
+ Car . SignalEvent ( Event . EmergencyVentValveOn ) ;
391
+ }
392
+ }
393
+ else EmergencyDumpStartTime = null ;
380
394
prevBrakePipePressurePSI = BrakeLine1PressurePSI ;
381
395
}
382
396
@@ -446,7 +460,15 @@ public override void Update(float elapsedClockSeconds)
446
460
EmergResPressurePSI -= dp ;
447
461
AuxResPressurePSI += dp * EmergAuxVolumeRatio ;
448
462
}
449
- if ( EmergencyDumpValveRatePSIpS > 0 )
463
+ if ( EmergencyDumpValveTimerS == 0 )
464
+ {
465
+ if ( BrakeLine1PressurePSI < 1 ) EmergencyDumpStartTime = null ;
466
+ }
467
+ else if ( Car . Simulator . GameTime - EmergencyDumpStartTime > EmergencyDumpValveTimerS )
468
+ {
469
+ EmergencyDumpStartTime = null ;
470
+ }
471
+ if ( EmergencyDumpValveRatePSIpS > 0 && EmergencyDumpStartTime != null )
450
472
{
451
473
BrakeLine1PressurePSI -= elapsedClockSeconds * EmergencyDumpValveRatePSIpS ;
452
474
if ( BrakeLine1PressurePSI < 0 )
0 commit comments