Planning Public Transportation with Raku

60 Minutes NEW

by Arne Sommer

60 Minutes NEW

[159.1.7] Published 31. December 2021. (Updated 2. January 2022)

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

The «summary» and «timingpoints»/«tp» commands behave differently for intervals below and above 60 minutes. (The «vehicles» command behaves the same.)

Multiple Intervals vs 60 Minutes

If you have multiple intervals (as in the first example below), the program uses the highest of them when it decides if the interval is below or above 60 minutes:

route set 2c file:02.def interval:60;20;20;20
route set 2a file:02.def interval:30
route set 2b file:02.def interval:15;45

(By the way, all three routes have 4 departures during a two hour period.)

Intervals smaller than 60 minutes
An interval of 1, 2, 3, 4, 5, 6, 7.5, 10, 12, 15 or 30 minutes give a departure pattern («minutes past the hour» values) that repeat after one hour. So the «summary» command will show one hour (a generic hour) of departures only.

Let us take Bergen route 2 as an example:

route set 2 file:bergen-bybanen/02.def 
summary

The summary (in the Down direction only), as the interval (which defaults to 10 minutes) is a factor of 60:

Route 2: Byparken - Fyllingsdalen terminal
----------------------------------------------------------------
00  | 00  10  20  30  40  50  Byparken [D]
01  | 01  11  21  31  41  51  Nonneseter [B]
02  | 02  12  22  32  42  52  Bystasjonen [D]
05  | 05  15  25  35  45  55  Fløen [B]
08  | 08  18  28  38  48  58  Haukeland sykehus [B]
11  | 11  21  31  41  51  01  Kronstad [D]
12  | 12  22  32  42  52  02  Mindemyren [B]
14  | 14  24  34  44  54  04  Kristiansborg [B]
18  | 18  28  38  48  58  08  Fyllingsdalen terminal [B]

Let us try with an 8 minute interval:

route set 2 file:bergen-bybanen/02.def interval:8
summary

The summary (again in the Down direction only):

Route 2: Byparken - Fyllingsdalen terminal
----------------------------------------------------------------
00  | 00  08  16  24  32  40  48  56  04  12  20  28  36  44  52  Byparken [D]
01  | 01  09  17  25  33  41  49  57  05  13  21  29  37  45  53  Nonneseter [B]
02  | 02  10  18  26  34  42  50  58  06  14  22  30  38  46  54  Bystasjonen [D]
05  | 05  13  21  29  37  45  53  01  09  17  25  33  41  49  57  Fløen [B]
08  | 08  16  24  32  40  48  56  04  12  20  28  36  44  52  00  Haukeland sykehus [B]
11  | 11  19  27  35  43  51  59  07  15  23  31  39  47  55  03  Kronstad [D]
12  | 12  20  28  36  44  52  00  08  16  24  32  40  48  56  04  Mindemyren [B]
14  | 14  22  30  38  46  54  02  10  18  26  34  42  50  58  06  Kristiansborg [B]
18  | 18  26  34  42  50  58  06  14  22  30  38  46  54  02  10  Fyllingsdalen terminal [B]

The interval 8 is not a factor of 60, but it is a factor of 120. The result is different departures for the first and the second hour. That is by itself not a problem, until we look at the timingpoints:

timingpoints bergen-bybanen/timingpoints-2.def

This is the top rows of the result:

Byparken [C]
 02  06  10  14  18  22  26  30  34  38  42  46  50  54  58   2 Byparken

Byparken [D]
 00  04  08  12  16  20  24  28  32  36  40  44  48  52  56   2 Fyllingsdalen terminal

Note that the program has sorted the departures nicely for us, even if half of them belong to the next hour. (This is a bug; #014.)

The vehicle computation does work:

	      0201  0202  0203  0204  0205  0206  0207
-------------------------------------------------------
Byp/2	dep   0000  0008  0016  0024  0032  0040  0048 
FyT	arr   0018  0026  0034  0042  0050  0058  0106 
FyT/2	dep   0032  0040  0048  0056  0104  0112  0120 
Byp	arr   0050  0058  0106  0114  0122  0130  0138 
Byp/2	dep   0056  0104  0112  0120  0128  0136  0144 

Intervals greater than 60 minutes
An interval of 60 minutes or more will give you the raw version if the summary. This will only show one departure (the part top the left of the «|» in the normal version). Done manually on Bergen route 2:

route set 2 file:bergen-bybanen/02.def 
summary :raw

The result:

Route 2: Byparken - Fyllingsdalen terminal
----------------------------------------------------------------
00  | Byparken [D]
01  | Nonneseter [B]
02  | Bystasjonen [D]
05  | Fløen [B]
08  | Haukeland sykehus [B]
11  | Kronstad [D]
12  | Mindemyren [B]
14  | Kristiansborg [B]
18  | Fyllingsdalen terminal [B]

Route 2: Fyllingsdalen terminal - Byparken
----------------------------------------------------------------
00  | Fyllingsdalen terminal [A]
04  | Kristiansborg [A]
06  | Mindemyren [A]
07  | Kronstad [C]
10  | Haukeland sykehus [A]
13  | Fløen [A]
16  | Bystasjonen [C]
17  | Nonneseter [A]
18  | Byparken [C]

This does not make much sense in this case, but it does when we set up long distance trains, as «The Canadian», the transcontinental train between Toronto and Vancouver. See the Railways article for details.

The timingpoints will skip routes with an interval of 60 minutes or more (and give an error message), but print any routes with a lower interval.

route set 2 file:02.def interval:60
timingpoints timingpoints-2.def

The result:

Route 2: Timingpoint "BB001" not possible.
Route 2: Timingpoint "BB002" not possible.
Route 2: Timingpoint "BB007" not possible.
Route 2: Timingpoint "BB032" not possible.
Route 2: Timingpoint "BB043" not possible.

Note that the error message uses the stop IDs, even though the «timingpoints-2.def» file used the stop names.

An interval that is not a factor of 60 will be shown prefixed with the hour. Done manually on Bergen route 1 and 2:

route set 1 file:01.def interval:15
route set 2 file:02.def interval:45
timingpoints timingpoints-2.def

Part of the result:

Byparken [B]
 00  15  30  45  | 1 Bergen lufthavn
 13  28  43  58  | 1 Byparken

Byparken [C]
 0h18  1h03  1h48  2h33  | 2 Byparken

Byparken [D]
 0h00  0h45  1h30  2h15  | 2 Fyllingsdalen terminal

Nonneseter [A]
 0h17  1h02  1h47  2h32  | 2 Byparken
 12  27  42  57  | 1 Byparken

Nonneseter [B]
 01  16  31  46  | 1 Bergen lufthavn
 0h01  0h46  1h31  2h16  | 2 Fyllingsdalen terminal

The «:tabulated» option does not work as expected:

Nonneseter [A]
-- 12 -- -- 27 -- 42 57 | 1 Byparken
0h17 -- 1h02 1h47 -- 2h32 -- -- | 2 Byparken

Nonneseter [B]
01 -- -- 16 -- -- 31 46 | 1 Bergen lufthavn
-- 0h01 0h46 -- 1h31 2h16 -- -- | 2 Fyllingsdalen terminal

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