Planning Public Transportation with Raku

Lisboa

by Arne Sommer

Lisboa

[159.5.1] Published 15. December 2021.

[ Introduction | Oslo Metro | Oslo Tram | Bergen | Misc. ]
[ Misc. Intro | Lisboa | Railways | Reindeer Expressed | Intervals NEW ]

Lisboa (or One-Way Routes)

A one-way route can be defined as normal, and then use only one of the directions in the vehicle definition file. The downside is that the other direction will show up in the summary, and as a timingpoint. Both places with seemingly valid departures.

It is much better to explicitly prevent one of the directions, by placing «-» in every platform column for that direction. The route will be missing in that direction in the summary, if all the platform in that direction has been set to «-». It will not show up as a timingpoint.

Lisboa tram route 12E (E = Electrico) is a straight forward (and short) example of a one-way route. It is shown at the right hand side of the map:

The tram routes in Lisboa does not run with fixed intervals, so I have simplified the departures quite a lot. (Want to have a look at the real departure times? Go to this page, and click on the PDF icon.)

File: lisboa/12E.def
#
# 12E Martim Moniz - Martim Moniz
# ----------------------------------------------------
LB001 B   - Martim Moniz
LB002 A:2 - Socorro
LB003 A   - Lg. Terreirinho
LB004 A:2 - R. Lagares
LB005 A:2 - S. Tomé
LB006 A:2 - Lg. Portas Sol
LB007 A:2 - Miradouro Sta. Luzia
LB008 A   - Limoeiro
LB009 A:2 - Sé
LB010 A:2 - R. Conceição / R. Fanqueiros
LB011 B:2 - Pç. Figueira
LB012 B:3 - Martim Moniz

The summary will give a single direction, which is also the first (and only) and thus in the Down direction. I recommend doing it like this, i.e. use the Down direction, but it is possible to use the Up direction instead.

Route 12: Martim Moniz - Martim Moniz
----------------------------------------------------------------
00  | 02  17  32  47  Martim Moniz [B]
02  | 04  19  34  49  Socorro [A]
03  | 05  20  35  50  Lg. Terreirinho [A]
05  | 07  22  37  52  R. Lagares [A]
07  | 09  24  39  54  S. Tomé [A]
09  | 11  26  41  56  Lg. Portas Sol [A]
11  | 13  28  43  58  Miradouro Sta. Luzia [A]
12  | 14  29  44  59  Limoeiro [A]
14  | 16  31  46  01  Sé [A]
16  | 18  33  48  03  R. Conceição / R. Fanqueiros [A]
18  | 20  35  50  05  Pç. Figueira [B]
21  | 23  38  53  08  Martim Moniz [B]

It is also possible to specify «down:off» to manually disable the Down direction, or «up:off» to disable the Up direction. If you combine this with «reverse», the reversal will be done before disabling the brand new direction. It is probably not a good idea to combine them, though.

The network setup file:

File: lisboa/lisboa-12.setup
## Networkplanner ##

route set 12 file:12E.def down:2 interval:15

summary

vehicles vehicles-12.def

The vehicle specification:

File: lisboa/vehicles-12.def
=1200
12 D MM/12;MM 5

The result:

	      1201  1202
-------------------------
MM/12	dep   0002  0017 
MM	arr   0023  0038 
MM/12	dep   0032  0047

Reversing a one directional route

It is possible to reverse a one-way route, but the result will be the same. I.e. a one-way route in the same direction. But that direction will now be Up if we started with Down and vice versa.

> route set 12 reverse:1 file:12E.def
> route source 12
#
# 12 Martim Moniz - Martim Moniz
# 
------------------------------
LB012 - B:3 Martim Moniz
LB011 - B:2 Pç. Figueira
LB010 - A:2 R. Conceição / R. Fanqueiros
LB009 - A:2 Sé
LB008 - A   Limoeiro
LB007 - A:2 Miradouro Sta. Luzia
LB006 - A:2 Lg. Portas Sol
LB005 - A:2 S. Tomé
LB004 - A:2 R. Lagares
LB003 - A   Lg. Terreirinho
LB002 - A:2 Socorro
LB001 - B   Martim Moniz

