Skip to content

Real Time Updates

Pablo Hoch edited this page Jun 1, 2021 · 1 revision

MOTIS supports real-time updates (delays, cancellations, additional trains, reroutings and more).

Implementation

The implementation is split into two modules:

  • The ris module accepts real-time update messages in various formats. The updates are read from files or received via the HTTP API. They are then converted into an internal format (RisMessage), stored in an embedded database and forwarded to the rt module.
  • The rt module receives internal real-time messages from the ris module, propagates delays and updates the schedule graph to reflect the latest state. It also publishes RtUpdate messages that can be processed by other modules to update their state.

Currently, only the routing module supports real-time updates. Other routing modules (tripbased, csa) cannot be used when real-time updates are applied.

Supported formats

  • RISML (proprietary format developed at Deutsche Bahn)
  • RI Basis (proprietary format developed at Deutsche Bahn)
  • GTFS-RT

Usage

Replay updates from an archive

In this example, /path/to/ris is a directory containing one or more archive files with real-time messages (e.g. .tar.zst files).

Add the following to config.ini and make sure that the ris and rt modules are enabled:

[ris]
input=/path/to/ris
db=/path/to/ris/ris.mdb
init_time=YYYY-MM-DDTHH:mm:ss+hhmm
# e.g. init_time=2021-05-31T00:00:00+0200 (CEST)

MOTIS will read all archive files in /path/to/ris, parse the update messages and store them in /path/to/ris/ris.mdb (which will be used for quicker startup on subsequent runs). It will then apply all update messages that were issued up to the specified init_time.

Once MOTIS is running, the simulation time can be advanced by sending RISForwardTimeRequest messages. This will apply all messages up to the new time.

To run batch queries at a specific time point, set init_time to the desired time. MOTIS will apply the relevant real-time updates before the queries are executed.