@@ -91,7 +91,7 @@ public AirSinglePipe(TrainCar car)
9191 DebugType = "1P" ;
9292
9393 // Force graduated releasable brakes. Workaround for MSTS with bugs preventing to set eng/wag files correctly for this.
94- ( Car as MSTSWagon ) . DistributorPresent |= Car . Simulator . Settings . GraduatedRelease ;
94+ if ( Car . Simulator . Settings . GraduatedRelease ) ( Car as MSTSWagon ) . BrakeValve = MSTSWagon . BrakeValveType . Distributor ;
9595
9696 if ( Car . Simulator . Settings . RetainersOnAllCars && ! ( Car is MSTSLocomotive ) )
9797 ( Car as MSTSWagon ) . RetainerPositions = 4 ;
@@ -312,6 +312,12 @@ public override void Initialize(bool handbrakeOn, float maxPressurePSI, float fu
312312 if ( Car . Simulator . Settings . CorrectQuestionableBrakingParams && Car . CarLengthM <= 1 )
313313 EmergResVolumeM3 = Math . Min ( 0.02f , EmergResVolumeM3 ) ;
314314
315+ if ( Car . Simulator . Settings . CorrectQuestionableBrakingParams && ( Car as MSTSWagon ) . BrakeValve == MSTSWagon . BrakeValveType . None )
316+ {
317+ ( Car as MSTSWagon ) . BrakeValve = MSTSWagon . BrakeValveType . TripleValve ;
318+ Trace . TraceWarning ( "{0} does not define a brake valve, defaulting to a plain triple valve" , ( Car as MSTSWagon ) . WagFilePath ) ;
319+ }
320+
315321 // In simple brake mode set emergency reservoir volume, override high volume values to allow faster brake release.
316322 if ( Car . Simulator . Settings . SimpleControlPhysics && EmergResVolumeM3 > 2.0 )
317323 EmergResVolumeM3 = 0.7f ;
@@ -358,7 +364,7 @@ public override void LocoInitializeMoving() // starting conditions when starting
358364
359365 public void UpdateTripleValveState ( float elapsedClockSeconds )
360366 {
361- if ( ( Car as MSTSWagon ) . DistributorPresent )
367+ if ( ( Car as MSTSWagon ) . BrakeValve == MSTSWagon . BrakeValveType . Distributor )
362368 {
363369 float targetPressurePSI = ( ControlResPressurePSI - BrakeLine1PressurePSI ) * AuxCylVolumeRatio ;
364370 if ( targetPressurePSI > AutoCylPressurePSI && EmergencyValveActuationRatePSIpS > 0 && ( prevBrakePipePressurePSI - BrakeLine1PressurePSI ) > Math . Max ( elapsedClockSeconds , 0.0001f ) * EmergencyValveActuationRatePSIpS )
@@ -391,7 +397,7 @@ public void UpdateTripleValveState(float elapsedClockSeconds)
391397
392398 public override void Update ( float elapsedClockSeconds )
393399 {
394- float threshold = ( Car as MSTSWagon ) . DistributorPresent ? ( ControlResPressurePSI - BrakeLine1PressurePSI ) * AuxCylVolumeRatio : 0 ;
400+ float threshold = ( ( Car as MSTSWagon ) . BrakeValve == MSTSWagon . BrakeValveType . Distributor ) ? ( ControlResPressurePSI - BrakeLine1PressurePSI ) * AuxCylVolumeRatio : 0 ;
395401
396402 if ( BleedOffValveOpen )
397403 {
@@ -425,7 +431,7 @@ public override void Update(float elapsedClockSeconds)
425431 float dp = elapsedClockSeconds * MaxApplicationRatePSIpS ;
426432 if ( AuxResPressurePSI - dp / AuxCylVolumeRatio < AutoCylPressurePSI + dp )
427433 dp = ( AuxResPressurePSI - AutoCylPressurePSI ) * AuxCylVolumeRatio / ( 1 + AuxCylVolumeRatio ) ;
428- if ( ( Car as MSTSWagon ) . DistributorPresent && TripleValveState != ValveState . Emergency && dp > threshold - AutoCylPressurePSI )
434+ if ( ( ( Car as MSTSWagon ) . BrakeValve == MSTSWagon . BrakeValveType . Distributor ) && TripleValveState != ValveState . Emergency && dp > threshold - AutoCylPressurePSI )
429435 dp = threshold - AutoCylPressurePSI ;
430436 if ( AutoCylPressurePSI + dp > MaxCylPressurePSI )
431437 dp = MaxCylPressurePSI - AutoCylPressurePSI ;
@@ -471,7 +477,7 @@ public override void Update(float elapsedClockSeconds)
471477 AuxResPressurePSI -= dp * EmergAuxVolumeRatio ;
472478 }
473479 }
474- if ( AuxResPressurePSI < BrakeLine1PressurePSI && ( ! TwoPipes || ! MRPAuxResCharging || ! ( Car as MSTSWagon ) . DistributorPresent || BrakeLine2PressurePSI < BrakeLine1PressurePSI ) && ! BleedOffValveOpen )
480+ if ( AuxResPressurePSI < BrakeLine1PressurePSI && ( ! TwoPipes || ! MRPAuxResCharging || ( ( Car as MSTSWagon ) . BrakeValve != MSTSWagon . BrakeValveType . Distributor ) || BrakeLine2PressurePSI < BrakeLine1PressurePSI ) && ! BleedOffValveOpen )
475481 {
476482 float dp = elapsedClockSeconds * MaxAuxilaryChargingRatePSIpS ; // Change in pressure for train brake pipe.
477483 if ( AuxResPressurePSI + dp > BrakeLine1PressurePSI - dp * AuxBrakeLineVolumeRatio )
@@ -504,7 +510,7 @@ public override void Update(float elapsedClockSeconds)
504510 // Charge Auxiliary reservoir for MRP
505511 if ( TwoPipes
506512 && MRPAuxResCharging
507- && ( Car as MSTSWagon ) . DistributorPresent
513+ && ( ( Car as MSTSWagon ) . BrakeValve == MSTSWagon . BrakeValveType . Distributor )
508514 && AuxResPressurePSI < BrakeLine2PressurePSI
509515 && AuxResPressurePSI < ControlResPressurePSI
510516 && ( BrakeLine2PressurePSI > BrakeLine1PressurePSI || TripleValveState != ValveState . Release ) && ! BleedOffValveOpen )
0 commit comments