Skip to content

Commit c697860

Browse files
committed
Automatic merge of T1.5.1-889-ge5d0fbbd4 and 17 pull requests
- Pull request #570 at 3539862: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #882 at 9c456aa: Blueprint/train car operations UI window - Pull request #885 at 8f94333: feat: Add notifications to Menu - Pull request #886 at 6c0785b: Scene viewer extension to TrackViewer - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #897 at 42f1dd9: feat: Improved system information collection - Pull request #903 at 9bead33: Downloading route content (Github, zip) - Pull request #907 at 9b0b04f: Bug fix for https://bugs.launchpad.net/or/+bug/2047300 Dynamic tracks disappear after long tunnel - Pull request #911 at 6834af0: docs: Add refactoring as a special type of PR - Pull request #912 at d595703: New Triple Valve Features Vol. 2 - Pull request #915 at d1fc31f: Correct calculation error with curve friction - Pull request #917 at 3bbf66e: Lighting Configuration Enhancements - Pull request #919 at 7aafe02: Added mouse wheel support for controls which can be moved by pressing t… - Pull request #920 at a94e403: Update RailDriver in Manual
19 parents 21c665f + e5d0fbb + 3539862 + d00beb9 + f92de76 + 9c456aa + 8f94333 + 6c0785b + 1f5ba4c + 5866028 + 42f1dd9 + 9bead33 + 9b0b04f + 6834af0 + d595703 + d1fc31f + 3bbf66e + 7aafe02 + a94e403 commit c697860

File tree

1 file changed

+98
-70
lines changed
  • Source/Orts.Simulation/Simulation/RollingStocks

1 file changed

+98
-70
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/TrainCar.cs

Lines changed: 98 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,8 @@ public float ConvectionFactor
340340
public float ActivityElapsedDurationS;
341341
public float HotBoxStartTimeS;
342342

343+
bool RigidWheelBaseInitialised = false;
344+
343345
// Setup for ambient temperature dependency
344346
Interpolator OutsideWinterTempbyLatitudeC; // Interploator to calculate ambient Winter temperature based upon the latitude of the route
345347
Interpolator OutsideAutumnTempbyLatitudeC; // Interploator to calculate ambient Autumn temperature based upon the latitude of the route
@@ -829,6 +831,102 @@ public virtual void Initialize()
829831
// called when it's time to update the MotiveForce and FrictionForce
830832
public virtual void Update(float elapsedClockSeconds)
831833
{
834+
// Initialize RigidWheelBaseM in first loop if not defined in ENG file, then ignore
835+
if (RigidWheelBaseM == 0 && !RigidWheelBaseInitialised) // Calculate default values if no value in Wag File
836+
{
837+
float Axles = WheelAxles.Count;
838+
float Bogies = Parts.Count - 1;
839+
float BogieSize = Axles / Bogies;
840+
841+
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)
842+
843+
// Calculate the number of axles in a car
844+
845+
if (WagonType != WagonTypes.Engine) // if car is not a locomotive then determine wheelbase
846+
{
847+
if (Bogies < 2) // if less then two bogies assume that it is a fixed wheelbase wagon
848+
{
849+
if (Axles == 2)
850+
{
851+
RigidWheelBaseM = 3.5052f; // Assume a standard 4 wheel (2 axle) wagon - wheel base - 11' 6" (3.5052m)
852+
}
853+
else if (Axles == 3)
854+
{
855+
RigidWheelBaseM = 3.6576f; // Assume a standard 6 wheel (3 axle) wagon - wheel base - 12' 2" (3.6576m)
856+
}
857+
858+
if (Simulator.Settings.VerboseConfigurationMessages)
859+
{
860+
Trace.TraceInformation("Rigid Wheelbase of CarID {0} set to {1} for number of axles {2}", CarID, FormatStrings.FormatVeryShortDistanceDisplay(RigidWheelBaseM, IsMetric), Axles);
861+
}
862+
863+
}
864+
else if (Bogies == 2)
865+
{
866+
if (BogieSize == 2)
867+
{
868+
if (WagonType == WagonTypes.Passenger)
869+
{
870+
RigidWheelBaseM = 2.4384f; // Assume a standard 4 wheel passenger bogie (2 axle) wagon - wheel base - 8' (2.4384m)
871+
}
872+
else
873+
{
874+
RigidWheelBaseM = 1.6764f; // Assume a standard 4 wheel freight bogie (2 axle) wagon - wheel base - 5' 6" (1.6764m)
875+
}
876+
}
877+
else if (BogieSize == 3)
878+
{
879+
RigidWheelBaseM = 3.6576f; // Assume a standard 6 wheel bogie (3 axle) wagon - wheel base - 12' 2" (3.6576m)
880+
}
881+
882+
if (Simulator.Settings.VerboseConfigurationMessages)
883+
{
884+
Trace.TraceInformation("Rigid Wheelbase of CarID {0} set to {1} for number of axles {2}", CarID, FormatStrings.FormatVeryShortDistanceDisplay(RigidWheelBaseM, IsMetric), BogieSize);
885+
}
886+
887+
}
888+
}
889+
else if (WagonType == WagonTypes.Engine) // if car is a locomotive and either a diesel or electric then determine wheelbase
890+
{
891+
if (EngineType != EngineTypes.Steam) // Assume that it is a diesel or electric locomotive
892+
{
893+
if (BogieSize == 2)
894+
{
895+
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)
896+
}
897+
else if (BogieSize == 3)
898+
{
899+
RigidWheelBaseM = 3.5052f; // Assume a standard 6 wheel bogie (3 axle) locomotive - wheel base - 11' 6" (3.5052m)
900+
}
901+
902+
if (Simulator.Settings.VerboseConfigurationMessages)
903+
{
904+
Trace.TraceInformation("Rigid Wheelbase of CarID {0} set to {1} for number of axles {2}", CarID, FormatStrings.FormatVeryShortDistanceDisplay(RigidWheelBaseM, IsMetric), BogieSize);
905+
}
906+
}
907+
else // assume steam locomotive
908+
{
909+
910+
if (LocoNumDrvAxles >= Axles) // Test to see if ENG file value is too big (typically doubled)
911+
{
912+
LocoNumDrvAxles = LocoNumDrvAxles / 2; // Appears this might be the number of wheels rather then the axles.
913+
}
914+
915+
// Approximation for calculating rigid wheelbase for steam locomotives
916+
// Wheelbase = 1.25 x (Loco Drive Axles - 1.0) x Drive Wheel diameter
917+
918+
RigidWheelBaseM = 1.25f * (LocoNumDrvAxles - 1.0f) * (DriverWheelRadiusM * 2.0f);
919+
920+
if (Simulator.Settings.VerboseConfigurationMessages)
921+
{
922+
Trace.TraceInformation("Rigid Wheelbase of CarID {0} set to {1} for number of axles {2}", CarID, FormatStrings.FormatVeryShortDistanceDisplay(RigidWheelBaseM, IsMetric), LocoNumDrvAxles);
923+
}
924+
}
925+
}
926+
927+
RigidWheelBaseInitialised = true; // Don't process again
928+
}
929+
832930

