@@ -338,6 +338,8 @@ public float ConvectionFactor
338338 public float ActivityElapsedDurationS ;
339339 public float HotBoxStartTimeS ;
340340
341+ bool RigidWheelBaseInitialised = false ;
342+
341343 // Setup for ambient temperature dependency
342344 Interpolator OutsideWinterTempbyLatitudeC ; // Interploator to calculate ambient Winter temperature based upon the latitude of the route
343345 Interpolator OutsideAutumnTempbyLatitudeC ; // Interploator to calculate ambient Autumn temperature based upon the latitude of the route
@@ -720,7 +722,7 @@ public virtual void Initialize()
720722 {
721723 BrakeSystem . Initialize ( ) ;
722724 CurveSpeedDependent = Simulator . Settings . CurveSpeedDependent ;
723-
725+
724726 //CurveForceFilter.Initialize();
725727
726728 // Initialize tunnel resistance values
@@ -819,6 +821,81 @@ public virtual void Initialize()
819821 public virtual void Update ( float elapsedClockSeconds )
820822 {
821823
824+ // Initialize RigidWheelBaseM in first loop if not defined in ENG file, then ignore
825+ if ( RigidWheelBaseM == 0 && ! RigidWheelBaseInitialised ) // Calculate default values if no value in Wag File
826+ {
827+ float Axles = WheelAxles . Count ;
828+ float Bogies = Parts . Count - 1 ;
829+ float BogieSize = Axles / Bogies ;
830+
831+ RigidWheelBaseM = 1.6764f ; // Set a default in case no option is found - assume a standard 4 wheel (2 axle) bogie - wheel base - 5' 6" (1.6764m)
832+
833+ // Calculate the number of axles in a car
834+
835+ if ( WagonType != WagonTypes . Engine ) // if car is not a locomotive then determine wheelbase
836+ {
837+ if ( Bogies < 2 ) // if less then two bogies assume that it is a fixed wheelbase wagon
838+ {
839+ if ( Axles == 2 )
840+ {
841+ RigidWheelBaseM = 3.5052f ; // Assume a standard 4 wheel (2 axle) wagon - wheel base - 11' 6" (3.5052m)
842+ }
843+ else if ( Axles == 3 )
844+ {
845+ RigidWheelBaseM = 3.6576f ; // Assume a standard 6 wheel (3 axle) wagon - wheel base - 12' 2" (3.6576m)
846+ }
847+ }
848+ else if ( Bogies == 2 )
849+ {
850+ if ( BogieSize == 2 )
851+ {
852+ if ( WagonType == WagonTypes . Passenger )
853+ {
854+ RigidWheelBaseM = 2.4384f ; // Assume a standard 4 wheel passenger bogie (2 axle) wagon - wheel base - 8' (2.4384m)
855+ }
856+ else
857+ {
858+ RigidWheelBaseM = 1.6764f ; // Assume a standard 4 wheel freight bogie (2 axle) wagon - wheel base - 5' 6" (1.6764m)
859+ }
860+ }
861+ else if ( BogieSize == 3 )
862+ {
863+ RigidWheelBaseM = 3.6576f ; // Assume a standard 6 wheel bogie (3 axle) wagon - wheel base - 12' 2" (3.6576m)
864+ }
865+ }
866+ }
867+ if ( WagonType == WagonTypes . Engine ) // if car is a locomotive and either a diesel or electric then determine wheelbase
868+ {
869+ if ( EngineType != EngineTypes . Steam ) // Assume that it is a diesel or electric locomotive
870+ {
871+ if ( BogieSize == 2 )
872+ {
873+ RigidWheelBaseM = 1.6764f ; // Set a default in case no option is found - assume a standard 4 wheel (2 axle) bogie - wheel base - 5' 6" (1.6764m)
874+ }
875+ else if ( BogieSize == 3 )
876+ {
877+ RigidWheelBaseM = 3.5052f ; // Assume a standard 6 wheel bogie (3 axle) locomotive - wheel base - 11' 6" (3.5052m)
878+ }
879+ }
880+ else // assume steam locomotive
881+ {
882+
883+ if ( LocoNumDrvAxles >= Axles ) // Test to see if ENG file value is too big (typically doubled)
884+ {
885+ LocoNumDrvAxles = LocoNumDrvAxles / 2 ; // Appears this might be the number of wheels rather then the axles.
886+ }
887+
888+ // Approximation for calculating rigid wheelbase for steam locomotives
889+ // Wheelbase = 1.25 x (Loco Drive Axles - 1.0) x Drive Wheel diameter
890+
891+ RigidWheelBaseM = 1.25f * ( LocoNumDrvAxles - 1.0f ) * ( DriverWheelRadiusM * 2.0f ) ;
892+ }
893+ }
894+
895+ RigidWheelBaseInitialised = true ; // Don't process again
896+ }
897+
898+
822899 // Initialise ambient temperatures on first initial loop, then ignore
823900 if ( ! AmbientTemperatureInitialised )
824901 {
@@ -2011,76 +2088,6 @@ public virtual void UpdateCurveForce(float elapsedClockSeconds)
20112088 {
20122089 if ( CurrentCurveRadiusM > 0 )
20132090 {
2014- if ( RigidWheelBaseM == 0 ) // Calculate default values if no value in Wag File
2015- {
2016- float Axles = WheelAxles . Count ;
2017- float Bogies = Parts . Count - 1 ;
2018- float BogieSize = Axles / Bogies ;
2019-
2020- RigidWheelBaseM = 1.6764f ; // Set a default in case no option is found - assume a standard 4 wheel (2 axle) bogie - wheel base - 5' 6" (1.6764m)
2021-
2022- // Calculate the number of axles in a car
2023-
2024- if ( WagonType != WagonTypes . Engine ) // if car is not a locomotive then determine wheelbase
2025- {
2026- if ( Bogies < 2 ) // if less then two bogies assume that it is a fixed wheelbase wagon
2027- {
2028- if ( Axles == 2 )
2029- {
2030- RigidWheelBaseM = 3.5052f ; // Assume a standard 4 wheel (2 axle) wagon - wheel base - 11' 6" (3.5052m)
2031- }
2032- else if ( Axles == 3 )
2033- {
2034- RigidWheelBaseM = 3.6576f ; // Assume a standard 6 wheel (3 axle) wagon - wheel base - 12' 2" (3.6576m)
2035- }
2036- }
2037- else if ( Bogies == 2 )
2038- {
2039- if ( Axles == 2 )
2040- {
2041- if ( WagonType == WagonTypes . Passenger )
2042- {
2043- RigidWheelBaseM = 2.4384f ; // Assume a standard 4 wheel passenger bogie (2 axle) wagon - wheel base - 8' (2.4384m)
2044- }
2045- else
2046- {
2047- RigidWheelBaseM = 1.6764f ; // Assume a standard 4 wheel freight bogie (2 axle) wagon - wheel base - 5' 6" (1.6764m)
2048- }
2049- }
2050- else if ( Axles == 3 )
2051- {
2052- RigidWheelBaseM = 3.6576f ; // Assume a standard 6 wheel bogie (3 axle) wagon - wheel base - 12' 2" (3.6576m)
2053- }
2054- }
2055- }
2056- if ( WagonType == WagonTypes . Engine ) // if car is a locomotive and either a diesel or electric then determine wheelbase
2057- {
2058- if ( EngineType != EngineTypes . Steam ) // Assume that it is a diesel or electric locomotive
2059- {
2060- if ( Axles == 2 )
2061- {
2062- RigidWheelBaseM = 1.6764f ; // Set a default in case no option is found - assume a standard 4 wheel (2 axle) bogie - wheel base - 5' 6" (1.6764m)
2063- }
2064- else if ( Axles == 3 )
2065- {
2066- RigidWheelBaseM = 3.5052f ; // Assume a standard 6 wheel bogie (3 axle) locomotive - wheel base - 11' 6" (3.5052m)
2067- }
2068- }
2069- else // assume steam locomotive
2070- {
2071-
2072- if ( LocoNumDrvAxles >= Axles ) // Test to see if ENG file value is too big (typically doubled)
2073- {
2074- LocoNumDrvAxles = LocoNumDrvAxles / 2 ; // Appears this might be the number of wheels rather then the axles.
2075- }
2076-
2077- // Approximation for calculating rigid wheelbase for steam locomotives
2078- // Wheelbase = 1.25 x (Loco Drive Axles - 1.0) x Drive Wheel diameter
2079-
2080- RigidWheelBaseM = 1.25f * ( LocoNumDrvAxles - 1.0f ) * ( DriverWheelRadiusM * 2.0f ) ;
2081- }
2082- }
2083- }
20842091
20852092 // References:
20862093
0 commit comments