@@ -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
@@ -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,52 @@ class StandaloneSimulationTest {
163
158
)
164
159
)
165
160
161
+ // Power restriction values
162
+ val powerRestrictionRangeMaps: List <DistanceRangeMap <String >> =
163
+ listOf (
164
+ distanceRangeMapOf(),
165
+ distanceRangeMapOf(
166
+ listOf (
167
+ DistanceRangeMap .RangeMapEntry (0 .meters, pathLength / 3.0 , " Restrict1" ),
168
+ DistanceRangeMap .RangeMapEntry (
169
+ pathLength / 3.0 ,
170
+ pathLength * 2.0 / 3.0 ,
171
+ " Restrict2"
172
+ ),
173
+ DistanceRangeMap .RangeMapEntry (
174
+ pathLength * 2.0 / 3.0 ,
175
+ pathLength,
176
+ " Restrict1"
177
+ )
178
+ )
179
+ )
180
+ )
181
+
166
182
// List all possible combinations
167
183
val res = mutableListOf<TestCase >()
168
184
for (schedule in schedules) {
169
185
for (margin in margins) {
170
186
for (startSpeed in listOf (0.0 , 15.0 )) {
171
187
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
188
+ for (powerRestrictions in powerRestrictionRangeMaps) {
189
+ res.add(
190
+ TestCase (
191
+ schedule = schedule,
192
+ margins = margin,
193
+ startSpeed = startSpeed,
194
+ allowanceDistribution = distribution,
195
+ pathLength = pathLength,
196
+ powerRestrictions = powerRestrictions
197
+ )
179
198
)
180
- )
199
+ }
181
200
}
182
201
}
183
202
}
184
203
}
185
204
return res.map { Arguments .of(it) }.stream()
186
205
}
206
+
187
207
/* * Parametrized test, checks the interactions between margins and scheduled points */
188
208
@ParameterizedTest
189
209
@MethodSource(" generateTestCases" )
@@ -199,7 +219,7 @@ class StandaloneSimulationTest {
199
219
Comfort .STANDARD ,
200
220
testCase.allowanceDistribution,
201
221
null ,
202
- distanceRangeMapOf() ,
222
+ testCase.powerRestrictions ,
203
223
false ,
204
224
2.0 ,
205
225
testCase.schedule,
0 commit comments