Skip to content

Commit

Permalink
core: hack missing post path traction and grades
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Erashin committed Feb 25, 2025
1 parent 2fe0a1f commit 390b821
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ public double getMinGrade(double begin, double end) {
// TODO: Optimise method by adding in a cache.
int indexBegin = getIndexBeforePos(begin);
int indexEnd = getIndexBeforePos(end);
// TODO: Remove when we extend path properties until last SvL > path.length.
if (indexBegin == indexEnd && indexBegin == gradePositions.length - 1)
// Take last grade value in this case
return gradeValues[gradeValues.length - 1];
var lowestGradient = gradeValues[indexBegin];
for (int i = indexBegin; i < indexEnd; i++) {
var grad = gradeValues[i];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,12 @@ private fun computeBecParams(
rollingStock.getRollingResistance(speed),
weightForce,
speed,
PhysicsRollingStock.getMaxEffort(speed, context.tractiveEffortCurveMap.get(position)),
PhysicsRollingStock.getMaxEffort(
speed,
// TODO: have a tractive effort curve map which extends until the last SvL instead
// of the end of the path.
context.tractiveEffortCurveMap.get(min(position, context.path.length))
),
1.0
)
// Speed correction due to the traction staying active during tTraction. See Subset:
Expand Down

0 comments on commit 390b821

Please sign in to comment.