Skip to content

Commit 1d4c5de

Browse files
committed
Automatic merge of T1.6-rc8-59-g2eb7441b08 and 11 pull requests
- Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc) - Pull request #1091 at 9b80fac: Automatic speed control - Pull request #1104 at 7919243: Handle simple adhesion within the axle module - Pull request #1115 at 270f22f: Do not activate ETS switch if no suitable cars are attached - Pull request #1120 at ba3c47f: Automatically Calculate Friction Values if Missing - Pull request #1121 at 91d2d26: Manually Override Articulation - Pull request #1124 at e241a0d: Built-in PBL2 brake controller - Pull request #1130 at 8ae6bb7: Fix F9 points to an incorrect car ID. - Pull request #1157 at 39cd994: Dynamic brake authorization by TCS - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1128 at 1d7643d: Particle Emitter Overhaul
13 parents f321ada + 2eb7441 + e10390b + 9b80fac + 7919243 + 270f22f + ba3c47f + 91d2d26 + e241a0d + 8ae6bb7 + 39cd994 + 5845a1a + 1d7643d commit 1d4c5de

File tree

4 files changed

+84
-69
lines changed

4 files changed

+84
-69
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6605,8 +6605,8 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds)
66056605
IndicatedHorsePowerHP += engine.IndicatedHorsePowerHP;
66066606
IndicatedHorsePowerHP = MathHelper.Clamp(IndicatedHorsePowerHP, 0, IndicatedHorsePowerHP);
66076607
}
6608-
//TODO - identify the maximum value for display??
6609-
PistonSpeedFtpMin = SteamEngines[0].PistonSpeedFtpMin;
6608+
//TODO - identify the maximum value for display??
6609+
PistonSpeedFtpMin = SteamEngines[0].PistonSpeedFtpMin;
66106610

