From 69253bffcab67daf3340464905069e89707a8cf9 Mon Sep 17 00:00:00 2001 From: Erashin Date: Tue, 4 Mar 2025 10:16:56 +0100 Subject: [PATCH] core: use envelope part min in ETCS Signed-off-by: Erashin --- .../envelope_sim/etcs/ETCSBrakingCurves.kt | 42 ++----------------- 1 file changed, 4 insertions(+), 38 deletions(-) diff --git a/core/envelope-sim/src/main/kotlin/fr/sncf/osrd/envelope_sim/etcs/ETCSBrakingCurves.kt b/core/envelope-sim/src/main/kotlin/fr/sncf/osrd/envelope_sim/etcs/ETCSBrakingCurves.kt index 30dc52882b4..9a9b716a2fe 100644 --- a/core/envelope-sim/src/main/kotlin/fr/sncf/osrd/envelope_sim/etcs/ETCSBrakingCurves.kt +++ b/core/envelope-sim/src/main/kotlin/fr/sncf/osrd/envelope_sim/etcs/ETCSBrakingCurves.kt @@ -126,45 +126,11 @@ private fun computeMinSvlEoaIndCurve( releaseSpeedPositionSvl, NATIONAL_RELEASE_SPEED ) - val startIntersectingRange = - max(slicedIndicationCurveEoa.beginPos, slicedIndicationCurveSvl.beginPos) - var refCurve = slicedIndicationCurveEoa - var otherCurve = slicedIndicationCurveSvl - if ( - slicedIndicationCurveEoa.interpolateSpeed(startIntersectingRange) > - slicedIndicationCurveSvl.interpolateSpeed(startIntersectingRange) - ) { - refCurve = slicedIndicationCurveSvl - otherCurve = slicedIndicationCurveEoa - } - val pointCount = refCurve.pointCount() - var indicationPositions = DoubleArray(pointCount) - var indicationSpeeds = DoubleArray(pointCount) - for (i in 0 until pointCount) { - val newPos = refCurve.getPointPos(i) - val newSpeed = refCurve.getPointSpeed(i) - if (newPos < otherCurve.beginPos) { - indicationPositions[i] = newPos - indicationSpeeds[i] = newSpeed - } else if (newPos <= otherCurve.endPos) { - val otherSpeed = slicedIndicationCurveSvl.interpolateSpeed(newPos) - indicationPositions[i] = newPos - // TODO: unneeded for now: interpolate to not approximate position at intersection. - indicationSpeeds[i] = min(otherSpeed, newSpeed) - } else { - indicationPositions[i] = otherCurve.endPos - indicationSpeeds[i] = otherCurve.endSpeed - // Clean up the last unneeded points in the arrays before exiting the loop. - indicationPositions = indicationPositions.dropLast(pointCount - 1 - i).toDoubleArray() - indicationSpeeds = indicationSpeeds.dropLast(pointCount - 1 - i).toDoubleArray() - break - } - } val firstIndicationPart = - EnvelopePart.generateTimes( - listOf(EnvelopeProfile.BRAKING), - indicationPositions, - indicationSpeeds + EnvelopePart.min( + slicedIndicationCurveEoa, + slicedIndicationCurveSvl, + listOf(EnvelopeProfile.BRAKING) ) if (releaseSpeedPositionSvl < releaseSpeedPositionEoa) { val maintainReleaseSpeedPart =