@@ -454,6 +454,7 @@ public enum TractionMotorTypes
454454 public IIRFilter CurrentFilter ;
455455 public IIRFilter AdhesionFilter ;
456456 public float SaveAdhesionFilter ;
457+ public float AdhesionConditions ;
457458
458459 public float FilteredMotiveForceN ;
459460
@@ -473,8 +474,6 @@ public MSTSLocomotive(Simulator simulator, string wagPath)
473474
474475 LocomotiveAxle = new Axle ( ) ;
475476 LocomotiveAxle . DriveType = AxleDriveType . ForceDriven ;
476- LocomotiveAxle . DampingNs = MassKG / 1000.0f ;
477- LocomotiveAxle . FrictionN = MassKG / 100.0f ;
478477 CurrentFilter = new IIRFilter ( IIRFilter . FilterTypes . Butterworth , 1 , IIRFilter . HzToRad ( 0.5f ) , 0.001f ) ;
479478 AdhesionFilter = new IIRFilter ( IIRFilter . FilterTypes . Butterworth , 1 , IIRFilter . HzToRad ( 1f ) , 0.001f ) ;
480479
@@ -1222,9 +1221,6 @@ public void MoveParamsToAxle()
12221221 {
12231222 LocomotiveAxle . SlipWarningTresholdPercent = SlipWarningThresholdPercent ;
12241223 LocomotiveAxle . AdhesionK = AdhesionK ;
1225- LocomotiveAxle . CurtiusKnifflerA = Curtius_KnifflerA ;
1226- LocomotiveAxle . CurtiusKnifflerB = Curtius_KnifflerB ;
1227- LocomotiveAxle . CurtiusKnifflerC = Curtius_KnifflerC ;
12281224 }
12291225 }
12301226
@@ -1686,8 +1682,6 @@ public override void InitializeMoving()
16861682 {
16871683 base . InitializeMoving ( ) ;
16881684 LocomotiveAxle . Reset ( Simulator . GameTime , SpeedMpS ) ;
1689- LocomotiveAxle . AxleSpeedMpS = SpeedMpS ;
1690- LocomotiveAxle . AdhesionConditions = ( float ) ( Simulator . Settings . AdhesionFactor ) * 0.01f ;
16911685 AdhesionFilter . Reset ( 0.5f ) ;
16921686 AverageForceN = MaxForceN * Train . MUThrottlePercent / 100 ;
16931687 float maxPowerW = MaxPowerW * Train . MUThrottlePercent * Train . MUThrottlePercent / 10000 ;
@@ -2646,16 +2640,16 @@ public void AdvancedAdhesion(float elapsedClockSeconds)
26462640 LocomotiveAxle . InertiaKgm2 = Math . Min ( AxleInertiaKgm2 , 40000 ) ;
26472641
26482642 //LocomotiveAxle.AxleRevolutionsInt.MinStep = LocomotiveAxle.InertiaKgm2 / MaxPowerW / 5.0f;
2649- LocomotiveAxle . AxleDiameterM = 2 * DriverWheelRadiusM ;
2643+ LocomotiveAxle . WheelRadiusM = DriverWheelRadiusM ;
2644+ LocomotiveAxle . DampingNs = MassKG / 1000.0f ;
2645+ LocomotiveAxle . FrictionN = MassKG / 1000.0f ;
26502646
26512647 if ( SlipControlSystem == SlipControlType . Full )
26522648 {
26532649 // Simple slip control
26542650 // Motive force is reduced to the maximum adhesive force
26552651 // In wheelslip situations, motive force is set to zero
2656- float umax = ( LocomotiveAxle . CurtiusKnifflerA / ( MpS . ToKpH ( Math . Abs ( SpeedMpS ) ) + LocomotiveAxle . CurtiusKnifflerB ) + LocomotiveAxle . CurtiusKnifflerC ) ; // Curtius - Kniffler equation
2657- umax *= LocomotiveAxle . AdhesionConditions ;
2658- MotiveForceN = Math . Sign ( MotiveForceN ) * Math . Min ( umax * LocomotiveAxle . AxleWeightN , Math . Abs ( MotiveForceN ) ) ;
2652+ MotiveForceN = Math . Sign ( MotiveForceN ) * Math . Min ( LocomotiveAxle . AdhesionLimit * LocomotiveAxle . AxleWeightN , Math . Abs ( MotiveForceN ) ) ;
26592653 if ( LocomotiveAxle . IsWheelSlip ) MotiveForceN = 0 ;
26602654 }
26612655
@@ -2666,8 +2660,11 @@ public void AdvancedAdhesion(float elapsedClockSeconds)
26662660 LocomotiveAxle . AxleWeightN = 9.81f * DrvWheelWeightKg ; //will be computed each time considering the tilting
26672661 LocomotiveAxle . DriveForceN = MotiveForceN ; //Total force applied to wheels
26682662 LocomotiveAxle . TrainSpeedMpS = SpeedMpS ; //Set the train speed of the axle mod
2663+ var watch = new Stopwatch ( ) ;
2664+ watch . Start ( ) ;
26692665 LocomotiveAxle . Update ( elapsedClockSeconds ) ; //Main updater of the axle model
2670-
2666+ watch . Stop ( ) ;
2667+ //AdhesionConditions = watch.ElapsedTicks / 1000.0f;
26712668 MotiveForceN = LocomotiveAxle . CompensatedAxleForceN ;
26722669 if ( elapsedClockSeconds > 0 )
26732670 {
@@ -3132,8 +3129,8 @@ public virtual void UpdateFrictionCoefficient(float elapsedClockSeconds)
31323129 if ( elapsedClockSeconds > 0 )
31333130 {
31343131 SaveAdhesionFilter = AdhesionFilter . Filter ( BaseFrictionCoefficientFactor + AdhesionRandom , elapsedClockSeconds ) ;
3135- LocomotiveAxle . AdhesionConditions = AdhesionMultiplier * SaveAdhesionFilter ;
3136- LocomotiveAxle . AdhesionConditions = MathHelper . Clamp ( LocomotiveAxle . AdhesionConditions , 0.05f , 2.5f ) ; // Avoids NaNs in axle speed computing
3132+ AdhesionConditions = MathHelper . Clamp ( AdhesionMultiplier * SaveAdhesionFilter , 0.05f , 2.5f ) ;
3133+ LocomotiveAxle . AdhesionLimit = AdhesionConditions * BaseuMax ;
31373134 }
31383135
31393136 // Set adhesion conditions for other steam locomotives
@@ -3143,7 +3140,7 @@ public virtual void UpdateFrictionCoefficient(float elapsedClockSeconds)
31433140 }
31443141 else
31453142 {
3146- LocomotiveCoefficientFrictionHUD = BaseuMax * LocomotiveAxle . AdhesionConditions ; // Set display value for HUD - diesel
3143+ LocomotiveCoefficientFrictionHUD = LocomotiveAxle . AdhesionLimit ; // Set display value for HUD - diesel
31473144 }
31483145
31493146
0 commit comments