Planning Public Transportation with Raku

Files

by Arne Sommer

Files

[159.1.2] Published 15. December 2021. (Updated 31. December 2021)

[ Introduction | Oslo Metro | Oslo Tram | Bergen | Misc. ]
[ About | Terms | Files | Commands | FAQ | Changelog | Roadmap | 60 Minutes NEW ]

Waterloo & City Line

I am using the Waterloo & City Line (in London) as example in this and the «Commands» article. It has two stops only, and looks like this:

See the Oslo Metro articles for a more comprehensive example.

Files

The route definition file
This file, which must have the «.def» filename extension, sets up a route.

File: london/wc.def
#
# Waterloo & City Line
# --------------------------------------------------
LO001 25    26:3 Waterloo
LO002 7|8:4 7|8  Bank

Note that empty rows and rows starting with # are ignored by the program.

Each row in the file (with exceptions as stated above) represents a stop on the route. The columns are separated by one or more spaces.

The first column is the stop ID:

LO001 25   26:3 Waterloo

This consist of two uppercase letters and three digits. The letters should designate the area. «LO» is short for «London» in this case.

The second column is the platform ID in the Down direction (the departure platform in this case). The ID should be short. One or two digits and/or letters is recommended. The values used here are the real ones. The trains turn back (reverse) in sidings after the station.

LO001 25  26:3 Waterloo

The platform ID may be followed by a colon and a number, specifying the travel time in minutes from the previous stop. Legal values are 0, 0.5, 1, 1.5 and so on. The default value is 1. Use «-» instead of a platform ID if the route does not use the stop in that direction.

The third column is the platform ID in the Up direction.

LO001 25  26:3 Waterloo

See above for details.

The fourth column, which may contain spaces, is the stop name.

LO001 25   26:3 Waterloo

The combination stop ID and stop name must be unique. It is legal to revisit an already defined stop, either on the same route or on a new one, but the stop names must be identical.

At Bank the trains terminate at two bay platforms, 7 and 8. I have indicated this situation with the cryptic «7|8» as the platform, where «|» implies either-or.

LO002 7|8:4 7|8  Bank

The travel time is specified in minutes. 12 hous is 720 minutes. But you can also specify it as «12h00» or «12h».

[v0.0.2] The travel time can also be specified in days: «1d» is the same as «24h» or «1440». Combine them at will, but note that «d» nust come before «h». E.g. «7d2h», «7d2h10», «7h10».

The timingpoints definition file
This file, which must have the «.def» filename extension, has a list of stop names or IDs to be used by the «timingpoints» command. One stop per row.

File: london/wc-timingpoints.def
LO001
Bank

The vehicle definition file
This file, which must have the «.def» filename extension, describes how to piece the routes together.

File: london/wc-vehicles.def
=wc00
W&C D Wloo  8
W&C U Bank  8

Empty lines are ignored.

Start by specifying the series to add the vehicles to. The = is part of the command, not the series:

=wc00

I recommend 4 characters, as the program will tabulate the departures based on that length. The last two must be numeric, usually «00».

The following rows add departures to the vehicle series. The values are separated by one or more spaces.

The first column in the route ID, as given to the «route set» command (which we will look at in the next part):

W&C D Wloo  8

The second column in the direction; where D is short for Down and U is short for Up:

W&C D Wloo  8

The third column is the label to use on the departures. This should clearly identify the route, unless done so by the series - and direction.

W&C D Wloo 8

«Wloo» is short for «Waterloo», while «Bank» does not ned a short form.

The fourth column in the minimum layover time (in minutes), before the departure in the given direction:

W&C D Wloo 8

Note that the program does not check that a departure follows an arrival at the same station.

Interval Bookkeeping
[v.0.0.3] You cannot combine routes with different intervals, as that would lead to a mismatch. The program will detect and report this error. Multiple intervals are fine; but they must have the same average value. (I.e. you can combine «3;7», «2;8» and «5» - as the average is 5 minutes - and they all result in 12 departures each hour.)

Note that you are responsible for not scheduling a departure defore the prior arrival, if you use multiple intervals and change the order. This is a a known limitation; see error #015.

The network setup file
This file, which should have the «.setup» filename extension, has the commands used to set up and show information about the network. The commands can also be entered manually, one by one, in interactive mode. So this file isn't strictly necessary.

The first line must be the string «## Networkplanner ##».

See the Commands article for an explanation of the commands.

File: london/wc.setup
## Networkplanner ##

route set W&C file:wc.def down:2 up:9

summary

timingpoints wc-timingpoints.def

vehicles wc-vehicles.def

Note that the program will look for the files in the same directory as the network setup file.

[v.0.0.3] You can tell the program to merge lines by ending the first one with a \. This is available for all input files, but is only useful in the Network setup files.

[ Introduction | Oslo Metro | Oslo Tram | Bergen | Misc. ]
[ About | Terms | Files | Commands | FAQ | Changelog | Roadmap | 60 Minutes NEW ]