@@ -214,6 +214,12 @@ public float CurrentLocomotiveSteamHeatBoilerWaterCapacityL
214214 //float DebugTimer = 0.0f;
215215
216216 // Adhesion parameters
217+ public enum SlipControlType
218+ {
219+ None ,
220+ Full
221+ }
222+ public SlipControlType SlipControlSystem = SlipControlType . Full ;
217223 float BaseFrictionCoefficientFactor ; // Factor used to adjust Curtius formula depending upon weather conditions
218224 public float SteamStaticWheelForce ;
219225 public float SteamTangentialWheelForce ;
@@ -426,6 +432,13 @@ public float OdometerM
426432 public float DynamicBrakeIntervention = - 1 ;
427433 protected float PreviousDynamicBrakeIntervention = - 1 ;
428434
435+ public enum ElectricMotorTypes
436+ {
437+ AC ,
438+ DC
439+ }
440+ public ElectricMotorTypes ElectricMotorType ;
441+
429442 public ILocomotivePowerSupply LocomotivePowerSupply => PowerSupply as ILocomotivePowerSupply ;
430443 public ScriptedTrainControlSystem TrainControlSystem ;
431444
@@ -862,6 +875,18 @@ public override void Parse(string lowercasetoken, STFReader stf)
862875 case "engine(dieselenginespeedofmaxtractiveeffort" : MSTSSpeedOfMaxContinuousForceMpS = stf . ReadFloatBlock ( STFReader . UNITS . Speed , null ) ; break ;
863876 case "engine(maxvelocity" : MaxSpeedMpS = stf . ReadFloatBlock ( STFReader . UNITS . Speed , null ) ; break ;
864877 case "engine(ortsunloadingspeed" : UnloadingSpeedMpS = stf . ReadFloatBlock ( STFReader . UNITS . Speed , null ) ; break ;
878+ case "engine(ortsslipcontrolsystem" :
879+ stf . MustMatch ( "(" ) ;
880+ string slipControlType = stf . ReadString ( ) . ToLowerInvariant ( ) ;
881+ try
882+ {
883+ SlipControlSystem = ( SlipControlType ) Enum . Parse ( typeof ( SlipControlType ) , slipControlType . First ( ) . ToString ( ) . ToUpper ( ) + slipControlType . Substring ( 1 ) ) ;
884+ }
885+ catch
886+ {
887+ STFException . TraceWarning ( stf , "Skipped unknown slip control system " + slipControlType ) ;
888+ }
889+ break ;
865890 case "engine(type" :
866891 stf . MustMatch ( "(" ) ;
867892 var engineType = stf . ReadString ( ) ;
@@ -874,6 +899,18 @@ public override void Parse(string lowercasetoken, STFReader stf)
874899 STFException . TraceWarning ( stf , "Skipped unknown engine type " + engineType ) ;
875900 }
876901 break ;
902+ case "engine(ortselectricmotortype" :
903+ stf . MustMatch ( "(" ) ;
904+ string electricMotorType = stf . ReadString ( ) . ToUpper ( ) ;
905+ try
906+ {
907+ ElectricMotorType = ( ElectricMotorTypes ) Enum . Parse ( typeof ( ElectricMotorTypes ) , electricMotorType ) ;
908+ }
909+ catch
910+ {
911+ STFException . TraceWarning ( stf , "Skipped unknown electric motor type " + electricMotorType ) ;
912+ }
913+ break ;
877914
878915 case "engine(enginecontrollers(throttle" : ThrottleController = new MSTSNotchController ( stf ) ; break ;
879916 case "engine(enginecontrollers(regulator" : ThrottleController = new MSTSNotchController ( stf ) ; break ;
@@ -1070,7 +1107,9 @@ public override void Copy(MSTSWagon copy)
10701107 MaxCurrentA = locoCopy . MaxCurrentA ;
10711108 MaxSpeedMpS = locoCopy . MaxSpeedMpS ;
10721109 UnloadingSpeedMpS = locoCopy . UnloadingSpeedMpS ;
1110+ SlipControlSystem = locoCopy . SlipControlSystem ;
10731111 EngineType = locoCopy . EngineType ;
1112+ ElectricMotorType = locoCopy . ElectricMotorType ;
10741113 TractiveForceCurves = locoCopy . TractiveForceCurves ;
10751114 MaxContinuousForceN = locoCopy . MaxContinuousForceN ;
10761115 SpeedOfMaxContinuousForceMpS = locoCopy . SpeedOfMaxContinuousForceMpS ;
@@ -1893,7 +1932,6 @@ public override void Update(float elapsedClockSeconds)
18931932 DynamicBrakeController . CurrentValue * 100 ) ;
18941933 }
18951934
1896-
18971935 // SimpleControlPhysics and if locomotive is a control car advanced adhesion will be "disabled".
18981936 if ( Simulator . UseAdvancedAdhesion && ! Simulator . Settings . SimpleControlPhysics && EngineType != EngineTypes . Control )
18991937 {
@@ -2199,13 +2237,25 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds, float t, f
21992237 // More modern locomotive have a more sophisticated system that eliminates slip in the majority (if not all circumstances).
22002238 // Simple adhesion control does not have any slip control feature built into it.
22012239 // TODO - a full review of slip/no slip control.
2202- if ( WheelSlip && AdvancedAdhesionModel )
2240+ if ( ElectricMotorType == ElectricMotorTypes . AC )
22032241 {
2204- AbsTractionSpeedMpS = AbsWheelSpeedMpS ;
2242+ AbsTractionSpeedMpS = AbsSpeedMpS ;
2243+ if ( AbsWheelSpeedMpS > 1.1 * MaxSpeedMpS )
2244+ {
2245+ AverageForceN = TractiveForceN = 0 ;
2246+ return ;
2247+ }
22052248 }
22062249 else
22072250 {
2208- AbsTractionSpeedMpS = AbsSpeedMpS ;
2251+ if ( WheelSlip && AdvancedAdhesionModel )
2252+ {
2253+ AbsTractionSpeedMpS = AbsWheelSpeedMpS ;
2254+ }
2255+ else
2256+ {
2257+ AbsTractionSpeedMpS = AbsSpeedMpS ;
2258+ }
22092259 }
22102260
22112261 if ( TractiveForceCurves == null )
@@ -2297,7 +2347,7 @@ public void ConfirmWheelslip(float elapsedClockSeconds)
22972347 if ( AdvancedAdhesionModel )
22982348 {
22992349 // Wheelslip
2300- if ( LocomotiveAxle . IsWheelSlip )
2350+ if ( WheelSlip )
23012351 {
23022352 if ( WheelslipState != Wheelslip . Occurring )
23032353 {
@@ -2307,7 +2357,7 @@ public void ConfirmWheelslip(float elapsedClockSeconds)
23072357 }
23082358 else
23092359 {
2310- if ( LocomotiveAxle . IsWheelSlipWarning )
2360+ if ( WheelSlipWarning )
23112361 {
23122362 if ( WheelslipState != Wheelslip . Warning )
23132363 {
@@ -2590,7 +2640,7 @@ public void AdvancedAdhesion(float elapsedClockSeconds)
25902640 //LocomotiveAxle.AxleRevolutionsInt.MinStep = LocomotiveAxle.InertiaKgm2 / MaxPowerW / 5.0f;
25912641 LocomotiveAxle . AxleDiameterM = 2 * DriverWheelRadiusM ;
25922642
2593- if ( AntislipControl == AntislipControlType . Full )
2643+ if ( SlipControlSystem == SlipControlType . Full )
25942644 {
25952645 // Simple slip control
25962646 // Motive force is reduced to the maximum adhesive force
@@ -2614,7 +2664,7 @@ public void AdvancedAdhesion(float elapsedClockSeconds)
26142664 if ( elapsedClockSeconds > 0 )
26152665 {
26162666 WheelSlip = LocomotiveAxle . IsWheelSlip ; //Get the wheelslip indicator
2617- WheelSlipWarning = LocomotiveAxle . IsWheelSlipWarning ;
2667+ WheelSlipWarning = LocomotiveAxle . IsWheelSlipWarning && SlipControlSystem != SlipControlType . Full ;
26182668 }
26192669 WheelSpeedMpS = LocomotiveAxle . AxleSpeedMpS ;
26202670 }
@@ -5017,7 +5067,7 @@ public virtual float GetDataOf(CabViewControl cvc)
50175067 if ( activeloco . DieselEngines [ 0 ] != null )
50185068 {
50195069 if ( activeloco . AdvancedAdhesionModel && Train . TrainType != Train . TRAINTYPE . AI_PLAYERHOSTING )
5020- data = activeloco . LocomotiveAxle . IsWheelSlipWarning ? 1 : 0 ;
5070+ data = activeloco . WheelSlipWarning ? 1 : 0 ;
50215071 else
50225072 data = activeloco . WheelSlip ? 1 : 0 ;
50235073
@@ -5028,7 +5078,7 @@ public virtual float GetDataOf(CabViewControl cvc)
50285078 else
50295079 {
50305080 if ( AdvancedAdhesionModel && Train . TrainType != Train . TRAINTYPE . AI_PLAYERHOSTING )
5031- data = LocomotiveAxle . IsWheelSlipWarning ? 1 : 0 ;
5081+ data = WheelSlipWarning ? 1 : 0 ;
50325082 else
50335083 data = WheelSlip ? 1 : 0 ;
50345084 }
0 commit comments