@@ -453,7 +453,6 @@ public enum TractionMotorTypes
453
453
public ILocomotivePowerSupply LocomotivePowerSupply => PowerSupply as ILocomotivePowerSupply ;
454
454
public ScriptedTrainControlSystem TrainControlSystem ;
455
455
456
- public Axles LocomotiveAxles ;
457
456
public IIRFilter CurrentFilter ;
458
457
public IIRFilter AdhesionFilter ;
459
458
public float SaveAdhesionFilter ;
@@ -480,7 +479,6 @@ public MSTSLocomotive(Simulator simulator, string wagPath)
480
479
MilepostUnitsMetric = Simulator . TRK . Tr_RouteFile . MilepostUnitsMetric ;
481
480
BrakeCutsPowerAtBrakeCylinderPressurePSI = 4.0f ;
482
481
483
- LocomotiveAxles = new Axles ( this ) ;
484
482
LocomotiveAxles . Add ( new Axle ( ) ) ;
485
483
CurrentFilter = new IIRFilter ( IIRFilter . FilterTypes . Butterworth , 1 , IIRFilter . HzToRad ( 0.5f ) , 0.001f ) ;
486
484
AdhesionFilter = new IIRFilter ( IIRFilter . FilterTypes . Butterworth , 1 , IIRFilter . HzToRad ( 1f ) , 0.001f ) ;
@@ -1229,23 +1227,10 @@ public override void Copy(MSTSWagon copy)
1229
1227
WaterScoopFillElevationM = locoCopy . WaterScoopFillElevationM ;
1230
1228
WaterScoopDepthM = locoCopy . WaterScoopDepthM ;
1231
1229
WaterScoopWidthM = locoCopy . WaterScoopWidthM ;
1232
- MoveParamsToAxle ( ) ;
1233
1230
CruiseControl = locoCopy . CruiseControl ? . Clone ( this ) ;
1234
1231
MultiPositionControllers = locoCopy . CloneMPC ( this ) ;
1235
1232
}
1236
1233
1237
- /// <summary>
1238
- /// We are moving parameters from locomotive to axle.
1239
- /// </summary>
1240
- public void MoveParamsToAxle ( )
1241
- {
1242
- foreach ( var axle in LocomotiveAxles )
1243
- {
1244
- axle . SlipWarningTresholdPercent = SlipWarningThresholdPercent ;
1245
- axle . AdhesionK = AdhesionK ;
1246
- }
1247
- }
1248
-
1249
1234
/// <summary>
1250
1235
/// We are saving the game. Save anything that we'll need to restore the
1251
1236
/// status later.
@@ -1294,7 +1279,6 @@ public override void Save(BinaryWriter outf)
1294
1279
LocomotivePowerSupply ? . Save ( outf ) ;
1295
1280
TrainControlSystem . Save ( outf ) ;
1296
1281
1297
- LocomotiveAxles . Save ( outf ) ;
1298
1282
CruiseControl ? . Save ( outf ) ;
1299
1283
}
1300
1284
@@ -1349,8 +1333,6 @@ public override void Restore(BinaryReader inf)
1349
1333
LocomotivePowerSupply ? . Restore ( inf ) ;
1350
1334
TrainControlSystem . Restore ( inf ) ;
1351
1335
1352
- MoveParamsToAxle ( ) ;
1353
- LocomotiveAxles . Restore ( inf ) ;
1354
1336
CruiseControl ? . Restore ( inf ) ;
1355
1337
}
1356
1338
@@ -1432,7 +1414,6 @@ public override void Initialize()
1432
1414
BrakemanBrakeController . Initialize ( ) ;
1433
1415
LocomotivePowerSupply ? . Initialize ( ) ;
1434
1416
TrainControlSystem . Initialize ( ) ;
1435
- LocomotiveAxles . Initialize ( ) ;
1436
1417
CruiseControl ? . Initialize ( ) ;
1437
1418
foreach ( MultiPositionController mpc in MultiPositionControllers )
1438
1419
{
@@ -1491,6 +1472,18 @@ public override void Initialize()
1491
1472
Trace . TraceInformation ( "Number of Locomotive Drive Axles set to default value of {0}" , LocoNumDrvAxles ) ;
1492
1473
}
1493
1474
}
1475
+ //Compute axle inertia from parameters if possible
1476
+ if ( AxleInertiaKgm2 <= 0 ) // if no axleinertia value supplied in ENG file, calculate axleinertia value.
1477
+ {
1478
+ if ( LocoNumDrvAxles > 0 && DriverWheelRadiusM > 0 )
1479
+ {
1480
+ float radiusSquared = DriverWheelRadiusM * DriverWheelRadiusM ;
1481
+ float wheelMass = 500 * radiusSquared / ( 0.5f * 0.5f ) ;
1482
+ AxleInertiaKgm2 = Math . Min ( LocoNumDrvAxles * wheelMass * radiusSquared + 500 , 40000 ) ;
1483
+ }
1484
+ else
1485
+ AxleInertiaKgm2 = 2000.0f ;
1486
+ }
1494
1487
if ( TractionMotorType == TractionMotorTypes . AC )
1495
1488
{
1496
1489
foreach ( var axle in LocomotiveAxles )
@@ -1500,7 +1493,6 @@ public override void Initialize()
1500
1493
}
1501
1494
}
1502
1495
1503
-
1504
1496
// Calculate minimum speed to pickup water
1505
1497
const float Aconst = 2 ;
1506
1498
WaterScoopMinSpeedMpS = Me . FromFt ( ( float ) Math . Sqrt ( Aconst * GravitationalAccelerationFtpSpS * Me . ToFt ( WaterScoopFillElevationM ) ) ) ;
@@ -1748,9 +1740,8 @@ public List<MultiPositionController> CloneMPC(MSTSLocomotive locomotive)
1748
1740
1749
1741
public override void InitializeMoving ( )
1750
1742
{
1751
- base . InitializeMoving ( ) ;
1752
1743
AdhesionFilter . Reset ( 0.5f ) ;
1753
- LocomotiveAxles . InitializeMoving ( ) ;
1744
+ base . InitializeMoving ( ) ;
1754
1745
AverageForceN = MaxForceN * Train . MUThrottlePercent / 100 ;
1755
1746
float maxPowerW = MaxPowerW * Train . MUThrottlePercent * Train . MUThrottlePercent / 10000 ;
1756
1747
if ( AverageForceN * SpeedMpS > maxPowerW ) AverageForceN = maxPowerW / SpeedMpS ;
@@ -2792,40 +2783,12 @@ public virtual void AdvancedAdhesion(float elapsedClockSeconds)
2792
2783
return ;
2793
2784
}
2794
2785
2795
- if ( EngineType == EngineTypes . Steam && SteamEngineType != MSTSSteamLocomotive . SteamEngineTypes . Geared )
2796
- {
2797
- // Managed in MSTSSteamLocomotive implementation of AdvancedAdhesion
2798
- }
2799
- else
2800
- {
2801
-
2802
- //Compute axle inertia from parameters if possible
2803
- if ( AxleInertiaKgm2 <= 0 ) // if no axleinertia value supplied in ENG file, calculate axleinertia value.
2804
- {
2805
- if ( LocoNumDrvAxles > 0 && DriverWheelRadiusM > 0 )
2806
- {
2807
- float radiusSquared = DriverWheelRadiusM * DriverWheelRadiusM ;
2808
- float wheelMass = 500 * radiusSquared / ( 0.5f * 0.5f ) ;
2809
- AxleInertiaKgm2 = LocoNumDrvAxles * wheelMass * radiusSquared + 500 ;
2810
- }
2811
- else
2812
- AxleInertiaKgm2 = 2000.0f ;
2813
- }
2814
- foreach ( var axle in LocomotiveAxles )
2815
- {
2816
- //Limit the inertia to 40000 kgm2
2817
- axle . InertiaKgm2 = Math . Min ( AxleInertiaKgm2 , 40000 ) ;
2818
- axle . DampingNs = MassKG / 1000.0f ;
2819
- axle . FrictionN = MassKG / 1000.0f ;
2820
- axle . AxleWeightN = 9.81f * DrvWheelWeightKg / LocomotiveAxles . Count ; ; //remains fixed for diesel/electric locomotives, but varies for steam locomotives
2821
- }
2822
- }
2823
2786
foreach ( var axle in LocomotiveAxles )
2824
- {
2787
+ {
2825
2788
axle . BrakeRetardForceN = BrakeRetardForceN / LocomotiveAxles . Count ;
2826
2789
axle . TrainSpeedMpS = SpeedMpS ; //Set the train speed of the axle mod
2827
2790
axle . WheelRadiusM = DriverWheelRadiusM ;
2828
- }
2791
+ }
2829
2792
LocomotiveAxles . Update ( elapsedClockSeconds ) ;
2830
2793
MotiveForceN = LocomotiveAxles . CompensatedForceN ;
2831
2794
0 commit comments