@@ -196,6 +196,7 @@ public static Interpolator SteamHeatBoilerFuelUsageGalukpH()
196196 public float CarBodyLengthM ;
197197 public float CarCouplerFaceLengthM ;
198198 public float DerailmentCoefficient ;
199+ public float CarAirHoseLengthM ;
199200
200201 public float MaxHandbrakeForceN ;
201202 public float MaxBrakeForceN = 89e3f ;
@@ -1277,15 +1278,11 @@ public void UpdateTrainDerailmentRisk()
12771278 }
12781279
12791280 // Calculate airhose angles and height
1280- var airhoselengthM = 1.0f ; // 2' = 600mm - Note if air hose length is less then coupler distance then NaN occurs
1281- var rearairhoseheightadjustmentreferenceM = ( float ) Math . Sqrt ( ( float ) Math . Pow ( airhoselengthM , 2 ) - ( float ) Math . Pow ( CouplerDistanceThisCarM , 2 ) ) ;
1282- var frontairhoseheightadjustmentreferenceM = ( float ) Math . Sqrt ( ( float ) Math . Pow ( airhoselengthM , 2 ) - ( float ) Math . Pow ( CouplerDistanceBehindCarM , 2 ) ) ;
1281+ var rearairhoseheightadjustmentreferenceM = ( float ) Math . Sqrt ( ( float ) Math . Pow ( CarAirHoseLengthM , 2 ) - ( float ) Math . Pow ( CouplerDistanceThisCarM , 2 ) ) ;
1282+ var frontairhoseheightadjustmentreferenceM = ( float ) Math . Sqrt ( ( float ) Math . Pow ( CarAirHoseLengthM , 2 ) - ( float ) Math . Pow ( CouplerDistanceBehindCarM , 2 ) ) ;
12831283
1284- RearAirHoseHeightAdjustmentM = ( float ) Math . Sqrt ( ( float ) Math . Pow ( airhoselengthM , 2 ) - ( float ) Math . Pow ( ( CouplerDistanceThisCarM + CouplerSlackM / 2.0f ) , 2 ) ) ;
1285- CarBehind . FrontAirHoseHeightAdjustmentM = ( float ) Math . Sqrt ( ( float ) Math . Pow ( airhoselengthM , 2 ) - ( float ) Math . Pow ( ( CouplerDistanceBehindCarM + CouplerSlackM / 2.0f ) , 2 ) ) ;
1286- // Trace.TraceInformation("Rear AirHose Heights - CarID {0} R {1} length {2} CouplerDistance {3} Slack {4}", CarID, RearAirHoseHeightAdjustmentM, airhoselengthM, CouplerDistanceThisCarM, CouplerSlackM / 2.0f);
1287-
1288- // Trace.TraceInformation("Front AirHose Heights - CarID {0} F {1} length {2} CouplerDistance {3} Slack {4}", CarID, CarBehind.FrontAirHoseHeightAdjustmentM, airhoselengthM, CouplerDistanceBehindCarM, CouplerSlackM / 2.0f);
1284+ RearAirHoseHeightAdjustmentM = ( float ) Math . Sqrt ( ( float ) Math . Pow ( CarAirHoseLengthM , 2 ) - ( float ) Math . Pow ( ( CouplerDistanceThisCarM + CouplerSlackM / 2.0f ) , 2 ) ) ;
1285+ CarBehind . FrontAirHoseHeightAdjustmentM = ( float ) Math . Sqrt ( ( float ) Math . Pow ( CarAirHoseLengthM , 2 ) - ( float ) Math . Pow ( ( CouplerDistanceBehindCarM + CouplerSlackM / 2.0f ) , 2 ) ) ;
12891286
12901287 // refererence adjustment heights to rest position
12911288 if ( RearAirHoseHeightAdjustmentM >= rearairhoseheightadjustmentreferenceM )
@@ -1306,15 +1303,11 @@ public void UpdateTrainDerailmentRisk()
13061303 CarBehind . FrontAirHoseHeightAdjustmentM = frontairhoseheightadjustmentreferenceM - CarBehind . FrontAirHoseHeightAdjustmentM ;
13071304 }
13081305
1309- var rearairhoseangleadjustmentreferenceRad = ( float ) Math . Cos ( CouplerDistanceThisCarM / airhoselengthM ) ;
1310- var frontairhoseangleadjustmentreferenceRad = ( float ) Math . Cos ( CouplerDistanceBehindCarM / airhoselengthM ) ;
1311-
1312- RearAirHoseAngleAdjustmentRad = ( float ) Math . Cos ( ( CouplerDistanceThisCarM + CouplerSlackM / 2.0f ) / airhoselengthM ) ;
1313- CarBehind . FrontAirHoseAngleAdjustmentRad = ( float ) Math . Cos ( ( CouplerDistanceBehindCarM + CouplerSlackM / 2.0f ) / airhoselengthM ) ;
1306+ var rearairhoseangleadjustmentreferenceRad = ( float ) Math . Cos ( CouplerDistanceThisCarM / CarAirHoseLengthM ) ;
1307+ var frontairhoseangleadjustmentreferenceRad = ( float ) Math . Cos ( CouplerDistanceBehindCarM / CarAirHoseLengthM ) ;
13141308
1315- // Trace.TraceInformation("Angle Adjustment Rear - CarID {0} Adj {1} CouplerDist {2} Slack {3} Length {4} Ref {5}", CarID, RearAirHoseAngleAdjustmentRad, CouplerDistanceThisCarM, CouplerSlackM / 2.0f, airhoselengthM, rearairhoseangleadjustmentreferenceRad);
1316-
1317- // Trace.TraceInformation("Angle Adjustment Front - CarID {0} Adj {1} CouplerDist {2} Slack {3} Length {4} Ref {5}", CarID, CarBehind.FrontAirHoseAngleAdjustmentRad, CouplerDistanceBehindCarM, CouplerSlackM / 2.0f, airhoselengthM, frontairhoseangleadjustmentreferenceRad);
1309+ RearAirHoseAngleAdjustmentRad = ( float ) Math . Cos ( ( CouplerDistanceThisCarM + CouplerSlackM / 2.0f ) / CarAirHoseLengthM ) ;
1310+ CarBehind . FrontAirHoseAngleAdjustmentRad = ( float ) Math . Cos ( ( CouplerDistanceBehindCarM + CouplerSlackM / 2.0f ) / CarAirHoseLengthM ) ;
13181311
13191312 // refererence adjustment angles to rest position
13201313 if ( RearAirHoseAngleAdjustmentRad >= rearairhoseangleadjustmentreferenceRad )
@@ -1335,8 +1328,6 @@ public void UpdateTrainDerailmentRisk()
13351328 CarBehind . FrontAirHoseAngleAdjustmentRad = frontairhoseangleadjustmentreferenceRad - CarBehind . FrontAirHoseAngleAdjustmentRad ;
13361329 }
13371330
1338- // Trace.TraceInformation("CarID {0} FrontAdj {1} RearAdj {2}", CarID, CarBehind.FrontAirHoseAngleAdjustmentRad, RearAirHoseAngleAdjustmentRad);
1339-
13401331 }
13411332
13421333 // Train will derail if lateral forces on the train exceed the vertical forces holding the train on the railway track.
0 commit comments