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: add error on zero length simulations #10738

Merged
merged 1 commit into from
Feb 11, 2025
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 @@ -171,6 +171,7 @@ public enum ErrorType {
"missing_route_from_chunk_path",
"couldn't find a route matching the given chunk list",
ErrorCause.INTERNAL),
ZeroLengthPath("zero_length_path", "can't simulate a zero length path", ErrorCause.USER),
;

public final String type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import fr.sncf.osrd.envelope_sim_infra.computeMRSP
import fr.sncf.osrd.external_generated_inputs.ElectricalProfileMapping
import fr.sncf.osrd.railjson.schema.rollingstock.Comfort
import fr.sncf.osrd.railjson.schema.schedule.RJSAllowanceDistribution
import fr.sncf.osrd.reporting.exceptions.ErrorType.ZeroLengthPath
import fr.sncf.osrd.reporting.exceptions.OSRDError
import fr.sncf.osrd.sim_infra.api.*
import fr.sncf.osrd.sim_infra.impl.ChunkPath
import fr.sncf.osrd.standalone_sim.result.ElectrificationRange
Expand Down Expand Up @@ -67,6 +69,7 @@ fun runStandaloneSimulation(
pathItemPositions: List<Offset<Path>>,
driverBehaviour: DriverBehaviour = DriverBehaviour()
): SimulationSuccess {
if (chunkPath.length == 0.meters) throw OSRDError(ZeroLengthPath)
// MRSP & SpeedLimits
val safetySpeedRanges = makeSafetySpeedRanges(infra, chunkPath, routes, schedule)
var mrsp =
Expand Down
Loading