From 390e894a568604d41968127e84513bb8e4742db9 Mon Sep 17 00:00:00 2001 From: Marc Riera Date: Thu, 2 Jan 2025 22:45:56 +0100 Subject: [PATCH] ATC Dimetronic: ATO braking calculations --- src/Devices/AtcDimetronic.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Devices/AtcDimetronic.cs b/src/Devices/AtcDimetronic.cs index 09c778f..a5fefab 100644 --- a/src/Devices/AtcDimetronic.cs +++ b/src/Devices/AtcDimetronic.cs @@ -464,6 +464,7 @@ namespace OpenbveFcmbTrainPlugin if (train.PhysicalHandles.Reverser == 1 && TrackState > TrackStates.Unprotected) { DeviceState = DeviceStates.ATP; + AtcControlState = AtcControlStates.Released; } } } @@ -724,6 +725,13 @@ namespace OpenbveFcmbTrainPlugin requiredDeceleration = (train.State.Speed.MetersPerSecond - target.MetersPerSecond) / (distance - 8) * 10; } + // Calculate time needed to reach target speed + double requiredDecelerationSeconds = 0; + if (target.KilometersPerHour < limit.KilometersPerHour) + { + requiredDecelerationSeconds = (target.MetersPerSecond - limit.MetersPerSecond) / -AtoDeceleration; + } + // Pitch multiplier, used to alter when state changes occur double pitchMulti = train.State.Pitch / 20;