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: warn when invalid detector is found #9604

Merged
merged 1 commit into from
Nov 18, 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 @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading