Skip to content

Commit 1428a2e

Browse files
committed
Automatic merge of T1.5.1-866-gbae4730e2 and 16 pull requests
- Pull request #570 at 3539862: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #882 at 9c456aa: Blueprint/train car operations UI window - Pull request #885 at 8f94333: feat: Add notifications to Menu - Pull request #886 at 6c0785b: Scene viewer extension to TrackViewer - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #897 at 42f1dd9: feat: Improved system information collection - Pull request #903 at 0d6d045: Downloading route content (Github, zip) - Pull request #907 at 9b0b04f: Bug fix for https://bugs.launchpad.net/or/+bug/2047300 Dynamic tracks disappear after long tunnel - Pull request #908 at ad3362c: feat: supports switching adhesion precisions - Pull request #911 at 6834af0: docs: Add refactoring as a special type of PR - Pull request #912 at 659396e: New Triple Valve Features Vol. 2 - Pull request #914 at adc9bd7: Adjustments to Duplex steam - Pull request #915 at 6d911d7: Correct calculation error with curve friction
18 parents 1ff91d1 + bae4730 + 3539862 + d00beb9 + f92de76 + 9c456aa + 8f94333 + 6c0785b + 1f5ba4c + 5866028 + 42f1dd9 + 0d6d045 + 9b0b04f + ad3362c + 6834af0 + 659396e + adc9bd7 + 6d911d7 commit 1428a2e

File tree

6 files changed

+75
-15
lines changed

6 files changed

+75
-15
lines changed

Source/Orts.Simulation/Simulation/Physics/Train.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ public TrainCar LastCar
155155

156156
public bool IsWheelSlipWarninq;
157157
public bool IsWheelSlip;
158+
public bool HuDIsWheelSlipWarninq;
159+
public bool HuDIsWheelSlip;
158160
public bool IsBrakeSkid;
159161

160162
public bool HotBoxSetOnTrain = false;
@@ -1955,6 +1957,8 @@ public virtual void physicsUpdate(float elapsedClockSeconds)
19551957

19561958
bool whlslp = false;
19571959
bool whlslpwrn = false;
1960+
bool hudwhlslp = false;
1961+
bool hudwhlslpwrn = false;
19581962
bool whlskd = false;
19591963