Note that we have to change the D to U in the vehicle definition file as well, for this to work. As you have reversed the route.

The other tram routes in Lisboa are rather boring, with all the departures running the full route, in both directions.

Let us take a look at route 28E, anyway, as we can use that to illustrate another point.

File: lisboa/28E.def
#
# 28E Martim Moniz - Campo Ourique
# ----------------------------------------------------
#
LB001 B   A:3 Martim Moniz
LB101 B:2 A:2 R. Palma
LB102 B:2 A   Igreja Anjos
LB103 B   A   R. Maria Andrade
LB104 B   -   R. Maria Fonte
LB105 -   A   E Forno Tijolo
LB106 B   A   R. Angelina Vidal
LB107 B:2 A:2 Sapadores
LB108 B   A:2 R. Graça
LB109 B:2 A   Graça
LB110 B   A:2 Voz Operário
LB111 B:2 A   Cç. S. Vicente
LB112 B   A   R. Escolas Gerais
LB006 B:2 A   Lg. Portas Sol
LB007 B:2 A:2 Miradouro Sta. Luzia
LB008 B   A   Limoeiro
LB009 B:2 A:3 Sé
LB121 B:2 A:2 R. Conceição
LB122 B:2 A:2 Lg. Academia Nacional Belas Artes
LB123 B:2 -   R. Vitor Cordon
LB124 -   A:2 R. Serpa Pinto
LB125 B:2 A   Chiado
LB021 B:3 A:2 Pç. Luis Camões (B. Alto)
LB131 B   A   Calhariz (Bica)
LB132 B:2 A   Sta. Catarina
LB133 B   A   Cç. Combro
LB134 B   -   R. Poiais S. Bento
LB135 -   A:2 R. S. Bento / Cç. Estrela
LB136 B   A   Cç. Estrela / R. Borges Carneiro
LB137 B   A   Cç. Estrela / R. Dr. Teófilo Braga
LB092 B   A:2 Estrela (Basílica)
LB093 B:2 A   Estrela - R. Domingos Sequeira
LB094 B   A   R. Domingos Sequeira
LB095 B:2 A   R. Saraiva Carvalho
LB096 B   A   Igreja Sto. Condestável (C. Ourique)
LB097 B:2 A   Campo Ourique (Prazeres)

Route 12E runs every 15 minutes, as shown above, whereas route 28E runs every 7.5 minutes (in my simplification). Let us have a go at combining the routes, so that the two trams (i.e. the drivers) on route 12E can see more of the world (or Lisboa, rather).

This requires two versions of route 28E (internally called 28a and 28b), each one running every 15 minutes, and then we combine one of them (28a) with route 12E (at Martim Moniz) in the vehicle definition file:

File: lisboa/lisboa-12+28.setup
## Networkplanner ##

route set 12  file:12E.def down:2          interval:15
route set 28a file:28E.def down:1   up:1   interval:15
route set 28b file:28E.def down:8.5 up:8.5 interval:15

vehicles vehicles-12+28.def

timingpoints :tabulated timingpoints.def

The vehicle definition file:

File: lisboa/vehicles-12+28.def
=2800
28a D MM/28;MM 5
12  D MM/12;MM 5
28a U CO/28;CO 5

=2810
28b D MM/28;MM 5
28b U CO/28;CO 5

The result:

            2801  2802  2803  2804  2805  2806  2807  2808  2809  2810
----------------------------------------------------------------------
MM/28 dep   0001  0016  0031  0046  0101  0116  0131  0146  0201  0216 
MM    arr   0051  0106  0121  0136  0151  0206  0221  0236  0251  0306 
MM/12 dep   0102  0117  0132  0147  0202  0217  0232  0247  0302  0317 
CO    arr   0123  0138  0153  0208  0223  0238  0253  0308  0323  0338 
CO/28 dep   0131  0146  0201  0216  0231  0246  0301  0316  0331  0346 
MM    arr   0218  0233  0248  0303  0318  0333  0348  0403  0418  0433 
MM/28 dep   0231  0246  0301  0316  0331  0346  0401  0416  0431  0446 

            2811  2812  2813  2814  2815  2816  2817  2818
