diff --git a/core/kt-osrd-rjs-parser/src/main/kotlin/fr/sncf/osrd/RawInfraRJSParser.kt b/core/kt-osrd-rjs-parser/src/main/kotlin/fr/sncf/osrd/RawInfraRJSParser.kt index 7aa8a5bebb6..dae8f06c1fb 100644 --- a/core/kt-osrd-rjs-parser/src/main/kotlin/fr/sncf/osrd/RawInfraRJSParser.kt +++ b/core/kt-osrd-rjs-parser/src/main/kotlin/fr/sncf/osrd/RawInfraRJSParser.kt @@ -279,7 +279,7 @@ private fun buildZones(builder: RawInfraBuilder) { val nodeHasZone = BooleanArray(builder.getTrackNodes().size.toInt()) { false } // TODO: change this algorithm to add all nodes to zones separately from iterating on track - // sections + // sections for (trackSectionIdx in builder.getTrackSections()) { val detectors = builder.getTrackSectionDetectors(trackSectionIdx) diff --git a/core/kt-osrd-sim-infra/src/main/kotlin/fr/sncf/osrd/sim_infra/impl/RawInfraBuilder.kt b/core/kt-osrd-sim-infra/src/main/kotlin/fr/sncf/osrd/sim_infra/impl/RawInfraBuilder.kt index ccd2c00f133..2b691d20fcc 100644 --- a/core/kt-osrd-sim-infra/src/main/kotlin/fr/sncf/osrd/sim_infra/impl/RawInfraBuilder.kt +++ b/core/kt-osrd-sim-infra/src/main/kotlin/fr/sncf/osrd/sim_infra/impl/RawInfraBuilder.kt @@ -362,6 +362,14 @@ class RawInfraBuilder { } fun setNextZone(detector: DirDetectorId, zone: ZoneId) { + if (nextZones[detector.opposite] == zone) { + // Invalid detector if the zone is identical on both sides: data issue + // (wrong place for detector or missing detectors around to avoid "zone-loop"). + // This often leads to self-conflicts on trains. + logger.warn { + "detector ${detectorPool[detector.value].names} is not bounding a zone (both sides are inside a unique zone)" + } + } nextZones[detector] = zone } diff --git a/core/kt-osrd-sim-infra/src/main/kotlin/fr/sncf/osrd/sim_infra/impl/RawInfraImpl.kt b/core/kt-osrd-sim-infra/src/main/kotlin/fr/sncf/osrd/sim_infra/impl/RawInfraImpl.kt index d5eec9e3034..3ed5ea44223 100644 --- a/core/kt-osrd-sim-infra/src/main/kotlin/fr/sncf/osrd/sim_infra/impl/RawInfraImpl.kt +++ b/core/kt-osrd-sim-infra/src/main/kotlin/fr/sncf/osrd/sim_infra/impl/RawInfraImpl.kt @@ -14,7 +14,7 @@ import kotlin.collections.set import kotlin.time.Duration import mu.KotlinLogging -private val logger = KotlinLogging.logger {} +val logger = KotlinLogging.logger {} // TODO: refactor this structure (and its usage) to be able to model a speed limit affecting only // trains using one specific route AND one specific speedLimitTag