Skip to content

Commit 4d83c00

Browse files
authored
Merge pull request #447 from peternewell/starting-resistance#2
Minor adjustments to number of wheels checking https://bugs.launchpad.net/or/+bug/1938977
2 parents e941627 + fa21190 commit 4d83c00

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ public virtual void LoadFromWagFile(string wagFilePath)
483483
}
484484

485485
// Ensure Drive Axles is set to a default if no OR value added to WAG file
486-
if (WagonNumAxles == 0)
486+
if (WagonNumAxles == 0 && WagonType != WagonTypes.Engine)
487487
{
488488
if (MSTSWagonNumWheels != 0 && MSTSWagonNumWheels < 6)
489489
{
@@ -2409,11 +2409,16 @@ private void UpdateTrainBaseResistance_DavisLowSpeed()
24092409
// Determine Axle loading of Car
24102410
if (WagonType == WagonTypes.Engine && IsPlayerTrain && Simulator.PlayerLocomotive is MSTSLocomotive locoParameters)
24112411
{
2412+
// This only takes into account the driven axles for 100% accuracy the non driven axles should also be considered
24122413
AxleLoadKg = locoParameters.DrvWheelWeightKg / locoParameters.LocoNumDrvAxles;
24132414
}
24142415
else
24152416
{
2416-
AxleLoadKg = MassKG / WagonNumAxles;
2417+
// Typically this loop should only be processed when it is a car of some description, and therefore it will use the wagon axles as it reference.
2418+
if (WagonNumAxles > 0)
2419+
{
2420+
AxleLoadKg = MassKG / WagonNumAxles;
2421+
}
24172422
}
24182423

24192424
// Calculate the track gradient based on wagon axle loading

0 commit comments

Comments
 (0)