Skip to content

Commit 263cbf3

Browse files
committed
More fixes
1 parent 7d8b074 commit 263cbf3

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2263,7 +2263,7 @@ public override void Update(float elapsedClockSeconds)
22632263
UpdateHornAndBell(elapsedClockSeconds);
22642264

22652265
UpdateSoundVariables(elapsedClockSeconds);
2266-
PrevTractiveForceN = MotiveForceN;
2266+
PrevTractiveForceN = TractiveForceN;
22672267
base.Update(elapsedClockSeconds);
22682268

22692269
#if DEBUG_ADHESION

Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,9 @@ public enum WindowState
172172
public float Curtius_KnifflerC = 0.161f; // speedMpS * 3.6 + B
173173
public float AdhesionK = 0.7f; //slip characteristics slope
174174
public float AxleInertiaKgm2; //axle inertia
175-
public float WheelSpeedMpS;
176175
public float WheelSpeedSlipMpS; // speed of wheel if locomotive is slipping
177176
public float SlipWarningThresholdPercent = 70;
178177
public MSTSNotchController WeightLoadController; // Used to control freight loading in freight cars
179-
public float AbsWheelSpeedMpS; // Math.Abs(WheelSpeedMpS) is used frequently in the subclasses, maybe it's more efficient to compute it once
180178

181179
public Axles LocomotiveAxles; // Only used at locomotives for efficiency
182180

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,13 +1038,10 @@ public void Update(float elapsedClockSeconds)
10381038

10391039
DemandedThrottlePercent = Math.Max(DemandedThrottlePercent, ReverseThrottleRPMTab[Locomotive.DieselPowerSupply.DieselEngineMinRpm]);
10401040

1041-
if (Locomotive.Direction == Direction.Reverse)
1042-
Locomotive.PrevTractiveForceN *= -1f;
1043-
10441041
if ((State == DieselEngineState.Running) && (Locomotive.ThrottlePercent > 0))
10451042
{
10461043
var abstempTractiveForce = Math.Abs(Locomotive.PrevTractiveForceN);
1047-
OutputPowerW = ( abstempTractiveForce > 0 ? abstempTractiveForce * Locomotive.AbsSpeedMpS : 0) / Locomotive.DieselEngines.NumOfActiveEngines;
1044+
OutputPowerW = ( abstempTractiveForce > 0 ? abstempTractiveForce * Locomotive.AbsWheelSpeedMpS : 0) / Locomotive.DieselEngines.NumOfActiveEngines;
10481045
}
10491046
else
10501047
{

Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ public float ConvectionFactor
299299
public float _SpeedMpS; // meters per second; updated by train physics, relative to direction of car 50mph = 22MpS
300300
public float _PrevSpeedMpS;
301301
public float AbsSpeedMpS; // Math.Abs(SpeedMps) expression is repeated many times in the subclasses, maybe this deserves a class variable
302+
public float WheelSpeedMpS;
303+
public float AbsWheelSpeedMpS; // Math.Abs(WheelSpeedMpS) is used frequently in the subclasses, maybe it's more efficient to compute it once
302304
public float CouplerSlackM; // extra distance between cars (calculated based on relative speeds)
303305
public int HUDCouplerForceIndication = 0; // Flag to indicate whether coupler is 1 - pulling, 2 - pushing or 0 - neither
304306
public float CouplerSlack2M; // slack calculated using draft gear force
@@ -2203,7 +2205,7 @@ public virtual string GetDebugStatus()
22032205
String.Format("{0}", FormatStrings.FormatSpeedDisplay(SpeedMpS, IsMetric)),
22042206
loco.DieselEngines[0].GearBox.HuDShaftRPM,
22052207
// For Locomotive HUD display shows "forward" motive power (& force) as a positive value, braking power (& force) will be shown as negative values.
2206-
FormatStrings.FormatPower(TractiveForceN * SpeedMpS, IsMetric, false, false),
2208+
FormatStrings.FormatPower(TractiveForceN * WheelSpeedMpS, IsMetric, false, false),
22072209
String.Format("{0}{1}", FormatStrings.FormatForce(TractiveForceN, IsMetric), WheelSlip ? "!!!" : WheelSlipWarning ? "???" : ""),
22082210
Simulator.Catalog.GetString(locomotivetypetext)
22092211
);
@@ -2218,7 +2220,7 @@ public virtual string GetDebugStatus()
22182220
ThrottlePercent,
22192221
String.Format("{0}", FormatStrings.FormatSpeedDisplay(SpeedMpS, IsMetric)),
22202222
// For Locomotive HUD display shows "forward" motive power (& force) as a positive value, braking power (& force) will be shown as negative values.
2221-
FormatStrings.FormatPower(TractiveForceN * SpeedMpS, IsMetric, false, false),
2223+
FormatStrings.FormatPower(TractiveForceN * WheelSpeedMpS, IsMetric, false, false),
22222224
String.Format("{0}{1}", FormatStrings.FormatForce(TractiveForceN, IsMetric), WheelSlip ? "!!!" : WheelSlipWarning ? "???" : ""),
22232225
Simulator.Catalog.GetString(locomotivetypetext)
22242226
);

0 commit comments

Comments
 (0)