Skip to content

Commit 87cdd9f

Browse files
committed
Add TODO messages indicating that variables should never be NaN
1 parent ee45324 commit 87cdd9f

File tree

1 file changed

+3
-3
lines changed
  • Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ public void Save(BinaryWriter outf)
11001100
/// </summary>
11011101
public (double accelMpSS, double angSpeedRadpS, double driveForceN, double axleMotiveForceN, double axleBrakeForceN, double axleFrictionForceN) GetAxleMotionVariation(double axleSpeedMpS, double elapsedClockSeconds)
11021102
{
1103-
if (double.IsNaN(axleSpeedMpS)) axleSpeedMpS = 0;
1103+
if (double.IsNaN(axleSpeedMpS)) axleSpeedMpS = 0; // TODO: axleSpeedMpS should always be a number, find the cause of the NaN
11041104
double slipSpeedMpS = axleSpeedMpS - TrainSpeedMpS;
11051105
// Compute force transmitted to rail according to adhesion curves
11061106
double axleOutForceN;
@@ -1306,8 +1306,8 @@ void Integrate(float elapsedClockSeconds)
13061306
/// <param name="elapsedSeconds"></param>
13071307
public virtual void Update(float elapsedSeconds)
13081308
{
1309-
if (float.IsNaN(TrainSpeedMpS)) TrainSpeedMpS = 0;
1310-
if (double.IsNaN(AxleSpeedMpS)) AxleSpeedMpS = 0;
1309+
if (float.IsNaN(TrainSpeedMpS)) TrainSpeedMpS = 0; // TODO: TrainSpeedMpS should always be a number, find the cause of the NaN
1310+
if (double.IsNaN(AxleSpeedMpS)) AxleSpeedMpS = 0; // TODO: AxleSpeedMpS should always be a number, find the cause of the NaN
13111311

13121312
bool advancedAdhesion = Car is MSTSLocomotive locomotive && locomotive.AdvancedAdhesionModel;
13131313
advancedAdhesion &= DriveType != AxleDriveType.NotDriven; // Skip integrator for undriven axles to save CPU

0 commit comments

Comments
 (0)