Skip to content

Commit

Permalink
editoast: add path projection endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
younesschrifi authored and flomonster committed Apr 24, 2024
1 parent 10f23eb commit 53dc96a
Show file tree
Hide file tree
Showing 5 changed files with 989 additions and 307 deletions.
12 changes: 11 additions & 1 deletion editoast/editoast_schemas/src/infra/track_offset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,21 @@ editoast_common::schemas! {
TrackOffset,
}

#[derive(Debug, Clone, Serialize, Deserialize, ToSchema, Hash)]
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize, ToSchema, Hash)]
pub struct TrackOffset {
/// Track section identifier
#[schema(inline)]
pub track: Identifier,
/// Offset in mm
pub offset: u64,
}

impl TrackOffset {
/// Create a new track location.
pub fn new<T: AsRef<str>>(track: T, offset: u64) -> Self {
Self {
track: track.as_ref().into(),
offset,
}
}
}
229 changes: 204 additions & 25 deletions editoast/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2403,10 +2403,10 @@ components:
properties:
context:
properties:
number:
missing:
type: integer
required:
- number
- missing
type: object
message:
type: string
Expand Down Expand Up @@ -4958,29 +4958,123 @@ components:
- $ref: '#/components/schemas/Tags'
nullable: true
type: object
ProjectPathResult:
description: Project path output is described by time-space points and blocks
ProjectPathInput:
description: Project path input is described by a list of routes and a list of track range
properties:
blocks:
items:
$ref: '#/components/schemas/SignalUpdate'
type: array
positions:
routes:
description: List of route ids
items:
format: int64
minimum: 0
type: integer
maxLength: 255
minLength: 1
type: string
minItems: 1
type: array
times:
track_section_ranges:
description: List of track ranges
items:
format: double
type: number
$ref: '#/components/schemas/TrackRange'
minItems: 1
type: array
required:
- positions
- times
- blocks
- routes
- track_section_ranges
type: object
ProjectPathTrainResult:
allOf:
- description: Project path output is described by time-space points and blocks
properties:
signal_updates:
description: List of signal updates along the path
items:
properties:
aspect_label:
description: The labels of the new aspect
type: string
blinking:
description: Whether the signal is blinking
type: boolean
color:
description: |-
The color of the aspect
(Bits 24-31 are alpha, 16-23 are red, 8-15 are green, 0-7 are blue)
format: int32
type: integer
position_end:
description: The route ends at this position in mm on the train path
format: int64
minimum: 0
type: integer
position_start:
description: The route starts at this position in mm on the train path
format: int64
minimum: 0
type: integer
signal_id:
description: The id of the updated signal
type: string
time_end:
description: The aspects stop being displayed at this time (number of seconds since `departure_time`)
format: int64
minimum: 0
type: integer
time_start:
description: The aspects start being displayed at this time (number of mseconds since `departure_time`)
format: int64
minimum: 0
type: integer
required:
- signal_id
- time_start
- time_end
- position_start
- position_end
- color
- blinking
- aspect_label
type: object
type: array
space_time_curves:
description: List of space-time curves sections along the path
items:
properties:
positions:
items:
format: int64
minimum: 0
type: integer
minItems: 2
type: array
times:
items:
format: int64
minimum: 0
type: integer
minItems: 2
type: array
required:
- positions
- times
type: object
type: array
required:
- space_time_curves
- signal_updates
type: object
- properties:
departure_time:
description: Departure time of the train
format: date-time
type: string
rolling_stock_length:
description: Rolling stock length in mm
format: int64
minimum: 0
type: integer
required:
- departure_time
- rolling_stock_length
type: object
description: Project path output is described by time-space points and blocks
ProjectWithStudies:
allOf:
- $ref: '#/components/schemas/Project'
Expand Down Expand Up @@ -6568,9 +6662,36 @@ components:
base:
$ref: '#/components/schemas/ReportTrainV2'
final_output:
$ref: '#/components/schemas/CompleteReportTrain'
allOf:
- $ref: '#/components/schemas/ReportTrainV2'
- properties:
routing_requirements:
items:
$ref: '#/components/schemas/RoutingRequirement'
type: array
signal_sightings:
items:
$ref: '#/components/schemas/SignalSighting'
type: array
spacing_requirements:
items:
$ref: '#/components/schemas/SpacingRequirement'
type: array
zone_updates:
items:
$ref: '#/components/schemas/ZoneUpdate'
type: array
required:
- signal_sightings
- zone_updates
- spacing_requirements
- routing_requirements
type: object
mrsp:
$ref: '#/components/schemas/Mrsp'
description: A MRSP computation result (Most Restrictive Speed Profile)
items:
$ref: '#/components/schemas/MrspPoint'
type: array
power_restrictions:
items:
properties:
Expand Down Expand Up @@ -6621,7 +6742,15 @@ components:
- pathfinding_result
- status
type: object
SimulationSummaryResultResponse:
- properties:
status:
enum:
- simulation_failed
type: string
required:
- status
type: object
SimulationSummaryResult:
oneOf:
- properties:
Success:
Expand Down Expand Up @@ -6649,7 +6778,7 @@ components:
- PathfindingFailed
type: string
- enum:
- RunningTimeFailed
- SimulationFailed
type: string
SingleSimulationRequest:
allOf:
Expand Down Expand Up @@ -7225,14 +7354,19 @@ components:
- offset
type: object
TrackRange:
description: |-
An oriented range on a track section.
`begin` is always less than `end`.
properties:
begin:
description: The beginning of the range in mm.
format: int64
minimum: 0
type: integer
direction:
$ref: '#/components/schemas/Direction'
end:
description: The end of the range in mm.
format: int64
minimum: 0
type: integer
Expand Down Expand Up @@ -10856,14 +10990,42 @@ paths:
post:
description: |-
Projects the space time curves and paths of a number of train schedules onto a given path
Params are the infra_id and a list of train_ids
- Returns 404 if the infra or any of the train schedules are not found
- Returns 200 with a hashmap of train_id to ProjectPathTrainResult
Train schedules that are invalid (pathfinding or simulation failed) are not included in the result
parameters:
- description: The infra id
in: query
name: infra
required: true
schema:
format: int64
type: integer
- description: Ids of train schedule
in: query
name: ids
required: true
schema:
items:
format: int64
type: integer
type: array
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ProjectPathInput'
description: ''
required: true
responses:
'200':
content:
application/json:
schema:
additionalProperties:
$ref: '#/components/schemas/ProjectPathResult'
$ref: '#/components/schemas/ProjectPathTrainResult'
type: object
description: Project Path Output
summary: Projects the space time curves and paths of a number of train schedules onto a given path
Expand All @@ -10874,13 +11036,30 @@ paths:
description: |-
Retrieve simulation information for a given train list.
Useful for finding out whether pathfinding/simulation was successful.
parameters:
- description: The infra id
in: query
name: infra
required: true
schema:
format: int64
type: integer
- description: Ids of train schedule
in: query
name: ids
required: true
schema:
items:
format: int64
type: integer
type: array
responses:
'200':
content:
application/json:
schema:
additionalProperties:
$ref: '#/components/schemas/SimulationSummaryResultResponse'
$ref: '#/components/schemas/SimulationSummaryResult'
type: object
description: Project Path Output
summary: Retrieve simulation information for a given train list.
Expand Down
Loading

0 comments on commit 53dc96a

Please sign in to comment.