ATC Dimetronic: ATO braking calculations

This commit is contained in:
Marc Riera 2025-01-02 22:45:56 +01:00
parent b3c35ecf4e
commit 390e894a56

View file

@ -464,6 +464,7 @@ namespace OpenbveFcmbTrainPlugin
if (train.PhysicalHandles.Reverser == 1 && TrackState > TrackStates.Unprotected) if (train.PhysicalHandles.Reverser == 1 && TrackState > TrackStates.Unprotected)
{ {
DeviceState = DeviceStates.ATP; DeviceState = DeviceStates.ATP;
AtcControlState = AtcControlStates.Released;
} }
} }
} }
@ -724,6 +725,13 @@ namespace OpenbveFcmbTrainPlugin
requiredDeceleration = (train.State.Speed.MetersPerSecond - target.MetersPerSecond) / (distance - 8) * 10; 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 // Pitch multiplier, used to alter when state changes occur
double pitchMulti = train.State.Pitch / 20; double pitchMulti = train.State.Pitch / 20;