Skip to content

Commit 03ba35e

Browse files
author
Chris Jakeman
committed
Removed option Tunnel-Dependent Resistance
This is now always calculated, but for the player's train only.
1 parent 5d5394f commit 03ba35e

File tree

5 files changed

+57
-103
lines changed

5 files changed

+57
-103
lines changed

Source/Documentation/Manual/options.rst

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -392,17 +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-
406395
.. _options-wind-resistance:
407396

408397
Wind dependent resistance

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-
checkTunnelResistanceDependent.Checked = Settings.TunnelResistanceDependent;
194193
checkWindResistanceDependent.Checked = Settings.WindResistanceDependent;
195194
checkOverrideNonElectrifiedRoutes.Checked = Settings.OverrideNonElectrifiedRoutes;
196195
checkHotStart.Checked = Settings.HotStart;
@@ -472,7 +471,6 @@ void buttonOK_Click(object sender, EventArgs e)
472471
Settings.AdhesionMovingAverageFilterSize = (int)numericAdhesionMovingAverageFilterSize.Value;
473472
Settings.BreakCouplers = checkBreakCouplers.Checked;
474473
Settings.CurveSpeedDependent = checkCurveSpeedDependent.Checked;
475-
Settings.TunnelResistanceDependent = checkTunnelResistanceDependent.Checked;
476474
Settings.WindResistanceDependent = checkWindResistanceDependent.Checked;
477475
Settings.OverrideNonElectrifiedRoutes = checkOverrideNonElectrifiedRoutes.Checked;
478476
Settings.HotStart = checkHotStart.Checked;

Source/Menu/Options.resx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,7 @@
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>
129-
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
130-
<value>17, 17</value>
131-
</metadata>
132126
</root>

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

Lines changed: 39 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,6 @@ public Direction Direction
615615
public float CurrentElevationPercent;
616616

617617
public bool CurveSpeedDependent;
618-
public bool TunnelResistanceDependent;
619-
620618

621619
protected float MaxDurableSafeCurveSpeedMpS;
622620

