Skip to content

Commit 2772fc6

Browse files
committed
Automatic merge of T1.5.1-905-gaf8fb30c5 and 14 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 #903 at 9bead33: Downloading route content (Github, zip) - Pull request #911 at 6834af0: docs: Add refactoring as a special type of PR - Pull request #916 at 992cc97: Distributed Power Air Brake Synchronization - Pull request #919 at 7aafe02: Added mouse wheel support for controls which can be moved by pressing t… - Pull request #920 at a94e403: Update RailDriver in Manual - Pull request #923 at d0208cd: Add curve squeal to route
16 parents c003e34 + af8fb30 + 3539862 + d00beb9 + f92de76 + 9c456aa + 8f94333 + 6c0785b + 1f5ba4c + 5866028 + 9bead33 + 6834af0 + 992cc97 + 7aafe02 + a94e403 + d0208cd commit 2772fc6

File tree

4 files changed

+33
-11
lines changed

4 files changed

+33
-11
lines changed

Source/Orts.Formats.Msts/RouteFile.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public Tr_RouteFile(STFReader stf)
121121
// sms file number in Ttype.dat when train over switch
122122
new STFReader.TokenProcessor("ortsswitchsmsnumber", ()=>{ SwitchSMSNumber = stf.ReadIntBlock(null); }),
123123
new STFReader.TokenProcessor("ortscurvesmsnumber", ()=>{ CurveSMSNumber = stf.ReadIntBlock(null); }),
124+
new STFReader.TokenProcessor("ortscurvesquealsmsnumber", ()=>{ CurveSquealSMSNumber = stf.ReadIntBlock(null); }),
124125
new STFReader.TokenProcessor("ortscurveswitchsmsnumber", ()=>{ CurveSwitchSMSNumber = stf.ReadIntBlock(null); }),
125126
new STFReader.TokenProcessor("ortsopendoorsinaitrains", ()=>{ OpenDoorsInAITrains = stf.ReadBoolBlock(false); }),
126127

@@ -175,9 +176,10 @@ public Tr_RouteFile(STFReader stf)
175176
public string DefaultTurntableSMS;
176177
public bool ? OpenDoorsInAITrains; // true if option active
177178

178-
public int SwitchSMSNumber = -1; // defines the number of the switch SMS files in file ttypedat
179+
public int SwitchSMSNumber = -1; // defines the number of the switch SMS files in file ttype.dat
179180
public int CurveSMSNumber = -1; // defines the number of the curve SMS files in file ttype.dat
180181
public int CurveSwitchSMSNumber = -1; // defines the number of the curve-switch SMS files in file ttype.dat
182+
public int CurveSquealSMSNumber = -1; // defines the number of the curve squeal SMS files in file ttype.dat
181183

182184
}
183185

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1869,7 +1869,7 @@ public override void Save(BinaryWriter outf)
18691869

18701870
outf.Write(WheelBrakeSlideProtectionActive);
18711871
outf.Write(WheelBrakeSlideProtectionTimerS);
1872-
outf.Write(AngleOfAttackRad);
1872+
outf.Write(AngleOfAttackmRad);
18731873
outf.Write(DerailClimbDistanceM);
18741874
outf.Write(DerailPossible);
18751875
outf.Write(DerailExpected);
@@ -1932,7 +1932,7 @@ public override void Restore(BinaryReader inf)
19321932

19331933
WheelBrakeSlideProtectionActive = inf.ReadBoolean();
19341934
WheelBrakeSlideProtectionTimerS = inf.ReadInt32();
1935-
AngleOfAttackRad = inf.ReadSingle();
1935+
AngleOfAttackmRad = inf.ReadSingle();
19361936
DerailClimbDistanceM = inf.ReadSingle();
19371937
DerailPossible = inf.ReadBoolean();
19381938
DerailExpected = inf.ReadBoolean();

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

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ public static Interpolator SteamHeatBoilerFuelUsageGalukpH()
204204
public bool DerailmentCoefficientEnabled = true;
205205
public float MaximumWheelFlangeAngleRad;
206206
public float WheelFlangeLengthM;
207-
public float AngleOfAttackRad;
207+
public float AngleOfAttackmRad;
208208
public float DerailClimbDistanceM;
209209
public bool DerailPossible = false;
210210
public bool DerailExpected = false;
@@ -968,6 +968,8 @@ public virtual void Update(float elapsedClockSeconds)
968968
CurrentElevationPercent = -CurrentElevationPercent;
969969
}
970970

