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
@@ -139,26 +131,8 @@ private static List<STDCMStep> parseSteps(FullInfra infra, List<STDCMRequest.STD
139
131
.toList ();
140
132
}
141
133
142
- /** The inputs only contains occupied blocks, we need to add the warning in the previous one (assuming BAL).
143
- * To be removed with new signaling. */
144
- private static Collection <STDCMRequest .RouteOccupancy > addWarningOccupancies (
145
- RawSignalingInfra rawInfra ,
146
- Collection <STDCMRequest .RouteOccupancy > occupancies
147
- ) {
148
- var warningOccupancies = new HashSet <>(occupancies );
149
- for (var occupancy : occupancies ) {
150
- var route = rawInfra .getRouteFromName (occupancy .id );
151
- var previousRoutes = toIntList (rawInfra .getRoutesEndingAtDet (
152
- InterlockingInfraKt .getRouteEntry (rawInfra , route )));
153
- for (var previousRoute : previousRoutes )
154
- warningOccupancies .add (new STDCMRequest .RouteOccupancy (rawInfra .getRouteName (previousRoute ),
155
- occupancy .startOccupancyTime , occupancy .endOccupancyTime ));
156
- }
157
- return warningOccupancies ;
158
- }
159
-
160
134
/** Generate a train schedule matching the envelope and rolling stock, with one stop at the end */
161
- private static StandaloneTrainSchedule makeTrainSchedule (
135
+ public static StandaloneTrainSchedule makeTrainSchedule (
162
136
double endPos ,
163
137
RollingStock rollingStock ,
164
138
RollingStock .Comfort comfort ,
0 commit comments