Skip to content

Commit 0366882

Browse files
authored
Merge pull request #423 from peternewell/brake_fixes
Adjustments to vacuum brake
2 parents 31ab461 + fbc8e64 commit 0366882

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

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

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ protected float VacResPressureAdjPSIA()
159159
(Car as MSTSWagon).HandBrakePresent ? string.Format("{0:F0}%", HandbrakePercent) : string.Empty,
160160
FrontBrakeHoseConnected ? "I" : "T",
161161
string.Format("A{0} B{1}", AngleCockAOpen ? "+" : "-", AngleCockBOpen ? "+" : "-"),
162+
BleedOffValveOpen ? Simulator.Catalog.GetString("Open") : string.Empty,
162163
};
163164
}
164165
else
@@ -177,6 +178,7 @@ protected float VacResPressureAdjPSIA()
177178
HandbrakePercent > 0 ? string.Format("{0:F0}%", HandbrakePercent) : string.Empty,
178179
FrontBrakeHoseConnected ? "I" : "T",
179180
string.Format("A{0} B{1}", AngleCockAOpen ? "+" : "-", AngleCockBOpen ? "+" : "-"),
181+
BleedOffValveOpen ? Simulator.Catalog.GetString("Open") : string.Empty,
180182
};
181183
}
182184
}
@@ -323,14 +325,16 @@ public override void Update(float elapsedClockSeconds)
323325

324326
LocomotiveSteamBrakeFitted = true;
325327

326-
// Steam brake operation is impacted by boiler pressure, a drop in boile rpressure will reduce the force applied
328+
// Steam brake operation is impacted by boiler pressure, a drop in boiler pressure will reduce the force applied
327329
SteamBrakeCompensation = lead.BoilerPressurePSI / lead.MaxBoilerPressurePSI;
328330

329331
float SteamBrakeDesiredFraction;
330-
float MaximumVacuumPressureValue = Vac.ToPress(lead.TrainBrakeController.MaxPressurePSI); // As model uses air pressure this equates to minimum vacuum pressure
331-
float MinimumVacuumPressureValue = Vac.ToPress(0); // As model uses air pressure this equates to maximum vacuum pressure
332+
333+
float MaximumVacuumPressureValue = OneAtmospherePSI - lead.TrainBrakeController.MaxPressurePSI; // As model uses air pressure this equates to minimum air pressure
334+
float MinimumVacuumPressureValue = OneAtmospherePSI; // As model uses air pressure this equates to maximum air pressure
332335
float EngineBrakePipeFraction = (lead.BrakeSystem.BrakeLine3PressurePSI - MaximumVacuumPressureValue) / (MinimumVacuumPressureValue - MaximumVacuumPressureValue);
333336
EngineBrakePipeFraction = MathHelper.Clamp(EngineBrakePipeFraction, 0.0f, 1.0f); // Keep fraction within bounds
337+
334338
float TrainBrakePipeFraction = (lead.BrakeSystem.BrakeLine1PressurePSI - MaximumVacuumPressureValue) / (MinimumVacuumPressureValue - MaximumVacuumPressureValue);
335339
TrainBrakePipeFraction = MathHelper.Clamp(TrainBrakePipeFraction, 0.0f, 1.0f); // Keep fraction within bounds
336340

@@ -343,7 +347,9 @@ public override void Update(float elapsedClockSeconds)
343347
if (SteamBrakingCurrentFraction < SteamBrakeDesiredFraction) // Brake application, increase steam brake pressure to max value as appropriate
344348
{
345349

346-
SteamBrakingCurrentFraction += elapsedClockSeconds * lead.EngineBrakeController.ApplyRatePSIpS / conversionFactor;
350+
var diff = elapsedClockSeconds * lead.EngineBrakeController.ApplyRatePSIpS / conversionFactor;
351+
352+
SteamBrakingCurrentFraction += diff;
347353
if (SteamBrakingCurrentFraction > 1.0f)
348354
{
349355
SteamBrakingCurrentFraction = 1.0f;
@@ -352,7 +358,10 @@ public override void Update(float elapsedClockSeconds)
352358
}
353359
else if (SteamBrakingCurrentFraction > SteamBrakeDesiredFraction) // Brake release, decrease steam brake pressure to min value as appropriate
354360
{
355-
SteamBrakingCurrentFraction -= elapsedClockSeconds * lead.EngineBrakeController.ReleaseRatePSIpS / conversionFactor;
361+
362+
var diff = elapsedClockSeconds * lead.EngineBrakeController.ReleaseRatePSIpS / conversionFactor;
363+
364+
SteamBrakingCurrentFraction -= diff;
356365

357366
if (SteamBrakingCurrentFraction < 0)
358367
{
@@ -374,6 +383,7 @@ public override void Update(float elapsedClockSeconds)
374383
float equivalentBrakeLine3PressurePSI = equivalentEngineBrakePipeFraction * (MinimumVacuumPressureValue - MaximumVacuumPressureValue) + MaximumVacuumPressureValue;
375384

376385
lead.BrakeSystem.BrakeLine3PressurePSI = equivalentBrakeLine3PressurePSI; // If engine brake on, then don't allow engine brake pressure to drop when reducing train brake pressure
386+
377387
EngineBrakePipeFraction = SteamBrakingCurrentFraction;
378388
Car.PreviousSteamBrakeCylinderPressurePSI = 0; // set to zero so that this loop is not executed again until train brake is activated
379389
}
@@ -473,7 +483,18 @@ public override void Update(float elapsedClockSeconds)
473483
}
474484
else
475485
{
476-
if (BrakeLine1PressurePSI < VacResPressurePSIA)
486+
487+
if (BleedOffValveOpen)
488+
{
489+
// the following reduces the brake cylinder and vacuum reservoir to 0inHg if the bleed valve is operated
490+
float dp = elapsedClockSeconds * MaxApplicationRatePSIpS;
491+
492+
VacResPressurePSIA = Math.Min(VacResPressurePSIA + dp, OneAtmospherePSI);
493+
494+
CylPressurePSIA = Math.Min(CylPressurePSIA + dp, OneAtmospherePSI);
495+
496+
}
497+
else if (BrakeLine1PressurePSI < VacResPressurePSIA)
477498
{
478499
float dp = elapsedClockSeconds * MaxApplicationRatePSIpS * (NumBrakeCylinders * BrakeCylVolM3) / VacResVolM3;
479500
float vr = VacResVolM3 / BrakePipeVolumeM3;

0 commit comments

Comments
 (0)