Skip to content

Commit b2046ed

Browse files
committed
Automatic merge of T1.5.1-553-g4b9199858 and 14 pull requests
- Pull request #757 at 98dd1a7: Unify RailDriver code implementations - Pull request #831 at 61bbf43: poor mans switch panel on tablet - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #841 at 410a585: https://blueprints.launchpad.net/or/+spec/animating-trainset-windows - Pull request #853 at d05f581: Notify out of focus - Pull request #855 at b39e5d8: Adds new route from TrainSimulations - Pull request #857 at 9afc8c3: Adding Air Flow Meters - Pull request #859 at 0e963aa: Steam adhesion bug#1 - Pull request #860 at d2b8a52: Changes in the Car Operations Menu for the lines with brake information - Pull request #862 at 489f261: Fix engine leak problem - Pull request #863 at a34b857: Alternate preset 3D cabviewpoints - Pull request #864 at 18c5481: Fixes for Undesired Emergency Applications - Pull request #865 at 776d6df: Dispatcher window improvements - Pull request #866 at a6cbc52: Fix Articulation For 0-Axle Train Cars
16 parents 44c05de + 4b91998 + 98dd1a7 + 61bbf43 + d00beb9 + 410a585 + d05f581 + b39e5d8 + 9afc8c3 + 0e963aa + d2b8a52 + 489f261 + a34b857 + 18c5481 + 776d6df + a6cbc52 commit b2046ed

File tree

1 file changed

+21
-37
lines changed

1 file changed

+21
-37
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@ public class MSTSSteamLocomotive : MSTSLocomotive
102102
public MSTSNotchController SmallEjectorController = new MSTSNotchController(0, 1, 0.1f);
103103
public MSTSNotchController LargeEjectorController = new MSTSNotchController(0, 1, 0.1f);
104104

105+
float DebugTimerS;
106+
105107
public bool Injector1IsOn;
106108
bool Injector1SoundIsOn = false;
107109
public bool Injector2IsOn;
@@ -142,8 +144,6 @@ public class MSTSSteamLocomotive : MSTSLocomotive
142144
bool AIFireOverride = false; // Flag to show ai fire has has been overriden
143145
bool InjectorLockedOut = false; // Flag to lock injectors from changing within a fixed period of time
144146

145-
float DebugTimerS;
146-
147147
// Aux Tender Parameters
148148
public bool AuxTenderMoveFlag = false; // Flag to indicate whether train has moved
149149
bool SteamIsAuxTenderCoupled = false;
@@ -5150,12 +5150,6 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
51505150
crankCylinderPressure = 0;
51515151
}
51525152

5153-
#if DEBUG_STEAM_SLIP
5154-
if (throttle > 0.01 && (absSpeedMpS < 0.2 || absSpeedMpS > 17.9 && absSpeedMpS < 18.1 || absSpeedMpS > 35.5 && absSpeedMpS < 35.9))
5155-
{
5156-
Trace.TraceInformation("Cylinder {0} CrankAngle {1} FwdCylPosition {2} FwdCylPressure {3} BwdCylPosition {4} BwdCylPressure {5} CrankPressure {6} ForwardStroke {7} Speed {8}", i, MathHelper.ToDegrees(crankAngleRad), forwardCylinderPosition, forwardCylinderPressure, backwardCylinderPosition, backwardCylinderPressure, crankCylinderPressure, forwardStroke, MpS.ToMpH(absSpeedMpS));
5157-
}
5158-
#endif
51595153
// Calculate wheel tangential forces = Force applied to wheels
51605154

51615155
float pistonForceLbf = Me2.ToIn2(Me2.FromFt2(CylinderPistonAreaFt2)) * crankCylinderPressure;
@@ -5183,7 +5177,8 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
51835177
float connectRodInertiaForcelbf = inertiaSpeedCorrectionFactor * connectRodInertiaAngleFactor * ConnectingRodWeightLb;
51845178

