@@ -18,14 +18,8 @@ import fr.sncf.osrd.railjson.schema.rollingstock.Comfort
18
18
import fr.sncf.osrd.railjson.schema.schedule.RJSAllowanceDistribution
19
19
import fr.sncf.osrd.sim_infra.api.makePathProperties
20
20
import fr.sncf.osrd.train.TestTrains
21
- import fr.sncf.osrd.utils.Helpers
22
- import fr.sncf.osrd.utils.distanceRangeMapOf
23
- import fr.sncf.osrd.utils.pathFromRoutes
24
- import fr.sncf.osrd.utils.toIdxList
25
- import fr.sncf.osrd.utils.units.Distance
26
- import fr.sncf.osrd.utils.units.Offset
27
- import fr.sncf.osrd.utils.units.TimeDelta
28
- import fr.sncf.osrd.utils.units.seconds
21
+ import fr.sncf.osrd.utils.*
22
+ import fr.sncf.osrd.utils.units.*
29
23
import java.util.stream.Stream
30
24
import kotlin.test.assertEquals
31
25
import org.junit.jupiter.api.Test
@@ -39,10 +33,10 @@ class StandaloneSimulationTest {
39
33
private val infra = Helpers .tinyInfra
40
34
private val routes =
41
35
listOf (
42
- " rt.buffer_stop_c->tde.track-bar" ,
43
- " rt.tde.track-bar->tde.switch_foo-track" ,
44
- " rt.tde.switch_foo-track->buffer_stop_a"
45
- )
36
+ " rt.buffer_stop_c->tde.track-bar" ,
37
+ " rt.tde.track-bar->tde.switch_foo-track" ,
38
+ " rt.tde.switch_foo-track->buffer_stop_a"
39
+ )
46
40
.map { infra.rawInfra.getRouteFromName(it) }
47
41
48
42
private val chunkPath = pathFromRoutes(infra.rawInfra, routes)
@@ -99,6 +93,7 @@ class StandaloneSimulationTest {
99
93
val startSpeed : Double = 0.0 ,
100
94
val margins : RangeValues <MarginValue > = RangeValues (),
101
95
val pathLength : Distance ,
96
+ val powerRestrictions : DistanceRangeMap <String > = distanceRangeMapOf()
102
97
)
103
98
104
99
/* *
@@ -163,27 +158,43 @@ class StandaloneSimulationTest {
163
158
)
164
159
)
165
160
161
+ // Power restriction values
162
+ val powerRestrictionRangeMaps: List <DistanceRangeMap <String >> = listOf (
163
+ distanceRangeMapOf(),
164
+ distanceRangeMapOf(
165
+ listOf (
166
+ DistanceRangeMap .RangeMapEntry (0 .meters, pathLength / 3.0 , " Restrict1" ),
167
+ DistanceRangeMap .RangeMapEntry (pathLength / 3.0 , pathLength * 2.0 / 3.0 , " Restrict2" ),
168
+ DistanceRangeMap .RangeMapEntry (pathLength * 2.0 / 3.0 , pathLength, " Restrict1" )
169
+ )
170
+ )
171
+ )
172
+
166
173
// List all possible combinations
167
174
val res = mutableListOf<TestCase >()
168
175
for (schedule in schedules) {
169
176
for (margin in margins) {
170
177
for (startSpeed in listOf (0.0 , 15.0 )) {
171
178
for (distribution in RJSAllowanceDistribution .entries) {
172
- res.add(
173
- TestCase (
174
- schedule = schedule,
175
- margins = margin,
176
- startSpeed = startSpeed,
177
- allowanceDistribution = distribution,
178
- pathLength = pathLength
179
+ for (powerRestrictions in powerRestrictionRangeMaps) {
180
+ res.add(
181
+ TestCase (
182
+ schedule = schedule,
183
+ margins = margin,
184
+ startSpeed = startSpeed,
185
+ allowanceDistribution = distribution,
186
+ pathLength = pathLength,
187
+ powerRestrictions = powerRestrictions
188
+ )
179
189
)
180
- )
190
+ }
181
191
}
182
192
}
183
193
}
184
194
}
185
195
return res.map { Arguments .of(it) }.stream()
186
196
}
197
+
187
198
/* * Parametrized test, checks the interactions between margins and scheduled points */
188
199
@ParameterizedTest
189
200
@MethodSource(" generateTestCases" )
@@ -199,7 +210,7 @@ class StandaloneSimulationTest {
199
210
Comfort .STANDARD ,
200
211
testCase.allowanceDistribution,
201
212
null ,
202
- distanceRangeMapOf() ,
213
+ testCase.powerRestrictions ,
203
214
false ,
204
215
2.0 ,
205
216
testCase.schedule,
0 commit comments