Skip to content

Commit 5aa3629

Browse files
authored
Merge pull request #588 from cjakeman/menu-options02e
02ef: Removed menu option Tunnel&Wind-Dependent Resistance
2 parents ef435e5 + db5e115 commit 5aa3629

File tree

8 files changed

+89
-183
lines changed

8 files changed

+89
-183
lines changed

Source/Documentation/Manual/options.rst

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -392,26 +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-tunnel-resistance:
396-
397-
Tunnel dependent resistance
398-
---------------------------
399-
400-
When this option is selected, OR takes into account the fact that trains
401-
in tunnels are subject to higher air resistance, and therefore need a
402-
higher effort at invariant speed. This option is described in detail
403-
:ref:`here <physics-tunnel-friction>` (theory) and
404-
:ref:`here <physics-tunnel-friction-application>` (OR application).
405-
406-
.. _options-wind-resistance:
407-
408-
Wind dependent resistance
409-
-------------------------
410-
411-
When this option is selected, resistance to train motion is influenced by
412-
the wind speed, and the direction that it is blowing. This option is
413-
described in detail :ref:`here <physics-wind-resistance>`
414-
415395
Run electric locos on non-electrified routes
416396
--------------------------------------------
417397

Source/Menu/Options.Designer.cs

Lines changed: 18 additions & 44 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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +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-
checkTunnelResistanceDependent.Checked = Settings.TunnelResistanceDependent;
194-
checkWindResistanceDependent.Checked = Settings.WindResistanceDependent;
195193
checkOverrideNonElectrifiedRoutes.Checked = Settings.OverrideNonElectrifiedRoutes;
196194
checkHotStart.Checked = Settings.HotStart;
197195
checkForcedRedAtStationStops.Checked = !Settings.NoForcedRedAtStationStops;
@@ -472,8 +470,6 @@ void buttonOK_Click(object sender, EventArgs e)
472470
Settings.AdhesionMovingAverageFilterSize = (int)numericAdhesionMovingAverageFilterSize.Value;
473471
Settings.BreakCouplers = checkBreakCouplers.Checked;
474472
Settings.CurveSpeedDependent = checkCurveSpeedDependent.Checked;
475-
Settings.TunnelResistanceDependent = checkTunnelResistanceDependent.Checked;
476-
Settings.WindResistanceDependent = checkWindResistanceDependent.Checked;
477473
Settings.OverrideNonElectrifiedRoutes = checkOverrideNonElectrifiedRoutes.Checked;
478474
Settings.HotStart = checkHotStart.Checked;
479475
Settings.NoForcedRedAtStationStops = !checkForcedRedAtStationStops.Checked;

Source/Menu/Options.resx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,6 @@
120120
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121121
<value>17, 17</value>
122122
</metadata>
123-
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124-
<value>17, 17</value>
125-
</metadata>
126123
<metadata name="bindingSourceContent.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
127124
<value>114, 17</value>
128125
</metadata>

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

Lines changed: 28 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -184,13 +184,6 @@ public int ActivityDurationS
184184
public float PhysicsTrainLocoDirectionDeg;
185185
public float ResultantWindComponentDeg;
186186
public float WindResultantSpeedMpS;
187-
public bool TrainWindResistanceDependent
188-
{
189-
get
190-
{
191-
return Simulator.Settings.WindResistanceDependent;
192-
}
193-
}
194187

195188
// Auxiliary Water Tenders
196189
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
{

0 commit comments

Comments
 (0)