@@ -132,6 +132,7 @@ public enum SoundState
132
132
public float UnloadingSpeedMpS ;
133
133
public float MainResPressurePSI = 130 ;
134
134
public bool CompressorIsOn ;
135
+ public bool CompressorIsMechanical = false ;
135
136
public float AverageForceN ;
136
137
public float PowerOnDelayS ;
137
138
public bool CabLightOn ;
@@ -837,6 +838,12 @@ public override void Parse(string lowercasetoken, STFReader stf)
837
838
case "engine(airbrakesmainmaxairpressure" : MainResPressurePSI = MaxMainResPressurePSI = stf . ReadFloatBlock ( STFReader . UNITS . PressureDefaultPSI , null ) ; break ;
838
839
case "engine(airbrakescompressorrestartpressure" : CompressorRestartPressurePSI = stf . ReadFloatBlock ( STFReader . UNITS . PressureDefaultPSI , null ) ; break ;
839
840
case "engine(airbrakesaircompressorpowerrating" : CompressorChargingRateM3pS = Me3 . FromFt3 ( stf . ReadFloatBlock ( STFReader . UNITS . VolumeDefaultFT3 , null ) ) ; break ;
841
+ case "engine(airbrakesiscompressorelectricormechanical" : var compressorMechanical = stf . ReadIntBlock ( null ) ;
842
+ if ( compressorMechanical == 1 )
843
+ {
844
+ CompressorIsMechanical = true ;
845
+ }
846
+ break ;
840
847
case "engine(trainpipeleakrate" : TrainBrakePipeLeakPSIorInHgpS = stf . ReadFloatBlock ( STFReader . UNITS . PressureRateDefaultPSIpS , null ) ; break ;
841
848
case "engine(vacuumbrakesvacuumpumpresistance" : VacuumPumpResistanceN = stf . ReadFloatBlock ( STFReader . UNITS . Force , null ) ; break ;
842
849
@@ -1016,6 +1023,7 @@ public override void Copy(MSTSWagon copy)
1016
1023
1017
1024
WheelslipCausesThrottleDown = locoCopy . WheelslipCausesThrottleDown ;
1018
1025
1026
+ CompressorIsMechanical = locoCopy . CompressorIsMechanical ;
1019
1027
CompressorRestartPressurePSI = locoCopy . CompressorRestartPressurePSI ;
1020
1028
TrainBrakePipeLeakPSIorInHgpS = locoCopy . TrainBrakePipeLeakPSIorInHgpS ;
1021
1029
MaxMainResPressurePSI = locoCopy . MaxMainResPressurePSI ;
@@ -2286,8 +2294,32 @@ protected virtual void UpdateCompressor(float elapsedClockSeconds)
2286
2294
else if ( ( MainResPressurePSI > MaxMainResPressurePSI || LocomotivePowerSupply . AuxiliaryPowerSupplyState != PowerSupplyState . PowerOn ) && CompressorIsOn )
2287
2295
SignalEvent ( Event . CompressorOff ) ;
2288
2296
2297
+ // For a mechanical compressor (typically fitted to a diesel locomotive) the charging rate will be related to the RpM of the diesel engine, and therefore
2298
+ // derated by an amount equivalent to the diesel RpM.
2299
+ // All other locomotive types it will be the full charging rate for the reservoir
2300
+ var reservoirChargingRate = MainResChargingRatePSIpS ;
2301
+
2302
+ if ( CompressorIsMechanical && ( EngineType == EngineTypes . Control || EngineType == EngineTypes . Diesel ) )
2303
+ {
2304
+ if ( EngineType == EngineTypes . Control )
2305
+ {
2306
+ FindControlActiveLocomotive ( ) ;
2307
+
2308
+ if ( ControlActiveLocomotive != null )
2309
+ {
2310
+ var activeloco = ControlActiveLocomotive as MSTSDieselLocomotive ;
2311
+ reservoirChargingRate = ( activeloco . DieselEngines [ 0 ] . RealRPM / activeloco . DieselEngines [ 0 ] . MaxRPM ) * MainResChargingRatePSIpS ;
2312
+ }
2313
+ }
2314
+ else
2315
+ {
2316
+ var mstsDieselLocomotive = this as MSTSDieselLocomotive ;
2317
+ reservoirChargingRate = ( mstsDieselLocomotive . DieselEngines [ 0 ] . RealRPM / mstsDieselLocomotive . DieselEngines [ 0 ] . MaxRPM ) * MainResChargingRatePSIpS ;
2318
+ }
2319
+ }
2320
+
2289
2321
if ( CompressorIsOn )
2290
- MainResPressurePSI += elapsedClockSeconds * MainResChargingRatePSIpS ;
2322
+ MainResPressurePSI += elapsedClockSeconds * reservoirChargingRate ;
2291
2323
}
2292
2324
2293
2325
/// <summary>
0 commit comments