Skip to content

Commit b19b5a1

Browse files
committed
Code cleanup
1 parent 279e244 commit b19b5a1

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5045,8 +5045,8 @@ 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 = (float)LocomotiveAxles[0].AxlePositionRad;
5049-
float crankAngleRad = (float)(axlePostionRad + WheelCrankAngleDiffRad[i]);
5048+
float LocalAxlePostionRad = (float)LocomotiveAxles[0].AxlePositionRad;
5049+
float crankAngleRad = (float)(LocalAxlePostionRad + WheelCrankAngleDiffRad[i]);
50505050

50515051
crankAngleRad = (float)(MathHelper.WrapAngle(crankAngleRad)); // Ensures that crank angle is in the range 0 - 180 - 0
50525052

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
//
1515
// You should have received a copy of the GNU General Public License
1616
// along with Open Rails. If not, see <http://www.gnu.org/licenses/>.
17+
//
18+
// Debug for Adhesion
19+
//#define DEBUG_ADHESION
1720

1821
using System;
1922
using System.IO;
@@ -974,6 +977,29 @@ public virtual void Update(float timeSpan)
974977
axleStaticForceN = AxleWeightN * SlipCharacteristics(0);
975978
}
976979

980+
#if DEBUG_ADHESION
981+
double[] spd = new double[50];
982+
double[] adh = new double[50];
983+
for (int i = 0; i < spd.Length; i++)
984+
{
985+
spd[i] = i / (float)spd.Length;
986+
adh[i] = SlipCharacteristics(spd[i]);
987+
}
988+
for (int i = 0; i < spd.Length; i++)
989+
{
990+
Console.Write(spd[i]);
991+
Console.Write(" ");
992+
}
993+
Console.WriteLine("");
994+
Console.WriteLine("");
995+
for (int i = 0; i < spd.Length; i++)
996+
{
997+
Console.Write(adh[i]);
998+
Console.Write(" ");
999+
}
1000+
Console.WriteLine("");
1001+
#endif
1002+
9771003
motor?.Update(timeSpan);
9781004

9791005
Integrate(timeSpan);

0 commit comments

Comments
 (0)