Skip to content

Commit a7ed824

Browse files
committed
doc: update nge content
Signed-off-by: Louis Greiner <[email protected]>
1 parent 07465ea commit a7ed824

File tree

4 files changed

+35
-114
lines changed

4 files changed

+35
-114
lines changed

content/docs/explanation/netzgrafik-editor/_index.en.md

+16-56
Original file line numberDiff line numberDiff line change
@@ -7,75 +7,35 @@ description: "Open-source software developed by SBB CFF FFS and its integration
77

88
Netzgrafik-Editor (NGE) is an open-source software that enables the creation, modification, and analysis of regular-interval timetable, at a macroscopic level of detail, developed by [Swiss Federal Railways (SBB CFF FFS)](https://www.sbb.ch/). See [front-end](https://github.com/SchweizerischeBundesbahnen/netzgrafik-editor-frontend) and [back-end](https://github.com/SchweizerischeBundesbahnen/netzgrafik-editor-backend) repositories.
99

10-
OSRD (microscopic level of detail, trains scheduled once, based on a defined infrastructure, depicts a timetable) and NGE (macroscopic level of detail, regular-interval based train runs, no infrastructure, depicts a transportation plan) are semantically different, but close enough to make it work together.
10+
OSRD (microscopic level of detail, based on a in-quality defined infrastructure, depicting a timetable composed of unique train schedules) and NGE (macroscopic level of detail, based on no explicit infrastructure, depicting a transportation plan composed on regular-interval based train runs) are semantically different, but close enough to make it work together.
11+
1112
The compatibility between NGE and OSRD has been tested through a proof of concept, by running both pieces of software as separate services and without automated synchronization.
1213

13-
The idea is to give to OSRD a graphical tool to edit (create, update and delete train schedules from) a timetable from an operational study scenario, and get some insights on analytics at the same time. The second benefit of using both microscopic and macroscopic level of detail is that OSRD microscopic calculations can be propagated in NGE to enhance the level of detail of it.
14+
The idea is to give to OSRD a graphical tool to edit (create, update and delete train schedules from) a timetable from an operational study scenario, and get some insights on analytics at the same time. The second benefit of using both microscopic and macroscopic level of detail is that OSRD's microscopic calculations extends the actual scope of NGE, its functionalities and information provided, such as the microscopic simulations or the conflicts detection tool.
1415

15-
The transversal objective of this feature is to make 2 open-source projects from 2 big infrastructure managers work along and cooperate with one another with the same goals.
16+
The transversal objective of this feature is to make 2 open-source projects from 2 railway big infrastructure managers work along and cooperate with one another with the same goal, which is to ensure a digital continuity on different time scales for railway operational studies.
1617

1718
#### 1 - Integration in OSRD
1819

19-
Therefore, NGE is integrated in the operational studies section of OSRD, in an [`iframe`](https://developer.mozilla.org/fr/docs/Web/HTML/Element/iframe). An alternative way to deal with the integration would have been to refactor NGE as [`web-components`](https://developer.mozilla.org/fr/docs/Web/API/Web_components), thus easy to import in OSRD, but this solution has been abandoned, because of the quantity of refactoring that would have been needed. This `iframe` points to `osrd-nge`, a minimalist Angular app that embed the actual NGE app. It can also be seen as a wrapper of the actual NGE app. `osrd-nge` then customizes the actual NGE app with specific parameters and functionalities:
20-
- a `standalone` flag:
21-
- to tell NGE to disable all back-end interactions (no database on NGE side)
22-
- to tell NGE to disable some UI components (authentication, project management, versioning system view, etc.)
23-
- implementation of a communication interface between OSRD and NGE ([`message_event`](https://developer.mozilla.org/fr/docs/Web/API/Window/message_event), [`eventListener`](https://developer.mozilla.org/fr/docs/Web/API/EventTarget/addEventListener) and [`postMessage`](https://developer.mozilla.org/fr/docs/Web/API/Window/postMessage)).
20+
For external use, a [build of NGE is available on NPM](https://www.npmjs.com/package/netzgrafik-frontend) and is published at each release. In addition to this, OSRD has developed a `standalone` version of NGE, integrated into the source code, which allows NGE to function without a back-end. Finally, to meet needs specific to OSRD, OSRD uses a [fork](https://github.com/osrd-project/netzgrafik-editor-frontend) of NGE (whose [build is also available on NPM](https://www.npmjs.com/package/@osrd-project/netzgrafik-frontend)), remaining as close as possible to the official directory.
2421

25-
NGE is then able to get the OSRD timetable as soon as a change is made on OSRD side, and OSRD is able to get the changes made on NGE side.
22+
Despite the non-compatibility of the front-end technologies (ReactJS for OSRD and Angular for NGE), this build allows OSRD to integrate NGE within an [`iframe`](https://developer.mozilla.org/fr/docs/Web/HTML/Element/iframe). This `iframe` deploys a minimalist Angular application which then imports the real NGE application thanks to the imported build.
2623

27-
The following diagram shows the workflow between the components.
24+
An alternative solution to the integration problem would have been to rewrite NGE as [`web-components`](https://developer.mozilla.org/fr/docs/Web/API/Web_components), in order to import them into OSRD, but this solution was abandoned because of the amount of work it would represent.
2825

29-
![Concept diagram](osrd_nge_concept_diagram.jpg)
26+
NGE, in its `standalone` version, communicates with OSRD through the `iframe` using [`Operations`](https://github.com/SchweizerischeBundesbahnen/netzgrafik-editor-frontend/blob/main/documentation/STANDALONE.md). These messages are sent via DOM element properties:
27+
- [`@Input`](https://github.com/SchweizerischeBundesbahnen/netzgrafik-editor-frontend/blob/fe3e788499e18054e260c05e714419aeeafc44e1/src/app/app.component.ts#L75): with the `netzgrafikDto` property, triggered when the content of the scenario is updated from OSRD.
28+
- [`@Output`](https://github.com/SchweizerischeBundesbahnen/netzgrafik-editor-frontend/blob/fe3e788499e18054e260c05e714419aeeafc44e1/src/app/app.component.ts#L84): with the `operation` property, triggered when NGE is used.
3029

31-
```mermaid
32-
---
33-
title: OSRD - NGE Sequence diagram
34-
---
35-
sequenceDiagram
36-
autonumber
37-
OSRD (parent window)-->>OSRD (parent window): init web page
38-
OSRD (parent window)->>NGE (osrd-nge iframe): iframe.contentWindow.postMessage(nge_light_model, "*")
39-
loop while synchronization is ON
40-
alt any modification in OSRD (parent window)
41-
OSRD (parent window)-->>OSRD (parent window): any modification
42-
OSRD (parent window)->>NGE (osrd-nge iframe): iframe.contentWindow.postMessage(nge_light_model, "*")
43-
else any modification in NGE (osrd-nge iframe)
44-
NGE (osrd-nge iframe)-->>NGE (osrd-nge iframe): any modification <br>(hooks)
45-
NGE (osrd-nge iframe)->>OSRD (parent window): parent.window.postMessage(nge_action, "*")
46-
OSRD (parent window)-->>OSRD (parent window): convert NGE action into <br/>timetable update
47-
OSRD (parent window)->>NGE (osrd-nge iframe): iframe.contentWindow.postMessage(nge_light_model, "*")
48-
end
49-
end
50-
```
51-
52-
Since OSRD is the only source of truth (= data source), NGE has to be updated as the very last action, to be aligned with the timetable current state, and to get the updated microscopic calculations from OSRD.
53-
54-
More precisely, when a change is made in NGE:
55-
56-
```mermaid
57-
---
58-
title: OSRD - NGE Communication when modification in NGE
59-
---
60-
sequenceDiagram
61-
autonumber
62-
NGE (nge-app)-->NGE (osrd-nge): osrd-nge listens on hooks <br>from nge-app
63-
NGE (osrd-nge)->>NGE (osrd-nge): (eventListeners) <br> callback triggered
64-
NGE (osrd-nge)->>OSRD (front-end): (callback functions) <br>parent.window.postMessage(nge_action, "*")
65-
OSRD (front-end)->>OSRD (front-end): (eventListeners) <br> convert nge_action <br> into timetable update
66-
OSRD (front-end)->>OSRD (back-end): call for update timetable
67-
OSRD (back-end)->>OSRD (front-end): update timetable
68-
OSRD (front-end)->> OSRD (front-end): convert timetable into <br> nge_light_model
69-
OSRD (front-end)->>NGE (osrd-nge): iframe.contentWindow.postMessage(nge_light_model, "*")
70-
NGE (osrd-nge)->>NGE (osrd-nge): (eventListener) <br> onLoad triggered
71-
NGE (osrd-nge)->>NGE (nge-app): (callback function) <br> onLoad(nge_light_model, ...)
72-
```
30+
![Concept diagram](osrd_nge_concept_diagram.png)
31+
32+
NGE is then able to obtain the OSRD timetable as soon as a change is made on the OSRD side, and OSRD is able to obtain the changes made on the NGE side.
7333

7434
#### 2 - Converters
7535

76-
To overpass the semantic differences and make the data models fit, 2 converters have to be implemented:
77-
- **[OSRD -> NGE]** a converter that transforms an OSRD timetable into an NGE model
78-
- **[OSRD <- NGE]** an event handler, that transforms NGE action into OSRD database update on timetable
36+
To overcome semantic differences and adapt data models, two converters are implemented:
37+
- **[OSRD -> NGE]** a converter which transforms an OSRD timetable into an NGE model. The nodes are the remarkable points described by the circulations, and whose macroscopic information (position on the reticular) is stored in the database. OSRD train schedules, `TrainSchedule`, then represent cadenced train lines, `Trainrun`. A concept of cadenced train lines, will soon be implemented to allow conceptual convergence between OSRD and NGE.
38+
- **[OSRD <- NGE]** an event manager, which transforms an NGE action into an update of the OSRD database.
7939

8040
#### 3 - Open-source (cooperation / contribution)
8141

0 commit comments

Comments
 (0)