Skip to content

Commit a2a9bbc

Browse files
authored
Merge pull request #1104 from cesarBLG/simple-adhesion-axle
Handle simple adhesion within the axle module
2 parents 2eb7441 + 7919243 commit a2a9bbc

File tree

16 files changed

+731
-597
lines changed

16 files changed

+731
-597
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSDieselLocomotive.cs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public override void Parse(string lowercasetoken, STFReader stf)
178178
var transmissionType = stf.ReadString();
179179
try
180180
{
181-
DieselTransmissionType = (DieselTransmissionTypes)Enum.Parse(typeof(DieselTransmissionTypes), transmissionType.First().ToString().ToUpper() + transmissionType.Substring(1));
181+
DieselTransmissionType = (DieselTransmissionTypes)Enum.Parse(typeof(DieselTransmissionTypes), transmissionType, true);
182182
}
183183
catch
184184
{
@@ -699,27 +699,12 @@ protected override void UpdateTractionForce(float elapsedClockSeconds)
699699
{
700700
if (DieselEngines.HasGearBox && (TractiveForceCurves == null || DieselTransmissionType == MSTSDieselLocomotive.DieselTransmissionTypes.Mechanic))
701701
{
702-
TractiveForceN = TractionForceN = DieselEngines.TractiveForceN;
702+
TractionForceN = DieselEngines.TractiveForceN;
703703
return;
704704
}
705705
base.UpdateTractionForce(elapsedClockSeconds);
706706
}
707707

708-
protected override void UpdateAxleDriveForce()
709-
{
710-
/* TODO: connect different engines to different axles
711-
if (DieselEngines.HasGearBox && DieselTransmissionType == MSTSDieselLocomotive.DieselTransmissionTypes.Mechanic)
712-
{
713-
foreach (var de in DieselEngines)
714-
{
715-
}
716-
}
717-
else */
718-
{
719-
base.UpdateAxleDriveForce();
720-
}
721-
}
722-
723708
/// <summary>
724709
/// This function updates periodically the locomotive's sound variables.
725710
/// </summary>

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

Lines changed: 175 additions & 172 deletions
Large diffs are not rendered by default.

Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs

Lines changed: 80 additions & 143 deletions
Large diffs are not rendered by default.

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ public enum WindowState
172172
public float SlipWarningThresholdPercent = 70;
173173
public MSTSNotchController WeightLoadController; // Used to control freight loading in freight cars
174174

175-
public Axles LocomotiveAxles; // Only used at locomotives for efficiency
175+
public Axles LocomotiveAxles;
176176

177177
// Colours for smoke and steam effects
178178
public Color ExhaustTransientColor = Color.Black;
@@ -2370,6 +2370,14 @@ private void UpdateTrainBaseResistance()
23702370
{
23712371
UpdateTrainBaseResistance_ORTS();
23722372
}
2373+
2374+
// TODO: the Davis A and B parameters already include rolling friction. Thus, there is an over-estimation
2375+
// of the rolling friction forces, due to a small amount of friction being inserted to the axle module.
2376+
// This needs to be fixed by inserting the Davis A and B parameters to the axle, to the 'friction' and
2377+
// 'damping' axle parameters respectively, and their calculation must be removed from UpdateTrainBaseResistance_ methods
2378+
// This means that low/high speed friction has to be calculated and passed to the axle module elsewhere
2379+
// Davis C is related to air speed and must be calculated here and not inside the axle module
2380+
FrictionForceN += RollingFrictionForceN;
23732381
}
23742382

23752383
/// <summary>

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Brakes/MSTS/AirSinglePipe.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,14 +1990,6 @@ public override void Update(float elapsedClockSeconds)
19901990
Car.HuDBrakeShoeFriction = Car.GetBrakeShoeFrictionCoefficientHuD();
19911991

19921992
Car.BrakeRetardForceN = Car.BrakeShoeForceN * brakeShoeFriction; // calculates value of force applied to wheel, independent of wheel skid
1993-
if (Car.BrakeSkid) // Test to see if wheels are skiding to excessive brake force
1994-
{
1995-
Car.BrakeForceN = Car.BrakeShoeForceN * Car.SkidFriction; // if excessive brakeforce, wheel skids, and loses adhesion
1996-
}
1997-
else
1998-
{
1999-
Car.BrakeForceN = Car.BrakeShoeForceN * brakeShoeFriction; // In advanced adhesion model brake shoe coefficient varies with speed, in simple model constant force applied as per value in WAG file, will vary with wheel skid.
2000-
}
20011993

20021994
// sound trigger checking runs every half second, to avoid the problems caused by the jumping BrakeLine1PressurePSI value, and also saves cpu time :)
20031995
if (SoundTriggerCounter >= 0.5f)

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Brakes/MSTS/ManualBraking.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,6 @@ public override void Update(float elapsedClockSeconds)
232232
Car.HuDBrakeShoeFriction = Car.GetBrakeShoeFrictionCoefficientHuD();
233233

