4444using Orts . Simulation . RollingStocks . SubSystems . Controllers ;
4545using Orts . Simulation . RollingStocks . SubSystems . PowerSupplies ;
4646using Orts . Simulation . RollingStocks . SubSystems . PowerTransmissions ;
47+ using Orts . Simulation . Simulation . RollingStocks . SubSystems . PowerSupplies ;
4748using ORTS . Common ;
4849using ORTS . Scripting . Api ;
4950using System ;
@@ -2190,6 +2191,11 @@ private void UpdateLocomotiveLoadPhysics()
21902191 MassKG = MathHelper . Clamp ( MassKG , LoadEmptyMassKg , LoadFullMassKg ) ; // Clamp Mass to between the empty and full wagon values
21912192 // Adjust drive wheel weight
21922193 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+
21932199 }
21942200 else // locomotive must be a tender type locomotive
21952201 // This is a tender locomotive. A tender locomotive does not have any fuel onboard.
@@ -2198,9 +2204,13 @@ private void UpdateLocomotiveLoadPhysics()
21982204 MassKG = LoadEmptyMassKg + Kg . FromLb ( SteamLocomotiveIdentification . BoilerMassLB ) + SteamLocomotiveIdentification . FireMassKG + + ( SteamLocomotiveIdentification . CurrentTrackSandBoxCapacityM3 * SteamLocomotiveIdentification . SandWeightKgpM3 ) ;
21992205 var MassUpperLimit = LoadFullMassKg * 1.02f ; // Allow full load to go slightly higher so that rounding errors do not skew results
22002206 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
22022208 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+ }
22042214
22052215 // Update wagon physics parameters sensitive to wagon mass change
22062216 // 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()
22782288 }
22792289 }
22802290
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 ( )
22822305 {
22832306 IsBelowMergeSpeed = AbsSpeedMpS < MergeSpeedMpS ;
22842307 IsStandStill = AbsSpeedMpS < 0.1f ;
0 commit comments