Skip to content

Commit c989cd6

Browse files
committed
Automatic merge of T1.6-rc2-41-gacd714487 and 10 pull requests
- Pull request #1104 at 03ccdc6: Handle simple adhesion within the axle module - Pull request #1086 at e10390b: Add Settings Exporter tool (copy settings to INI, etc) - Pull request #1091 at 2391bc0: Automatic speed control - Pull request #1107 at f5eb3dc: Fix DPMode when last remote is moved to front. - Pull request #1110 at 387388e: Fix Activity Runner persists after loading exception - Pull request #1114 at 9a4a873: Fix color of DB in DrivingInfo when in setup with DPU fenced. - Pull request #1115 at 270f22f: Do not activate ETS switch if no suitable cars are attached - Pull request #1116 at 721d118: Fix Potential Hang in AnimatedPart.SetFrameWrap - Pull request #1082 at 5845a1a: Allow variable water level in glass gauge - Pull request #1081 at 689494b: Brake cuts power unification
12 parents 000eb44 + acd7144 + 03ccdc6 + e10390b + 2391bc0 + f5eb3dc + 387388e + 9a4a873 + 270f22f + 721d118 + 5845a1a + 689494b commit c989cd6

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies/DieselPowerSupply.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public class DefaultDieselPowerSupply : DieselPowerSupply
150150
/// </remarks>
151151
private DieselEngineState PreviousSecondEngineState;
152152

153-
private bool QuickPowerOn = false;
153+
private (bool CloseTractionCutOffRelay, bool SwitchOnElectricTrainSupply) QuickPowerOn = (false, false);
154154

