File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed
Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -1376,20 +1376,13 @@ public void Update(float elapsedClockSeconds)
13761376
13771377 if ( DieselPowerTab != null )
13781378 {
1379- CurrentDieselOutputPowerW = ( DieselPowerTab [ RawRpM ] * ( 1 - Locomotive . PowerReduction ) <= MaximumDieselPowerW * ( 1 - Locomotive . PowerReduction ) ? DieselPowerTab [ RawRpM ] * ( 1 - Locomotive . PowerReduction ) : MaximumDieselPowerW * ( 1 - Locomotive . PowerReduction ) ) ;
1379+ CurrentDieselOutputPowerW = Math . Min ( DieselPowerTab [ RawRpM ] , MaximumDieselPowerW ) * ( 1 - Locomotive . PowerReduction ) ;
13801380 }
13811381 else
13821382 {
13831383 CurrentDieselOutputPowerW = ( RawRpM - IdleRPM ) / ( MaxRPM - IdleRPM ) * MaximumDieselPowerW * ( 1 - Locomotive . PowerReduction ) ;
13841384 }
13851385
1386- if ( Locomotive . DieselEngines . NumOfActiveEngines > 0 )
1387- {
1388-
1389- CurrentDieselOutputPowerW -= Locomotive . DieselPowerSupply . ElectricTrainSupplyPowerW / Locomotive . DieselEngines . NumOfActiveEngines ;
1390- CurrentDieselOutputPowerW = CurrentDieselOutputPowerW < 0f ? 0f : CurrentDieselOutputPowerW ;
1391- }
1392-
13931386 CurrentDieselOutputPowerW = MathHelper . Clamp ( CurrentDieselOutputPowerW , 0.0f , CurrentDieselOutputPowerW ) ; // prevent power going -ve
13941387
13951388 // For geared locomotives the engine RpM can be higher then the throttle demanded rpm, and this gives an inflated value of power
Original file line number Diff line number Diff line change 1818using Orts . Common ;
1919using Orts . Parsers . Msts ;
2020using ORTS . Scripting . Api ;
21+ using System ;
2122using System . IO ;
2223
2324namespace Orts . Simulation . RollingStocks . SubSystems . PowerSupplies
@@ -258,6 +259,8 @@ public override void Update(float elapsedClockSeconds)
258259 DieselEngineMinRpm = 0 ;
259260 }
260261
262+ AvailableTractionPowerW = Math . Max ( DieselEngineOutputPowerW - ElectricTrainSupplyPowerW , 0 ) ;
263+
261264 UpdateSounds ( ) ;
262265 }
263266
You can’t perform that action at this time.
0 commit comments