[
Introduction |
Oslo Metro |
Oslo Tram |
Bergen |
Misc.
]
[
About |
Terms |
Files |
Commands |
FAQ |
Changelog |
Roadmap |
60 Minutes NEW
]
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.
$ networkplanner
networkplanner: Enter «exit» to exit
> help
See https://raku-musings.com/transit-network for a description of this program.
Sample networks are bundled with this program. Unpack the following zip file in a
suitable location: /home/foo-bar/.raku/resources/1C04xE74A46753197D9D2554D8891.zip
You can also use the «--help» command line option.
Note that the program will look for the files in the same directory as the network setup file. So do't specify the path inside the network setup file.
The above is done by setting the path (see lower down). And this will be left as it is after the batch command has finished. (So the current directory is not the current directory any more..)
$ networkplanner
networkplanner: Enter «exit» to exit
> batch london/wc.setup
Use the «-silent» flag to suppress (most) output:
> batch -silent london/wc.setup
This can be used to set up a network in interactive mode by loading a network setup file, allowing the user to run additional commands afterwards. Including additional «batch» commands.
The route definition file must have the «.def» extension.
Let us start «networkplanner» in interactive mode, and set up the route manually:
$ networkplanner
networkplanner: Enter «exit» to exit
> route set W&C file:london/wc.def
>
Not very verbose at all. You have to wait a couple of paragraphs before we come to commands that cause output.
I have chosen to rebrand the route as «W&C» as «WC» does not sound especially serious.
The «route set» command supports the following optional arguments:
down:<number>
The offset from 00 for the first departure in the Down direction. Whole and half minutes
are supported. Do not use negative values (but they are supported; see the Railway article
for why).
The offset can also be specified in days, as described for the route definition file. [Added in v0.0.2]
The default value is 0.
Values higher than 60 minutes is supported, and should
be specified with the <hour>h<minutes>
syntax to make them readable.
12 hours is the same as 720 minutes, but «12h00» is preferable.
[0.0.2]: It is also possible to specify days, with «d».
E.g. «2d12h15» for «2 days, 12 hours amd 15 minutes».
down:<number>[<stop-id>]
The offset can be applied from any stop enroute, by specifying the stop ID in brackets. The
offset from the start of the route is calculated so that the departure passes the specified
stop with the given offset value.
If the route visits the stop more than once, the first one is used. Specifying a stop ID not on the route will cause program termination.
down:off
Disable departures in the Down direction.
up:<number>
The offset from 00 for the first departure in the Up direction. Whole and half minutes
are supported. Do not use negative values.
The default value is 0.
Values higher than 60 minutes are supported. See «down», above.
up:<number>[<stop-id>]
As for «down»; see above.
up:off
Disable departures in the Up direction.
interval:<number>
The number of minutes between the departures; e.g. 1, 2, 3 and so on. Half minutes are
also supported; e.g. 0.5, 1.5 and so on.
The number should add up to 60, so that the program can use the same minutes past the hour for the second hour and so on. If not, the program will go on until has reached a multiple of 60 minutes. Note that the timingpoints will be off in this case.
Eight departures per hour can either be specified as «7.5», if you allow half minutes, or as «7;8» if you want the intervals to be 8 and 7 minutes respectively (or as «8;7» if that order is better). Any number of values are supported; e.g. «3;3.5;3.5», but they should add up to 60.
The default value is 10.
It is possible to use 60 and higher values. The timingpoints will be off, and the summary is disabled.
Values higher than 60 minutes should be specified with the
<hour>h<minutes>
syntax, to make them readable. 12 hous is the same
as 720 minutes, but «12h00» is preferable.
interval-down:<number>
Use this command if you want to set an interval for the Down direction only. The value set
with «interval» will be used if this is not specified. [Added in v0.0.3]
interval-up:<number>
Use this command if you want to set an interval for the Up direction only. The value set
with «interval» will be used if this is not specified. [Added in v0.0.3]
start-at:<stop-id>
The route will start at the first stop, unless an intermediary stop is specified here.
Use the stop-id, and not the stop name.
The platforms can also be overridden, but you have to specify both if you do.
start-at:OS104[C;D]
The travel time can also be overridden:
start-at:OS104[C;D:10]
end-at:<top-id>
The route will end at the last stop, unless an intermediary stop is specified here. Use
the stop-id, and not the stop name.
The platforms (and travel time) can be overridden here as well.
reverse:1
Reverse the route definition as it is read from the file. The value after the colon is not
important, but it has to be there.
This is the minimum command, with a route id and a file to read the route from. The file must have a «.def» extension.
The route must exist (set up with «route set»).
The optional fields «start-at», «end-at» and «reverse» are supported. See «route set» (above) for details. «reverse» applies to the selected section only. [v.0.0.3: Removed support for the other optional fields supported by «route set».]
This will basically print the route definition file. Any changes applied with «end-at», «start-at», and «route append» will be included.
This is useful for debugging, when the result does not match the expectation.
Enter the «summary» command in interactive mode, after setting up the route W&C:
> summary
Route W&C: Waterloo - Bank
----------------------------------------------------------------
00 | 00 10 20 30 40 50 Waterloo [25]
04 | 04 14 24 34 44 54 Bank [7|8]
Route W&C: Bank - Waterloo
----------------------------------------------------------------
00 | 00 10 20 30 40 50 Bank [7|8]
03 | 03 13 23 33 43 53 Waterloo [26]
> summary :raw
Route W&C: Waterloo - Bank
----------------------------------------------------------------
02 | Waterloo [25]
06 | Bank [7|8]
Route W&C: Bank - Waterloo
----------------------------------------------------------------
09 | Bank [7|8]
12 | Waterloo [26]
Routes with an interval of 60 or more are skipped.
Timinpoints are useful when you have a network with several routes with one or more shared sections, where you want to time the departures. An example:
We'll not discuss this here, but will look into it when we come to the Oslo metro and Bergen light rail networks.
It is easy to set up the departures from A (route 1 and 3), and M (route 2 and 3), but this does not help with the situation at e.g. Q (in the middle).
> timingpoints london/wc-timingpoints.def
Bank [7|8]
06 16 26 36 46 56 | W&C Bank
09 19 29 39 49 59 | W&C Waterloo
Waterloo [25]
02 12 22 32 42 52 | W&C Bank
Waterloo [26]
02 12 22 32 42 52 | W&C Waterloo
If you have several routes, with different intervals, use the «:tabulated» option:
> route set W&C file:london/wc.def
> route set W&C2 file:london/wc.def interval:30 down:5 up:5
> timingpoints london/wc-timingpoints.def
Bank [7|8]
00 10 20 30 40 50 | W&C Waterloo
04 14 24 34 44 54 | W&C Bank
05 35 | W&C2 Waterloo
09 39 | W&C2 Bank
Waterloo [25]
00 10 20 30 40 50 | W&C Bank
05 35 | W&C2 Bank
Waterloo [26]
03 13 23 33 43 53 | W&C Waterloo
08 38 | W&C2 Waterloo
> timingpoints :tabulated london/wc-timingpoints.def
Bank [7|8]
-- 04 -- -- -- 14 -- 24 -- 34 -- -- -- 44 -- 54 | W&C Bank
00 -- -- -- 10 -- 20 -- 30 -- -- -- 40 -- 50 -- | W&C Waterloo
-- -- -- 09 -- -- -- -- -- -- -- 39 -- -- -- -- | W&C2 Bank
-- -- 05 -- -- -- -- -- -- -- 35 -- -- -- -- -- | W&C2 Waterloo
Waterloo [25]
00 -- 10 20 30 -- 40 50 | W&C Bank
-- 05 -- -- -- 35 -- -- | W&C2 Bank
Waterloo [26]
03 -- 13 23 33 -- 43 53 | W&C Waterloo
-- 08 -- -- -- 38 -- -- | W&C2 Waterloo
It is possible to merge routes, as long as they have the same destination. Use the «:merge» option, with a semicolon separated list of route IDs in brackets. Like this:
> timingpoints :merge[W&C;W&C2] london/wc-timingpoints.def
Bank [7|8]
-- 04 -- 09 -- 14 -- 24 -- 34 -- 39 -- 44 -- 54 | W&C Bank
00 -- 05 -- 10 -- 20 -- 30 -- 35 -- 40 -- 50 -- | W&C Waterloo
Waterloo [25]
00 05 10 20 30 35 40 50 | W&C Bank
Waterloo [26]
03 08 13 23 33 38 43 53 | W&C Waterloo
The first route ID in the list will be used, in this case W&C.
Note that «:merge» will enable «:tabulated» as well. This can not be disabled.
You can have multiple :merge arguments as of v.0.0.3. In earlier version they replaced each other, and the last one was used.
This example is not very useful, but we can use it to alternate between the stub platforms at Bank (as «7|8» is't very precise):
We have rto set up two separate routes, each one using one platform at Bank. We can do this in the network setup file:
File: london/wcII.setup
## Networkplanner ##
route set W&Ca file:wc.def down:2 up:19 interval:20 end-at:LO002[7:4;7]
route set W&Cb file:wc.def down:12 up:9 interval:20 end-at:LO002[8:4;8]
summary
timingpoints :merge[W&C;W&Ca;W&Cb] wc-timingpoints.def
vehicles wc-vehiclesII.def
The vehicle definition file:
File: wc-vehiclesII.def
=WC00
W&Ca D Wloo/25;Wloo/26 8
W&Ca U Bank/7 8
W&Cb D Wloo/25;Wloo/26 8
W&Cb U Bank/8 8
The result:
WC01 WC02 WC03
------------------------------
Wloo/25 dep 0002 0022 0042
Bank/7 arr 0006 0026 0046
Bank/7 dep 0019 0039 0059
Wloo/26 arr 0022 0042 0102
Wloo/25 dep 0032 0052 0112
Bank/8 arr 0036 0056 0116
Bank/8 dep 0049 0109 0129
Wloo/26 arr 0052 0112 0132
Wloo/25 dep 0102 0122 0142
WC00: Number of vehicles: 3
---------------------------------------
Total number of vehicles: 3
> tp Bank Farringdon
Bank [W1]
00 10 20 30 40 50 W&C Waterloo
Bank [W2]
04 14 24 34 44 54 W&C Bank
Non-existing stop names are silently ignored, as illustrated with «Farringdon».
The «:tabulated» and «:merge» options (see «timingpoints» above) are also supported. Routes with an interval of 60 or more are skipped.
Note that this command accept stop names that contain one or more spaces, if you quote the name. Single (') and double (") quotes are supported. E.g.:
> tp "Kings Cross" "Liverpool Street" Bank
> vehicles london/wc-vehicles.def
WC01 WC02 WC03 WC04
-------------------------------------
Wloo dep 0000 0010 0020 0030
Bank arr 0004 0014 0024 0034
Bank dep 0020 0030 0040 0050
Wloo arr 0023 0033 0043 0053
Wloo dep 0040 0050 0100 0110
WC00: Number of vehicles: 4
---------------------------------------
Total number of vehicles: 4
The departure times, and the required number of vehicles, change if we change the «down» and/or «up» values:
> route set W&C file:london/wc.def down:2 up:9
> vehicles london/wc-vehicles.def
WC01 WC02 WC03
-------------------------------
Wloo dep 0002 0012 0022
Bank arr 0006 0016 0026
Bank dep 0019 0029 0039
Wloo arr 0022 0032 0042
Wloo dep 0032 0042 0052
WC00: Number of vehicles: 3
---------------------------------------
Total number of vehicles: 3
> route set W&C file:london/wc.def down:2 up:9 interval:7.5
> vehicles london/wc-vehicles.def
WC01 WC02 WC03 WC04
-------------------------------------
Wloo dep 0002 0009' 0017 0024'
Bank arr 0006 0013' 0021 0028'
Bank dep 0016' 0024 0031' 0039
Wloo arr 0019' 0027 0034' 0042
Wloo dep 0032 0039' 0047 0054'
WC00: Number of vehicles: 4
---------------------------------------
Total number of vehicles: 4
The Waterloo & City line has 5 trains, so we can safely use 3 of them. 4 will probably be ok, most of the time.
The same interval will be used on all the rows. It is taken from the first route, in the Down direction (the «interval-down» argument), with fallback to «interval». This is a bug; #001. See the Roadmap for details.
> stops
LO001 Waterloo
LO002 Bank
Note that deleting or redefining routes will not remove unused stops from this list.
> route set W&C file:london/wc.def down:2 up:9 interval:7.5
> vehicles london/wc-vehicles.def
> path london
> route set W&C file:wc.def down:2 up:9 interval:7.5
> vehicles wc-vehicles.def
This mimics what is done when loading a network setup file.
Supported languages:
You can also use the «--lang» command line option. E.g. «--lang=NO».
The «summary», «timingpoints» and «vehicles» commands support an extra argument. Specify a file name (ending with «.txt») at the end, and the output will be saved to that file instead of beeing printed to the screen.
Leave the filename blank (as shown above), or use «-», to get the output to the screen.
[
Introduction |
Oslo Metro |
Oslo Tram |
Bergen |
Misc.
]
[
About |
Terms |
Files |
Commands |
FAQ |
Changelog |
Roadmap |
60 Minutes NEW
]