19601964
TrainCar uncoupleBehindCar = null;
@@ -1981,6 +1985,12 @@ public virtual void physicsUpdate(float elapsedClockSeconds)
19811985
whlslp = true;
19821986
if (car.WheelSlipWarning)
19831987
whlslpwrn = true;
1988+
1989+
if (car.HuDIsWheelSlip)
1990+
hudwhlslp = true;
1991+
if (car.HuDIsWheelSlipWarninq)
1992+
hudwhlslpwrn = true;
1993+
19841994
if (car.BrakeSkid)
19851995
{
19861996
whlskd = true;
@@ -2013,6 +2023,10 @@ public virtual void physicsUpdate(float elapsedClockSeconds)
20132023

20142024
IsWheelSlip = whlslp;
20152025
IsWheelSlipWarninq = whlslpwrn;
2026+
2027+
HuDIsWheelSlip = hudwhlslp;
2028+
HuDIsWheelSlipWarninq = hudwhlslpwrn;
2029+
20162030
IsBrakeSkid = whlskd;
20172031

20182032
// Coupler breaker

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2503,17 +2503,18 @@ public void ConfirmWheelslip(float elapsedClockSeconds)
25032503
if (AdvancedAdhesionModel)
25042504
{
25052505
// Wheelslip
2506-
if (WheelSlip)
2506+
if (HuDIsWheelSlip)
25072507
{
25082508
if (WheelslipState != Wheelslip.Occurring)
25092509
{
25102510
WheelslipState = Wheelslip.Occurring;
25112511
Simulator.Confirmer.Warning(CabControl.Wheelslip, CabSetting.On);
2512+
Trace.TraceInformation("Display Wheelslip#1 - CarID {0} WheelSlip {1}", CarID, HuDIsWheelSlip);
25122513
}
25132514
}
25142515
else
25152516
{
2516-
if (WheelSlipWarning)
2517+
if (HuDIsWheelSlipWarninq)
25172518
{
25182519
if (WheelslipState != Wheelslip.Warning)
25192520
{
@@ -2537,6 +2538,7 @@ public void ConfirmWheelslip(float elapsedClockSeconds)
25372538
{
25382539
WheelslipState = Wheelslip.Occurring;
25392540
Simulator.Confirmer.Warning(CabControl.Wheelslip, CabSetting.On);
2541+
Trace.TraceInformation("Display Wheelslip#2");
25402542
}
25412543
if ((!WheelSlip) && (WheelslipState != Wheelslip.None))
25422544
{
@@ -2797,6 +2799,8 @@ public virtual void AdvancedAdhesion(float elapsedClockSeconds)
27972799
{
27982800
WheelSlip = LocomotiveAxles.IsWheelSlip;
27992801
WheelSlipWarning = LocomotiveAxles.IsWheelSlipWarning;
2802+
HuDIsWheelSlip = LocomotiveAxles.HuDIsWheelSlip;
2803+
HuDIsWheelSlipWarninq = LocomotiveAxles.HuDIsWheelSlipWarning;
28002804
}
28012805

28022806
WheelSpeedMpS = (float)LocomotiveAxles[0].AxleSpeedMpS;
@@ -5580,19 +5584,19 @@ public virtual float GetDataOf(CabViewControl cvc)
55805584
if (activeloco.DieselEngines[0] != null)
55815585
{
55825586
if (activeloco.AdvancedAdhesionModel && Train.TrainType != Train.TRAINTYPE.AI_PLAYERHOSTING)
5583-
data = activeloco.WheelSlipWarning ? 1 : 0;
5587+
data = activeloco.HuDIsWheelSlipWarninq ? 1 : 0;
55845588
else
5585-
data = activeloco.WheelSlip ? 1 : 0;
5589+
data = activeloco.HuDIsWheelSlip ? 1 : 0;
55865590

55875591
}
55885592
}
55895593
}
55905594
else
55915595
{
55925596
if (AdvancedAdhesionModel && Train.TrainType != Train.TRAINTYPE.AI_PLAYERHOSTING)
5593-
data = WheelSlipWarning ? 1 : 0;
5597+
data = HuDIsWheelSlipWarninq ? 1 : 0;
55945598
else
5595-
data = WheelSlip ? 1 : 0;
5599+
data = HuDIsWheelSlip ? 1 : 0;
55965600
}
55975601
break;
55985602
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6455,6 +6455,8 @@ public override void AdvancedAdhesion(float elapsedClockSeconds)
64556455
{
64566456
WheelSlip = LocomotiveAxles.IsWheelSlip;
64576457
WheelSlipWarning = LocomotiveAxles.IsWheelSlipWarning;
6458+
HuDIsWheelSlip = LocomotiveAxles.HuDIsWheelSlip;
6459+
HuDIsWheelSlipWarninq = LocomotiveAxles.HuDIsWheelSlipWarning;
64586460
}
64596461

64606462
// This enables steam locomotives to have different speeds for driven and non-driven wheels.
@@ -7968,7 +7970,7 @@ public override string GetDebugStatus()
79687970
Simulator.Catalog.GetString("Coeff"),
79697971
Train.LocomotiveCoefficientFriction,
79707972
Simulator.Catalog.GetString("Slip"),
7971-
SteamEngines[i].AttachedAxle.IsWheelSlip ? Simulator.Catalog.GetString("Yes") : Simulator.Catalog.GetString("No"),
7973+
SteamEngines[i].AttachedAxle.HuDIsWheelSlip ? Simulator.Catalog.GetString("Yes") : Simulator.Catalog.GetString("No"),
79727974
Simulator.Catalog.GetString("WheelM"),
79737975
FormatStrings.FormatMass(SteamEngines[i].AttachedAxle.WheelWeightKg, IsMetric),
79747976
Simulator.Catalog.GetString("FoA"),

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

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,33 @@ public bool IsWheelSlipWarning
124124
return false;
125125
}
126126
}
127+
128+
/// <summary>
129+
/// Get wheel slip status for the whole engine, ie whenever one axle is in slip
130+
/// </summary>
131+
public bool HuDIsWheelSlip
132+
{
133+
get
134+
{
135+
foreach (var axle in AxleList)
136+
{
137+
if (axle.HuDIsWheelSlip) return true;
138+
}
139+
return false;
140+
}
141+
}
142+
public bool HuDIsWheelSlipWarning
143+
{
144+
get
145+
{
146+
foreach (var axle in AxleList)
147+
{
148+
if (axle.HuDIsWheelSlipWarning) return true;
149+
}
150+
return false;
151+
}
152+
}
153+
127154
public int NumOfSubstepsPS
128155
{
129156
get
@@ -245,7 +272,7 @@ public void Initialize()
245272
// Because of the irregular force around the wheel for a steam engine during a revolution, "response" time for warnings needs to be lower
246273
if (locomotive.EngineType == TrainCar.EngineTypes.Steam)
247274
{
248-
axle.WheelSlipThresholdTimeS = 0.1f;
275+
axle.WheelSlipThresholdTimeS = 1;
249276
axle.WheelSlipWarningThresholdTimeS = axle.WheelSlipThresholdTimeS * 0.75f;
250277
}
251278
else // diesel and electric locomotives
@@ -686,6 +713,7 @@ public float TransmissionEfficiency
686713
/// Wheel slip indicator
687714
/// - is true when absolute value of SlipSpeedMpS is greater than WheelSlipThresholdMpS, otherwise is false
688715
/// </summary>
716+
public bool HuDIsWheelSlip { get; private set; }
689717
public bool IsWheelSlip { get; private set; }
690718
float WheelSlipTimeS;
691719
public float WheelSlipThresholdTimeS = 1;
@@ -748,6 +776,7 @@ public void ComputeWheelSlipThresholdMpS()
748776
/// SlipSpeedPercent is greater than SlipWarningThresholdPercent in both directions,
749777
/// otherwise is false
750778
/// </summary>
779+
public bool HuDIsWheelSlipWarning { get; private set; }
751780
public bool IsWheelSlipWarning { get; private set; }
752781
float WheelSlipWarningTimeS;
753782
public float WheelSlipWarningThresholdTimeS = 1;
@@ -1188,22 +1217,31 @@ public virtual void Update(float elapsedSeconds)
11881217

11891218
if (Math.Abs(SlipSpeedMpS) > WheelSlipThresholdMpS)
11901219
{
1191-
// Wait some time before indicating wheelslip to avoid false triggers
1220+
// Wheel slip internally happens instantaneously, but may correct itself in a short period, so HuD indication has a small time delay to eliminate "false" indications
1221+
IsWheelSlip = IsWheelSlipWarning = true;
1222+
1223+
// Wait some time before indicating the HuD wheelslip to avoid false triggers
11921224
if (WheelSlipTimeS > WheelSlipThresholdTimeS)
11931225
{
1194-
IsWheelSlip = IsWheelSlipWarning = true;
1226+
HuDIsWheelSlip = HuDIsWheelSlipWarning = true;
11951227
}
11961228
WheelSlipTimeS += elapsedSeconds;
11971229
}
11981230
else if (Math.Abs(SlipSpeedPercent) > SlipWarningTresholdPercent)
11991231
{
1200-
// Wait some time before indicating wheelslip to avoid false triggers
1201-
if (WheelSlipWarningTimeS > WheelSlipWarningThresholdTimeS) IsWheelSlipWarning = true;
1232+
// Wheel slip internally happens instantaneously, but may correct itself in a short period, so HuD indication has a small time delay to eliminate "false" indications
1233+
IsWheelSlipWarning = true;
12021234
IsWheelSlip = false;
1235+
1236+
// Wait some time before indicating wheelslip to avoid false triggers
1237+
if (WheelSlipWarningTimeS > WheelSlipWarningThresholdTimeS) HuDIsWheelSlipWarning = true;
1238+
HuDIsWheelSlip = false;
12031239
WheelSlipWarningTimeS += elapsedSeconds;
12041240
}
12051241
else
12061242
{
1243+
HuDIsWheelSlipWarning = false;
1244+
HuDIsWheelSlip = false;
12071245
IsWheelSlipWarning = false;
12081246
IsWheelSlip = false;
12091247
WheelSlipWarningTimeS = WheelSlipTimeS = 0;

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ public float ConvectionFactor
315315

316316
public bool WheelSlip; // true if locomotive wheels slipping
317317
public bool WheelSlipWarning;
318+
public bool HuDIsWheelSlipWarninq;
319+
public bool HuDIsWheelSlip;
318320
public bool WheelSkid; // True if wagon wheels lock up.
319321
public float _AccelerationMpSS;
320322
protected IIRFilter AccelerationFilter = new IIRFilter(IIRFilter.FilterTypes.Butterworth, 1, 1.0f, 0.1f);
@@ -722,7 +724,7 @@ public virtual void Initialize()
722724
{
723725
BrakeSystem.Initialize();
724726
CurveSpeedDependent = Simulator.Settings.CurveSpeedDependent;
725-
727+
726728
//CurveForceFilter.Initialize();
727729

728730
// Initialize tunnel resistance values

Source/RunActivity/Viewer3D/Popups/HUDWindow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,9 @@ void TextPageCommon(TableData table)
479479
if (Viewer.PlayerLocomotive.Train.TrainType == Train.TRAINTYPE.AI_PLAYERHOSTING)
480480
TableAddLine(table, Viewer.Catalog.GetString("Autopilot") + "???");
481481

482-
if (Viewer.PlayerTrain.IsWheelSlip)
482+
if (Viewer.PlayerTrain.HuDIsWheelSlip)
483483
TableAddLine(table, Viewer.Catalog.GetString("Wheel slip") + "!!!");
484-
else if (Viewer.PlayerTrain.IsWheelSlipWarninq)
484+
else if (Viewer.PlayerTrain.HuDIsWheelSlipWarninq)
485485
TableAddLine(table, Viewer.Catalog.GetString("Wheel slip warning") + "???");
486486

487487
if (Viewer.PlayerTrain.IsBrakeSkid )

0 commit comments

Comments
 (0)