Skip to content

Commit 6d117d0

Browse files
committed
Automatic merge of T1.5.1-719-g89833d44e and 17 pull requests
- Pull request #570 at c59c788: 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 #865 at 67014b7: Dispatcher window improvements - Pull request #874 at f8dbeab: Dynamic brake controller refactoring - Pull request #875 at 43bf33e: Bug fix for https://bugs.launchpad.net/or/+bug/2036346 Player train switching doesn't work with 3D cabs - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #882 at c5cdbd3: Blueprint/train car operations UI window - Pull request #883 at edcc2dd: SwitchPanel disconnect/connect handling - Pull request #885 at c81447b: feat: Add notifications to Menu - Pull request #886 at cd452ee: Scene viewer extension to TrackViewer - Pull request #888 at d7daf62: docs: Document player application model - Pull request #890 at 39a9fa4: Allow depart early - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #893 at bf8876b: Signal errors - Pull request #894 at 794fddf: Correct Decrease Colour - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #897 at 64a29c8: feat: Improved system information collection
19 parents b904276 + 89833d4 + c59c788 + d00beb9 + 67014b7 + f8dbeab + 43bf33e + f92de76 + c5cdbd3 + edcc2dd + c81447b + cd452ee + d7daf62 + 39a9fa4 + 1f5ba4c + bf8876b + 794fddf + 5866028 + 64a29c8 commit 6d117d0

File tree

5 files changed

+55
-55
lines changed

5 files changed

+55
-55
lines changed

Source/Documentation/Manual/physics.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2986,7 +2986,7 @@ the following parameters will adjust the behaviour of air brakes:
29862986
air brakes are released while dynamic brakes satisfy the train brake demand.
29872987
If dynamic braking is not sufficient, air brakes will be partially applied
29882988
so the combination air+dynamic provides the required brake demand.
2989-
2989+
29902990
Sometimes the train brake controller is capable to apply the dynamic
29912991
brakes for the whole consist, usually as a first step before air brakes
29922992
are applied. This is usually known as "train blending", as opposed to

Source/Orts.Simulation/Simulation/RollingStocks/MSTSDieselLocomotive.cs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ public override void LoadFromWagFile(string wagFilePath)
303303
}
304304
}
305305

306-
306+
307307
if (MaximumDieselEnginePowerW == 0)
308308
{
309309
MaximumDieselEnginePowerW = LocomotiveMaxRailOutputPowerW; // If no value set in ENG file, then set the Prime Mover power to same as RailOutputPower (typically the MaxPower value)
@@ -338,12 +338,12 @@ public override void LoadFromWagFile(string wagFilePath)
338338
}
339339

340340

341-
// Check force assumptions set for diesel
342-
CalculatedMaxContinuousForceN = 0;
343-
float ThrottleSetting = 1.0f; // Must be at full throttle for these calculations
344-
if (TractiveForceCurves == null) // Basic configuration - ie no force and Power tables, etc
345-
{
346-
CalculatedMaxContinuousForceN = ThrottleSetting * LocomotiveMaxRailOutputPowerW / SpeedOfMaxContinuousForceMpS;
341+
// Check force assumptions set for diesel
342+
CalculatedMaxContinuousForceN = 0;
343+
float ThrottleSetting = 1.0f; // Must be at full throttle for these calculations
344+
if (TractiveForceCurves == null) // Basic configuration - ie no force and Power tables, etc
345+
{
346+
CalculatedMaxContinuousForceN = ThrottleSetting * LocomotiveMaxRailOutputPowerW / SpeedOfMaxContinuousForceMpS;
347347

348348
if (Simulator.Settings.VerboseConfigurationMessages)
349349
{
@@ -356,12 +356,12 @@ public override void LoadFromWagFile(string wagFilePath)
356356
}
357357
}
358358

359-
}
360-
else // Advanced configuration -
361-
{
362-
float StartingSpeedMpS = 0.1f; // Assumed starting speed for diesel - can't be zero otherwise error will occurr
363-
float StartingForceN = TractiveForceCurves.Get(ThrottleSetting, StartingSpeedMpS);
364-
CalculatedMaxContinuousForceN = TractiveForceCurves.Get(ThrottleSetting, SpeedOfMaxContinuousForceMpS);
359+
}
360+
else // Advanced configuration -
361+
{
362+
float StartingSpeedMpS = 0.1f; // Assumed starting speed for diesel - can't be zero otherwise error will occurr
363+
float StartingForceN = TractiveForceCurves.Get(ThrottleSetting, StartingSpeedMpS);
364+
CalculatedMaxContinuousForceN = TractiveForceCurves.Get(ThrottleSetting, SpeedOfMaxContinuousForceMpS);
365365
if (Simulator.Settings.VerboseConfigurationMessages)
366366
{
367367
Trace.TraceInformation("Diesel Force Settings (ADVANCED Config): Max Starting Force {0}, Calculated Max Continuous Force {1}, @ speed of {2}", FormatStrings.FormatForce(StartingForceN, IsMetric), FormatStrings.FormatForce(CalculatedMaxContinuousForceN, IsMetric), FormatStrings.FormatSpeedDisplay(SpeedOfMaxContinuousForceMpS, IsMetric));
@@ -374,30 +374,30 @@ public override void LoadFromWagFile(string wagFilePath)
374374
}
375375
}
376376

