Skip to content

Commit db5e115

Browse files
author
Chris Jakeman
committed
Removed option Wind-Dependent Resistance
1 parent b28f7cb commit db5e115

File tree

7 files changed

+57
-101
lines changed

7 files changed

+57
-101
lines changed

Source/Documentation/Manual/options.rst

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,15 +392,6 @@ displayed as a message. This option is described in detail
392392
:ref:`here <physics-curve-speed-limit-application>` (OR application).
393393
OR does not display the damage.
394394

395-
.. _options-wind-resistance:
396-
397-
Wind dependent resistance
398-
-------------------------
399-
400-
When this option is selected, resistance to train motion is influenced by
401-
the wind speed, and the direction that it is blowing. This option is
402-
described in detail :ref:`here <physics-wind-resistance>`
403-
404395
Run electric locos on non-electrified routes
405396
--------------------------------------------
406397

Source/Menu/Options.Designer.cs

Lines changed: 18 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/Menu/Options.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ public OptionsForm(UserSettings settings, UpdateManager updateManager, bool init
190190
numericAdhesionMovingAverageFilterSize.Value = Settings.AdhesionMovingAverageFilterSize;
191191
checkBreakCouplers.Checked = Settings.BreakCouplers;
192192
checkCurveSpeedDependent.Checked = Settings.CurveSpeedDependent;
193-
checkWindResistanceDependent.Checked = Settings.WindResistanceDependent;
194193
checkOverrideNonElectrifiedRoutes.Checked = Settings.OverrideNonElectrifiedRoutes;
195194
checkHotStart.Checked = Settings.HotStart;
196195
checkForcedRedAtStationStops.Checked = !Settings.NoForcedRedAtStationStops;
@@ -471,7 +470,6 @@ void buttonOK_Click(object sender, EventArgs e)
471470
Settings.AdhesionMovingAverageFilterSize = (int)numericAdhesionMovingAverageFilterSize.Value;
472471
Settings.BreakCouplers = checkBreakCouplers.Checked;
473472
Settings.CurveSpeedDependent = checkCurveSpeedDependent.Checked;
474-
Settings.WindResistanceDependent = checkWindResistanceDependent.Checked;
475473
Settings.OverrideNonElectrifiedRoutes = checkOverrideNonElectrifiedRoutes.Checked;
476474
Settings.HotStart = checkHotStart.Checked;
477475
Settings.NoForcedRedAtStationStops = !checkForcedRedAtStationStops.Checked;

Source/Menu/Options.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,7 @@
123123
<metadata name="bindingSourceContent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124124
<value>114, 17</value>
125125
</metadata>
126+
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
127+
<value>17, 17</value>
128+
</metadata>
126129
</root>

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

Lines changed: 28 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,6 @@ public int ActivityDurationS
186186
public float PhysicsTrainLocoDirectionDeg;
187187
public float ResultantWindComponentDeg;
188188
public float WindResultantSpeedMpS;
189-
public bool TrainWindResistanceDependent
190-
{
191-
get
192-
{
193-
return Simulator.Settings.WindResistanceDependent;
194-
}
195-
}
196189

197190
// Auxiliary Water Tenders
198191
public float MaxAuxTenderWaterMassKG;
@@ -2108,46 +2101,38 @@ public void UpdateWindComponents()
21082101
//These will be representative of the train whilst it is on a straight track, but each wagon will vary when going around a curve.
21092102
// Note both train and wind direction will be positive between 0 (north) and 180 (south) through east, and negative between 0 (north) and 180 (south) through west
21102103
// Wind and train direction to be converted to an angle between 0 and 360 deg.
2111-
if (TrainWindResistanceDependent)
2112-
{
2113-
// Calculate Wind speed and direction, and train direction
2114-
// Update the value of the Wind Speed and Direction for the train
2115-
PhysicsWindDirectionDeg = MathHelper.ToDegrees(Simulator.Weather.WindDirection);
2116-
PhysicsWindSpeedMpS = Simulator.Weather.WindSpeed;
2117-
float TrainSpeedMpS = Math.Abs(SpeedMpS);
2118-
2119-
// If a westerly direction (ie -ve) convert to an angle between 0 and 360
2120-
if (PhysicsWindDirectionDeg < 0)
2121-
PhysicsWindDirectionDeg += 360;
2122-
2123-
if (PhysicsTrainLocoDirectionDeg < 0)
2124-
PhysicsTrainLocoDirectionDeg += 360;
2125-
2126-
// calculate angle between train and eind direction
2127-
if (PhysicsWindDirectionDeg > PhysicsTrainLocoDirectionDeg)
2128-
ResultantWindComponentDeg = PhysicsWindDirectionDeg - PhysicsTrainLocoDirectionDeg;
2129-
else if (PhysicsTrainLocoDirectionDeg > PhysicsWindDirectionDeg)
2130-
ResultantWindComponentDeg = PhysicsTrainLocoDirectionDeg - PhysicsWindDirectionDeg;
2131-
else
2132-
ResultantWindComponentDeg = 0.0f;
2133-
2134-
// Correct wind direction if it is greater then 360 deg, then correct to a value less then 360
2135-
if (Math.Abs(ResultantWindComponentDeg) > 360)
2136-
ResultantWindComponentDeg = ResultantWindComponentDeg - 360.0f;
2104+
// Calculate Wind speed and direction, and train direction
2105+
// Update the value of the Wind Speed and Direction for the train
2106+
PhysicsWindDirectionDeg = MathHelper.ToDegrees(Simulator.Weather.WindDirection);
2107+
PhysicsWindSpeedMpS = Simulator.Weather.WindSpeed;
2108+
float TrainSpeedMpS = Math.Abs(SpeedMpS);
2109+
2110+
// If a westerly direction (ie -ve) convert to an angle between 0 and 360
2111+
if (PhysicsWindDirectionDeg < 0)
2112+
PhysicsWindDirectionDeg += 360;
2113+
2114+
if (PhysicsTrainLocoDirectionDeg < 0)
2115+
PhysicsTrainLocoDirectionDeg += 360;
2116+
2117+
// calculate angle between train and eind direction
2118+
if (PhysicsWindDirectionDeg > PhysicsTrainLocoDirectionDeg)
2119+
ResultantWindComponentDeg = PhysicsWindDirectionDeg - PhysicsTrainLocoDirectionDeg;
2120+
else if (PhysicsTrainLocoDirectionDeg > PhysicsWindDirectionDeg)
2121+
ResultantWindComponentDeg = PhysicsTrainLocoDirectionDeg - PhysicsWindDirectionDeg;
2122+
else
2123+
ResultantWindComponentDeg = 0.0f;
21372124

2138-
// Wind angle should be kept between 0 and 180 the formulas do not cope with angles > 180. If angle > 180, denotes wind of "other" side of train
2139-
if (ResultantWindComponentDeg > 180)
2140-
ResultantWindComponentDeg = 360 - ResultantWindComponentDeg;
2125+
// Correct wind direction if it is greater then 360 deg, then correct to a value less then 360
2126+
if (Math.Abs(ResultantWindComponentDeg) > 360)
2127+
ResultantWindComponentDeg = ResultantWindComponentDeg - 360.0f;
21412128

2142-
float WindAngleRad = MathHelper.ToRadians(ResultantWindComponentDeg);
2129+
// Wind angle should be kept between 0 and 180 the formulas do not cope with angles > 180. If angle > 180, denotes wind of "other" side of train
2130+
if (ResultantWindComponentDeg > 180)
2131+
ResultantWindComponentDeg = 360 - ResultantWindComponentDeg;
21432132

2144-
WindResultantSpeedMpS = (float)Math.Sqrt(TrainSpeedMpS * TrainSpeedMpS + PhysicsWindSpeedMpS * PhysicsWindSpeedMpS + 2.0f * TrainSpeedMpS * PhysicsWindSpeedMpS * (float)Math.Cos(WindAngleRad));
2133+
float WindAngleRad = MathHelper.ToRadians(ResultantWindComponentDeg);
21452134

2146-
}
2147-
else
2148-
{
2149-
WindResultantSpeedMpS = Math.Abs(SpeedMpS);
2150-
}
2135+
WindResultantSpeedMpS = (float)Math.Sqrt(TrainSpeedMpS * TrainSpeedMpS + PhysicsWindSpeedMpS * PhysicsWindSpeedMpS + 2.0f * TrainSpeedMpS * PhysicsWindSpeedMpS * (float)Math.Cos(WindAngleRad));
21512136
}
21522137

