@@ -204,7 +204,7 @@ public static Interpolator SteamHeatBoilerFuelUsageGalukpH()
204204 public bool DerailmentCoefficientEnabled = true ;
205205 public float MaximumWheelFlangeAngleRad ;
206206 public float WheelFlangeLengthM ;
207- public float AngleOfAttackRad ;
207+ public float AngleOfAttackmRad ;
208208 public float DerailClimbDistanceM ;
209209 public bool DerailPossible = false ;
210210 public bool DerailExpected = false ;
@@ -968,6 +968,8 @@ public virtual void Update(float elapsedClockSeconds)
968968 CurrentElevationPercent = - CurrentElevationPercent ;
969969 }
970970
971+ AngleOfAttackmRad = GetAngleofAttackmRad ( ) ;
972+
971973 UpdateCurveSpeedLimit ( ) ; // call this first as it will provide inputs for the curve force.
972974 UpdateCurveForce ( elapsedClockSeconds ) ;
973975 UpdateTunnelForce ( ) ;
@@ -1681,10 +1683,6 @@ public void UpdateTrainDerailmentRisk(float elapsedClockSeconds)
16811683 // Calculate Nadal derailment coefficient limit
16821684 NadalDerailmentCoefficient = ( ( float ) Math . Tan ( MaximumWheelFlangeAngleRad ) - wagonAdhesion ) / ( 1f + wagonAdhesion * ( float ) Math . Tan ( MaximumWheelFlangeAngleRad ) ) ;
16831685
1684- // Calculate Angle of Attack - AOA = sin-1(2 * bogie wheel base / curve radius)
1685- AngleOfAttackRad = ( float ) Math . Asin ( 2 * RigidWheelBaseM / CurrentCurveRadiusM ) ;
1686- var angleofAttackmRad = AngleOfAttackRad * 1000f ; // Convert to micro radians
1687-
16881686 // Calculate the derail climb distance - uses the general form equation 2.4 from the above publication
16891687 var parameterA_1 = ( ( 100 / ( - 1.9128f * MathHelper . ToDegrees ( MaximumWheelFlangeAngleRad ) + 146.56f ) ) + 3.1f ) * Me . ToIn ( WheelFlangeLengthM ) ;
16901688
@@ -1698,7 +1696,7 @@ public void UpdateTrainDerailmentRisk(float elapsedClockSeconds)
16981696
16991697 var parameterB = parameterB_1 + parameterB_2 ;
17001698
1701- DerailClimbDistanceM = Me . FromFt ( ( float ) ( ( parameterA * parameterB * Me . ToIn ( WheelFlangeLengthM ) ) / ( ( angleofAttackmRad + ( parameterB * Me . ToIn ( WheelFlangeLengthM ) ) ) ) ) ) ;
1699+ DerailClimbDistanceM = Me . FromFt ( ( float ) ( ( parameterA * parameterB * Me . ToIn ( WheelFlangeLengthM ) ) / ( ( AngleOfAttackmRad + ( parameterB * Me . ToIn ( WheelFlangeLengthM ) ) ) ) ) ) ;
17021700
17031701 // calculate the time taken to travel the derail climb distance
17041702 var derailTimeS = DerailClimbDistanceM / AbsSpeedMpS ;
@@ -1769,6 +1767,26 @@ public void UpdateTrainDerailmentRisk(float elapsedClockSeconds)
17691767
17701768 #endregion
17711769
1770+ /// <summary>
1771+ /// Get the Angle of attack for a car as it goes through a curve
1772+ /// </summary>
1773+ /// <returns>angle in micro radians</returns>
1774+ ///
1775+ public float GetAngleofAttackmRad ( )
1776+ {
1777+ if ( CurrentCurveRadiusM > 0 )
1778+ {
1779+ // Calculate Angle of Attack - AOA = sin-1(2 * bogie wheel base / curve radius)
1780+ var angleofAttackmRad = ( float ) Math . Asin ( 2 * RigidWheelBaseM / CurrentCurveRadiusM ) * 1000f ; // Convert to micro radians
1781+ return angleofAttackmRad ;
1782+ }
1783+ else
1784+ {
1785+ return 0 ;
1786+ }
1787+ }
1788+
1789+
17721790 /// <summary>
17731791 /// Get the current direction that curve is heading relative to the train.
17741792 /// </summary>
0 commit comments