Skip to content

Commit 3ca8dfc

Browse files
committed
Automatic merge of T1.6-rc8-48-ga5be12922 and 15 pull requests
- Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc) - Pull request #1091 at 2e06f85: Automatic speed control - Pull request #1104 at ccc5c4d: Handle simple adhesion within the axle module - Pull request #1115 at 270f22f: Do not activate ETS switch if no suitable cars are attached - Pull request #1120 at ba3c47f: Automatically Calculate Friction Values if Missing - Pull request #1121 at 91d2d26: Manually Override Articulation - Pull request #1130 at 8ae6bb7: Fix F9 points to an incorrect car ID. - Pull request #1143 at ba9e40a: Status in Work Orders popup set too fast - Pull request #1152 at 66dfd09: fix: Clean up multiple issues with data logger - Pull request #1155 at 40f8c34: fix for illegal characters in refeerence to Shape file - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1081 at 689494b: Brake cuts power unification - Pull request #1124 at 61c08c3: Built-in PBL2 brake controller - Pull request #1128 at 1d7643d: Particle Emitter Overhaul - Pull request #1157 at 71283ab: Dynamic brake authorization by TCS
17 parents b0d7970 + a5be129 + e10390b + 2e06f85 + ccc5c4d + 270f22f + ba3c47f + 91d2d26 + 8ae6bb7 + ba9e40a + 66dfd09 + 40f8c34 + 5845a1a + 689494b + 61c08c3 + 1d7643d + 71283ab commit 3ca8dfc

File tree

2 files changed

+25
-10
lines changed

2 files changed

+25
-10
lines changed

Source/Orts.Simulation/Common/Scripting/BrakeController.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ internal void AttachToHost(ScriptedBrakeController host)
8686
/// </summary>
8787
public bool IsCabPowerSupplyOn() => LocomotivePowerSupply.CabPowerSupplyOn;
8888

89+
/// <summary>
90+
/// True if auxiliary power supply is switched on.
91+
/// </summary>
92+
public bool IsAuxiliaryPowerSupplyOn() => LocomotivePowerSupply.AuxiliaryPowerSupplyOn;
93+
8994
/// <summary>
9095
/// Brake pipe pressure
9196
/// </summary>

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/Controllers/PBL2BrakeController.cs

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public override float Update(float elapsedSeconds)
136136
break;
137137
}
138138

139-
NeutralModeOn = NeutralModeCommandSwitchOn || EmergencyBrakingPushButton() || TCSEmergencyBraking();
139+
NeutralModeOn = NeutralModeCommandSwitchOn || EmergencyBrakingPushButton() || TCSEmergencyBraking() || !IsAuxiliaryPowerSupplyOn();
140140

141141
return CurrentValue();
142142
}
@@ -266,18 +266,20 @@ public override void UpdatePressure(ref float pressureBar, float elapsedClockSec
266266
break;
267267
}
268268
case State.Emergency:
269-
SetUpdateValue(1);
270-
271-
pressureBar -= EmergencyRateBarpS() * elapsedClockSeconds;
269+
{
270+
SetUpdateValue(1);
272271

273-
if (pressureBar < 0)
274-
pressureBar = 0;
275-
break;
272+
float dp = EmergencyRateBarpS() * elapsedClockSeconds;
273+
if (pressureBar - dp < MaxPressureBar() - FullServReductionBar())
274+
dp = Math.Max(pressureBar - (MaxPressureBar() - FullServReductionBar()), 0);
275+
pressureBar -= dp;
276+
break;
277+
}
276278
}
277279

278280
if (BrakePipePressureBar() > Math.Max(MaxPressureBar() - FullServReductionBar(), pressureBar) + EpActivationThresholdBar)
279281
epPressureBar = 1; // EP application wire
280-
else if (CurrentState != State.Emergency && BrakePipePressureBar() >= MaxPressureBar() - FullServReductionBar() && BrakePipePressureBar() < Math.Min(MaxPressureBar(), pressureBar) - EpActivationThresholdBar)
282+
else if (!NeutralModeOn && BrakePipePressureBar() >= MaxPressureBar() - FullServReductionBar() && BrakePipePressureBar() < Math.Min(MaxPressureBar(), pressureBar) - EpActivationThresholdBar)
281283
epPressureBar = 0; // EP release wire
282284
else
283285
epPressureBar = -1;
@@ -391,8 +393,16 @@ public override bool IsValid()
391393

392394
public override ControllerState GetState()
393395
{
394-
if (CurrentState != State.Emergency && NeutralModeOn)
395-
return ControllerState.Neutral;
396+
if (NeutralModeOn)
397+
{
398+
switch (CurrentState)
399+
{
400+
case State.Emergency:
401+
return ControllerState.Emergency;
402+
default:
403+
return ControllerState.Lap;
404+
}
405+
}
396406
switch (CurrentState)
397407
{
398408
case State.Overcharge:

0 commit comments

Comments
 (0)