Skip to content

Commit 1dc5de0

Browse files
committed
Automatic merge of T1.5.1-913-g91804456c and 14 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 a057eff: Blueprint/train car operations UI window - 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 #903 at 9bead33: Downloading route content (Github, zip) - Pull request #910 at 97d4569: Allow building code using .NET 6 (Windows) - Pull request #911 at 6834af0: docs: Add refactoring as a special type of PR - Pull request #919 at 9358732: Added mouse wheel support for controls which can be moved by pressing t… - Pull request #920 at a94e403: Update RailDriver in Manual - Pull request #923 at d0208cd: Add curve squeal to route - Pull request #924 at 6c2c3cd: Default Asset Improvements
16 parents cad2bec + 9180445 + 3539862 + d00beb9 + f92de76 + a057eff + 6c0785b + 1f5ba4c + 5866028 + 9bead33 + 97d4569 + 6834af0 + 9358732 + a94e403 + d0208cd + 6c2c3cd commit 1dc5de0

File tree

1 file changed

+31
-31
lines changed
  • Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Brakes/MSTS

1 file changed

+31
-31
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Brakes/MSTS/AirSinglePipe.cs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,19 +1267,19 @@ protected static void PropagateBrakeLinePressures(float elapsedClockSeconds, Tra
12671267
bool syncRelease = loco == lead || (loco.DPSyncTrainRelease && lead.DPSyncTrainRelease);
12681268
bool syncEmergency = loco == lead || (loco.DPSyncEmergency && lead.DPSyncEmergency);
12691269

1270-
tempBrakePipeFlow = 0.0f;
1270+
tempBrakePipeFlow = 0.0f;
12711271

1272-
// Allow for leaking train air brakepipe
1272+
// Allow for leaking train air brakepipe
12731273
// TODO: Make leak apply to the whole train, not just the locomotives
12741274
if (loco.BrakeSystem.BrakeLine1PressurePSI - trainPipeLeakLossPSI > 0 && loco.TrainBrakePipeLeakPSIorInHgpS != 0) // if train brake pipe has pressure in it, ensure result will not be negative if loss is subtracted
1275-
{
1275+
{
12761276
loco.BrakeSystem.BrakeLine1PressurePSI -= trainPipeLeakLossPSI;
1277-
}
1277+
}
12781278

1279-
// Emergency brake - vent brake pipe to 0 psi regardless of equalizing res pressure
1279+
// Emergency brake - vent brake pipe to 0 psi regardless of equalizing res pressure
12801280
if (syncEmergency && lead.TrainBrakeController.EmergencyBraking)
1281-
{
1282-
float emergencyVariationFactor = Math.Min(trainPipeTimeVariationS / emergencyTimeFactor, 0.95f);
1281+
{
1282+
float emergencyVariationFactor = Math.Min(trainPipeTimeVariationS / emergencyTimeFactor, 0.95f);
12831283
float pressureDiffPSI = emergencyVariationFactor * loco.BrakeSystem.BrakeLine1PressurePSI;
12841284

12851285
if (loco.BrakeSystem.BrakeLine1PressurePSI - pressureDiffPSI < 0)
@@ -1289,17 +1289,17 @@ protected static void PropagateBrakeLinePressures(float elapsedClockSeconds, Tra
12891289
// Instantaneous flow rate out of BP to atmosphere
12901290
// Flow meters don't display this, still keeping track of it for reference
12911291
tempBrakePipeFlow = -(pressureDiffPSI * loco.BrakeSystem.BrakePipeVolumeM3) / (OneAtmospherePSI * trainPipeTimeVariationS);
1292-
}
1293-
else if (lead.TrainBrakeController.TrainBrakeControllerState != ControllerState.Neutral)
1294-
{
1292+
}
1293+
else if (lead.TrainBrakeController.TrainBrakeControllerState != ControllerState.Neutral)
1294+
{
12951295
// Charge train brake pipe - adjust main reservoir pressure, and loco brake pressure line to maintain brake pipe equal to equalising resevoir pressure - release brakes
12961296
if (syncRelease && loco.BrakeSystem.BrakeLine1PressurePSI < train.EqualReservoirPressurePSIorInHg)
1297-
{
1297+
{
12981298
// Calculate change in brake pipe pressure between equalising reservoir and loco brake pipe
12991299
float chargingRatePSIpS = loco.BrakePipeChargingRatePSIorInHgpS;
1300-
if (lead.TrainBrakeController.TrainBrakeControllerState == ControllerState.FullQuickRelease || lead.TrainBrakeController.TrainBrakeControllerState == ControllerState.Overcharge)
1300+
if (lead.TrainBrakeController.TrainBrakeControllerState == ControllerState.FullQuickRelease || lead.TrainBrakeController.TrainBrakeControllerState == ControllerState.Overcharge)
13011301
chargingRatePSIpS = loco.BrakePipeQuickChargingRatePSIpS;
1302-
float PressureDiffEqualToPipePSI = trainPipeTimeVariationS * chargingRatePSIpS; // default condition - if EQ Res is higher then Brake Pipe Pressure
1302+
float PressureDiffEqualToPipePSI = trainPipeTimeVariationS * chargingRatePSIpS; // default condition - if EQ Res is higher then Brake Pipe Pressure
13031303

13041304
float chargeSlowdown = chargingRatePSIpS / 4.0f; // Estimate of when charging starts to be choked by feed valve
13051305

@@ -1315,23 +1315,23 @@ protected static void PropagateBrakeLinePressures(float elapsedClockSeconds, Tra
13151315
if (loco.BrakeSystem.BrakeLine1PressurePSI + PressureDiffEqualToPipePSI > loco.MainResPressurePSI)
13161316
PressureDiffEqualToPipePSI = loco.MainResPressurePSI - loco.BrakeSystem.BrakeLine1PressurePSI;
13171317

1318-
if (PressureDiffEqualToPipePSI < 0)
1319-
PressureDiffEqualToPipePSI = 0;
1318+
if (PressureDiffEqualToPipePSI < 0)
1319+
PressureDiffEqualToPipePSI = 0;
13201320

1321-
// Adjust brake pipe pressure based upon pressure differential
1322-
if (lead.TrainBrakeController.TrainBrakeControllerState != ControllerState.Lap) // in LAP psoition brake pipe is isolated, and thus brake pipe pressure decreases, but reservoir remains at same pressure
1323-
{
1321+
// Adjust brake pipe pressure based upon pressure differential
1322+
if (lead.TrainBrakeController.TrainBrakeControllerState != ControllerState.Lap) // in LAP psoition brake pipe is isolated, and thus brake pipe pressure decreases, but reservoir remains at same pressure
1323+
{
13241324
loco.BrakeSystem.BrakeLine1PressurePSI += PressureDiffEqualToPipePSI;
13251325
loco.MainResPressurePSI -= PressureDiffEqualToPipePSI * loco.BrakeSystem.BrakePipeVolumeM3 / loco.MainResVolumeM3;
13261326

13271327
// Instantaneous flow rate from MR to BP
13281328
tempBrakePipeFlow = (PressureDiffEqualToPipePSI * loco.BrakeSystem.BrakePipeVolumeM3) / (OneAtmospherePSI * trainPipeTimeVariationS);
1329+
}
13291330
}
1330-
}
13311331
// reduce pressure in loco brake line if brake pipe pressure is above equalising pressure - apply brakes
13321332
else if (syncApplication && loco.BrakeSystem.BrakeLine1PressurePSI > train.EqualReservoirPressurePSIorInHg)
1333-
{
1334-
float serviceVariationFactor = Math.Min(trainPipeTimeVariationS / serviceTimeFactor, 0.95f);
1333+
{
1334+
float serviceVariationFactor = Math.Min(trainPipeTimeVariationS / serviceTimeFactor, 0.95f);
13351335
float pressureDiffPSI = serviceVariationFactor * loco.BrakeSystem.BrakeLine1PressurePSI;
13361336

13371337
if (train.EqualReservoirPressurePSIorInHg > loco.BrakeSystem.BrakeLine1PressurePSI - 5.0f) // Reduce exhausting rate if near EQ pressure to simulate feed valve
@@ -1343,16 +1343,16 @@ protected static void PropagateBrakeLinePressures(float elapsedClockSeconds, Tra
13431343
// Instantaneous flow rate out of BP to atmosphere
13441344
// Flow meters don't display this, still keeping track of it for reference
13451345
tempBrakePipeFlow = -(pressureDiffPSI * loco.BrakeSystem.BrakePipeVolumeM3) / (OneAtmospherePSI * trainPipeTimeVariationS);
1346+
}
13461347
}
1347-
}
13481348

1349-
// Finish updating air flow meter
1349+
// Finish updating air flow meter
13501350
loco.BrakePipeFlowM3pS = tempBrakePipeFlow;
13511351
loco.FilteredBrakePipeFlowM3pS = loco.AFMFilter.Filter(Math.Max(loco.BrakePipeFlowM3pS, 0.0f), trainPipeTimeVariationS); // Actual flow rate displayed by air flow meter
13521352
}
13531353

13541354
if (lead != null)
1355-
train.LeadPipePressurePSI = lead.BrakeSystem.BrakeLine1PressurePSI; // Keep a record of current train pipe pressure in lead locomotive
1355+
train.LeadPipePressurePSI = lead.BrakeSystem.BrakeLine1PressurePSI; // Keep a record of current train pipe pressure in lead locomotive
13561356
}
13571357

13581358
// Propagate air pipe pressure along the train (brake pipe and main reservoir pipe)
@@ -1453,24 +1453,24 @@ protected static void PropagateBrakeLinePressures(float elapsedClockSeconds, Tra
14531453
totalReservoirPressurePSI = sumpv / sumv;
14541454

14551455
foreach (TrainCar locoCar in locoGroup)
1456-
{
1456+
{
14571457
if (locoCar is MSTSLocomotive loco)
14581458
{
14591459
if (loco.BrakeSystem.TwoPipes)
14601460
{
14611461
// Equalize air in MR and MR pipe
1462-
float volumeRatio = loco.BrakeSystem.BrakePipeVolumeM3 / loco.MainResVolumeM3;
1462+
float volumeRatio = loco.BrakeSystem.BrakePipeVolumeM3 / loco.MainResVolumeM3;
14631463
float dp = Math.Min((loco.MainResPressurePSI - loco.BrakeSystem.BrakeLine2PressurePSI) / (1 + volumeRatio),
14641464
loco.MaximumMainReservoirPipePressurePSI - loco.BrakeSystem.BrakeLine2PressurePSI);
14651465

1466-
loco.MainResPressurePSI -= dp * volumeRatio;
1467-
loco.BrakeSystem.BrakeLine2PressurePSI += dp;
1466+
loco.MainResPressurePSI -= dp * volumeRatio;
1467+
loco.BrakeSystem.BrakeLine2PressurePSI += dp;
14681468

14691469
if (loco.MainResPressurePSI < 0)
14701470
loco.MainResPressurePSI = 0;
14711471
if (loco.BrakeSystem.BrakeLine2PressurePSI < 0)
14721472
loco.BrakeSystem.BrakeLine2PressurePSI = 0;
1473-
}
1473+
}
14741474
else // Workaround to emulate MR pipe for single pipe locomotives
14751475
loco.MainResPressurePSI = totalReservoirPressurePSI;
14761476

@@ -1578,16 +1578,16 @@ protected static void PropagateBrakeLinePressures(float elapsedClockSeconds, Tra
15781578
case ValveState.Release: leadLoco.SignalEvent(Event.EngineBrakePressureIncrease); break;
15791579
case ValveState.Apply: leadLoco.SignalEvent(Event.EngineBrakePressureDecrease); break;
15801580
case ValveState.Lap: leadLoco.SignalEvent(Event.EngineBrakePressureStoppedChanging); break;
1581+
}
15811582
}
1582-
}
15831583

15841584
// Propagate engine brake pipe pressure to MU'd vehicles in a simplified manner
15851585
// Instantly equalizes pressure between adjacent vehicles, may do something more realistic later
15861586
float totalVolume = 0.0f;
15871587
float totalAir = 0.0f;
15881588

15891589
foreach (TrainCar loco in train.LocoGroups[i])
1590-
{
1590+
{
15911591
totalVolume += loco.BrakeSystem.BrakePipeVolumeM3;
15921592
totalAir += loco.BrakeSystem.BrakePipeVolumeM3 * loco.BrakeSystem.BrakeLine3PressurePSI;
15931593
}

0 commit comments

Comments
 (0)