Skip to content

Commit 12d50c5

Browse files
committed
Adjust Diesel Power
1 parent 0855181 commit 12d50c5

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies/DieselEngine.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ public virtual void Parse(STFReader stf)
978978
case "exhaustdynamicsdown": ExhaustDecelReduction = stf.ReadFloatBlock(STFReader.UNITS.None, null); initLevel |= SettingsFlags.ExhaustDynamics; break;
979979
case "exhaustcolor": ExhaustSteadyColor = stf.ReadColorBlock(Color.Gray); initLevel |= SettingsFlags.ExhaustColor; break;
980980
case "exhausttransientcolor": ExhaustTransientColor = stf.ReadColorBlock(Color.Black);initLevel |= SettingsFlags.ExhaustTransientColor; break;
981-
case "dieselpowertab": DieselPowerTab = new Interpolator(stf);initLevel |= SettingsFlags.DieselPowerTab; break;
981+
case "dieselpowertab": DieselPowerTab = new Interpolator(stf); initLevel |= SettingsFlags.DieselPowerTab; break;
982982
case "dieselconsumptiontab": DieselConsumptionTab = new Interpolator(stf);initLevel |= SettingsFlags.DieselConsumptionTab; break;
983983
case "throttlerpmtab":
984984
ThrottleRPMTab = new Interpolator(stf);
@@ -1688,7 +1688,6 @@ public void Save(BinaryWriter outf)
16881688
/// </summary>
16891689
public void InitFromMSTS()
16901690
{
1691-
16921691
if (MaximumRailOutputPowerW == 0 && Locomotive.MaxPowerW != 0)
16931692
{
16941693
MaximumRailOutputPowerW = Locomotive.MaxPowerW; // set rail power to a default value on the basis that of the value specified in the MaxPowerW parameter
@@ -2141,7 +2140,6 @@ public void InitDieselRailPowers(MSTSDieselLocomotive loco)
21412140
{
21422141
// Set up the reverse ThrottleRPM table. This is used to provide an apparent throttle setting to the Tractive Force calculation, and allows the diesel engine to control the up/down time of
21432142
// tractive force. This table should be creeated with all locomotives, as they will either use (create) a default ThrottleRPM table, or the user will enter one.
2144-
21452143
if (ThrottleRPMTab != null)
21462144
{
21472145
var size = ThrottleRPMTab.GetSize();

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions/GearBox.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void Parse(string lowercasetoken, STFReader stf)
7070
switch (lowercasetoken)
7171
{
7272
case "engine(gearboxnumberofgears": GearBoxNumberOfGears = stf.ReadIntBlock(1); initLevel++; break;
73-
case "engine(ortsreversegearboxindication": int tempIndication = stf.ReadIntBlock(1); if (tempIndication == 1) { ReverseGearBoxIndication = true; } Trace.TraceInformation("Read Indication {0}",ReverseGearBoxIndication); break;
73+
case "engine(ortsreversegearboxindication": int tempIndication = stf.ReadIntBlock(1); if (tempIndication == 1) { ReverseGearBoxIndication = true; }; break;
7474
case "engine(gearboxdirectdrivegear": GearBoxDirectDriveGear = stf.ReadIntBlock(1); break;
7575
case "engine(ortsgearboxfreewheel":
7676
var freeWheel = stf.ReadIntBlock(null);
@@ -661,11 +661,12 @@ public float TractiveForceN
661661

662662
if (CurrentSpeedMpS > 0)
663663
{
664-
if (tractiveForceN > (DieselEngine.RailPowerTab[DieselEngine.RealRPM] / CurrentSpeedMpS))
664+
var tractiveEffortLimitN = (DieselEngine.DieselPowerTab[DieselEngine.RealRPM] * (DieselEngine.LoadPercent / 100f)) / CurrentSpeedMpS;
665+
666+
if (tractiveForceN > tractiveEffortLimitN )
665667
{
666-
tractiveForceN = DieselEngine.RailPowerTab[DieselEngine.RealRPM] / CurrentSpeedMpS;
668+
tractiveForceN = tractiveEffortLimitN;
667669
}
668-
669670
}
670671

671672
// Set TE to zero if gear change happening && type B gear box

0 commit comments

Comments
 (0)