[Meta] Implement a converter from OSRD scenario to NGE light model #7538
Closed
8 of 20 tasks
Labels
area:front
Work on Standard OSRD Interface modules
kind:feature-task
Work related to a feature epic
module:operational-studies
Multi-train simulation with structured studies management
3rd step of meta #7535
Acceptance criteria
Running times are the same as OSRD calculationsOnly valid trains are displayed in NGEQuelques cas pour l'affichage des noeuds/lignes dans NGE :Légende du schéma : Les lettres sur les PRs sont les initiales des villes / Rond vide = passage sans arrêt / Rond plein = passage avec arrêt
Le temps de parcours affiché entre 2 noeuds A et B dans NGE est le temps de parcours total de A à B (s'il y a des PRs intermédiaires non affichés dans NGE, il faut faire la somme des temps de parcours)Implementation plan
netzgrafikDto
DOM root propertycreate_nge_model_infra
method from PoC)create_nge_model_with_trains
method from PoC, taking in account TSv2)@Input
for this message in NGEloadNetzgrafikDto
Description
The preliminary work to implement the converter can be done without having
osrd-nge
integrated in OSRD.Train schedules v2
Train schedules v2 is not released at the time on the refinement of this ticket, refinement taking in account TSv2 will have to be done during the development of this ticket.
It will especially enable train round trips, train frequency, departure time and stops modifications.
Semantic differences
Missing (or not good enough) concepts in OSRD for NGE use: round trip and train frequency
(See NGE data models)
Train schedule
: passes by manysteps
, associated to arolling stock
step
(PathWayPoint
) : represents a station withuic
/ch
code andsuggestion
that indicates the actual stop or not of the train (with associatedduration
if so)departure_time
defined for each train schedule, andstop
times are given (microscopic)Trainrun
: composed of manyTrainrunSection
, associated to aTrainrun category
TrainrunSection
: link a sourceNode
and targetNode
sourceDeparture
,targetArrival
andtargetDeparture
,sourceArrival
times are defined once perTrainrun
for this specificTrainrunSection
(macroscopic)TrainrunCategory
: (macro) can be seen as group of rolling stocks, or by type of train schedule (intercity, regional, freight...)The PoC currently uses these attributes:
infra
:stations
:operational_points
:id
/obj_id
ch
geographic coordinates
sncf trigram
name
timetable
:train_schedules
:id
path_id
name
rolling_stock
:id
name
;steps
:id
(same as[infra][station][operational_points][id]
)suggestion
duration
time
departure_time
Node
:Trainruns
:id
(same as[infra][station][operational_points][id]
)name
categoryId
TrainrunSections
:sourceDeparture
:time
consecutiveTime
sourceNodeId
targetNodeId
stop duration time
(not implemented yet)warnings
(to storedeparture_time
for now, but this needs refacto)Payload
As shown in the documentation, NGE model is a JSON containing the elements displayed in NGE (
nodes
,trainruns
,trainrunSections
...) and their locations. The locations don't need to be given and are recalculated by NGE if set empty: this is the difference betweennge_light_model
(no position given) andnge_complete_model
.From a base model, we need to append all the objects with their minimal configuration.
The minimal configuration for the different objects has to be based on the PoC (see
__init__
methods).The output format is a NGE model as JSON.
Infrastructure import, step 1
In the PoC, the whole infrastructure goes in NGE, which is not convenient on big infrastructures (France has around 4000 BV+00 (= stations for travelers). For this reason, it has been decided to import only the stations that intervene in the timetable, that is:
stop_node
)stop_node
)non_stop
)stop_node
)The nodes all have to be labeled, if present, with their
ch code
.Can be only be based, taking in account previous point,
create_nge_model_infra
on PoC.Since the user cannot see the nodes that are not linked to the timetable yet, it "disables" the creation of a trainrun that involves a nodes that is "off" NGE. An idea could be to add a functionnality to the user: allow the user to create a node in NGE, and fill the name and/or shortname with the name/trigram of the station that the user needs and make it able to use it for its trainruns. Once the event (
create trainrun
) will be forwarded to OSRD, we can try to rebuild the train schedule with its path (not only operational point ids, but for this case to match the informations of the node). If the path of the newly created train schedule is valid, it will propagate the changes to NGE, and relocate the newly created node. Else, the train schedule is invalid, and the user can fix the path directly in OSRD.The function
geographic_to_cartesian_coordinates
takes in account all the stations belonging to the infrastructure and computes the min/max coordinates of the NGE model. This logic is important to center, normalize and display all the nodes in the model. The node fieldsposition_x
andposition_y
are then filled with their geographical coordinates in OSRD, taking in account the screen size in NGE and the min/max coordinates to display. It is important to preserve the logarithm parameter that calculates the size of the model in NGE, to adapt the screen with the nodes represented.Timetable import
Can be based on
create_nge_model_with_trains
from the PoC, without going into the branches dedicated to Viriato (get_train_schedules
is previously called also). Has to be re-thought to fit with Train Schedules v2.To get the stops, use the
PathProperties
of the train schedules.A simple way to implement this functionnality could be to first import only the train schedules from start to end (no stops in between), then look for the stops (no running times), then look for the running times, etc...
Event listener and callback functions
Enable the
eventListener
already implemented inosrd-nge
to listen toosrd_window.postMessage(nge_light_model, nge_iframe
) and set the callback function asonLoad
function (which loads the NGE JSON model in NGE) from NGE.See also
message_event
.Tests
Infrastructure import, step 2
Once everything else is done, we can add a functionnality for user to choose either to import infrastructure with the "Infrastructure import, step 1" way, either to import all the stations that are in the infrastructure of the scenario. This is not convenient for big infrastructures, but on smaller infrastructures it can make it quick and easy to draw a timetable from scratch, without having to go in OSRD first to "unreveal" the nodes of the infrastructure.
Definition of ready
PO
Technical
General
The text was updated successfully, but these errors were encountered: