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
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)
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
2920
-
// ie base value between 0.8 and 1.0 (TODO)
2921
-
// note lowest friction will be for drizzle rain; friction will increase for precipitation both higher and lower than drizzle rail
// 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
2925
-
if(pric>=0.5)
2926
-
BaseFrictionCoefficientFactor=Math.Min((pric*0.0078f+0.45f),0.8f);// should give a minimum value between 0.8 and 1.0
2927
-
else
2928
-
BaseFrictionCoefficientFactor=Math.Min((0.4539f+1.0922f*(0.5f-pric)),0.8f);// should give a minimum value between 0.8 and 1.0
2929
-
}
2930
-
else// if not proportional to precipitation use fixed friction value of 0.8 x friction coefficient of 0.33
@@ -2959,27 +2984,9 @@ public virtual void UpdateFrictionCoefficient(float elapsedClockSeconds)
2959
2984
}
2960
2985
}
2961
2986
}
2962
-
else// Default to Dry (Clear) weather
2987
+
else// dry weather
2963
2988
{
2964
-
2965
-
if(Simulator.Settings.AdhesionProportionalToWeather&&AdvancedAdhesionModel&&!Simulator.Paused)// Adjust clear weather for fog presence
2966
-
{
2967
-
floatfog=Simulator.Weather.FogDistance;
2968
-
if(fog>2000)
2969
-
{
2970
-
BaseFrictionCoefficientFactor=1.0f;// if fog is not too thick don't change the friction
2971
-
}
2972
-
else
2973
-
{
2974
-
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
-
}
2976
-
}
2977
-
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
@@ -2999,6 +3006,7 @@ public virtual void UpdateFrictionCoefficient(float elapsedClockSeconds)
2999
3006
}
3000
3007
}
3001
3008
}
3009
+
3002
3010
}
3003
3011
3004
3012
// For wagons use base Curtius-Kniffler adhesion factor - u = 0.33
@@ -3016,13 +3024,54 @@ public virtual void UpdateFrictionCoefficient(float elapsedClockSeconds)
3016
3024
3017
3025
}
3018
3026
3019
-
if(WheelSlip&&ThrottlePercent>0.2f&&!BrakeSkid)// Test to see if loco wheel is slipping, then coeff of friction will be decreased below static value. Sanding will override this somewhat
3027
+
// When wheel slips or skids, then dynamic (kinetic) coeff of friction will be decreased below static value. Sanding will override this somewhat.
3028
+
// The transition between static and dynamic friction appears to decrease at an exponential rate until it reaches a steady state dynamic value.
3029
+
//
3030
+
3031
+
3032
+
// Test to see if loco wheel is slipping or skidding due to brake application
BaseFrictionCoefficientFactor=0.15f*SandingFrictionCoefficientFactor;// Descrease friction to take into account dynamic (kinetic) friction U = 0.0525
3035
+
3036
+
WheelStopSlipTimeS=0;// Reset stop slip time if wheel slip starts
3037
+
3038
+
// Exponential curve is used to transition between static friction and dynamic friction when wheel slips
3039
+
// Exponential constant calculated between two points, using this tool - https://mathcracker.com/exponential-function-calculator#results
3040
+
// Google search suggests that Steel on steel has a static coeff = 0.74, and a dynamic coeff = 0.57. Hence reduction = 0.77.
3041
+
// Constant points facilitate a decrease from 1 to 0.7 in 3 seconds - P1 = (0, 1), P2 = (5, 0.77). Hence exp constant = −0.0523
3042
+
varexpAdhesion=-0.0523;
3043
+
WheelSlipTimeS+=elapsedClockSeconds;
3044
+
WheelSlipTimeS=MathHelper.Clamp(WheelSlipTimeS,0.0f,5.0f);// Ensure that time to transition between the two friction cases is maintained - currently set to 3 secs
BaseFrictionCoefficientFactor*=adhesionMultiplier;// Descrease friction to take into account dynamic (kinetic) friction, typically kinetic friction is approximately 50% of static friction.
BaseFrictionCoefficientFactor=MathHelper.Clamp(BaseFrictionCoefficientFactor,0.05f,1.0f);// Ensure friction coefficient never exceeds a "reasonable" value
3022
3053
}
3023
-
elseif(WheelSlip&&ThrottlePercent<0.1f&&BrakeSkid)// Test to see if loco wheel is skidding due to brake application
3054
+
else
3024
3055
{
3025
-
BaseFrictionCoefficientFactor=0.15f*SandingFrictionCoefficientFactor;// Descrease friction to take into account dynamic (kinetic) friction U = 0.0525
3056
+
WheelSlipTimeS=0;// Reset slip time if wheel slip stops
3057
+
3058
+
if((EngineType==EngineTypes.Steam&&SteamEngineType!=MSTSSteamLocomotive.SteamEngineTypes.Geared)&&SlipFrictionCoefficientFactor<BaseFrictionCoefficientFactor&&SlipFrictionCoefficientFactor!=0)// Once these two are equal then assume that wheels have stopped slipping.
3059
+
{
3060
+
// Trace.TraceInformation("SlipFriction {0} Base {1}", SlipFrictionCoefficientFactor, BaseFrictionCoefficientFactor);
3061
+
// Exponential curve is used to transition between dynamic friction and static friction when wheel stops slipping
3062
+
// Constant points facilitate an increase from 0.7 to 1 in 3 seconds - P1 = (5, 0.77), P2 = (0, 1). Hence exp constant = 0.0523
3063
+
varexpAdhesion=0.0523;
3064
+
WheelStopSlipTimeS+=elapsedClockSeconds;
3065
+
WheelStopSlipTimeS=MathHelper.Clamp(WheelStopSlipTimeS,0.0f,5.0f);// Ensure that time to transition between the two friction cases is maintained - currently set to 3 secs
// Trace.TraceInformation("adhesion {0} StopTime {1} Base {2} Current {3}", adhesionMultiplier, WheelStopSlipTimeS, BaseFrictionCoefficientFactor, CurrentWheelSlipAdhesionMultiplier);
3070
+
3071
+
BaseFrictionCoefficientFactor*=adhesionMultiplier;// Descrease friction to take into account dynamic (kinetic) friction, typically kinetic friction is approximately 50% of static friction.
BaseFrictionCoefficientFactor=MathHelper.Clamp(BaseFrictionCoefficientFactor,0.05f,1.0f);// Ensure friction coefficient never exceeds a "reasonable" value
3074
+
}
3026
3075
}
3027
3076
3028
3077
varAdhesionMultiplier=Simulator.Settings.AdhesionFactor/100.0f;// Convert to a factor where 100% = no change to adhesion
0 commit comments