You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs
+52-45Lines changed: 52 additions & 45 deletions
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@
42
42
//#define ALLOW_ORTS_SPECIFIC_ENG_PARAMETERS
43
43
44
44
// Debug for Advanced Adhesion Model
45
-
//#define DEBUG_ADHESION
45
+
//#define DEBUG_ADHESION
46
46
47
47
usingMicrosoft.Xna.Framework;
48
48
usingMicrosoft.Xna.Framework.Graphics;
@@ -223,6 +223,10 @@ public float CurrentLocomotiveSteamHeatBoilerWaterCapacityL
223
223
floatWheelSlipTimeS;
224
224
floatWheelStopSlipTimeS;
225
225
floatCurrentWheelSlipAdhesionMultiplier;
226
+
floatDebugTimer;// Used for debugging adhesion coefficient
227
+
boolDebugSpeedReached=false;// Used for debugging adhesion coefficient
228
+
floatDebugSpeedIncrement=1;// Used for debugging adhesion coefficient
229
+
floatDebugSpeed=1;// Used for debugging adhesion coefficient
226
230
227
231
// parameters for Track Sander based upon compressor air and abrasive table for 1/2" sand blasting nozzle @ 50psi
228
232
publicfloatMaxTrackSandBoxCapacityM3=Me3.FromFt3(40.0f);// Capacity of sandbox - assume 40.0 cu ft
@@ -2906,39 +2910,59 @@ public virtual void UpdateFrictionCoefficient(float elapsedClockSeconds)
2906
2910
{
2907
2911
floatBaseuMax=(Curtius_KnifflerA/(MpS.ToKpH(AbsSpeedMpS)+Curtius_KnifflerB)+Curtius_KnifflerC);// Base Curtius - Kniffler equation - u = 0.33, all other values are scaled off this formula
// 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
2924
+
if(pric>=0.5)
2925
+
pricBaseFrictionCoefficientFactor=Math.Min((pric-0.5f)*0.0078f+0.6f,0.8f);// should give a value between 0.6 and 0.8
2926
+
else
2927
+
pricBaseFrictionCoefficientFactor=0.6f+0.8f*(0.5f-pric);// should give a transition value between 1.0 and 0.6 as rain starts
2928
+
2929
+
// Adjust adhesion for impact of fog - default = 20000m = 20km
2930
+
floatfog=Simulator.Weather.FogDistance;
2931
+
if(fog<20000)// as fog thickens then decrease adhesion
fogBaseFrictionCoefficientFactor=Math.Min((fog*2.75e-4f+0.6f),1.0f);// If fog is less then 2km then it will impact friction, decrease adhesion to 60% (same as light rain transition)
// 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%
2930
-
}
2931
-
else// if not proportional to precipitation use fixed friction value of 0.8 x friction coefficient value
2932
-
{
2933
-
BaseFrictionCoefficientFactor=0.8f;
2934
-
}
2953
+
BaseFrictionCoefficientFactor=0.6f;
2935
2954
}
2936
-
else// Snow weather
2955
+
else
2937
2956
{
2938
-
BaseFrictionCoefficientFactor=0.6f;
2957
+
BaseFrictionCoefficientFactor=0.8f;
2939
2958
}
2959
+
}
2940
2960
2941
-
//add sander - more effective in wet weather, so increases adhesion by more
@@ -2960,27 +2984,9 @@ public virtual void UpdateFrictionCoefficient(float elapsedClockSeconds)
2960
2984
}
2961
2985
}
2962
2986
}
2963
-
else// Default to Dry (Clear) weather
2987
+
else// dry weather
2964
2988
{
2965
-
2966
-
if(Simulator.Settings.AdhesionProportionalToWeather&&AdvancedAdhesionModel&&!Simulator.Paused)// Adjust clear weather for fog presence
2967
-
{
2968
-
floatfog=Simulator.Weather.FogDistance;
2969
-
if(fog>2000)
2970
-
{
2971
-
BaseFrictionCoefficientFactor=1.0f;// if fog is not too thick don't change the friction - minimal fog stay at clear adhesion
2972
-
}
2973
-
else
2974
-
{
2975
-
BaseFrictionCoefficientFactor=Math.Min((fog*2.75e-4f+0.6f),1.0f);// If fog is less then 2km then it will impact friction, decrease adhesion to 60% (same as light rain transition)
2976
-
}
2977
-
}
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
0 commit comments