@@ -3,7 +3,6 @@ package fr.sncf.osrd.conflicts
3
3
import fr.sncf.osrd.signaling.SignalingSimulator
4
4
import fr.sncf.osrd.signaling.ZoneStatus
5
5
import fr.sncf.osrd.sim_infra.api.*
6
- import fr.sncf.osrd.sim_infra_adapter.SimInfraAdapter
7
6
import fr.sncf.osrd.standalone_sim.result.ResultTrain.SpacingRequirement
8
7
import fr.sncf.osrd.utils.indexing.mutableStaticIdxArrayListOf
9
8
import fr.sncf.osrd.utils.units.Offset
@@ -36,11 +35,11 @@ data class PendingSpacingRequirement(
36
35
37
36
class SpacingRequirementAutomaton (
38
37
// context
39
- val rawInfra : SimInfraAdapter ,
38
+ val rawInfra : RawInfra ,
40
39
val loadedSignalInfra : LoadedSignalInfra ,
41
40
val blockInfra : BlockInfra ,
42
41
val simulator : SignalingSimulator ,
43
- val callbacks : IncrementalRequirementCallbacks ,
42
+ var callbacks : IncrementalRequirementCallbacks ,
44
43
val incrementalPath : IncrementalPath ,
45
44
) {
46
45
private var nextProcessedBlock = 0
@@ -188,8 +187,8 @@ class SpacingRequirementAutomaton(
188
187
// there may be more zone states than what's contained in the path's blocks, which shouldn't
189
188
// matter
190
189
val zoneStartIndex = incrementalPath.getBlockStartZone(incrementalPath.beginBlockIndex)
191
- val zoneCount =
192
- incrementalPath.getBlockEndZone(incrementalPath.endBlockIndex - 1 ) - zoneStartIndex
190
+ val zoneEndIndex = incrementalPath.getBlockEndZone(incrementalPath.endBlockIndex - 1 )
191
+ val zoneCount = zoneEndIndex - zoneStartIndex
193
192
val zoneStates = MutableList (zoneCount) { ZoneStatus .CLEAR }
194
193
195
194
// for all signals, update zone requirement times until a signal is found for which
@@ -215,10 +214,9 @@ class SpacingRequirementAutomaton(
215
214
216
215
// find the first zone after the signal which can be occupied without disturbing the
217
216
// train
218
- var lastConstrainingZone = - 1
219
217
zoneProbingLoop@ while (true ) {
220
218
// if we reached the last zone, just quit
221
- if (nextProbedZoneForSignal == incrementalPath.endZonePathIndex ) {
219
+ if (nextProbedZoneForSignal == zoneEndIndex ) {
222
220
if (incrementalPath.pathComplete) break @zoneProbingLoop
223
221
return NotEnoughPath
224
222
}
@@ -249,13 +247,6 @@ class SpacingRequirementAutomaton(
249
247
// FIXME: Have a better way to check if the signal is constraining
250
248
if (signalState.getEnum(" aspect" ) == " VL" ) break
251
249
addSignalRequirements(signalProtectedZone, zoneIndex, sightTime)
252
- lastConstrainingZone = zoneIndex
253
- }
254
-
255
- if (lastConstrainingZone == - 1 ) {
256
- logger.error {
257
- " signal ${rawInfra.getLogicalSignalName(pathSignal.signal)} does not react to zone occupation"
258
- }
259
250
}
260
251
pendingSignals.removeFirst()
261
252
nextProbedZoneForSignal = - 1
@@ -318,6 +309,6 @@ class SpacingRequirementAutomaton(
318
309
319
310
sealed interface SpacingResourceUpdate
320
311
321
- class SpacingRequirements (val requirements : List <SpacingRequirement >) : SpacingResourceUpdate
312
+ data class SpacingRequirements (val requirements : List <SpacingRequirement >) : SpacingResourceUpdate
322
313
323
314
data object NotEnoughPath : SpacingResourceUpdate
0 commit comments