Skip to content

Commit

Permalink
core, editoast, front: stop using speed-limit tags' long names
Browse files Browse the repository at this point in the history
* stop fallback on long-names (core)
* remove short-id extractors (front)
* adapt examples and small_infra

also remove default-speed, as it is unused

Signed-off-by: Pierre-Etienne Bougué <[email protected]>
  • Loading branch information
bougue-pe committed Sep 11, 2024
1 parent 4350e4c commit ef349bf
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 236 deletions.
90 changes: 0 additions & 90 deletions assets/static_resources/speed_limit_tags.yml
Original file line number Diff line number Diff line change
@@ -1,224 +1,134 @@
V200:
name: Voyageurs - V200
fallback_list: [V160, V140, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

R200:
name: Voyageurs - Trains réversibles V200
fallback_list: [V200, V160, V140, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

AR200:
name: Voyageurs - AR200
fallback_list: [V200, V160, V140, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

V160:
name: Voyageurs - V160
fallback_list: [V140, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

R160:
name: Voyageurs - Trains réversibles V160
fallback_list: [V160, V140, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

AR160:
name: Voyageurs - AR160
fallback_list: [V160, V140, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

V140:
name: Voyageurs - V140
fallback_list: [V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

R140:
name: Voyageurs - Trains réversibles V140
fallback_list: [V140, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

AR140:
name: Voyageurs - AR140
fallback_list: [V140, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

V120:
name: Voyageurs - V120
fallback_list: [ME100, MA100, MA90, MA80]
default_speed: 8.333333

R120:
name: Voyageurs - Trains réversibles V120
fallback_list: [V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

AR120:
name: Voyageurs - AR120
fallback_list: [V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

MVGV:
name: Messagerie - MVGV
fallback_list: [MV160, ME140, ME120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

MV160:
name: Messagerie - MV160
fallback_list: [ME140, ME120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

ME140:
name: Messagerie - ME140
fallback_list: [ME120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

ME120:
name: Messagerie - ME120
fallback_list: [ME100, MA100, MA90, MA80]
default_speed: 8.333333

ME100:
name: Messagerie - ME100
fallback_list: [MA100, MA90, MA80]
default_speed: 8.333333

HLP:
name: Divers - Haut le pied
fallback_list: [ME100, MA100, MA90, MA80]
default_speed: 8.333333

MA100:
name: Marchandise - MA100
fallback_list: [MA90, MA80]
default_speed: 8.333333

MA90:
name: Marchandise - MA90
fallback_list: [MA80]
default_speed: 8.333333

MA80:
name: Marchandise - MA80
fallback_list: []
default_speed: 8.333333

E32C:
name: Voyageurs - Automoteurs - E32C
fallback_list: [E30C, E20C, E20N, V200, E16C, E16N, V160, E14C, E14N, V140, E12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

E30C:
name: Voyageurs - Automoteurs - E30C
fallback_list: [E20C, E20N, V200, E16C, E16N, V160, E14C, E14N, V140, E12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

E20C:
name: Voyageurs - Automoteurs - E20C
fallback_list: [E20N, V200, E16C, E16N, V160, E14C, E14N, V140, E12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

E20N:
name: Voyageurs - Automoteurs - E20N
fallback_list: [V200, E16N, V160, E14N, V140, E12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

E16C:
name: Voyageurs - Automoteurs - E16C
fallback_list: [E16N, V160, E14C, E14N, V140, E12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

E16N:
name: Voyageurs - Automoteurs - E16N
fallback_list: [V160, E14N, V140, E12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

E14F:
name: Voyageurs - Automoteurs - E14F
fallback_list: [E14R, E14Q, E14P, E14C, E14N, V140, E12Q, E12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

E14C:
name: Voyageurs - Automoteurs - E14C
fallback_list: [E14N, V140, E12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

E14R:
name: Voyageurs - Automoteurs - E14R
fallback_list: [E14Q, E14P, E14N, V140, E12Q, E12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

E14Q:
name: Voyageurs - Automoteurs - E14Q
fallback_list: [E14P, E14N, V140, E12Q, E12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

E14P:
name: Voyageurs - Automoteurs - E14P
fallback_list: [E14N, V140, E12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

E14N:
name: Voyageurs - Automoteurs - E14N
fallback_list: [V140, E12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

E12C:
name: Voyageurs - Automoteurs - E12C
fallback_list: [E12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

E12Q:
name: Voyageurs - Automoteurs - E12Q
fallback_list: [E12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

E12N:
name: Voyageurs - Automoteurs - E12N
fallback_list: [V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

E10C:
name: Voyageurs - Automoteurs - E10C
fallback_list: [ME100, MA100, MA90, MA80]
default_speed: 8.333333

T16C:
name: Voyageurs - Autorails - T16C
fallback_list: [V160, T14C, T14N, V140, T12C, T12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

T14C:
name: Voyageurs - Autorails - T14C
fallback_list: [T14N, V140, T12C, T12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

T14N:
name: Voyageurs - Autorails - T14N
fallback_list: [V140, T12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

T12C:
name: Voyageurs - Autorails - T12C
fallback_list: [T12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

T12N:
name: Voyageurs - Autorails - T12N
fallback_list: [V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

B16C:
name: Voyageurs - BIMA - B16C
fallback_list: [T16C, V160, T14C, T14N, V140, T12C, T12N, V120, ME100, MA100, MA90, MA80]
default_speed: 8.333333

TM:
name: Divers - Train de machines
fallback_list: [MA90, MA80]
default_speed: 8.333333

EVO:
name: Divers - Evolution
fallback_list: [MA80]
default_speed: 8.333333
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ import fr.sncf.osrd.geom.LineString
import fr.sncf.osrd.railjson.schema.common.graph.EdgeDirection
import fr.sncf.osrd.railjson.schema.common.graph.EdgeEndpoint
import fr.sncf.osrd.railjson.schema.geom.RJSLineString
import fr.sncf.osrd.railjson.schema.infra.RJSInfra
import fr.sncf.osrd.railjson.schema.infra.RJSRoute
import fr.sncf.osrd.railjson.schema.infra.RJSSwitch
import fr.sncf.osrd.railjson.schema.infra.RJSSwitchType
import fr.sncf.osrd.railjson.schema.infra.RJSTrackSection
import fr.sncf.osrd.railjson.schema.infra.*
import fr.sncf.osrd.railjson.schema.infra.trackobjects.RJSRouteWaypoint
import fr.sncf.osrd.railjson.schema.infra.trackobjects.RJSSignal
import fr.sncf.osrd.railjson.schema.infra.trackranges.RJSElectrification
Expand All @@ -20,57 +16,13 @@ import fr.sncf.osrd.railjson.schema.infra.trackranges.RJSSpeedSection
import fr.sncf.osrd.railjson.schema.rollingstock.RJSLoadingGaugeType
import fr.sncf.osrd.reporting.exceptions.ErrorType
import fr.sncf.osrd.reporting.exceptions.OSRDError
import fr.sncf.osrd.sim_infra.api.Detector
import fr.sncf.osrd.sim_infra.api.DetectorId
import fr.sncf.osrd.sim_infra.api.DirDetectorId
import fr.sncf.osrd.sim_infra.api.DirTrackSectionId
import fr.sncf.osrd.sim_infra.api.EndpointTrackSectionId
import fr.sncf.osrd.sim_infra.api.LoadingGaugeConstraint
import fr.sncf.osrd.sim_infra.api.LoadingGaugeType
import fr.sncf.osrd.sim_infra.api.NeutralSection
import fr.sncf.osrd.sim_infra.api.RawInfra
import fr.sncf.osrd.sim_infra.api.RawSignalParameters
import fr.sncf.osrd.sim_infra.api.TrackChunk
import fr.sncf.osrd.sim_infra.api.TrackNodeConfig
import fr.sncf.osrd.sim_infra.api.TrackNodeConfigId
import fr.sncf.osrd.sim_infra.api.TrackNodeId
import fr.sncf.osrd.sim_infra.api.TrackNodePort
import fr.sncf.osrd.sim_infra.api.TrackNodePortId
import fr.sncf.osrd.sim_infra.api.TrackSection
import fr.sncf.osrd.sim_infra.api.ZoneId
import fr.sncf.osrd.sim_infra.api.decreasing
import fr.sncf.osrd.sim_infra.api.increasing
import fr.sncf.osrd.sim_infra.impl.BuildRouteError
import fr.sncf.osrd.sim_infra.impl.MissingNodeConfig
import fr.sncf.osrd.sim_infra.impl.RawInfraBuilder
import fr.sncf.osrd.sim_infra.impl.ReachedNodeDeadEnd
import fr.sncf.osrd.sim_infra.impl.ReachedTrackDeadEnd
import fr.sncf.osrd.sim_infra.impl.SpeedLimitTagDescriptor
import fr.sncf.osrd.sim_infra.impl.SpeedSection
import fr.sncf.osrd.sim_infra.impl.TrackChunkDescriptor
import fr.sncf.osrd.sim_infra.impl.TrackNodeConfigDescriptor
import fr.sncf.osrd.sim_infra.impl.route
import fr.sncf.osrd.utils.Direction
import fr.sncf.osrd.sim_infra.api.*
import fr.sncf.osrd.sim_infra.impl.*
import fr.sncf.osrd.utils.*
import fr.sncf.osrd.utils.Direction.DECREASING
import fr.sncf.osrd.utils.Direction.INCREASING
import fr.sncf.osrd.utils.DirectionalMap
import fr.sncf.osrd.utils.DistanceRangeMap
import fr.sncf.osrd.utils.DistanceRangeMapImpl
import fr.sncf.osrd.utils.Endpoint
import fr.sncf.osrd.utils.UnionFind
import fr.sncf.osrd.utils.distanceRangeMapOf
import fr.sncf.osrd.utils.indexing.DirStaticIdx
import fr.sncf.osrd.utils.indexing.MutableStaticIdxArraySet
import fr.sncf.osrd.utils.indexing.StaticIdx
import fr.sncf.osrd.utils.indexing.StaticPool
import fr.sncf.osrd.utils.indexing.mutableStaticIdxArrayListOf
import fr.sncf.osrd.utils.indexing.mutableStaticIdxArraySetOf
import fr.sncf.osrd.utils.units.Distance
import fr.sncf.osrd.utils.units.Offset
import fr.sncf.osrd.utils.units.Speed
import fr.sncf.osrd.utils.units.meters
import fr.sncf.osrd.utils.units.metersPerSecond
import fr.sncf.osrd.utils.units.mutableOffsetArrayListOf
import fr.sncf.osrd.utils.indexing.*
import fr.sncf.osrd.utils.units.*
import java.io.IOException
import java.util.*
import kotlin.collections.set
Expand Down Expand Up @@ -766,9 +718,7 @@ fun EdgeEndpoint.toEndpoint(): Endpoint {

@Serializable
data class YamlSpeedLimitTagDescriptor(
val name: String,
@SerialName("fallback_list") val fallbackList: List<String>,
@SerialName("default_speed") val defaultSpeed: Double?,
)

fun parseSpeedLimitTags(builder: RawInfraBuilder) {
Expand All @@ -784,16 +734,10 @@ fun parseSpeedLimitTags(builder: RawInfraBuilder) {
)

for ((tagCode, tagDescriptor) in speedLimitTagDescriptors.entries) {
val defaultSpeed =
if (tagDescriptor.defaultSpeed != null)
Speed.fromMetersPerSecond(tagDescriptor.defaultSpeed)
else null
builder.speedLimitTag(
tagCode,
SpeedLimitTagDescriptor(
tagCode,
tagDescriptor.name,
tagDescriptor.fallbackList,
defaultSpeed
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,8 @@ class RawInfraBuilder {
return physicalSignalPool.add(builder.build())
}

fun speedLimitTag(tagDescriptor: SpeedLimitTagDescriptor) {
speedLimitTagPool[tagDescriptor.id] = tagDescriptor
fun speedLimitTag(tagId: String, tagDescriptor: SpeedLimitTagDescriptor) {
speedLimitTagPool[tagId] = tagDescriptor
}

fun trackSection(name: String, chunks: StaticIdxList<TrackChunk>): TrackSectionId {
Expand Down
Loading

0 comments on commit ef349bf

Please sign in to comment.