Skip to content

Commit fb9ad97

Browse files
committed
core: hack missing post path traction and grades
The path's context only extends until the end of the path. Hence, for an SvL located further along, the tractive effort and the slopes are missing. In this commit, we hack it to make it work, but we probably should extend the path's context so it goes until the last SvL. TBD at a later date. Signed-off-by: Erashin <[email protected]>
1 parent aaa76b5 commit fb9ad97

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

core/envelope-sim/src/main/java/fr/sncf/osrd/envelope_sim/EnvelopeSimPath.java

+4
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ public double getMinGrade(double begin, double end) {
111111
// TODO: Optimise method by adding in a cache.
112112
int indexBegin = getIndexBeforePos(begin);
113113
int indexEnd = getIndexBeforePos(end);
114+
// TODO: Remove when we extend path properties until last SvL > path.length.
115+
if (indexBegin == indexEnd && indexBegin == gradePositions.length - 1)
116+
// Take last grade value in this case
117+
return gradeValues[gradeValues.length - 1];
114118
var lowestGradient = gradeValues[indexBegin];
115119
for (int i = indexBegin; i < indexEnd; i++) {
116120
var grad = gradeValues[i];

core/envelope-sim/src/main/kotlin/fr/sncf/osrd/envelope_sim/etcs/ETCSBrakingCurves.kt

+6-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,12 @@ private fun computeBecParams(
542542
rollingStock.getRollingResistance(speed),
543543
weightForce,
544544
speed,
545-
PhysicsRollingStock.getMaxEffort(speed, context.tractiveEffortCurveMap.get(position)),
545+
PhysicsRollingStock.getMaxEffort(
546+
speed,
547+
// TODO: have a tractive effort curve map which extends until the last SvL instead
548+
// of the end of the path.
549+
context.tractiveEffortCurveMap.get(min(position, context.path.length))
550+
),
546551
1.0
547552
)
548553
// Speed correction due to the traction staying active during tTraction. See Subset:

0 commit comments

Comments
 (0)