@@ -56,6 +56,7 @@ public class AirSinglePipe : MSTSBrakeSystem
5656 protected float EmergAuxVolumeRatio = 1.4f ;
5757 protected bool RelayValveFitted = false ;
5858 public float RelayValveRatio { get ; protected set ; } = 1 ;
59+ protected float EngineRelayValveRatio = 0 ;
5960 protected float RelayValveApplicationRatePSIpS = 50 ;
6061 protected float RelayValveReleaseRatePSIpS = 50 ;
6162 protected string DebugType = string . Empty ;
@@ -129,6 +130,7 @@ public override void InitializeFromCopy(BrakeSystem copy)
129130 HoldingValve = thiscopy . HoldingValve ;
130131 RelayValveFitted = thiscopy . RelayValveFitted ;
131132 RelayValveRatio = thiscopy . RelayValveRatio ;
133+ EngineRelayValveRatio = thiscopy . EngineRelayValveRatio ;
132134 RelayValveApplicationRatePSIpS = thiscopy . RelayValveApplicationRatePSIpS ;
133135 RelayValveReleaseRatePSIpS = thiscopy . RelayValveReleaseRatePSIpS ;
134136 MaxTripleValveCylPressurePSI = thiscopy . MaxTripleValveCylPressurePSI ;
@@ -256,6 +258,7 @@ public override void Parse(string lowercasetoken, STFReader stf)
256258 RelayValveFitted = false ;
257259 }
258260 break ;
261+ case "wagon(ortsenginebrakerelayvalveratio" : EngineRelayValveRatio = stf . ReadFloatBlock ( STFReader . UNITS . None , null ) ; break ;
259262 case "wagon(ortsbrakerelayvalveapplicationrate" : RelayValveApplicationRatePSIpS = stf . ReadFloatBlock ( STFReader . UNITS . PressureRateDefaultPSIpS , null ) ; break ;
260263 case "wagon(ortsbrakerelayvalvereleaserate" : RelayValveReleaseRatePSIpS = stf . ReadFloatBlock ( STFReader . UNITS . PressureRateDefaultPSIpS , null ) ; break ;
261264 case "wagon(ortsmaxtriplevalvecylinderpressure" : MaxTripleValveCylPressurePSI = stf . ReadFloatBlock ( STFReader . UNITS . PressureDefaultPSI , null ) ; break ;
@@ -324,6 +327,7 @@ public override void Initialize(bool handbrakeOn, float maxPressurePSI, float fu
324327 EmergResVolumeM3 = 0.7f ;
325328
326329 if ( MaxTripleValveCylPressurePSI == 0 ) MaxTripleValveCylPressurePSI = MaxCylPressurePSI / RelayValveRatio ;
330+ if ( EngineRelayValveRatio == 0 ) EngineRelayValveRatio = RelayValveRatio ;
327331
328332 BrakeLine1PressurePSI = Car . Train . EqualReservoirPressurePSIorInHg ;
329333 BrakeLine2PressurePSI = Car . Train . BrakeLine2PressurePSI ;
@@ -593,7 +597,7 @@ public override void Update(float elapsedClockSeconds)
593597 }
594598 else
595599 {
596- demandedPressurePSI = Math . Max ( AutoCylPressurePSI , BrakeLine3PressurePSI ) ;
600+ demandedPressurePSI = AutoCylPressurePSI ;
597601 if ( loco != null && loco . EngineType != TrainCar . EngineTypes . Control ) // TODO - Control cars ned to be linked to power suppy requirements.
598602 {
599603 if ( loco . LocomotivePowerSupply . MainPowerSupplyOn )
@@ -630,22 +634,20 @@ public override void Update(float elapsedClockSeconds)
630634 demandedPressurePSI = CylPressurePSI ;
631635 }
632636 demandedPressurePSI /= RelayValveRatio ;
633- if ( demandedPressurePSI < BrakeLine3PressurePSI )
634- demandedPressurePSI = BrakeLine3PressurePSI ;
635637 }
636638 }
637639 else if ( loco . DynamicBrakeAutoBailOff )
638640 {
639641 if ( loco . DynamicBrakeForceCurves == null )
640642 {
641- demandedPressurePSI = BrakeLine3PressurePSI ;
643+ demandedPressurePSI = 0 ;
642644 }
643645 else
644646 {
645647 var dynforce = loco . DynamicBrakeForceCurves . Get ( 1.0f , loco . AbsSpeedMpS ) ;
646648 if ( ( loco . MaxDynamicBrakeForceN == 0 && dynforce > 0 ) || dynforce > loco . MaxDynamicBrakeForceN * 0.6 )
647649 {
648- demandedPressurePSI = BrakeLine3PressurePSI ;
650+ demandedPressurePSI = 0 ;
649651 }
650652 }
651653 }
@@ -655,7 +657,7 @@ public override void Update(float elapsedClockSeconds)
655657 }
656658 if ( RelayValveFitted )
657659 {
658- demandedPressurePSI *= RelayValveRatio ;
660+ demandedPressurePSI = Math . Max ( RelayValveRatio * demandedPressurePSI , EngineRelayValveRatio * BrakeLine3PressurePSI ) ;
659661 if ( demandedPressurePSI > CylPressurePSI )
660662 {
661663 float dp = elapsedClockSeconds * RelayValveApplicationRatePSIpS ;
@@ -688,7 +690,7 @@ public override void Update(float elapsedClockSeconds)
688690 }
689691 else
690692 {
691- CylPressurePSI = demandedPressurePSI ;
693+ CylPressurePSI = Math . Max ( demandedPressurePSI , BrakeLine3PressurePSI ) ;
692694 }
693695
694696 // During braking wheelslide control is effected throughout the train by additional equipment on each vehicle. In the piping to each pair of brake cylinders are fitted electrically operated
0 commit comments