21532138

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2856,14 +2856,13 @@ private void UpdateWheelBearingTemperature(float elapsedClockSeconds)
28562856

28572857
private void UpdateWindForce()
28582858
{
2859-
28602859
// Calculate compensation for wind
28612860
// There are two components due to wind -
28622861
// Drag, impact of wind on train, will increase resistance when head on, will decrease resistance when acting as a tailwind.
28632862
// Lateral resistance - due to wheel flange being pushed against rail due to side wind.
28642863
// Calculation based upon information provided in AREA 1942 Proceedings - https://archive.org/details/proceedingsofann431942amer - pg 56
28652864

2866-
if (Train.TrainWindResistanceDependent && !CarTunnelData.FrontPositionBeyondStartOfTunnel.HasValue && AbsSpeedMpS > 2.2352) // Only calculate wind resistance if option selected in options menu, and not in a tunnel, and speed is sufficient for wind effects (>5mph)
2865+
if (!CarTunnelData.FrontPositionBeyondStartOfTunnel.HasValue && AbsSpeedMpS > 2.2352) // Only calculate wind resistance if option selected in options menu, and not in a tunnel, and speed is sufficient for wind effects (>5mph)
28672866
{
28682867

28692868
// Wagon Direction
@@ -2972,19 +2971,15 @@ private void UpdateWindForce()
29722971
{
29732972
PrevCarLead = false;
29742973
}
2975-
29762974
}
29772975

29782976
// If tender is coupled to a trailing locomotive then reduce resistance
29792977
if (!IsLeadTender)
29802978
{
29812979
LateralWindResistanceForceN *= TrailLocoResistanceFactor;
29822980
}
2983-
29842981
}
2985-
2986-
WindForceN = LateralWindResistanceForceN + WindDragResistanceForceN;
2987-
2982+
WindForceN = LateralWindResistanceForceN + WindDragResistanceForceN;
29882983
}
29892984
else
29902985
{

Source/RunActivity/Viewer3D/Popups/HUDWindow.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,15 +1187,12 @@ void TextPageForceInfo(TableData table)
11871187

11881188
TableAddLine(table);
11891189

1190-
if (train.TrainWindResistanceDependent) // Only show this information if wind resistance is selected
1191-
{
1192-
TableAddLine(table, $"{Viewer.Catalog.GetString("Wind Speed:")} {Viewer.Catalog.GetStringFmt("{0:N2} mph", Me.ToMi(pS.TopH(train.PhysicsWindSpeedMpS)))} " +
1193-
$"{Viewer.Catalog.GetString("Wind Direction:")} {Viewer.Catalog.GetStringFmt("{0:N2} Deg", train.PhysicsWindDirectionDeg)} " +
1194-
$"{Viewer.Catalog.GetString("Train Direction:")} {Viewer.Catalog.GetStringFmt("{0:N2} Deg", train.PhysicsTrainLocoDirectionDeg)} " +
1195-
$"{Viewer.Catalog.GetString("ResWind:")} {Viewer.Catalog.GetStringFmt("{0:N2} Deg", train.ResultantWindComponentDeg)} " +
1196-
$"{Viewer.Catalog.GetString("ResSpeed:")} {Viewer.Catalog.GetStringFmt("{0:N2} mph", Me.ToMi(pS.TopH(train.WindResultantSpeedMpS)))}");
1197-
TableAddLine(table);
1198-
}
1190+
TableAddLine(table, $"{Viewer.Catalog.GetString("Wind Speed:")} {Viewer.Catalog.GetStringFmt("{0:N2} mph", Me.ToMi(pS.TopH(train.PhysicsWindSpeedMpS)))} " +
1191+
$"{Viewer.Catalog.GetString("Wind Direction:")} {Viewer.Catalog.GetStringFmt("{0:N2} Deg", train.PhysicsWindDirectionDeg)} " +
1192+
$"{Viewer.Catalog.GetString("Train Direction:")} {Viewer.Catalog.GetStringFmt("{0:N2} Deg", train.PhysicsTrainLocoDirectionDeg)} " +
1193+
$"{Viewer.Catalog.GetString("ResWind:")} {Viewer.Catalog.GetStringFmt("{0:N2} Deg", train.ResultantWindComponentDeg)} " +
1194+
$"{Viewer.Catalog.GetString("ResSpeed:")} {Viewer.Catalog.GetStringFmt("{0:N2} mph", Me.ToMi(pS.TopH(train.WindResultantSpeedMpS)))}");
1195+
TableAddLine(table);
11991196
}
12001197

12011198
TableSetCells(table, 0,

0 commit comments

Comments
 (0)