Skip to content

Commit 3362c71

Browse files
committed
Duplex steam engines - Booster Engine addition
1 parent 89833d4 commit 3362c71

File tree

7 files changed

+1898
-768
lines changed

7 files changed

+1898
-768
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSControlTrailerCar.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public override string GetStatus()
225225
/// <summary>
226226
/// This function updates periodically the locomotive's motive force.
227227
/// </summary>
228-
protected override void UpdateTractiveForce(float elapsedClockSeconds, float t, float AbsSpeedMpS, float AbsWheelSpeedMpS)
228+
protected override void UpdateTractiveForce(float elapsedClockSeconds, float t, float AbsSpeedMpS, float AbsWheelSpeedMpS, int numberofengine)
229229
{
230230
}
231231

Source/Orts.Simulation/Simulation/RollingStocks/MSTSDieselLocomotive.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ protected override void UpdateControllers(float elapsedClockSeconds)
624624
/// <summary>
625625
/// This function updates periodically the locomotive's motive force.
626626
/// </summary>
627-
protected override void UpdateTractiveForce(float elapsedClockSeconds, float t, float AbsSpeedMpS, float AbsWheelSpeedMpS)
627+
protected override void UpdateTractiveForce(float elapsedClockSeconds, float t, float AbsSpeedMpS, float AbsWheelSpeedMpS, int numberofengine)
628628
{
629629
// This section calculates the motive force of the locomotive as follows:
630630
// Basic configuration (no TF table) - uses P = F /speed relationship - requires power and force parameters to be set in the ENG file.
@@ -760,7 +760,7 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
760760
DieselEngines.HandleEvent(PowerSupplyEvent.StopEngine);
761761
}
762762

763-
ApplyDirectionToTractiveForce();
763+
ApplyDirectionToTractiveForce(ref TractiveForceN);
764764

765765
// Calculate the total tractive force for the locomotive - ie Traction + Dynamic Braking force.
766766
// Note typically only one of the above will only ever be non-zero at the one time.

Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,9 +2008,12 @@ public override void Update(float elapsedClockSeconds)
20082008

20092009
// Cruise Control
20102010
CruiseControl?.Update(elapsedClockSeconds);
2011-
2012-
// TODO this is a wild simplification for electric and diesel electric
2013-
UpdateTractiveForce(elapsedClockSeconds, ThrottlePercent / 100f, AbsSpeedMpS, AbsWheelSpeedMpS);
2011+
2012+
if (EngineType == EngineTypes.Diesel || EngineType == EngineTypes.Electric)
2013+
{
2014+
// TODO this is a wild simplification for electric and diesel electric
2015+
UpdateTractiveForce(elapsedClockSeconds, ThrottlePercent / 100f, AbsSpeedMpS, AbsWheelSpeedMpS, 0);
2016+
}
20142017

20152018
foreach (MultiPositionController mpc in MultiPositionControllers)
20162019
{
@@ -2372,7 +2375,7 @@ protected virtual void UpdateControllers(float elapsedClockSeconds)
23722375
/// <summary>
23732376
/// This function updates periodically the locomotive's motive force.
23742377
/// </summary>
2375-
protected virtual void UpdateTractiveForce(float elapsedClockSeconds, float t, float AbsSpeedMpS, float AbsWheelSpeedMpS)
2378+
protected virtual void UpdateTractiveForce(float elapsedClockSeconds, float t, float AbsSpeedMpS, float AbsWheelSpeedMpS, int numberofengine)
23762379
{
23772380
// Method to set force and power info
23782381
// An alternative method in the steam locomotive will override this and input force and power info for it.
@@ -2438,7 +2441,7 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds, float t, f
24382441
AverageForceN = w * AverageForceN + (1 - w) * TractiveForceN;
24392442
}
24402443

2441-
ApplyDirectionToTractiveForce();
2444+
ApplyDirectionToTractiveForce(ref TractiveForceN);
24422445

24432446
// Calculate the total tractive force for the locomotive - ie Traction + Dynamic Braking force.
24442447
// Note typically only one of the above will only ever be non-zero at the one time.
@@ -2493,21 +2496,21 @@ protected virtual void UpdateAxleDriveForce()
24932496
/// <summary>
24942497
/// This function applies a sign to the motive force as a function of the direction of the train.
24952498
/// </summary>
2496-
protected virtual void ApplyDirectionToTractiveForce()
2499+
protected virtual void ApplyDirectionToTractiveForce(ref float tractiveForceN)
24972500
{
24982501
if (Train.IsPlayerDriven)
24992502
{
25002503
switch (Direction)
25012504
{
25022505
case Direction.Forward:
2503-
//MotiveForceN *= 1; //Not necessary
2506+
//tractiveForceN *= 1; //Not necessary
25042507
break;
25052508
case Direction.Reverse:
2506-
TractiveForceN *= -1;
2509+
tractiveForceN *= -1;
25072510
break;
25082511
case Direction.N:
25092512
default:
2510-
TractiveForceN *= 0;
2513+
tractiveForceN *= 0;
25112514
break;
25122515
}
25132516
}
@@ -2516,7 +2519,7 @@ protected virtual void ApplyDirectionToTractiveForce()
25162519
switch (Direction)
25172520
{
25182521
case Direction.Reverse:
2519-
TractiveForceN *= -1;
2522+
tractiveForceN *= -1;
25202523
break;
25212524
default:
25222525
break;

0 commit comments

Comments
 (0)