66116611
// Find the maximum TE for debug i.e. @ start and full throttle
66126612
if (AbsTractionSpeedMpS < 1.0)
@@ -6724,8 +6724,8 @@ protected override void UpdateAxles(float elapsedClockSeconds)
67246724
axle.CurrentCurveRadiusM = CurrentCurveRadiusM;
67256725
axle.BogieRigidWheelBaseM = RigidWheelBaseM;
67266726
}
6727-
foreach (var engine in SteamEngines)
6728-
{
6727+
foreach (var engine in SteamEngines)
6728+
{
67296729
var axle = engine.AttachedAxle;
67306730
if (SteamEngineType == SteamEngineTypes.Geared || engine.AuxiliarySteamEngineType == SteamEngine.AuxiliarySteamEngineTypes.Booster)
67316731
// geared locomotive or booster locomotive
@@ -6739,7 +6739,7 @@ protected override void UpdateAxles(float elapsedClockSeconds)
67396739
float TotalWheelMomentofInertia = WheelMomentInertia + AxleMomentInertia; // Total MoI for generic wheelset
67406740
float TotalMomentInertia = TotalWheelMomentofInertia;
67416741
axle.InertiaKgm2 = TotalMomentInertia;
6742-
6742+
67436743
// Calculate internal resistance - IR = 3.8 * diameter of cylinder^2 * stroke * dia of drivers (all in inches) - This should reduce wheel force
67446744
axle.FrictionN = N.FromLbf(3.8f * Me.ToIn(engine.CylindersDiameterM) * Me.ToIn(engine.CylindersDiameterM) * Me.ToIn(engine.CylindersStrokeM) / (Me.ToIn(axle.WheelRadiusM * 2.0f)));
67456745
}
@@ -6758,7 +6758,7 @@ protected override void UpdateAxles(float elapsedClockSeconds)
67586758
float WheelMomentInertia = (wheelMassKG * axle.WheelRadiusM * axle.WheelRadiusM) / 2.0f;
67596759
float AxleMomentInertia = (AxleMassKG * AxleRadiusM * AxleRadiusM) / 2.0f;
67606760
float TotalWheelMomentofInertia = WheelMomentInertia + AxleMomentInertia; // Total MoI for generic wheelset
6761-
6761+
67626762
// The moment of inertia needs to be increased by the number of wheels in each set
67636763
TotalWheelMomentofInertia *= engine.AttachedAxle.NumWheelsetAxles;
67646764

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

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,8 @@ public void Initialize()
354354
else if (axle.DriveType == AxleDriveType.ForceDriven) numForce++;
355355
else if (axle.DriveType == AxleDriveType.MotorDriven) numMotor++;
356356
}
357+
float totalDriveWheelWeightKg = 0;
358+
float totalWheelWeightKg = 0;
357359
foreach (var axle in AxleList)
358360
{
359361
if (numMotor > 0 && axle.DriveType == AxleDriveType.ForceDriven) axle.DriveType = AxleDriveType.NotDriven;
@@ -366,7 +368,6 @@ public void Initialize()
366368
{
367369
if (axle.DriveType != AxleDriveType.NotDriven)
368370
{
369-
axle.BrakeForceFraction = 1.0f / (locomotive.DriveWheelOnlyBrakes ? numDriven : AxleList.Count);
370371
if (axle.WheelWeightKg <= 0) axle.WheelWeightKg = locomotive.DrvWheelWeightKg / numDriven;
371372
if (axle.NumWheelsetAxles <= 0) axle.NumWheelsetAxles = locomotive.LocoNumDrvAxles / numDriven;
372373
if (axle.WheelRadiusM <= 0) axle.WheelRadiusM = locomotive.DriverWheelRadiusM;
@@ -388,7 +389,6 @@ public void Initialize()
388389
if (axle.DriveType == AxleDriveType.NotDriven)
389390
{
390391
var wagon = Car as MSTSWagon;
391-
axle.BrakeForceFraction = locomotive != null && locomotive.DriveWheelOnlyBrakes ? 0 :1.0f / AxleList.Count;
392392
if (axle.WheelWeightKg <= 0)
393393
{
394394
if (locomotive != null) axle.WheelWeightKg = Math.Max((Car.MassKG - locomotive.DrvWheelWeightKg) / numNotDriven, 500);
@@ -402,6 +402,21 @@ public void Initialize()
402402
if (axle.AxleWeightN <= 0) axle.AxleWeightN = 9.81f * axle.WheelWeightKg; //remains fixed for diesel/electric locomotives, but varies for steam locomotives
403403
if (axle.DampingNs <= 0) axle.DampingNs = axle.WheelWeightKg / 1000.0f;
404404
if (axle.FrictionN <= 0) axle.FrictionN = axle.WheelWeightKg / 1000.0f;
405+
406+
if (axle.DriveType != AxleDriveType.NotDriven) totalDriveWheelWeightKg += axle.WheelWeightKg;
407+
totalWheelWeightKg += axle.WheelWeightKg;
408+
}
409+
foreach (var axle in AxleList)
410+
{
411+
var locomotive = Car as MSTSLocomotive;
412+
if (axle.DriveType == AxleDriveType.NotDriven)
413+
{
414+
axle.BrakeForceFraction = locomotive == null || !locomotive.DriveWheelOnlyBrakes ? axle.WheelWeightKg / totalWheelWeightKg : 0;
415+
}
416+
else
417+
{
418+
axle.BrakeForceFraction = axle.WheelWeightKg / (locomotive != null && locomotive.DriveWheelOnlyBrakes ? totalDriveWheelWeightKg : totalWheelWeightKg);
419+
}
405420
axle.Initialize();
406421
}
407422
}

Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,89 +1123,89 @@ public void InitializeCarTemperatures()
11231123
public virtual void UpdateBrakeSlideCalculation()
11241124
{
11251125
if (this is MSTSLocomotive locomotive)
1126+
{
1127+
// If advanced adhesion model indicates wheel slip warning, then check other conditions (throttle and brake force) to determine whether it is a wheel slip or brake skid
1128+
if (WheelSlipWarning && ThrottlePercent < 0.1f && BrakeRetardForceN > 25.0)
11261129
{
1127-
// If advanced adhesion model indicates wheel slip warning, then check other conditions (throttle and brake force) to determine whether it is a wheel slip or brake skid
1128-
if (WheelSlipWarning && ThrottlePercent < 0.1f && BrakeRetardForceN > 25.0)
1129-
{
1130-
BrakeSkidWarning = true; // set brake skid flag true
1131-
}
1132-
else
1133-
{
1134-
BrakeSkidWarning = false;
1135-
}
1130+
BrakeSkidWarning = true; // set brake skid flag true
1131+
}
1132+
else
1133+
{
1134+
BrakeSkidWarning = false;
1135+
}
11361136

1137-
// If advanced adhesion model indicates wheel slip, then check other conditions (throttle and brake force) to determine whether it is a wheel slip or brake skid
1138-
if (WheelSlip && ThrottlePercent < 0.1f && BrakeRetardForceN > 25.0)
1139-
{
1140-
BrakeSkid = true; // set brake skid flag true
1141-
}
1142-
else
1143-
{
1144-
BrakeSkid = false;
1145-
}
1137+
// If advanced adhesion model indicates wheel slip, then check other conditions (throttle and brake force) to determine whether it is a wheel slip or brake skid
1138+
if (WheelSlip && ThrottlePercent < 0.1f && BrakeRetardForceN > 25.0)
1139+
{
1140+
BrakeSkid = true; // set brake skid flag true
11461141
}
1142+
else
1143+
{
1144+
BrakeSkid = false;
1145+
}
1146+
}
11471147
// Only apply slide, and advanced brake friction, if advanced adhesion is selected, simplecontrolphysics is not set, and it is a Player train
11481148
else if (Simulator.UseAdvancedAdhesion && !Simulator.Settings.SimpleControlPhysics && IsPlayerTrain)
1149+
{
1150+
// Determine whether car is experiencing a wheel slip during braking
1151+
if (!BrakeSkidWarning && AbsSpeedMpS > 0.01)
11491152
{
1150-
// Determine whether car is experiencing a wheel slip during braking
1151-
if (!BrakeSkidWarning && AbsSpeedMpS > 0.01)
1152-
{
1153-
var wagonbrakeadhesiveforcen = MassKG * GravitationalAccelerationMpS2 * Train.WagonCoefficientFriction; // Adhesive force wheel normal
1153+
var wagonbrakeadhesiveforcen = MassKG * GravitationalAccelerationMpS2 * Train.WagonCoefficientFriction; // Adhesive force wheel normal
11541154

11551155
if (BrakeRetardForceN > 0.80f * WagonBrakeAdhesiveForceN && ThrottlePercent > 0.01)
1156-
{
1157-
BrakeSkidWarning = true; // wagon wheel is about to slip
1158-
}
1159-
}
1160-
else if (BrakeRetardForceN < 0.75f * WagonBrakeAdhesiveForceN)
11611156
{
1162-
BrakeSkidWarning = false; // wagon wheel is back to normal
1157+
BrakeSkidWarning = true; // wagon wheel is about to slip
11631158
}
1159+
}
1160+
else if (BrakeRetardForceN < 0.75f * WagonBrakeAdhesiveForceN)
1161+
{
1162+
BrakeSkidWarning = false; // wagon wheel is back to normal
1163+
}
11641164

1165-
// Reset WSP dump valve lockout
1166-
if (WheelBrakeSlideProtectionFitted && WheelBrakeSlideProtectionDumpValveLockout && (ThrottlePercent > 0.01 || AbsSpeedMpS <= 0.002))
1167-
{
1168-
WheelBrakeSlideProtectionTimerS = wheelBrakeSlideTimerResetValueS;
1169-
WheelBrakeSlideProtectionDumpValveLockout = false;
1165+
// Reset WSP dump valve lockout
1166+
if (WheelBrakeSlideProtectionFitted && WheelBrakeSlideProtectionDumpValveLockout && (ThrottlePercent > 0.01 || AbsSpeedMpS <= 0.002))
1167+
{
1168+
WheelBrakeSlideProtectionTimerS = wheelBrakeSlideTimerResetValueS;
1169+
WheelBrakeSlideProtectionDumpValveLockout = false;
11701170

1171-
}
1171+
}
11721172

1173-
// Calculate adhesive force based upon whether in skid or not
1174-
if (BrakeSkid)
1175-
{
1176-
WagonBrakeAdhesiveForceN = MassKG * GravitationalAccelerationMpS2 * SkidFriction; // Adhesive force if wheel skidding
1177-
}
1178-
else
1179-
{
1180-
WagonBrakeAdhesiveForceN = MassKG * GravitationalAccelerationMpS2 * Train.WagonCoefficientFriction; // Adhesive force wheel normal
1181-
}
1173+
// Calculate adhesive force based upon whether in skid or not
1174+
if (BrakeSkid)
1175+
{
1176+
WagonBrakeAdhesiveForceN = MassKG * GravitationalAccelerationMpS2 * SkidFriction; // Adhesive force if wheel skidding
1177+
}
1178+
else
1179+
{
1180+
WagonBrakeAdhesiveForceN = MassKG * GravitationalAccelerationMpS2 * Train.WagonCoefficientFriction; // Adhesive force wheel normal
1181+
}
11821182

11831183

1184-
// Test if wheel forces are high enough to induce a slip. Set slip flag if slip occuring
1185-
if (!BrakeSkid && AbsSpeedMpS > 0.01) // Train must be moving forward to experience skid
1186-
{
1184+
// Test if wheel forces are high enough to induce a slip. Set slip flag if slip occuring
1185+
if (!BrakeSkid && AbsSpeedMpS > 0.01) // Train must be moving forward to experience skid
1186+
{
11871187
if (BrakeRetardForceN > WagonBrakeAdhesiveForceN)
1188-
{
1189-
BrakeSkid = true; // wagon wheel is slipping
1190-
var message = "Car ID: " + CarID + " - experiencing braking force wheel skid.";
1191-
Simulator.Confirmer.Message(ConfirmLevel.Warning, message);
1192-
}
1193-
}
1194-
else if (BrakeSkid && AbsSpeedMpS > 0.01)
11951188
{
1196-
if (BrakeRetardForceN < WagonBrakeAdhesiveForceN || BrakeForceN == 0.0f)
1197-
{
1198-
BrakeSkid = false; // wagon wheel is not slipping
1199-
}
1200-
1189+
BrakeSkid = true; // wagon wheel is slipping
1190+
var message = "Car ID: " + CarID + " - experiencing braking force wheel skid.";
1191+
Simulator.Confirmer.Message(ConfirmLevel.Warning, message);
12011192
}
1202-
else
1193+
}
1194+
else if (BrakeSkid && AbsSpeedMpS > 0.01)
1195+
{
1196+
if (BrakeRetardForceN < WagonBrakeAdhesiveForceN || BrakeForceN == 0.0f)
12031197
{
12041198
BrakeSkid = false; // wagon wheel is not slipping
12051199
}
1200+
1201+
}
1202+
else
1203+
{
1204+
BrakeSkid = false; // wagon wheel is not slipping
1205+
}
12061206
BrakeForceN = BrakeRetardForceN;
12071207
if (BrakeSkid) BrakeForceN = Math.Min(BrakeForceN, MassKG * GravitationalAccelerationMpS2 * SkidFriction);
1208-
}
1208+
}
12091209
else // set default values if simple adhesion model
12101210
{
12111211
BrakeSkid = false; // wagon wheel is not slipping

Source/RunActivity/Viewer3D/InfoDisplay.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ void DataLoggerLog()
182182
Logger.Data(Viewer.PlayerLocomotive.ThrottlePercent.ToString("F0"));
183183
Logger.Data(Viewer.PlayerLocomotive.MotiveForceN.ToString("F0"));
184184
Logger.Data(Viewer.PlayerLocomotive.BrakeForceN.ToString("F0"));
185-
Logger.Data((Viewer.PlayerLocomotive as MSTSLocomotive).LocomotiveAxles.AxleMotiveForceN.ToString("F2"));
185+
Logger.Data((Viewer.PlayerLocomotive as MSTSLocomotive).LocomotiveAxles.AxleMotiveForceN.ToString("F2"));
186186
Logger.Data((Viewer.PlayerLocomotive as MSTSLocomotive).LocomotiveAxles.SlipSpeedPercent.ToString("F1"));
187187
DataLoggerLogSpeed(Viewer.PlayerLocomotive.SpeedMpS);
188188
DataLoggerLogSpeed(Viewer.PlayerTrain.AllowedMaxSpeedMpS);

0 commit comments

Comments
 (0)