Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: remove neutral section hacks to improve reliability #7413

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,10 @@ fun parseRJSInfra(rjsInfra: RJSInfra): RawInfra {

for (neutralSection in rjsInfra.neutralSections) {
parseNeutralRanges(builder, false, neutralSection)
parseNeutralRanges(builder, true, neutralSection)

// FIXME: the current implementation of neutral section announcements breaks
// some use cases, see https://github.com/OpenRailAssociation/osrd/issues/7359
// parseNeutralRanges(builder, true, neutralSection)
}

for (speedSection in rjsInfra.speedSections) {
Expand Down
13 changes: 2 additions & 11 deletions core/src/main/java/fr/sncf/osrd/train/RollingStock.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,16 +233,6 @@ public CurvesAndConditions mapTractiveEffortCurves(
return new CurvesAndConditions(ImmutableRangeMap.copyOf(res), ImmutableRangeMap.copyOf(conditionsUsed));
}

protected Range<Double> computeDeadSectionRange(Range<Double> neutralRange, Neutral n, Envelope maxEffortEnvelope) {
var endRange = neutralRange.upperEndpoint();
var finalSpeed = maxEffortEnvelope.interpolateSpeedLeftDir(endRange, 1);
double additionalRange = finalSpeed * electricalPowerStartUpTime;
if (n.lowerPantograph) {
additionalRange += finalSpeed * raisePantographTime;
}
return Range.closed(neutralRange.lowerEndpoint(), neutralRange.upperEndpoint() + additionalRange);
}

/**
* Returns the tractive effort curves corresponding to the electrical conditions map with
* neutral sections
Expand All @@ -268,7 +258,8 @@ public RangeMap<Double, TractiveEffortPoint[]> addNeutralSystemTimes(
// estimate the distance during which the train will be coasting, due to having
// respected the
// neutral section
var deadSectionRange = computeDeadSectionRange(elecCondEntry.getKey(), n, maxSpeedEnvelope);
Range<Double> neutralRange = elecCondEntry.getKey();
var deadSectionRange = Range.closed(neutralRange.lowerEndpoint(), neutralRange.upperEndpoint());
var curveAndCondition = findTractiveEffortCurve(comfort, n);
if (curveAndCondition.cond.mode == null) { // The train is effectively coasting
newCurves.put(deadSectionRange, curveAndCondition.curve);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,8 @@ public void testElectrificationRangesInResultWithPowerRestriction() throws IOExc

ElectrificationUsage[] expected = {
new ElectrifiedUsage("1500V", true, "O", false),
// the C2 power restriction reduces the power class, so no electrical profile is found
new ElectrifiedUsage("1500V", true, null, true),
new NeutralUsage(true),
new ElectrifiedUsage("25000V", true, "25000V", true),
new ElectrifiedUsage("25000V", true, "20000V", true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class PathPropEndpointTest : ApiTest() {
assertEquals(
parsed.electrifications,
RangeValues(
listOf(1800.meters, 1950.meters),
listOf(1910.meters, 1950.meters),
listOf(Electrified("1500V"), Neutral(true), Electrified("25000V"))
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ElectrificationConstraintsTest {
// section
Arguments.of(
1,
mutableSetOf(Pathfinding.Range(Offset<Block>(0.meters), Offset(30.meters)))
mutableSetOf(Pathfinding.Range(Offset<Block>(0.meters), Offset(140.meters)))
), // Fully corresponding electrification ranges without dead
// sections
Arguments.of(2, HashSet<Any>())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,16 +205,8 @@ class EnvelopeTrainPathTest {
putInElectrificationMapByPowerClass(
expected,
800.0,
850.0,
Electrified("1500V"),
"A",
false
)
putInElectrificationMapByPowerClass(
expected,
850.0,
960.0,
Neutral(true, Electrified("1500V"), true),
Electrified("1500V"),
"A",
false
)
Expand Down Expand Up @@ -310,16 +302,8 @@ class EnvelopeTrainPathTest {
putInElectrificationMapByPowerClass(
expectedElectrificationPowerClass1,
2_600.0,
2_900.0,
Electrified("1500V"),
"B",
false
)
putInElectrificationMapByPowerClass(
expectedElectrificationPowerClass1,
2_900.0,
2_910.0,
Neutral(false, Electrified("1500V"), true),
Electrified("1500V"),
"B",
false
)
Expand Down Expand Up @@ -372,16 +356,8 @@ class EnvelopeTrainPathTest {
putInElectrificationMapByPowerClass(
expectedElectrificationPowerClass2,
2_700.0,
2_900.0,
Electrified("1500V"),
"C",
false
)
putInElectrificationMapByPowerClass(
expectedElectrificationPowerClass2,
2_900.0,
2_910.0,
Neutral(false, Electrified("1500V"), true),
Electrified("1500V"),
"C",
false
)
Expand Down Expand Up @@ -422,11 +398,7 @@ class EnvelopeTrainPathTest {
Direction.INCREASING,
ImmutableRangeMap.Builder<Double, Electrification>()
.put(Range.closedOpen(0.0, 300.0), NonElectrified())
.put(Range.closedOpen(300.0, 1_350.0), Electrified("1500V"))
.put(
Range.closedOpen(1_350.0, 1_460.0),
Neutral(true, Electrified("1500V"), true)
)
.put(Range.closedOpen(300.0, 1_460.0), Electrified("1500V"))
.put(
Range.closedOpen(1_460.0, 1_500.0),
Neutral(true, Electrified("1500V"), false)
Expand All @@ -442,11 +414,7 @@ class EnvelopeTrainPathTest {
ImmutableRangeMap.Builder<Double, Electrification>()
.put(Range.closedOpen(0.0, 350.0), Electrified("25000V"))
.put(Range.closedOpen(350.0, 450.0), NonElectrified())
.put(Range.closedOpen(450.0, 1_450.0), Electrified("1500V"))
.put(
Range.closedOpen(1_450.0, 1_460.0),
Neutral(false, Electrified("1500V"), true)
)
.put(Range.closedOpen(450.0, 1_460.0), Electrified("1500V"))
.put(
Range.closedOpen(1_460.0, 1_600.0),
Neutral(false, Electrified("1500V"), false)
Expand Down
Loading