OpenRailAssociation / osrd

An open source web application for railway infrastructure design, capacity analysis, timetabling and simulation
https://osrd.fr
459 stars 43 forks source link

NetzGrafik-Editor (NGE) integration in OSRD #7535

Closed louisgreiner closed 3 months ago

louisgreiner commented 5 months ago

Description

Concept diagram:

OSRD-NGE Concept diagram

This flowchart describes how the main bricks will be communicating.

---
title: OSRD - NGE Workflow for synchronous workspaces
---
flowchart TD
  OSRD[("OSRD")] -- create / update on change --> timetable["Timetable"]
  timetable -- create / modify / delete train schedules &\n (re)calculate pathfindings and running times --> timetable
  timetable -- on change --> synchronization_timetable{"Synchro \nenabled?"}
  synchronization_timetable -- yes, save modifications ----> OSRD
  OSRD -- send infra & timetable for convertion --> converter["Converter / Event handler (osrd-front)"]
  converter -- send NGE light model \n(window.postMessage) --> NGE["osrd-nge component"]
  NGE -- create / modify / delete trainruns --> NGE
  NGE -- on change --> synchronization_nge{"Synchro \nenabled?"}
  synchronization_nge -- yes, save modifications \n(window.postMessage) --> converter
  converter -- requests to update timetable --> OSRD

As shown in the following sequence diagram, services have to develop new communcations.

---
title: OSRD - NGE Sequence diagram
---
sequenceDiagram
  autonumber
  OSRD (osrd_window)-->>OSRD (osrd_window): init web page
  OSRD (osrd_window)->>NGE (nge_iframe): set `netzgrafikDto` DOM property
  loop while synchronization is ON
    alt any modification in OSRD (osrd_window)
      OSRD (osrd_window)-->>OSRD (osrd_window): any modification
      OSRD (osrd_window)->>NGE (nge_iframe): set `netzgrafikDto` DOM property
    else any modification in NGE (nge_iframe)
      NGE (nge_iframe)-->>NGE (nge_iframe): any modification <br>(hooks)
      NGE (nge_iframe)->>OSRD (osrd_window): send `operationX` event (@Output)
      OSRD (osrd_window)-->>OSRD (osrd_window): convert NGE operation into <br/>timetable update
      OSRD (osrd_window)->>NGE (nge_iframe): set `netzgrafikDto` DOM property
    end
  end

Contacts: @louisgreiner (SNCF Réseau) - @aiAdrian (SBB CFF FFS)

Acceptance criteria

*a trainrun in NGE is the equivalent of a train schedule in OSRD (even tho it is not semantically 100% correct)

Implementation plan

Definition of ready

aiAdrian commented 5 months ago

I will have a look into the current version of Netgrafik-Editor and try to locate the all the required changes to get the integration done.

aiAdrian commented 3 months ago

Excellent work!