From 2ce092971cc7d4231691983ddd080b0f8c908ca8 Mon Sep 17 00:00:00 2001 From: Erashin Date: Mon, 2 Dec 2024 15:05:15 +0100 Subject: [PATCH] core: amend ertms braking simulator interface Signed-off-by: Erashin --- .../osrd/ertms/etcs/ETCSBrakingSimulator.kt | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/core/src/main/kotlin/fr/sncf/osrd/ertms/etcs/ETCSBrakingSimulator.kt b/core/src/main/kotlin/fr/sncf/osrd/ertms/etcs/ETCSBrakingSimulator.kt index a6b2047dc8a..becac3ef2f4 100644 --- a/core/src/main/kotlin/fr/sncf/osrd/ertms/etcs/ETCSBrakingSimulator.kt +++ b/core/src/main/kotlin/fr/sncf/osrd/ertms/etcs/ETCSBrakingSimulator.kt @@ -11,28 +11,30 @@ interface ETCSBrakingSimulator { val rollingStock: RollingStock val timeStep: Double - /** - * Compute the ETCS braking envelope from the MRSP: for each decreasing speed transition, - * compute the corresponding ETCS braking curve. - */ - fun getETCSBrakingEnvelopeFromMrsp(mrsp: Envelope) - - /** - * Compute the ETCS braking envelope from target: compute the corresponding ETCS braking curve - * decreasing from rolling stock max speed and ending at target offset/speed-wise. - */ - fun getETCSBrakingEnvelopeFromTarget(target: Target) + /** Compute the ETCS braking envelope from the MRSP, for each LOA and EOA. */ + fun addETCSBrakingParts( + mrsp: Envelope, + limitsOfAuthority: Collection, + endsOfAuthority: Collection + ): Envelope } -data class Target( +data class LimitOfAuthority( val offset: Offset, val speed: Double, - val type: TargetType = if (speed != 0.0) TargetType.SLOWDOWN else TargetType.STOP -) +) { + init { + assert(speed > 0) + } +} -enum class TargetType { - SLOWDOWN, - STOP +data class EndOfAuthority( + val offsetEOA: Offset, + val offsetSVL: Offset?, +) { + init { + if (offsetSVL != null) assert(offsetSVL >= offsetEOA) + } } class ETCSBrakingSimulatorImpl( @@ -41,11 +43,11 @@ class ETCSBrakingSimulatorImpl( override val timeStep: Double ) : ETCSBrakingSimulator { - override fun getETCSBrakingEnvelopeFromMrsp(mrsp: Envelope) { - TODO("Not yet implemented") - } - - override fun getETCSBrakingEnvelopeFromTarget(target: Target) { + override fun addETCSBrakingParts( + mrsp: Envelope, + limitsOfAuthority: Collection, + endsOfAuthority: Collection + ): Envelope { TODO("Not yet implemented") } }