1
1
package fr .sncf .osrd .api .stdcm ;
2
2
3
- import static fr .sncf .osrd .utils .KtToJavaConverter .toIntList ;
4
-
5
3
import fr .sncf .osrd .api .ExceptionHandler ;
6
4
import fr .sncf .osrd .api .FullInfra ;
7
5
import fr .sncf .osrd .api .InfraManager ;
14
12
import fr .sncf .osrd .reporting .exceptions .ErrorType ;
15
13
import fr .sncf .osrd .reporting .exceptions .OSRDError ;
16
14
import fr .sncf .osrd .reporting .warnings .DiagnosticRecorderImpl ;
17
- import fr .sncf .osrd .sim_infra .api .InterlockingInfraKt ;
18
- import fr .sncf .osrd .sim_infra .api .RawSignalingInfra ;
19
15
import fr .sncf .osrd .standalone_sim .ScheduleMetadataExtractor ;
20
16
import fr .sncf .osrd .standalone_sim .result .ResultEnvelopePoint ;
21
17
import fr .sncf .osrd .standalone_sim .result .StandaloneSimResult ;
35
31
import org .takes .rs .RsWithBody ;
36
32
import org .takes .rs .RsWithStatus ;
37
33
import java .util .ArrayList ;
38
- import java .util .Collection ;
39
- import java .util .HashSet ;
40
34
import java .util .List ;
41
35
42
36
public class STDCMEndpoint implements Take {
@@ -70,7 +64,6 @@ public Response act(Request req) throws OSRDError {
70
64
final var comfort = RJSRollingStockParser .parseComfort (request .comfort );
71
65
final var steps = parseSteps (infra , request .steps );
72
66
final String tag = request .speedLimitComposition ;
73
- var occupancies = request .routeOccupancies ;
74
67
AllowanceValue standardAllowance = null ;
75
68
if (request .standardAllowance != null )
76
69
standardAllowance = RJSStandaloneTrainScheduleParser .parseAllowanceValue (
@@ -81,11 +74,10 @@ public Response act(Request req) throws OSRDError {
81
74
82
75
// Build the unavailable space
83
76
// temporary workaround, to remove with new signaling
84
- occupancies = addWarningOccupancies (infra .rawInfra (), occupancies );
85
77
var unavailableSpace = UnavailableSpaceBuilder .computeUnavailableSpace (
86
78
infra .rawInfra (),
87
79
infra .blockInfra (),
88
- occupancies ,
80
+ request . spacingRequirements ,
89
81
rollingStock ,
90
82
request .gridMarginAfterSTDCM ,
91
83
request .gridMarginBeforeSTDCM
@@ -140,26 +132,8 @@ private static List<STDCMStep> parseSteps(FullInfra infra, List<STDCMRequest.STD
140
132
.toList ();
141
133
}
142
134
143
- /** The inputs only contains occupied blocks, we need to add the warning in the previous one (assuming BAL).
144
- * To be removed with new signaling. */
145
- private static Collection <STDCMRequest .RouteOccupancy > addWarningOccupancies (
146
- RawSignalingInfra rawInfra ,
147
- Collection <STDCMRequest .RouteOccupancy > occupancies
148
- ) {
149
- var warningOccupancies = new HashSet <>(occupancies );
150
- for (var occupancy : occupancies ) {
151
- var route = rawInfra .getRouteFromName (occupancy .id );
152
- var previousRoutes = toIntList (rawInfra .getRoutesEndingAtDet (
153
- InterlockingInfraKt .getRouteEntry (rawInfra , route )));
154
- for (var previousRoute : previousRoutes )
155
- warningOccupancies .add (new STDCMRequest .RouteOccupancy (rawInfra .getRouteName (previousRoute ),
156
- occupancy .startOccupancyTime , occupancy .endOccupancyTime ));
157
- }
158
- return warningOccupancies ;
159
- }
160
-
161
135
/** Generate a train schedule matching the envelope and rolling stock, with one stop at the end */
162
- private static StandaloneTrainSchedule makeTrainSchedule (
136
+ public static StandaloneTrainSchedule makeTrainSchedule (
163
137
double endPos ,
164
138
RollingStock rollingStock ,
165
139
RollingStock .Comfort comfort ,
0 commit comments