971+
AngleOfAttackmRad = GetAngleofAttackmRad();
972+
971973
UpdateCurveSpeedLimit(); // call this first as it will provide inputs for the curve force.
972974
UpdateCurveForce(elapsedClockSeconds);
973975
UpdateTunnelForce();
@@ -1681,10 +1683,6 @@ public void UpdateTrainDerailmentRisk(float elapsedClockSeconds)
16811683
// Calculate Nadal derailment coefficient limit
16821684
NadalDerailmentCoefficient = ((float) Math.Tan(MaximumWheelFlangeAngleRad) - wagonAdhesion) / (1f + wagonAdhesion * (float) Math.Tan(MaximumWheelFlangeAngleRad));
16831685

1684-
// Calculate Angle of Attack - AOA = sin-1(2 * bogie wheel base / curve radius)
1685-
AngleOfAttackRad = (float)Math.Asin(2 * RigidWheelBaseM / CurrentCurveRadiusM);
1686-
var angleofAttackmRad = AngleOfAttackRad * 1000f; // Convert to micro radians
1687-
16881686
// Calculate the derail climb distance - uses the general form equation 2.4 from the above publication
16891687
var parameterA_1 = ((100 / (-1.9128f * MathHelper.ToDegrees(MaximumWheelFlangeAngleRad) + 146.56f)) + 3.1f) * Me.ToIn(WheelFlangeLengthM);
16901688

@@ -1698,7 +1696,7 @@ public void UpdateTrainDerailmentRisk(float elapsedClockSeconds)
16981696

16991697
var parameterB = parameterB_1 + parameterB_2;
17001698

1701-
DerailClimbDistanceM = Me.FromFt( (float)((parameterA * parameterB * Me.ToIn(WheelFlangeLengthM)) / ((angleofAttackmRad + (parameterB * Me.ToIn(WheelFlangeLengthM))))) );
1699+
DerailClimbDistanceM = Me.FromFt( (float)((parameterA * parameterB * Me.ToIn(WheelFlangeLengthM)) / ((AngleOfAttackmRad + (parameterB * Me.ToIn(WheelFlangeLengthM))))) );
17021700

17031701
// calculate the time taken to travel the derail climb distance
17041702
var derailTimeS = DerailClimbDistanceM / AbsSpeedMpS;
@@ -1769,6 +1767,26 @@ public void UpdateTrainDerailmentRisk(float elapsedClockSeconds)
17691767

17701768
#endregion
17711769

1770+
/// <summary>
1771+
/// Get the Angle of attack for a car as it goes through a curve
1772+
/// </summary>
1773+
/// <returns>angle in micro radians</returns>
1774+
///
1775+
public float GetAngleofAttackmRad ()
1776+
{
1777+
if (CurrentCurveRadiusM > 0)
1778+
{
1779+
// Calculate Angle of Attack - AOA = sin-1(2 * bogie wheel base / curve radius)
1780+
var angleofAttackmRad = (float)Math.Asin(2 * RigidWheelBaseM / CurrentCurveRadiusM) * 1000f; // Convert to micro radians
1781+
return angleofAttackmRad;
1782+
}
1783+
else
1784+
{
1785+
return 0;
1786+
}
1787+
}
1788+
1789+
17721790
/// <summary>
17731791
/// Get the current direction that curve is heading relative to the train.
17741792
/// </summary>

Source/RunActivity/Viewer3D/Popups/HUDWindow.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,8 +1236,9 @@ void TextPageForceInfo(TableData table)
12361236
Viewer.Catalog.GetString("Brk Slide"),
12371237
Viewer.Catalog.GetString("Bear Temp"),
12381238
Viewer.Catalog.GetString(" "),
1239-
Viewer.Catalog.GetString("DerailCoeff")
1240-
1239+
Viewer.Catalog.GetString("DrailCof"),
1240+
Viewer.Catalog.GetString("AoA")
1241+
12411242
);
12421243
TableAddLine(table);
12431244

@@ -1266,6 +1267,7 @@ void TextPageForceInfo(TableData table)
12661267
TableSetCell(table, 17, "{0} {1}", FormatStrings.FormatTemperature(car.WheelBearingTemperatureDegC, car.IsMetric, false), car.DisplayWheelBearingTemperatureStatus);
12671268
TableSetCell(table, 18, car.Flipped ? Viewer.Catalog.GetString("Flipped") : "");
12681269
TableSetCell(table, 19, "{0:F2}{1}", car.DerailmentCoefficient, car.DerailExpected ? "!!!" : car.DerailPossible ? "???" : "");
1270+
TableSetCell(table, 20, "{0:F2}", car.AngleOfAttackmRad);
12691271
TableAddLine(table);
12701272

12711273
}

0 commit comments

Comments
 (0)