377-
// Check that MaxPower value is realistic - Calculate power - metric - P = F x V
378-
float CalculatedContinuousPowerW = MaxContinuousForceN * SpeedOfMaxContinuousForceMpS;
377+
// Check that MaxPower value is realistic - Calculate power - metric - P = F x V
378+
float CalculatedContinuousPowerW = MaxContinuousForceN * SpeedOfMaxContinuousForceMpS;
379379
if (MaxPowerW < CalculatedContinuousPowerW && Simulator.Settings.VerboseConfigurationMessages)
380-
{
381-
Trace.TraceInformation("!!!! Warning: MaxPower {0} is less then continuous force calculated power {1} @ speed of {2}, please check !!!!", FormatStrings.FormatPower(MaxPowerW, IsMetric, false, false), FormatStrings.FormatPower(CalculatedContinuousPowerW, IsMetric, false, false), FormatStrings.FormatSpeedDisplay(SpeedOfMaxContinuousForceMpS, IsMetric));
382-
}
380+
{
381+
Trace.TraceInformation("!!!! Warning: MaxPower {0} is less then continuous force calculated power {1} @ speed of {2}, please check !!!!", FormatStrings.FormatPower(MaxPowerW, IsMetric, false, false), FormatStrings.FormatPower(CalculatedContinuousPowerW, IsMetric, false, false), FormatStrings.FormatSpeedDisplay(SpeedOfMaxContinuousForceMpS, IsMetric));
382+
}
383383

