Skip to content

Commit dbcdee0

Browse files
committed
Adjust precipitation and fog adhesion coefficients
1 parent 67c67f1 commit dbcdee0

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

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

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2920,18 +2920,15 @@ public virtual void UpdateFrictionCoefficient(float elapsedClockSeconds)
29202920
}
29212921
if (Simulator.WeatherType == WeatherType.Rain) // Wet weather
29222922
{
2923-
if (Simulator.Settings.AdhesionProportionalToWeather && AdvancedAdhesionModel && !Simulator.Paused) // Adjust clear weather for precipitation presence - base friction value will be approximately between 0.15 and 0.2
2924-
// ie base value between 0.8 and 1.0 (TODO)
2925-
// note lowest friction will be for drizzle rain; friction will increase for precipitation both higher and lower than drizzle rail
2923+
if (Simulator.Settings.AdhesionProportionalToWeather && AdvancedAdhesionModel && !Simulator.Paused) // Adjust clear weather for precipitation presence
2924+
// ie base value between 60% and 80% (TODO)
2925+
// note lowest friction will be for drizzle (light) rain; friction will increase for precipitation higher than drizzle rail
29262926
{
29272927
float pric = Simulator.Weather.PricipitationIntensityPPSPM2 * 1000;
2928-
// precipitation will calculate a value between 0.15 (light rain) and 0.2 (heavy rain) - this will be a factor that is used to adjust the base value - assume linear value between upper and lower precipitation values
2929-
if (pric >= 0.5)
2930-
BaseFrictionCoefficientFactor = Math.Min((pric * 0.0078f + 0.45f), 0.8f); // should give a minimum value between 0.8 and 1.0
2931-
else
2932-
BaseFrictionCoefficientFactor = Math.Min((0.4539f + 1.0922f * (0.5f - pric)), 0.8f); // should give a minimum value between 0.8 and 1.0
2928+
// precipitation will calculate a base coefficient value between 60% (light rain) and 80% (heavy rain) - this will be a factor that is used to adjust the base value - assume linear value between upper and lower precipitation values
2929+
BaseFrictionCoefficientFactor = Math.Min((pric * 0.0078f + 0.6f), 0.8f); // should give a minimum value between 60% and 80%
29332930
}
2934-
else // if not proportional to precipitation use fixed friction value of 0.8 x friction coefficient of 0.33
2931+
else // if not proportional to precipitation use fixed friction value of 0.8 x friction coefficient value
29352932
{
29362933
BaseFrictionCoefficientFactor = 0.8f;
29372934
}
@@ -2971,14 +2968,14 @@ public virtual void UpdateFrictionCoefficient(float elapsedClockSeconds)
29712968
float fog = Simulator.Weather.FogDistance;
29722969
if (fog > 2000)
29732970
{
2974-
BaseFrictionCoefficientFactor = 1.0f; // if fog is not too thick don't change the friction
2971+
BaseFrictionCoefficientFactor = 1.0f; // if fog is not too thick don't change the friction - minimal fog stay at clear adhesion
29752972
}
29762973
else
29772974
{
2978-
BaseFrictionCoefficientFactor = Math.Min((fog * 2.75e-4f + 0.8f), 0.8f); // If fog is less then 2km then it will impact friction, decrease adhesion by up to 20% (same as clear to wet transition)
2975+
BaseFrictionCoefficientFactor = Math.Min((fog * 2.75e-4f + 0.6f), 0.8f); // If fog is less then 2km then it will impact friction, decrease adhesion to 60% (same as light rain transition)
29792976
}
29802977
}
2981-
else // if not proportional to fog use fixed friction value approximately equal to 0.33, thus factor will be 1.0 x friction coefficient of 0.33
2978+
else // if not proportional to fog use fixed friction value approximately equal to default 0.33 (will vary if adhesion parameters set), thus factor will be 1.0 x friction coefficient of 0.33
29822979
{
29832980
BaseFrictionCoefficientFactor = 1.0f;
29842981
}

0 commit comments

Comments
 (0)