Skip to content

Commit 05bff15

Browse files
committed
Add simple slip control
1 parent 14c0a12 commit 05bff15

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2188,6 +2188,7 @@ protected virtual void UpdateTractiveForce(float elapsedClockSeconds, float t, f
21882188
{
21892189
// Method to set force and power info
21902190
// An alternative method in the steam locomotive will override this and input force and power info for it.
2191+
21912192
if (LocomotivePowerSupply.MainPowerSupplyOn && Direction != Direction.N)
21922193
{
21932194

@@ -2589,6 +2590,17 @@ public void AdvancedAdhesion(float elapsedClockSeconds)
25892590
//LocomotiveAxle.AxleRevolutionsInt.MinStep = LocomotiveAxle.InertiaKgm2 / MaxPowerW / 5.0f;
25902591
LocomotiveAxle.AxleDiameterM = 2*DriverWheelRadiusM;
25912592

2593+
if (AntislipControl == AntislipControlType.Full)
2594+
{
2595+
// Simple slip control
2596+
// Motive force is reduced to the maximum adhesive force
2597+
// In wheelslip situations, motive force is set to zero
2598+
float umax = (LocomotiveAxle.CurtiusKnifflerA / (MpS.ToKpH(Math.Abs(SpeedMpS)) + LocomotiveAxle.CurtiusKnifflerB) + LocomotiveAxle.CurtiusKnifflerC); // Curtius - Kniffler equation
2599+
umax *= LocomotiveAxle.AdhesionConditions;
2600+
MotiveForceN = Math.Sign(MotiveForceN) * Math.Min(umax * LocomotiveAxle.AxleWeightN, Math.Abs(MotiveForceN));
2601+
if (LocomotiveAxle.IsWheelSlip) MotiveForceN = 0;
2602+
}
2603+
25922604
//Set axle model parameters
25932605

25942606
// Inputs
@@ -2597,6 +2609,7 @@ public void AdvancedAdhesion(float elapsedClockSeconds)
25972609
LocomotiveAxle.DriveForceN = MotiveForceN; //Total force applied to wheels
25982610
LocomotiveAxle.TrainSpeedMpS = SpeedMpS; //Set the train speed of the axle mod
25992611
LocomotiveAxle.Update(elapsedClockSeconds); //Main updater of the axle model
2612+
26002613
MotiveForceN = LocomotiveAxle.CompensatedAxleForceN;
26012614
if (elapsedClockSeconds > 0)
26022615
{

Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,12 @@ public class MSTSWagon : TrainCar
146146
public float Curtius_KnifflerB = 44.0f; // (adhesion coeficient) umax = --------------------- + C
147147
public float Curtius_KnifflerC = 0.161f; // speedMpS * 3.6 + B
148148
public float AdhesionK = 0.7f; //slip characteristics slope
149-
//public AntislipControl AntislipControl = AntislipControl.None;
149+
public enum AntislipControlType
150+
{
151+
None,
152+
Full
153+
}
154+
public AntislipControlType AntislipControl = AntislipControlType.None;
150155
public float AxleInertiaKgm2; //axle inertia
151156
public float AdhesionDriveWheelRadiusM;
152157
public float WheelSpeedMpS;
@@ -1361,8 +1366,9 @@ public virtual void Parse(string lowercasetoken, STFReader stf)
13611366
stf.SkipRestOfBlock();
13621367
break;
13631368
case "wagon(ortsadhesion(ortsantislip":
1364-
stf.MustMatch("(");
1365-
//AntislipControl = stf.ReadStringBlock(null);
1369+
string type = stf.ReadStringBlock("none").ToLowerInvariant();
1370+
if (type == "full") AntislipControl = AntislipControlType.Full;
1371+
else AntislipControl = AntislipControlType.None;
13661372
stf.SkipRestOfBlock();
13671373
break;
13681374
case "wagon(ortsadhesion(wheelset(axle(ortsinertia":
@@ -1567,6 +1573,7 @@ public virtual void Copy(MSTSWagon copy)
15671573
Curtius_KnifflerC = copy.Curtius_KnifflerC;
15681574
AdhesionK = copy.AdhesionK;
15691575
AxleInertiaKgm2 = copy.AxleInertiaKgm2;
1576+
AntislipControl = copy.AntislipControl;
15701577
AdhesionDriveWheelRadiusM = copy.AdhesionDriveWheelRadiusM;
15711578
SlipWarningThresholdPercent = copy.SlipWarningThresholdPercent;
15721579
Lights = copy.Lights;

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerTransmissions/ElectricMotor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public virtual void Update(float timeSpan)
115115
//revolutionsRad += timeSpan / inertiaKgm2 * (developedTorqueNm + loadTorqueNm + (revolutionsRad == 0.0 ? 0.0 : frictionTorqueNm));
116116
//if (revolutionsRad < 0.0)
117117
// revolutionsRad = 0.0;
118-
//temperatureK = tempIntegrator.Integrate(timeSpan, 1.0f/(SpecificHeatCapacityJ_kg_C * WeightKg)*((powerLossesW - CoolingPowerW) / (ThermalCoeffJ_m2sC * SurfaceM) - temperatureK));
118+
temperatureK = tempIntegrator.Integrate(timeSpan, (temperatureK) => 1.0f/(SpecificHeatCapacityJ_kg_C * WeightKg)*((powerLossesW - CoolingPowerW) / (ThermalCoeffJ_m2sC * SurfaceM) - temperatureK));
119119

120120
}
121121

0 commit comments

Comments
 (0)