44
44
using Orts . Simulation . RollingStocks . SubSystems . Controllers ;
45
45
using Orts . Simulation . RollingStocks . SubSystems . PowerSupplies ;
46
46
using Orts . Simulation . RollingStocks . SubSystems . PowerTransmissions ;
47
+ using Orts . Simulation . Simulation . RollingStocks . SubSystems . PowerSupplies ;
47
48
using ORTS . Common ;
48
49
using ORTS . Scripting . Api ;
49
50
using System ;
@@ -2190,6 +2191,11 @@ private void UpdateLocomotiveLoadPhysics()
2190
2191
MassKG = MathHelper . Clamp ( MassKG , LoadEmptyMassKg , LoadFullMassKg ) ; // Clamp Mass to between the empty and full wagon values
2191
2192
// Adjust drive wheel weight
2192
2193
SteamLocomotiveIdentification . DrvWheelWeightKg = ( MassKG / InitialMassKG ) * SteamLocomotiveIdentification . InitialDrvWheelWeightKg ;
2194
+
2195
+ // update drive wheel weight for each multiple steam engine
2196
+ UpdateDriveWheelWeight ( LocoIndex , MassKG , SteamLocomotiveIdentification . SteamEngines . Count ) ;
2197
+
2198
+
2193
2199
}
2194
2200
else // locomotive must be a tender type locomotive
2195
2201
// This is a tender locomotive. A tender locomotive does not have any fuel onboard.
@@ -2198,9 +2204,13 @@ private void UpdateLocomotiveLoadPhysics()
2198
2204
MassKG = LoadEmptyMassKg + Kg . FromLb ( SteamLocomotiveIdentification . BoilerMassLB ) + SteamLocomotiveIdentification . FireMassKG + + ( SteamLocomotiveIdentification . CurrentTrackSandBoxCapacityM3 * SteamLocomotiveIdentification . SandWeightKgpM3 ) ;
2199
2205
var MassUpperLimit = LoadFullMassKg * 1.02f ; // Allow full load to go slightly higher so that rounding errors do not skew results
2200
2206
MassKG = MathHelper . Clamp ( MassKG , LoadEmptyMassKg , MassUpperLimit ) ; // Clamp Mass to between the empty and full wagon values
2201
- // Adjust drive wheel weight
2207
+ // Adjust drive wheel weight
2202
2208
SteamLocomotiveIdentification . DrvWheelWeightKg = ( MassKG / InitialMassKG ) * SteamLocomotiveIdentification . InitialDrvWheelWeightKg ;
2203
- }
2209
+
2210
+ // update drive wheel weight for each multiple steam engine
2211
+ UpdateDriveWheelWeight ( LocoIndex , MassKG , SteamLocomotiveIdentification . SteamEngines . Count ) ;
2212
+
2213
+ }
2204
2214
2205
2215
// Update wagon physics parameters sensitive to wagon mass change
2206
2216
// Calculate the difference ratio, ie how full the wagon is. This value allows the relevant value to be scaled from the empty mass to the full mass of the wagon
@@ -2278,7 +2288,20 @@ private void UpdateLocomotiveLoadPhysics()
2278
2288
}
2279
2289
}
2280
2290
2281
- private void UpdateTrainBaseResistance ( )
2291
+ private void UpdateDriveWheelWeight ( int index , float masskg , int numberofengines )
2292
+ {
2293
+ var LocoIdentification = Train . Cars [ index ] as MSTSSteamLocomotive ;
2294
+ if ( LocoIdentification != null )
2295
+ {
2296
+
2297
+ for ( int i = 0 ; i < LocoIdentification . SteamEngines . Count ; i ++ )
2298
+ {
2299
+ LocoIdentification . SteamEngines [ i ] . AttachedAxle . WheelWeightKg = ( MassKG / InitialMassKG ) * LocoIdentification . SteamEngines [ i ] . AttachedAxle . InitialDrvWheelWeightKg ;
2300
+ }
2301
+ }
2302
+ }
2303
+
2304
+ private void UpdateTrainBaseResistance ( )
2282
2305
{
2283
2306
IsBelowMergeSpeed = AbsSpeedMpS < MergeSpeedMpS ;
2284
2307
IsStandStill = AbsSpeedMpS < 0.1f ;
0 commit comments