51855179
// Account for the position of the crosshead position. In other words it depends upon whether the Rods and Reciporating gear is above or below the axle.
5186-
if (axlePostionRad < 0)
5180+
// The crosshead will be -ve for normalised angles between 0 - 180, and +ve for normalised angles between 180 - 360
5181+
if (normalisedCrankAngleRad > 0 && normalisedCrankAngleRad < Math.PI )
51875182
{
51885183
reciprocatingInertiaForcelbf *= -1;
51895184
connectRodInertiaForcelbf *= -1;
@@ -5208,6 +5203,21 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
52085203
// should be deducted from this as well.
52095204
float tangentialWheelTreadForceLbf = tangentialCrankWheelForceLbf * Me.ToIn(CylinderStrokeM) / Me.ToIn(DrvWheelDiaM);
52105205

5206+
#if DEBUG_STEAM_SLIP
5207+
if (SpeedMpS > 17.88 && SpeedMpS < 18.5 || SpeedMpS > 34.0 && throttle == 0)
5208+
{
5209+
Trace.TraceInformation("Adhesion Debug - Cyl {0} Time {1} Speed {2} WheelRpM {3} CrankAngle {4} TotalTangForce {5} TangForce {6} TotalInertiaForce {7} TotalTangInertiaForce {8} RecipForce {9} RecipANgleFactor {10} RecipWeight {11} SpeedFactor {12} RodForce {13} RodAngleFactor {14} ForwardCyLPos {15} BackCylPos {16} CrankCylPos {17} NormCrankAngle {18} AxlePosnRad {19}", i + 1, DebugTimerS, MpS.ToMpH(SpeedMpS), DrvWheelRevRpS * 60.0f, MathHelper.ToDegrees(crankAngleRad), tangentialWheelTreadForceLbf, tangentialForcelbf, totalInertiaForcelbf, totalTangentialInertiaForcelbf, reciprocatingInertiaForcelbf, reciprocatingInertiaAngleFactor, ReciprocatingWeightLb, inertiaSpeedCorrectionFactor, connectRodInertiaForcelbf, connectRodInertiaAngleFactor, forwardCylinderPosition, backwardCylinderPosition, crankCylinderPosition, normalisedCrankAngleRad, axlePostionRad);
5210+
5211+
DebugTimerS += elapsedClockSeconds;
5212+
}
5213+
5214+
if (SpeedMpS > 18.5 && SpeedMpS < 19)
5215+
{
5216+
DebugTimerS = 0;
5217+
}
5218+
5219+
#endif
5220+
52115221
DisplayTangentialWheelTreadForceLbf += tangentialWheelTreadForceLbf;
52125222
TractiveForceN += N.FromLbf(tangentialWheelTreadForceLbf);
52135223

@@ -5227,7 +5237,8 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
52275237
float excessBalanceForcelbf = inertiaSpeedCorrectionFactor * excessBalanceWeightLb * sin;
52285238

52295239
// Account for the position of the crosshead position. In other words it depends upon whether the ExcessBalance is above or below the axle.
5230-
if (axlePostionRad < 0)
5240+
// The crosshead will be -ve for normalised angles between 0 - 180, and +ve for normalised angles between 180 - 360
5241+
if (normalisedCrankAngleRad > 0 && normalisedCrankAngleRad < Math.PI)
52315242
{
52325243
excessBalanceForcelbf *= -1;
52335244
}
@@ -5250,37 +5261,10 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
52505261
{
52515262
totalDrvWeightN += N.FromLbf(excessBalanceForcelbf - verticalThrustForcelbf);
52525263
}
5253-
5254-
#if DEBUG_STEAM_SLIP
5255-
if (throttle > 0.01 && (absSpeedMpS < 0.2 || absSpeedMpS > 17.7 && absSpeedMpS < 18.2))
5256-
{
5257-
// Trace.TraceInformation("MaxSpeed {0}", MaxLocoSpeedMpH);
5258-
5259-
Trace.TraceInformation("Crank Angle {0} Cylinder Position {1} AxlePosition {2} Cylinder {3} CylArea {4} CylPress {5}", MathHelper.ToDegrees(crankAngleRad), crankCylinderPosition, MathHelper.ToDegrees(LocomotiveAxle.AxlePositionRad), i, Me2.ToIn2(Me2.FromFt2(CylinderPistonAreaFt2)), crankCylinderPressure);
5260-
5261-
Trace.TraceInformation("Tang.CrankFactor {0} RecInertiaFactor {1}, ConInertiaFactor {2} VerticalForceFactor {3} InertiaSpeedFactor {4}", tangentialCrankForceFactor, reciprocatingInertiaFactor, connectRodInertiaFactor, verticalThrustFactor, inertiaSpeedCorrectionFactor);
5262-
5263-
Trace.TraceInformation("PistonForce {0} RodForce {1} RecForce {2}", pistonForceLbf, connectRodInertiaForce, reciprocatingInertiaForce);
5264-
5265-
Trace.TraceInformation("VerticalThrustForce {0} ExcessBalanceForce {1}", verticalThrustForce, excessBalanceForce);
5266-
5267-
}
5268-
#endif
52695264
}
52705265

52715266
LocomotiveAxles[0].AxleWeightN = totalDrvWeightN + 9.81f * DrvWheelWeightKg;
52725267
SteamStaticWheelForce = N.ToLbf(totalDrvWeightN + 9.81f * DrvWheelWeightKg) * LocomotiveCoefficientFrictionHUD;
5273-
5274-
#if DEBUG_STEAM_SLIP
5275-
if (throttle > 0.01 && (absSpeedMpS < 0.2 || absSpeedMpS > 17.7 && absSpeedMpS < 18.2))
5276-
{
5277-
Trace.TraceInformation("RotationalForce {0} AdhesiveForce {1}", N.ToLbf(TractiveForceN), SteamStaticWheelForce);
5278-
5279-
5280-
}
5281-
#endif
5282-
5283-
52845268
}
52855269
else // Set wheel speed if "simple" friction is used
52865270
{

0 commit comments

Comments
 (0)