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, python: rename use infra speed limits tag #10829

Merged
merged 1 commit into from
Feb 17, 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 @@ -90,7 +90,7 @@ class SimulationEndpoint(
request.speedLimitTag,
parsePowerRestrictions(request.powerRestrictions),
request.options.useElectricalProfiles,
request.options.useInfraSpeedLimits ?: true,
request.options.useSpeedLimits ?: true,
2.0,
parseRawSimulationScheduleItems(request.schedule),
request.initialSpeed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,5 @@ class SimulationPowerRestrictionItem(

class TrainScheduleOptions(
@Json(name = "use_electrical_profiles") val useElectricalProfiles: Boolean,
@Json(name = "use_infra_speed_limits_for_simulation") val useInfraSpeedLimits: Boolean?
@Json(name = "use_speed_limits_for_simulation") val useSpeedLimits: Boolean?
)
18 changes: 9 additions & 9 deletions core/src/main/kotlin/fr/sncf/osrd/envelope_sim_infra/MRSP.kt
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import kotlin.math.min
* @param addRollingStockLength whether the rolling stock length should be taken into account in the
* computation.
* @param trainTag corresponding train.
* @param useInfraSpeedLimits whether the speed limits coming from the infrastructure should be
* taken into account in the computation
* @param useSpeedLimits whether the speed limits coming from the infrastructure should be taken
* into account in the computation
* @return the corresponding MRSP as an Envelope.
*/
fun computeMRSP(
Expand All @@ -41,7 +41,7 @@ fun computeMRSP(
trainTag: String?,
temporarySpeedLimitManager: TemporarySpeedLimitManager?,
safetySpeedRanges: DistanceRangeMap<Speed>? = null,
useInfraSpeedLimits: Boolean = true,
useSpeedLimits: Boolean = true,
): Envelope {
return computeMRSP(
path,
Expand All @@ -51,7 +51,7 @@ fun computeMRSP(
trainTag,
temporarySpeedLimitManager,
safetySpeedRanges,
useInfraSpeedLimits,
useSpeedLimits,
)
}

Expand All @@ -66,8 +66,8 @@ fun computeMRSP(
* @param trainTag corresponding train.
* @param safetySpeedRanges Extra speed ranges, used for safety speeds. Note: rolling stock length
* is *not* added at the end of these ranges.
* @param useInfraSpeedLimits whether the speed limits coming from the infrastructure should be
* taken into account in the computation
* @param useSpeedLimits whether the speed limits coming from the infrastructure should be taken
* into account in the computation
* @return the corresponding MRSP as an Envelope.
*/
fun computeMRSP(
Expand All @@ -78,14 +78,14 @@ fun computeMRSP(
trainTag: String?,
temporarySpeedLimitManager: TemporarySpeedLimitManager?,
safetySpeedRanges: DistanceRangeMap<Speed>? = null,
useInfraSpeedLimits: Boolean = true,
useSpeedLimits: Boolean = true,
): Envelope {
val builder = MRSPEnvelopeBuilder()
val pathLength = toMeters(path.getLength())

val offset = if (addRollingStockLength) rsLength else 0.0
val speedLimitProperties =
if (useInfraSpeedLimits) path.getSpeedLimitProperties(trainTag, temporarySpeedLimitManager)
if (useSpeedLimits) path.getSpeedLimitProperties(trainTag, temporarySpeedLimitManager)
else distanceRangeMapOf<SpeedLimitProperty>()
for (speedLimitPropertyRange in speedLimitProperties) {
// Compute where this limit is active from and to
Expand Down Expand Up @@ -126,7 +126,7 @@ fun computeMRSP(
)

// Add safety speeds
if (useInfraSpeedLimits && safetySpeedRanges != null) {
if (useSpeedLimits && safetySpeedRanges != null) {
for (range in safetySpeedRanges) {
val speed = range.value
val newAttrs =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fun runStandaloneSimulation(
speedLimitTag: String?,
powerRestrictions: DistanceRangeMap<String>,
useElectricalProfiles: Boolean,
useInfraSpeedLimits: Boolean,
useSpeedLimits: Boolean,
timeStep: Double,
schedule: List<SimulationScheduleItem>,
initialSpeed: Double,
Expand All @@ -82,7 +82,7 @@ fun runStandaloneSimulation(
speedLimitTag,
null,
safetySpeedRanges,
useInfraSpeedLimits
useSpeedLimits
)
mrsp = driverBehaviour.applyToMRSP(mrsp, signalingRanges)
// We don't use speed safety ranges in the MRSP displayed in the front
Expand All @@ -95,7 +95,7 @@ fun runStandaloneSimulation(
speedLimitTag,
null,
null,
useInfraSpeedLimits,
useSpeedLimits,
)

// Build paths and contexts
Expand Down
4 changes: 2 additions & 2 deletions python/osrd_schemas/osrd_schemas/train_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,15 @@ class PowerRestrictionRanges(RootModel):
class TrainScheduleOptions(BaseModel):
"""Optional arguments :
- `use_electrical_profiles` : use the electrical profiles for the standalone simulation
- `use_infra_speed_limits_for_simulation` : use the speed limits coming from the infrastructure for
- `use_speed_limits_for_simulation` : use the speed limits coming from the infrastructure for
the standalone simulation
"""

use_electrical_profiles: bool = Field(
default=False,
description="If true, the electrical profiles are used in the standalone simulation",
)
use_infra_speed_limits_for_simulation: bool = Field(
use_speed_limits_for_simulation: bool = Field(
default=True,
description="If false, the speed limits of the infrastructure are ignored in the standalone simulation",
)
Expand Down
Loading