Skip to content

Commit

Permalink
core: unfinished: if target speed is not null, ebi should maintain th…
Browse files Browse the repository at this point in the history
…at speed as soon as it is reached

Signed-off-by: Erashin <[email protected]>
  • Loading branch information
Erashin committed Dec 13, 2024
1 parent 756922f commit 084a5b0
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ private fun computeBrakingCurvesAtEOAs(
targetSpeed,
BrakingType.ETCS_EBD
)
val ebiCurve = computeEbiBrakingCurveFromEbd(context, ebdCurve)
val ebiCurve = computeEbiBrakingCurveFromEbd(context, ebdCurve, targetSpeed)
val indicationCurveSvl =
computeIndicationBrakingCurveFromRef(
context,
Expand Down Expand Up @@ -100,7 +100,7 @@ private fun computeBrakingCurvesAtLOAs(
computeBrakingCurve(context, mrsp, targetPosition, targetSpeed, BrakingType.ETCS_EBD)
val guiCurve =
computeBrakingCurve(context, mrsp, targetPosition, targetSpeed, BrakingType.ETCS_GUI)
val ebiCurve = computeEbiBrakingCurveFromEbd(context, ebdCurve)
val ebiCurve = computeEbiBrakingCurveFromEbd(context, ebdCurve, targetSpeed)
val indicationCurve =
computeIndicationBrakingCurveFromRef(context, ebiCurve, BrakingCurveType.EBI, guiCurve)
builder.addPart(indicationCurve)
Expand Down Expand Up @@ -162,18 +162,17 @@ private fun computeBrakingCurve(
/** Compute braking curves at every slowdown, with a given reference curve. */
private fun computeEbiBrakingCurveFromEbd(
context: EnvelopeSimContext,
ebdCurve: EnvelopePart
ebdCurve: EnvelopePart,
targetSpeed: Double
): EnvelopePart {
val pos = ebdCurve.clonePositions()
val speeds = ebdCurve.cloneSpeeds()
val newPos = ArrayList<Double>()
val newSpeeds = ArrayList<Double>()
val intersection = ebdCurve.interpolateSpeed(targetSpeed)
for (i in 0 until ebdCurve.pointCount()) {
// TODO : give a proper target speed, depending on the case (slowdown vs marker board),
// using ceiling -> not
// sure about this, comment by alex
val deltaPosAndDeltaSpeed =
computeBecDeltaPosAndSpeed(context, ebdCurve, speeds[i], ebdCurve.beginSpeed)
computeBecDeltaPosAndSpeed(context, ebdCurve, speeds[i], targetSpeed)
val deltaPos = deltaPosAndDeltaSpeed.component1()
val deltaSpeed = deltaPosAndDeltaSpeed.component2()
// TODO: when targetSpeed !=0 and newSpeed == targetSpeed -> maintain speed = target speed
Expand Down

0 comments on commit 084a5b0

Please sign in to comment.