155155
public override void Initialize()
156156
{
@@ -197,11 +197,10 @@ public override void Update(float elapsedClockSeconds)
197197
{
198198
case TractionCutOffRelayState.Open:
199199
// If traction cut-off relay is open, then it must be closed to finish the quick power-on sequence
200-
if (QuickPowerOn)
200+
if (QuickPowerOn.CloseTractionCutOffRelay)
201201
{
202-
QuickPowerOn = false;
202+
QuickPowerOn.CloseTractionCutOffRelay = false;
203203
SignalEventToTractionCutOffRelay(PowerSupplyEvent.CloseTractionCutOffRelay);
204-
if (NumberOfElectricTrainSupplyConnectedCars > 0) SignalEventToElectricTrainSupplySwitch(PowerSupplyEvent.SwitchOnElectricTrainSupply);
205204
}
206205

207206
if (PowerOnTimer.Started)
@@ -216,11 +215,7 @@ public override void Update(float elapsedClockSeconds)
216215

217216
case TractionCutOffRelayState.Closed:
218217
// If traction cut-off relay is closed, quick power-on sequence has finished
219-
if (QuickPowerOn)
220-
{
221-
QuickPowerOn = false;
222-
if (NumberOfElectricTrainSupplyConnectedCars > 0) SignalEventToElectricTrainSupplySwitch(PowerSupplyEvent.SwitchOnElectricTrainSupply);
223-
}
218+
if (QuickPowerOn.CloseTractionCutOffRelay) QuickPowerOn.CloseTractionCutOffRelay = false;
224219

225220
if (!PowerOnTimer.Started)
226221
PowerOnTimer.Start();
@@ -240,6 +235,12 @@ public override void Update(float elapsedClockSeconds)
240235
{
241236
SignalEvent(Event.PowerConverterOn);
242237
SetCurrentAuxiliaryPowerSupplyState(PowerSupplyState.PowerOn);
238+
239+
if (QuickPowerOn.SwitchOnElectricTrainSupply)
240+
{
241+
QuickPowerOn.SwitchOnElectricTrainSupply = false;
242+
if (NumberOfElectricTrainSupplyConnectedCars > 0) SignalEventToElectricTrainSupplySwitch(PowerSupplyEvent.SwitchOnElectricTrainSupply);
243+
}
243244
}
244245
break;
245246
}
@@ -312,14 +313,14 @@ public override void HandleEvent(PowerSupplyEvent evt)
312313
switch (evt)
313314
{
314315
case PowerSupplyEvent.QuickPowerOn:
315-
QuickPowerOn = true;
316+
QuickPowerOn = (true, true);
316317
SignalEventToBatterySwitch(PowerSupplyEvent.QuickPowerOn);
317318
SignalEventToMasterKey(PowerSupplyEvent.TurnOnMasterKey);
318319
SignalEventToDieselEngines(PowerSupplyEvent.StartEngine);
319320
break;
320321

321322
case PowerSupplyEvent.QuickPowerOff:
322-
QuickPowerOn = false;
323+
QuickPowerOn = (false, false);
323324
SignalEventToElectricTrainSupplySwitch(PowerSupplyEvent.SwitchOffElectricTrainSupply);
324325
SignalEventToTractionCutOffRelay(PowerSupplyEvent.OpenTractionCutOffRelay);
325326
SignalEventToDieselEngines(PowerSupplyEvent.StopEngine);

Source/Orts.Simulation/Simulation/RollingStocks/SubSystems/PowerSupplies/ElectricPowerSupply.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ public class DefaultElectricPowerSupply : ElectricPowerSupply
176176
private Timer PowerOnTimer;
177177
private Timer AuxPowerOnTimer;
178178

179-
private bool QuickPowerOn = false;
179+
private (bool CloseCircuitBreaker, bool SwitchOnElectricTrainSupply) QuickPowerOn;
180180

181181
public override void Initialize()
182182
{
@@ -227,10 +227,9 @@ public override void Update(float elapsedClockSeconds)
227227
{
228228
case CircuitBreakerState.Open:
229229
// If circuit breaker is open, then it must be closed to finish the quick power-on sequence
230-
if (QuickPowerOn)
230+
if (QuickPowerOn.CloseCircuitBreaker)
231231
{
232-
QuickPowerOn = false;
233-
if (NumberOfElectricTrainSupplyConnectedCars > 0) SignalEventToElectricTrainSupplySwitch(PowerSupplyEvent.SwitchOnElectricTrainSupply);
232+
QuickPowerOn.CloseCircuitBreaker = false;
234233
SignalEventToCircuitBreaker(PowerSupplyEvent.QuickPowerOn);
235234
}
236235

@@ -254,11 +253,7 @@ public override void Update(float elapsedClockSeconds)
254253

255254
case CircuitBreakerState.Closed:
256255
// If circuit breaker is closed, quick power-on sequence has finished
257-
if (QuickPowerOn)
258-
{
259-
QuickPowerOn = false;
260-
if (NumberOfElectricTrainSupplyConnectedCars > 0) SignalEventToElectricTrainSupplySwitch(PowerSupplyEvent.SwitchOnElectricTrainSupply);
261-
}
256+
if (QuickPowerOn.CloseCircuitBreaker) QuickPowerOn.CloseCircuitBreaker = false;
262257

263258
if (!PowerOnTimer.Started)
264259
PowerOnTimer.Start();
@@ -274,6 +269,12 @@ public override void Update(float elapsedClockSeconds)
274269
{
275270
SignalEvent(Event.PowerConverterOn);
276271
SetCurrentAuxiliaryPowerSupplyState(PowerSupplyState.PowerOn);
272+
273+
if (QuickPowerOn.SwitchOnElectricTrainSupply)
274+
{
275+
QuickPowerOn.SwitchOnElectricTrainSupply = false;
276+
if (NumberOfElectricTrainSupplyConnectedCars > 0) SignalEventToElectricTrainSupplySwitch(PowerSupplyEvent.SwitchOnElectricTrainSupply);
277+
}
277278
}
278279
SetFilterVoltageV(VoltageFilter.Filter(PantographVoltageV(), elapsedClockSeconds));
279280
break;
@@ -309,15 +310,15 @@ public override void HandleEvent(PowerSupplyEvent evt)
309310
switch (evt)
310311
{
311312
case PowerSupplyEvent.QuickPowerOn:
312-
QuickPowerOn = true;
313+
QuickPowerOn = (true, true);
313314
SignalEventToBatterySwitch(PowerSupplyEvent.QuickPowerOn);
314315
SignalEventToMasterKey(PowerSupplyEvent.TurnOnMasterKey);
315316
SignalEventToPantograph(PowerSupplyEvent.RaisePantograph, 1);
316317
SignalEventToOtherTrainVehiclesWithId(PowerSupplyEvent.RaisePantograph, 1);
317318
break;
318319

319320
case PowerSupplyEvent.QuickPowerOff:
320-
QuickPowerOn = false;
321+
QuickPowerOn = (false, false);
321322
SignalEventToElectricTrainSupplySwitch(PowerSupplyEvent.SwitchOffElectricTrainSupply);
322323
SignalEventToCircuitBreaker(PowerSupplyEvent.QuickPowerOff);
323324
SignalEventToPantographs(PowerSupplyEvent.LowerPantograph);

0 commit comments

Comments
 (0)