----------------------------------------------------------
MM/28 dep   0008' 0023' 0038' 0053' 0108' 0123' 0138' 0153'
CO    arr   0058' 0113' 0128' 0143' 0158' 0213' 0228' 0243'
CO/28 dep   0108' 0123' 0138' 0153' 0208' 0223' 0238' 0253'
MM    arr   0155' 0210' 0225' 0240' 0255' 0310' 0325' 0340'
MM/28 dep   0208' 0223' 0238' 0253' 0308' 0323' 0338' 0353'

2800: Number of vehicles: 10
2810: Number of vehicles: 8
---------------------------------------
Total number of vehicles: 18

The timingpoints will report route 28a and 28 separately, as shown for some of the stops:

Martim Moniz [A]
03 --  18 --  33 --  48 --  | 28a Martim Moniz
-- 10' -- 25' -- 40' -- 55' | 28b Martim Moniz

Martim Moniz [B]
-- 02 --  -- 17 --  -- 32 --  -- 47 --  | 12 Martim Moniz
01 -- --  16 -- --  31 -- --  46 -- --  | 28a Campo Ourique (Prazeres)
-- -- 08' -- -- 23' -- -- 38' -- -- 53' | 28b Campo Ourique (Prazeres)

Sé [A]
01 --  -- 16 --  -- 31 --  -- 46 --  -- | 12 Martim Moniz
-- --  11 -- --  26 -- --  41 -- --  56 | 28a Martim Moniz
-- 03' -- -- 18' -- -- 33' -- -- 48' -- | 28b Martim Moniz

Sé [B]
--  09 --  24 --  39 --  54 | 28a Campo Ourique (Prazeres)
01' -- 16' -- 31' -- 46' -- | 28b Campo Ourique (Prazeres)

We can merge the routes, like this:

File: lisboa/lisboa-12+28II.setup (changes only)
timingpoints :merge[28;28a;28b] timingpoints.def

The first route ID in the semicolon separated list (inside the brackets) is used instead of the other ones. The routes (i.e. rows) are only merged if they have the same destination.

Note that «:merge» will enable «:tabulated» as well, as shown below. This can not be disabled.

Martim Moniz [A]
03 10' 18 25' 33 40' 48 55' | 28 Martim Moniz

Martim Moniz [B]
-- 02 --  -- 17 --  -- 32 --  -- 47 --  | 12 Martim Moniz
01 -- 08' 16 -- 23' 31 -- 38' 46 -- 53' | 28 Campo Ourique (Prazeres)

01 --  -- 16 --  -- 31 --  -- 46 --  -- | 12 Martim Moniz
-- 03' 11 -- 18' 26 -- 33' 41 -- 48' 56 | 28 Martim Moniz

Sé [B]
01' 09 16' 24 31' 39 46' 54 | 28 Campo Ourique (Prazeres)

The whole tram network

I have not forgotten the remaining tram lines in Lisboa; 15E, 18E, 24E and 25E, as shown in the illustration at the top of the article. Let us have a go at all of them, for completeness, even if they do not have anything new to offer us:

The network setup file:

File: lisboa/lisboa.setup
## Networkplanner ##

route set 12 file:12E.def down:2        interval:15
route set 15 file:15E.def down:0  up:7  interval:10
route set 18 file:18E.def down:14 up:3  interval:20
route set 24 file:24E.def down:2  up:11 interval:20
route set 25 file:25E.def down:14 up:3  interval:15
route set 28 file:28E.def down:14 up:3  interval:7;8

summary

timingpoints :tabulated timingpoints.def

vehicles vehicles.def

I'll skip the definition files, and jump straight to the required number of vehickes - as it gives an idea of the size of the operation:

1200: Number of vehicles: 2
1500: Number of vehicles: 10
1800: Number of vehicles: 4
2400: Number of vehicles: 3
2500: Number of vehicles: 5
2800: Number of vehicles: 14
---------------------------------------
Total number of vehicles: 38

[ Introduction | Oslo Metro | Oslo Tram | Bergen | Misc. ]
[ Misc. Intro | Lisboa | Railways | Reindeer Expressed | Intervals NEW ]