@@ -728,11 +726,10 @@ public struct CarTunnelInfoData
728726
public virtual void Initialize()
729727
{
730728
CurveSpeedDependent = Simulator.Settings.CurveSpeedDependent;
731-
TunnelResistanceDependent = Simulator.Settings.TunnelResistanceDependent;
732729

733730
//CurveForceFilter.Initialize();
734-
// Initialize tunnel resistance values
735731

732+
// Initialize tunnel resistance values
736733
DoubleTunnelCrossSectAreaM2 = (float)Simulator.TRK.Tr_RouteFile.DoubleTunnelAreaM2;
737734
SingleTunnelCrossSectAreaM2 = (float)Simulator.TRK.Tr_RouteFile.SingleTunnelAreaM2;
738735
DoubleTunnelPerimeterM = (float)Simulator.TRK.Tr_RouteFile.DoubleTunnelPerimeterM;
@@ -1116,62 +1113,51 @@ public virtual void UpdateTunnelForce()
11161113
{
11171114
if (Train.IsPlayerDriven) // Only calculate tunnel resistance when it is the player train.
11181115
{
1119-
if (TunnelResistanceDependent)
1116+
if (CarTunnelData.FrontPositionBeyondStartOfTunnel.HasValue)
11201117
{
1121-
if (CarTunnelData.FrontPositionBeyondStartOfTunnel.HasValue)
1122-
{
1118+
float? TunnelStart;
1119+
float? TunnelAhead;
1120+
float? TunnelBehind;
11231121

1124-
float? TunnelStart;
1125-
float? TunnelAhead;
1126-
float? TunnelBehind;
1127-
1128-
TunnelStart = CarTunnelData.FrontPositionBeyondStartOfTunnel; // position of front of wagon wrt start of tunnel
1129-
TunnelAhead = CarTunnelData.LengthMOfTunnelAheadFront; // Length of tunnel remaining ahead of front of wagon (negative if front of wagon out of tunnel)
1130-
TunnelBehind = CarTunnelData.LengthMOfTunnelBehindRear; // Length of tunnel behind rear of wagon (negative if rear of wagon has not yet entered tunnel)
1131-
1132-
// Calculate tunnel default effective cross-section area, and tunnel perimeter - based upon the designed speed limit of the railway (TRK File)
1133-
1134-
float TunnelLengthM = CarTunnelData.LengthMOfTunnelAheadFront.Value + CarTunnelData.LengthMOfTunnelBehindRear.Value;
1135-
float TrainLengthTunnelM = Train.Length;
1136-
float TrainMassTunnelKg = Train.MassKg;
1137-
float PrevTrainCrossSectionAreaM2 = TrainCrossSectionAreaM2;
1138-
TrainCrossSectionAreaM2 = CarWidthM * CarHeightM;
1139-
if (TrainCrossSectionAreaM2 < PrevTrainCrossSectionAreaM2)
1140-
{
1141-
TrainCrossSectionAreaM2 = PrevTrainCrossSectionAreaM2; // Assume locomotive cross-sectional area is the largest, if not use new one.
1142-
}
1143-
const float DensityAirKgpM3 = 1.2f;
1144-
1145-
// Determine tunnel X-sect area and perimeter based upon number of tracks
1146-
if (CarTunnelData.numTunnelPaths >= 2)
1147-
{
1148-
TunnelCrossSectionAreaM2 = DoubleTunnelCrossSectAreaM2; // Set values for double track tunnels and above
1149-
TunnelPerimeterM = DoubleTunnelPerimeterM;
1150-
}
1151-
else
1152-
{
1153-
TunnelCrossSectionAreaM2 = SingleTunnelCrossSectAreaM2; // Set values for single track tunnels
1154-
TunnelPerimeterM = SingleTunnelPerimeterAreaM;
1155-
}
1156-
1157-
//
1158-
// Calculate first tunnel factor
1159-
1160-
float TunnelAComponent = (0.00003318f * DensityAirKgpM3 * TunnelCrossSectionAreaM2) / ((1 - (TrainCrossSectionAreaM2 / TunnelCrossSectionAreaM2)) * (1 - (TrainCrossSectionAreaM2 / TunnelCrossSectionAreaM2)));
1161-
float TunnelBComponent = 174.419f * (1 - (TrainCrossSectionAreaM2 / TunnelCrossSectionAreaM2)) * (1 - (TrainCrossSectionAreaM2 / TunnelCrossSectionAreaM2));
1162-
float TunnelCComponent = (2.907f * (1 - (TrainCrossSectionAreaM2 / TunnelCrossSectionAreaM2)) * (1 - (TrainCrossSectionAreaM2 / TunnelCrossSectionAreaM2))) / (4.0f * (TunnelCrossSectionAreaM2 / TunnelPerimeterM));
1163-
1164-
float TempTunnel1 = (float)Math.Sqrt(TunnelBComponent + (TunnelCComponent * (TunnelLengthM - TrainLengthTunnelM) / TrainLengthTunnelM));
1165-
float TempTunnel2 = (1.0f - (1.0f / (1.0f + TempTunnel1))) * (1.0f - (1.0f / (1.0f + TempTunnel1)));
1166-
1167-
float UnitAerodynamicDrag = ((TunnelAComponent * TrainLengthTunnelM) / Kg.ToTonne(TrainMassTunnelKg)) * TempTunnel2;
1122+
// Calculate tunnel default effective cross-section area, and tunnel perimeter - based upon the designed speed limit of the railway (TRK File)
1123+
float TunnelLengthM = CarTunnelData.LengthMOfTunnelAheadFront.Value + CarTunnelData.LengthMOfTunnelBehindRear.Value;
1124+
float TrainLengthTunnelM = Train.Length;
1125+
float TrainMassTunnelKg = Train.MassKg;
1126+
float PrevTrainCrossSectionAreaM2 = TrainCrossSectionAreaM2;
1127+
TrainCrossSectionAreaM2 = CarWidthM * CarHeightM;
1128+
if (TrainCrossSectionAreaM2 < PrevTrainCrossSectionAreaM2)
1129+
{
1130+
TrainCrossSectionAreaM2 = PrevTrainCrossSectionAreaM2; // Assume locomotive cross-sectional area is the largest, if not use new one.
1131+
}
1132+
const float DensityAirKgpM3 = 1.2f;
11681133

1169-
TunnelForceN = UnitAerodynamicDrag * Kg.ToTonne(MassKG) * AbsSpeedMpS * AbsSpeedMpS;
1134+
// Determine tunnel X-sect area and perimeter based upon number of tracks
1135+
if (CarTunnelData.numTunnelPaths >= 2)
1136+
{
1137+
TunnelCrossSectionAreaM2 = DoubleTunnelCrossSectAreaM2; // Set values for double track tunnels and above
1138+
TunnelPerimeterM = DoubleTunnelPerimeterM;
11701139
}
11711140
else
11721141
{
1173-
TunnelForceN = 0.0f; // Reset tunnel force to zero when train is no longer in the tunnel
1142+
TunnelCrossSectionAreaM2 = SingleTunnelCrossSectAreaM2; // Set values for single track tunnels
1143+
TunnelPerimeterM = SingleTunnelPerimeterAreaM;
11741144
}
1145+
1146+
// Calculate first tunnel factor
1147+
float TunnelAComponent = (0.00003318f * DensityAirKgpM3 * TunnelCrossSectionAreaM2) / ((1 - (TrainCrossSectionAreaM2 / TunnelCrossSectionAreaM2)) * (1 - (TrainCrossSectionAreaM2 / TunnelCrossSectionAreaM2)));
1148+
float TunnelBComponent = 174.419f * (1 - (TrainCrossSectionAreaM2 / TunnelCrossSectionAreaM2)) * (1 - (TrainCrossSectionAreaM2 / TunnelCrossSectionAreaM2));
1149+
float TunnelCComponent = (2.907f * (1 - (TrainCrossSectionAreaM2 / TunnelCrossSectionAreaM2)) * (1 - (TrainCrossSectionAreaM2 / TunnelCrossSectionAreaM2))) / (4.0f * (TunnelCrossSectionAreaM2 / TunnelPerimeterM));
1150+
1151+
float TempTunnel1 = (float)Math.Sqrt(TunnelBComponent + (TunnelCComponent * (TunnelLengthM - TrainLengthTunnelM) / TrainLengthTunnelM));
1152+
float TempTunnel2 = (1.0f - (1.0f / (1.0f + TempTunnel1))) * (1.0f - (1.0f / (1.0f + TempTunnel1)));
1153+
1154+
float UnitAerodynamicDrag = ((TunnelAComponent * TrainLengthTunnelM) / Kg.ToTonne(TrainMassTunnelKg)) * TempTunnel2;
1155+
1156+
TunnelForceN = UnitAerodynamicDrag * Kg.ToTonne(MassKG) * AbsSpeedMpS * AbsSpeedMpS;
1157+
}
1158+
else
1159+
{
1160+
TunnelForceN = 0.0f; // Reset tunnel force to zero when train is no longer in the tunnel
11751161
}
11761162
}
11771163
}

0 commit comments

Comments
 (0)