833931
// Initialise ambient temperatures on first initial loop, then ignore
834932
if (!AmbientTemperatureInitialised)
@@ -2022,76 +2120,6 @@ public virtual void UpdateCurveForce(float elapsedClockSeconds)
20222120
{
20232121
if (CurrentCurveRadiusM > 0)
20242122
{
2025-
if (RigidWheelBaseM == 0) // Calculate default values if no value in Wag File
2026-
{
2027-
float Axles = WheelAxles.Count;
2028-
float Bogies = Parts.Count - 1;
2029-
float BogieSize = Axles / Bogies;
2030-
2031-
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)
2032-
2033-
// Calculate the number of axles in a car
2034-
2035-
if (WagonType != WagonTypes.Engine) // if car is not a locomotive then determine wheelbase
2036-
{
2037-
if (Bogies < 2) // if less then two bogies assume that it is a fixed wheelbase wagon
2038-
{
2039-
if (Axles == 2)
2040-
{
2041-
RigidWheelBaseM = 3.5052f; // Assume a standard 4 wheel (2 axle) wagon - wheel base - 11' 6" (3.5052m)
2042-
}
2043-
else if (Axles == 3)
2044-
{
2045-
RigidWheelBaseM = 3.6576f; // Assume a standard 6 wheel (3 axle) wagon - wheel base - 12' 2" (3.6576m)
2046-
}
2047-
}
2048-
else if (Bogies == 2)
2049-
{
2050-
if (Axles == 2)
2051-
{
2052-
if (WagonType == WagonTypes.Passenger)
2053-
{
2054-
RigidWheelBaseM = 2.4384f; // Assume a standard 4 wheel passenger bogie (2 axle) wagon - wheel base - 8' (2.4384m)
2055-
}
2056-
else
2057-
{
2058-
RigidWheelBaseM = 1.6764f; // Assume a standard 4 wheel freight bogie (2 axle) wagon - wheel base - 5' 6" (1.6764m)
2059-
}
2060-
}
2061-
else if (Axles == 3)
2062-
{
2063-
RigidWheelBaseM = 3.6576f; // Assume a standard 6 wheel bogie (3 axle) wagon - wheel base - 12' 2" (3.6576m)
2064-
}
2065-
}
2066-
}
2067-
if (WagonType == WagonTypes.Engine) // if car is a locomotive and either a diesel or electric then determine wheelbase
2068-
{
2069-
if (EngineType != EngineTypes.Steam) // Assume that it is a diesel or electric locomotive
2070-
{
2071-
if (Axles == 2)
2072-
{
2073-
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)
2074-
}
2075-
else if (Axles == 3)
2076-
{
2077-
RigidWheelBaseM = 3.5052f; // Assume a standard 6 wheel bogie (3 axle) locomotive - wheel base - 11' 6" (3.5052m)
2078-
}
2079-
}
2080-
else // assume steam locomotive
2081-
{
2082-
2083-
if (LocoNumDrvAxles >= Axles) // Test to see if ENG file value is too big (typically doubled)
2084-
{
2085-
LocoNumDrvAxles = LocoNumDrvAxles / 2; // Appears this might be the number of wheels rather then the axles.
2086-
}
2087-
2088-
// Approximation for calculating rigid wheelbase for steam locomotives
2089-
// Wheelbase = 1.25 x (Loco Drive Axles - 1.0) x Drive Wheel diameter
2090-
2091-
RigidWheelBaseM = 1.25f * (LocoNumDrvAxles - 1.0f) * (DriverWheelRadiusM * 2.0f);
2092-
}
2093-
}
2094-
}
20952123

20962124
// References:
20972125

0 commit comments

Comments
 (0)