Skip to content

Commit f4c0b91

Browse files
committed
Implement Polach Adhesion
1 parent 6641105 commit f4c0b91

File tree

8 files changed

+290
-136
lines changed

8 files changed

+290
-136
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,7 +1469,7 @@ public override void Initialize()
14691469
// Ensure Drive Axles is set with a default value if user doesn't supply an OR value in ENG file
14701470
if (LocoNumDrvAxles == 0)
14711471
{
1472-
if (MSTSLocoNumDrvWheels != 0 && MSTSLocoNumDrvWheels < 6)
1472+
if (MSTSLocoNumDrvWheels != 0 && MSTSLocoNumDrvWheels < 7)
14731473
{
14741474
LocoNumDrvAxles = (int) MSTSLocoNumDrvWheels;
14751475
}
@@ -2800,6 +2800,9 @@ public virtual void AdvancedAdhesion(float elapsedClockSeconds)
28002800
axle.BrakeRetardForceN = BrakeRetardForceN/LocomotiveAxles.Count;
28012801
axle.TrainSpeedMpS = SpeedMpS; //Set the train speed of the axle mod
28022802
axle.WheelRadiusM = DriverWheelRadiusM;
2803+
axle.WheelDistanceGaugeM = TrackGaugeM;
2804+
axle.CurrentCurveRadiusM = CurrentCurveRadiusM;
2805+
axle.BogieRigidWheelBaseM = RigidWheelBaseM;
28032806
}
28042807
LocomotiveAxles.Update(elapsedClockSeconds);
28052808
MotiveForceN = LocomotiveAxles.CompensatedForceN;
@@ -2813,10 +2816,10 @@ public virtual void AdvancedAdhesion(float elapsedClockSeconds)
28132816
// This enables steam locomotives to have different speeds for driven and non-driven wheels.
28142817
if (EngineType == EngineTypes.Steam && SteamEngineType != MSTSSteamLocomotive.SteamEngineTypes.Geared)
28152818
{
2816-
WheelSpeedSlipMpS = LocomotiveAxles[0].AxleSpeedMpS;
2819+
WheelSpeedSlipMpS = (float)LocomotiveAxles[0].AxleSpeedMpS;
28172820
WheelSpeedMpS = SpeedMpS;
28182821
}
2819-
else WheelSpeedMpS = LocomotiveAxles[0].AxleSpeedMpS;
2822+
else WheelSpeedMpS = (float)LocomotiveAxles[0].AxleSpeedMpS;
28202823

28212824
}
28222825

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5045,7 +5045,7 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
50455045
// Crank Angle - converts the above range to 0 - 180 - 0 - this is the principle reference used so that it lines up with reference
50465046
// tables used to buold this function
50475047
// Normalised Crank Angle - converts the above to a 0 - 360 range, this is used for triggering special steam effects, etc.
5048-
float axlePostionRad = LocomotiveAxles[0].AxlePositionRad;
5048+
float axlePostionRad = (float)LocomotiveAxles[0].AxlePositionRad;
50495049
float crankAngleRad = (float)(axlePostionRad + WheelCrankAngleDiffRad[i]);
50505050

50515051
crankAngleRad = (float)(MathHelper.WrapAngle(crankAngleRad)); // Ensures that crank angle is in the range 0 - 180 - 0
@@ -5299,8 +5299,8 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
52995299
/// </summary>
53005300
private float NormalisedCrankAngle(int cylinderNumber)
53015301
{
5302-
float normalisedCrankAngleRad = (float)MathHelper.WrapAngle(LocomotiveAxles[0].AxlePositionRad + WheelCrankAngleDiffRad[cylinderNumber]);
5303-
5302+
float normalisedCrankAngleRad = (float)MathHelper.WrapAngle((float)LocomotiveAxles[0].AxlePositionRad + WheelCrankAngleDiffRad[cylinderNumber]);
5303+
53045304
if (normalisedCrankAngleRad < 0)
53055305
{
53065306
normalisedCrankAngleRad += (float)(2 * Math.PI);

0 commit comments

Comments
 (0)