Skip to content

Commit 21c665f

Browse files
committed
Automatic merge of T1.5.1-889-ge5d0fbbd4 and 16 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 #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
18 parents 8bdc241 + e5d0fbb + 3539862 + d00beb9 + f92de76 + 9c456aa + 8f94333 + 6c0785b + 1f5ba4c + 5866028 + 42f1dd9 + 9bead33 + 9b0b04f + 6834af0 + d595703 + 3bbf66e + 7aafe02 + a94e403 commit 21c665f

File tree

3 files changed

+87
-115
lines changed

3 files changed

+87
-115
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSLocomotive.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ public enum SlipControlType
264264
public float MaxTrackSanderSandConsumptionForwardM3pS;
265265
public float CurrentTrackSanderAirConsumptionM3pS;
266266
public float CurrentTrackSanderSandConsumptionM3pS;
267-
public float CurrentTrackSandBoxCapacityM3;
267+
public float CurrentTrackSandBoxCapacityM3;
268268
public float MaxTrackSanderSandConsumptionReverseM3pS = 0;
269269
public float SandWeightKgpM3 = 1600; // One cubic metre of sand weighs about 1.54-1.78 tonnes.
270270
public float MaxTrackSanderSteamConsumptionForwardLbpS;
@@ -1542,7 +1542,7 @@ public override void Initialize()
15421542
{
15431543
CurrentTrackSandBoxCapacityM3 = MaxTrackSandBoxCapacityM3;
15441544
}
1545-
1545+
15461546
// Ensure Drive Axles is set with a default value if user doesn't supply an OR value in ENG file
15471547
if (LocoNumDrvAxles == 0)
15481548
{
@@ -2997,7 +2997,7 @@ public virtual void UpdateWaterTroughRefill(float elapsedClockSeconds, float abs
29972997
else if (ScoopIsBroken)
29982998
{
29992999
Simulator.Confirmer.Message(ConfirmLevel.Error, Simulator.Catalog.GetString("Scoop is broken, can't refill"));
3000-
RefillingFromTrough = false;
3000+
RefillingFromTrough = false;
30013001
}
30023002
else if (IsOverJunction())
30033003
{
@@ -3007,7 +3007,7 @@ public virtual void UpdateWaterTroughRefill(float elapsedClockSeconds, float abs
30073007
}
30083008
ScoopIsBroken = true;
30093009
RefillingFromTrough = false;
3010-
SignalEvent(Event.WaterScoopBroken);
3010+
SignalEvent(Event.WaterScoopBroken);
30113011
}
30123012
else if (!IsOverTrough())
30133013
{
@@ -3291,9 +3291,9 @@ public virtual void UpdateFrictionCoefficient(float elapsedClockSeconds)
32913291

32923292
public void UpdateTrackSander(float elapsedClockSeconds)
32933293
{
3294-
// updates track sander in terms of sand usage and impact on air compressor
3295-
// The following assumptions have been made:
3296-
//
3294+
// updates track sander in terms of sand usage and impact on air compressor
3295+
// The following assumptions have been made:
3296+
//
32973297

32983298
if (Sander && AbsSpeedMpS < SanderSpeedOfMpS) // If sander switch is on, and not blocked by speed, adjust parameters
32993299
{
@@ -3319,18 +3319,18 @@ public void UpdateTrackSander(float elapsedClockSeconds)
33193319
SandingSteamUsageLBpS = (BoilerPressurePSI / MaxBoilerPressurePSI) * sandingSteamConsumptionLbpS * elapsedClockSeconds;
33203320

33213321
// Calculate sand consumption for sander
3322-
if (CurrentTrackSandBoxCapacityM3 > 0.0) // if sand still in sandbox then sanding is available
3323-
{
3324-
// Calculate consumption of sand, and drop in sand box level
3322+
if (CurrentTrackSandBoxCapacityM3 > 0.0) // if sand still in sandbox then sanding is available
3323+
{
3324+
// Calculate consumption of sand, and drop in sand box level
33253325
CurrentTrackSanderSandConsumptionM3pS = (BoilerPressurePSI / MaxBoilerPressurePSI) * sandingSandConsumptionM3pS * elapsedClockSeconds;
33263326
CurrentTrackSandBoxCapacityM3 -= CurrentTrackSanderSandConsumptionM3pS;
3327-
CurrentTrackSandBoxCapacityM3 = MathHelper.Clamp(CurrentTrackSandBoxCapacityM3, 0.0f, MaxTrackSandBoxCapacityM3);
3327+
CurrentTrackSandBoxCapacityM3 = MathHelper.Clamp(CurrentTrackSandBoxCapacityM3, 0.0f, MaxTrackSandBoxCapacityM3);
33283328
if (CurrentTrackSandBoxCapacityM3 <= 0.0)
3329-
{
3330-
Simulator.Confirmer.Message(ConfirmLevel.Warning, Simulator.Catalog.GetString("Sand supply has been exhausted"));
3329+
{
3330+
Simulator.Confirmer.Message(ConfirmLevel.Warning, Simulator.Catalog.GetString("Sand supply has been exhausted"));
3331+
}
33313332
}
33323333
}
3333-
}
33343334
else // air consumption
33353335
{
33363336
float sandingAirConsumptionM3pS = 0.0f;
@@ -3345,7 +3345,7 @@ public void UpdateTrackSander(float elapsedClockSeconds)
33453345
{
33463346
sandingAirConsumptionM3pS = MaxTrackSanderAirComsumptionForwardM3pS;
33473347
sandingSandConsumptionM3pS = MaxTrackSanderSandConsumptionForwardM3pS;
3348-
}
3348+
}
33493349

33503350
// Calculate air consumption and change in main air reservoir pressure
33513351
CurrentTrackSanderAirConsumptionM3pS = (MainResPressurePSI / MaxMainResPressurePSI) * sandingAirConsumptionM3pS * elapsedClockSeconds;

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

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

343-
bool RigidWheelBaseInitialised = false;
344-
345343
// Setup for ambient temperature dependency
346344
Interpolator OutsideWinterTempbyLatitudeC; // Interploator to calculate ambient Winter temperature based upon the latitude of the route
347345
Interpolator OutsideAutumnTempbyLatitudeC; // Interploator to calculate ambient Autumn temperature based upon the latitude of the route
@@ -831,102 +829,6 @@ public virtual void Initialize()
831829
// called when it's time to update the MotiveForce and FrictionForce
832830
public virtual void Update(float elapsedClockSeconds)
833831
{
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-
930832

931833
// Initialise ambient temperatures on first initial loop, then ignore
932834
if (!AmbientTemperatureInitialised)
@@ -2120,6 +2022,76 @@ public virtual void UpdateCurveForce(float elapsedClockSeconds)
21202022
{
21212023
if (CurrentCurveRadiusM > 0)
21222024
{
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+
}
21232095

21242096
// References:
21252097

Source/RunActivity/Viewer3D/Popups/HUDWindow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ static string GetCarWhyteLikeNotation(TrainCar car)
629629
currentCount = 0;
630630
axlesCount = 0;
631631
i = i + 1;
632-
}
632+
}
633633
}
634634
}
635635
else if (axle.Part.bogie) // this is a bogie
@@ -1192,7 +1192,7 @@ void TextPageForceInfo(TableData table)
11921192
if (HUDEngineType == TrainCar.EngineTypes.Steam && (HUDSteamEngineType == TrainCar.SteamEngineTypes.Compound || HUDSteamEngineType == TrainCar.SteamEngineTypes.Simple || HUDSteamEngineType == TrainCar.SteamEngineTypes.Unknown))
11931193
{
11941194
TableSetCell(table, table.CurrentRow++, table.CurrentValueColumn + 2 * i, "{0:N0}º", axle.AxlePositionRad * 180 / Math.PI + 180);
1195-
}
1195+
}
11961196
}
11971197

11981198
TableAddLabelValue(table, Viewer.Catalog.GetString("Loco Adhesion"), "{0:F0}%", mstsLocomotive.LocomotiveCoefficientFrictionHUD * 100.0f);

0 commit comments

Comments
 (0)