384-
if (!DieselEngines.HasGearBox)
385-
{
386-
// Check Adhesion values
387-
var calculatedmaximumpowerw = CalculatedMaxContinuousForceN * SpeedOfMaxContinuousForceMpS;
388-
var maxforcekN = MaxForceN / 1000.0f;
389-
var designadhesionzerospeed = maxforcekN / (Kg.ToTonne(DrvWheelWeightKg) * 10);
384+
if (!DieselEngines.HasGearBox)
385+
{
386+
// Check Adhesion values
387+
var calculatedmaximumpowerw = CalculatedMaxContinuousForceN * SpeedOfMaxContinuousForceMpS;
388+
var maxforcekN = MaxForceN / 1000.0f;
389+
var designadhesionzerospeed = maxforcekN / (Kg.ToTonne(DrvWheelWeightKg) * 10);
390390
if (Simulator.Settings.VerboseConfigurationMessages)
391391
{
392392
Trace.TraceInformation("Zero Adhesion - zeroadhesion {0} maxForcekN {1} Driveweight {2}", designadhesionzerospeed, maxforcekN, DrvWheelWeightKg);
393393
}
394-
var calculatedmaxcontinuousforcekN = CalculatedMaxContinuousForceN / 1000.0f;
395-
var designadhesionmaxcontspeed = calculatedmaxcontinuousforcekN / (Kg.ToTonne(DrvWheelWeightKg) * 10);
396-
var zerospeed = 0;
397-
var configuredadhesionzerospeed = (Curtius_KnifflerA / (zerospeed + Curtius_KnifflerB) + Curtius_KnifflerC);
398-
var configuredadhesionmaxcontinuousspeed = (Curtius_KnifflerA / (SpeedOfMaxContinuousForceMpS + Curtius_KnifflerB) + Curtius_KnifflerC);
399-
var dropoffspeed = calculatedmaximumpowerw / (MaxForceN);
400-
var configuredadhesiondropoffspeed = (Curtius_KnifflerA / (dropoffspeed + Curtius_KnifflerB) + Curtius_KnifflerC);
394+
var calculatedmaxcontinuousforcekN = CalculatedMaxContinuousForceN / 1000.0f;
395+
var designadhesionmaxcontspeed = calculatedmaxcontinuousforcekN / (Kg.ToTonne(DrvWheelWeightKg) * 10);
396+
var zerospeed = 0;
397+
var configuredadhesionzerospeed = (Curtius_KnifflerA / (zerospeed + Curtius_KnifflerB) + Curtius_KnifflerC);
398+
var configuredadhesionmaxcontinuousspeed = (Curtius_KnifflerA / (SpeedOfMaxContinuousForceMpS + Curtius_KnifflerB) + Curtius_KnifflerC);
399+
var dropoffspeed = calculatedmaximumpowerw / (MaxForceN);
400+
var configuredadhesiondropoffspeed = (Curtius_KnifflerA / (dropoffspeed + Curtius_KnifflerB) + Curtius_KnifflerC);
401401
if (Simulator.Settings.VerboseConfigurationMessages)
402402
{
403403
Trace.TraceInformation("Slip control system: {0}, Traction motor type: {1}", SlipControlSystem.ToString(), TractionMotorType.ToString()); // Slip control

Source/Orts.Simulation/Simulation/RollingStocks/MSTSSteamLocomotive.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5317,7 +5317,7 @@ protected override void UpdateTractiveForce(float elapsedClockSeconds, float t,
53175317
private float NormalisedCrankAngle(int cylinderNumber)
53185318
{
53195319
float normalisedCrankAngleRad = (float)MathHelper.WrapAngle((float)LocomotiveAxles[0].AxlePositionRad + WheelCrankAngleDiffRad[cylinderNumber]);
5320-
5320+
53215321
if (normalisedCrankAngleRad < 0)
53225322
{
53235323
normalisedCrankAngleRad += (float)(2 * Math.PI);

Source/Orts.Simulation/Simulation/Simulator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,7 @@ private void StartSwitchPlayerTrain()
19481948
if (playerTrain != null)
19491949
{
19501950
if (playerTrain.ControlMode == Train.TRAIN_CONTROL.MANUAL) TrainSwitcher.SuspendOldPlayer = true; // force suspend state to avoid disappearing of train;
1951-
if (TrainSwitcher.SuspendOldPlayer &&
1951+
if (TrainSwitcher.SuspendOldPlayer &&
19521952
(playerTrain.SpeedMpS < -0.025 || playerTrain.SpeedMpS > 0.025 || playerTrain.PresentPosition[0].TCOffset != playerTrain.PreviousPosition[0].TCOffset))
19531953
{
19541954
Confirmer.Message(ConfirmLevel.Warning, Catalog.GetString("Train can't be suspended with speed not equal 0"));
@@ -2167,10 +2167,10 @@ public void RestartWaitingTrain(RestartWaitingTrain restartWaitingTrain)
21672167
}
21682168
}
21692169
if (trainToRestart == null)
2170-
Trace.TraceWarning("Train {0} to restart not found", restartWaitingTrain.WaitingTrainToRestart);
2170+
Trace.TraceWarning("Train {0} to restart not found", restartWaitingTrain.WaitingTrainToRestart);
21712171
}
21722172

2173-
2173+
21742174

21752175
/// <summary>
21762176
/// Derive log-file name from route path and activity name

Source/RunActivity/Viewer3D/RollingStock/MSTSWagonViewer.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ public override void PrepareFrame(RenderFrame frame, ElapsedTime elapsedTime)
753753
car.SoundHeardInternallyCorrection[MSTSWagon.LeftWindowFrontIndex] = LeftWindowFront.AnimationKeyFraction();
754754
if (RightWindowFront.FrameCount > 0)
755755
car.SoundHeardInternallyCorrection[MSTSWagon.RightWindowFrontIndex] = RightWindowFront.AnimationKeyFraction();
756-
}
756+
}
757757
}
758758

759759

@@ -774,59 +774,59 @@ private void UpdateAnimation(RenderFrame frame, ElapsedTime elapsedTime)
774774
foreach (var kvp in RunningGears)
775775
{
776776
if (!kvp.Value.Empty())
777-
{
777+
{
778778
var axle = kvp.Key >= 0 && kvp.Key < loco.LocomotiveAxles.Count ? loco.LocomotiveAxles[kvp.Key] : null;
779779
if (axle != null)
780780
//TODO: next code line has been modified to flip trainset physics in order to get viewing direction coincident with loco direction when using rear cab.
781781
kvp.Value.UpdateLoop(((MSTSWagon.Train != null && MSTSWagon.Train.IsPlayerDriven && loco.UsingRearCab) ? -1 : 1) * (float)axle.AxleSpeedMpS * elapsedTime.ClockSeconds / MathHelper.TwoPi / axle.WheelRadiusM);
782782
else if (AnimationDriveWheelRadiusM > 0.001)
783783
kvp.Value.UpdateLoop(distanceTravelledM / MathHelper.TwoPi / AnimationDriveWheelRadiusM);
784-
}
784+
}
785785

786-
}
786+
}
787787
foreach (var kvp in WheelPartIndexes)
788-
{
788+
{
789789
var axle = kvp.Key < loco.LocomotiveAxles.Count && kvp.Key >= 0 ? loco.LocomotiveAxles[kvp.Key] : (Car.EngineType == TrainCar.EngineTypes.Steam ? null : loco.LocomotiveAxles[0]);
790790
Matrix wheelRotationMatrix;
791791
if (axle != null)
792792
{
793793
//TODO: next code line has been modified to flip trainset physics in order to get viewing direction coincident with loco direction when using rear cab.
794794
wheelRotationMatrix = Matrix.CreateRotationX(((MSTSWagon.Train != null && MSTSWagon.Train.IsPlayerDriven && loco.UsingRearCab) ? -1 : 1) * -(float)axle.AxlePositionRad);
795-
}
795+
}
796796
else
797-
{
797+
{
798798
var rotationalDistanceR = distanceTravelledM / AnimationWheelRadiusM; // in radians
799799
WheelRotationR = MathHelper.WrapAngle(WheelRotationR - rotationalDistanceR);
800800
wheelRotationMatrix = Matrix.CreateRotationX(WheelRotationR);
801801
}
802802
foreach (var iMatrix in kvp.Value)
803-
{
803+
{
804804
TrainCarShape.XNAMatrices[iMatrix] = wheelRotationMatrix * TrainCarShape.SharedShape.Matrices[iMatrix];
805-
}
805+
}
806806
}
807807
}
808808
else // set values for simple adhesion
809-
{
809+
{
810810
distanceTravelledM = ((MSTSWagon.IsDriveable && MSTSWagon.Train != null && MSTSWagon.Train.IsPlayerDriven && ((MSTSLocomotive)MSTSWagon).UsingRearCab) ? -1 : 1) * MSTSWagon.SpeedMpS * elapsedTime.ClockSeconds;
811811
if (Car.BrakeSkid) distanceTravelledM = 0;
812812
foreach (var kvp in RunningGears)
813813
{
814814
if (!kvp.Value.Empty() && AnimationDriveWheelRadiusM > 0.001)
815815
kvp.Value.UpdateLoop(distanceTravelledM / MathHelper.TwoPi / AnimationDriveWheelRadiusM);
816816
}
817-
// Wheel rotation (animation) - for non-drive wheels in steam locomotives and all wheels in other stock
818-
if (WheelPartIndexes.Count > 0)
819-
{
817+
// Wheel rotation (animation) - for non-drive wheels in steam locomotives and all wheels in other stock
818+
if (WheelPartIndexes.Count > 0)
819+
{
820820
var rotationalDistanceR = distanceTravelledM / AnimationWheelRadiusM; // in radians
821-
WheelRotationR = MathHelper.WrapAngle(WheelRotationR - rotationalDistanceR);
822-
var wheelRotationMatrix = Matrix.CreateRotationX(WheelRotationR);
821+
WheelRotationR = MathHelper.WrapAngle(WheelRotationR - rotationalDistanceR);
822+
var wheelRotationMatrix = Matrix.CreateRotationX(WheelRotationR);
823823
foreach (var kvp in WheelPartIndexes)
824-
{
824+
{
825825
foreach (var iMatrix in kvp.Value)
826826
{
827-
TrainCarShape.XNAMatrices[iMatrix] = wheelRotationMatrix * TrainCarShape.SharedShape.Matrices[iMatrix];
828-
}
829-
}
827+
TrainCarShape.XNAMatrices[iMatrix] = wheelRotationMatrix * TrainCarShape.SharedShape.Matrices[iMatrix];
828+
}
829+
}
830830
}
831831
}
832832

0 commit comments

Comments
 (0)