234234
Car.BrakeRetardForceN = Car.BrakeShoeForceN * brakeShoeFriction; // calculates value of force applied to wheel, independent of wheel skid
235-
if (Car.BrakeSkid) // Test to see if wheels are skiding to excessive brake force
236-
{
237-
Car.BrakeForceN = Car.BrakeShoeForceN * Car.SkidFriction; // if excessive brakeforce, wheel skids, and loses adhesion
238-
}
239-
else
240-
{
241-
Car.BrakeForceN = Car.BrakeShoeForceN * brakeShoeFriction; // In advanced adhesion model brake shoe coefficient varies with speed, in simple model constant force applied as per value in WAG file, will vary with wheel skid.
242-
}
243235

244236
}
245237

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Brakes/MSTS/SingleTransferPipe.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,6 @@ public override void Update(float elapsedClockSeconds)
170170
UpdateAngleCockState(AngleCockBOpen, ref AngleCockBOpenAmount, ref AngleCockBOpenTime);
171171

172172
Car.BrakeRetardForceN = ( Car.MaxHandbrakeForceN * HandbrakePercent / 100) * brakeShoeFriction; // calculates value of force applied to wheel, independent of wheel skid
173-
if (Car.BrakeSkid) // Test to see if wheels are skiding to excessive brake force
174-
{
175-
Car.BrakeForceN = (Car.MaxHandbrakeForceN * HandbrakePercent / 100) * Car.SkidFriction; // if excessive brakeforce, wheel skids, and loses adhesion
176-
}
177-
else
178-
{
179-
Car.BrakeForceN = (Car.MaxHandbrakeForceN * HandbrakePercent / 100) * brakeShoeFriction; // In advanced adhesion model brake shoe coefficient varies with speed, in simple model constant force applied as per value in WAG file, will vary with wheel skid.
180-
}
181-
182173
}
183174
}
184175
}

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Brakes/MSTS/StraightVacuumSinglePipe.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,6 @@ public override void Update(float elapsedClockSeconds)
168168
Car.HuDBrakeShoeFriction = Car.GetBrakeShoeFrictionCoefficientHuD();
169169

170170
Car.BrakeRetardForceN = Car.BrakeShoeForceN * brakeShoeFriction; // calculates value of force applied to wheel, independent of wheel skid
171-
if (Car.BrakeSkid) // Test to see if wheels are skiding due to excessive brake force
172-
{
173-
Car.BrakeForceN = Car.BrakeShoeForceN * Car.SkidFriction; // if excessive brakeforce, wheel skids, and loses adhesion
174-
}
175-
else
176-
{
177-
Car.BrakeForceN = Car.BrakeShoeForceN * brakeShoeFriction; // In advanced adhesion model brake shoe coefficient varies with speed, in simple odel constant force applied as per value in WAG file, will vary with wheel skid.
178-
}
179171

180172
// If wagons are not attached to the locomotive, then set wagon BC pressure to same as locomotive in the Train brake line
181173
if (!Car.Train.WagonsAttached && (Car.WagonType == MSTSWagon.WagonTypes.Engine || Car.WagonType == MSTSWagon.WagonTypes.Tender))

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Brakes/MSTS/VacuumSinglePipe.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -621,15 +621,6 @@ public override void Update(float elapsedClockSeconds)
621621
Car.HuDBrakeShoeFriction = Car.GetBrakeShoeFrictionCoefficientHuD();
622622

623623
Car.BrakeRetardForceN = Car.BrakeShoeForceN * brakeShoeFriction; // calculates value of force applied to wheel, independent of wheel skid
624-
if (Car.BrakeSkid) // Test to see if wheels are skiding due to excessive brake force
625-
{
626-
Car.BrakeForceN = Car.BrakeShoeForceN * Car.SkidFriction; // if excessive brakeforce, wheel skids, and loses adhesion
627-
}
628-
else
629-
{
630-
Car.BrakeForceN = Car.BrakeShoeForceN * brakeShoeFriction; // In advanced adhesion model brake shoe coefficient varies with speed, in simple model constant force applied as per value in WAG file, will vary with wheel skid.
631-
}
632-
633624

634625
// sound trigger checking runs every 4th update, to avoid the problems caused by the jumping BrakeLine1PressurePSI value, and also saves cpu time :)
635626
if (SoundTriggerCounter >= 4)

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/CruiseControl.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,10 +1495,10 @@ public float GetDataOf(CabViewControl cvc)
14951495
data = Locomotive.TractiveForceN;
14961496
break;
14971497
case CABViewControlTypes.ORTS_MOTIVE_FORCE_KILONEWTON:
1498-
if (Locomotive.TractionForceN >0)
1499-
data = (float)Math.Round(Locomotive.TractionForceN / 1000, 0);
1500-
else if (Locomotive.DynamicBrakeForceN > 0)
1498+
if (Locomotive.DynamicBrake)
15011499
data = -(float)Math.Round(Locomotive.DynamicBrakeForceN / 1000, 0);
1500+
else
1501+
data = (float)Math.Round(Locomotive.TractionForceN / 1000, 0);
15021502
break;
15031503
case CABViewControlTypes.ORTS_MAXIMUM_FORCE:
15041504
data = Locomotive.MaxForceN;

0 commit comments

Comments
 (0)