Train Director - Schedule File Generation

 English   -    Italiano   -    Magyar


Western Pacific 805 A
at Donner Pass, California

 

Main Page
Territory Directory
Icons Directory
FAQ
User's Manual
Scenario Creation
Time Table Creation
Scripts
Localizations
Build Instructions
Discussion Group

 

IMPORTANT

Recently the German Railroad web site, as well as many other sites that use the HAFAS timetable database, have been modified in a way that makes it impossible to automatically extract the schedule information using a program that's as simple as "gentt".

The only site that still use the old format is the site of the Luxembourg Railroads, but who knows for how long it'll stay that way.

Therefore it is not possibile to use the automatic timetable generator program described in the "How to create the schedule file" section below.

If someone knows of a web site that allows automatic free access to schedule information (for example via the XML format), please let me know via the discussion group.

I am designing a way to enter the time table data from the traindir progra, without having to enter each line in the .sch file. Unfortunately, until this new feature is available, the only way to create the schedule file is indeed to enter each station and times using a text editor.

The description of the .pth files in the following "Path files" chapter is still valid.

How to create the schedule file

The list of trains for each Train Director scenario is in a file with extension .sch. This file also has the timetable of every single train that will travel on the layout.

Since it's very time consuming to enter all this data by hand, Train Director comes with a program, called gentt, which can download the data from the German Railways web site.

The program gentt manipulates the HTML pages downloaded from the site. The first step is to download one of these pages. Let's assume we have the following scenario:

The first step is to go to the German Railways web site, at http://reiseauskunft.bahn.de/bin/bhftafel.exe/en?protocol=http:. Enter the name of one of the stations and press "Show".
You can request either the arrival or departure times. Even the time is irrelevant, since the program will automatically download all the pages. Assuming we asked for the arrival at the station "B", once we've received the page with the list of arrivals we'll have to save this page on the local disk by using the "File+Save" option of your browser. It is sufficient to save the HTML page, without any image that might be embedded in the page.
Note that by default the page returned contains real-time data about the requested station. You cannot save this page, as gentt will not work properly. Instead, click on one of the hours in the table at the top of the page (for example on 06:00), and then save that page.
The same procedure must be performed for the second (or the third and so on) station. Go back to the http://reiseauskunft.bahn.de/bin/bhftafel.exe/en?protocol=http: page, enter the name of the second station, for example "E", and once you get the page with the list of trains (again not the one with real-time data, but the one about a specific hour) save it on the disk. The same for station H.

After having downloaded one page for each station present in your scenario, we'll have a series of pages on our local disk, for example "B00arr.htm" (arrivals from midnight at station B), "E09arr.htm" (arrivals from 9 AM at station E) and "H09dep.htm" (departures from H from 9 AM).
Now it's sufficient to run the program gentt from a DOS window. For example:

C> gentt -a *.htm > BH.sch
The program will read all the pages with the arrivals and departures from B, E and H for all the hours of the day. It will then read the data for each train and it will create the file BH.sch in the format required by Train Director.

If all the trains of the B-H line stop both at B and at E, then it will not be necessary to download the schedule page for station E. That is not true for station H. Even when all the trains departing from B towards L stop both at B and H, we still need to download the page with H's schedule to take into account the trains traveling on the F-H-L line. Likewise, it is not enough to request only the page for station H, and ignore the one for station B; the page for station B is needed to take into account all the trains of the A-B-C line.

It is more difficult to consider the case of trains that don't stop in any of the stations present on the layout. For these trains it is useless to request the pages for stations A or L (stations which are outside of the scenario) because Train Director wouldn't know when to make the train enter the scenario. For these trains it will be necessary to enter the data by hand.

It goes without saying that to use gentt it's necessary to have a connection to the Internet.

The program is also capable to work behind a firewall. In this case, it is necessary to provide the name of the proxy system that handles the HTTP requests. To use gentt with a proxy, set the follwing environment variable in a DOS window before running gentt, as in:

C> set PROXY=http://webcache:8080/
C> gentt -a A.htm > AG.sch
If you are not behind a firewall, then do not set the PROXY variable.

Gentt has some sub-functions. The most important is the option -t, as in:

C> gentt -t *.tr > BF.sch
This option is useful when the timetable page of every train (the .tr files) are already on the disk, and you want to re-create the .sch file. In this case it is not necessary to be connected to the Internet.

It is very important to feed gentt with the pages for all the stations where trains originate from. If all the trains originate from stations that are not on the layout, as for instance the stations A and F, it is still possible to give those pages to gentt as long as all the trains stop to at least one of the stations present on the layout.

Since version 1.12 of Train Director it is possible to use multiple schedule files. Using the "Include: " command in a .sch file, it is possible to group several schedule files created for different stations, possibly re-using the same timetable files for several different scenarios. The syntax of the Include: command is as follows:

     #!trdir

     # file AL.sch delle linee A-B-D, B-E-H, F-H-G

     Include: BH.sch

     Train: T1
	Enter: 0:05, A
		0:09, -, C
     Train: T2
        Enter: 0:07, D
		0:13, -, G
In this example, the file BH.sch has been created with the above procedure. It will only necessary to add the lines that don't stop in any of the stations, thus avoiding changing the file BH.sch.
Another advantage of this approach is that the file BH.sch can be created every time the schedule changes, for example every six months, without the need to re-enter the trains that don't stop.

Path files

Having the schedule files for a line is not sufficient to simulate that line. Train Director requires that in the .sch file be specified for each train the entry/exit points and time of entrance/exit.

Although entering this data is certainly faster than entering the timetable for every single train, it is still very time consuming.

Luckily, since version 1.9 of Train Director it is possible to enter this data only once in a separate file (with extension .pth), and Train Director will automatically compute the enter/exit points and times.

The syntax of a .pth file is as follows:

  Path:
	From: B
	To: Z
	Times: 5/5/6/7 D

  Path:
	From W
	To: H
	Times: 2/2/3/4 F

# etc.

Here's an explaination: let's assume that station Z be outside the layout beyond the D station. The first element (that is the first "Path") tells Train Director that all trains that go from B to Z are actually exiting the scenario via D. The exit time is computed by adding 5 minutes to the departure time from station B of type 1 and 2 trains, 6 minutes for trains of type 3, and 7 minutes for trains of type 4.
The second path tells Train Director to consider all trains traveling from W to H (assuming W outside the layout, before F) to be entering the layout from F at their arrival time at H minus 2 minutes for type 1 and 2 trains, minus 3 minutes for type 3 trains, and minus 4 minutes for trains of type 4.

It is absolutely necessary to specify the travel times for both directions, that is from B to Z (exiting from D) and from Z to B (entering from D). This is because the speed up time of a train is different from the slow down time.

Another advantage of this approach is that it becomes possible to extend a scenario without the need to modify the schedule file, that is without changing all the entry and exit points in the .sch file. For example, if initially the scenario only has the stations B, E and H, with stations J and K outside the scenario, it is possible to add J and K simply by modifying the layout and by adding the new paths to the .pth file. No need to change the schedule file!

One must take into account every path from the last stop on the layout to the exit point (and viceversa). In our example, if there are trains traveling from B to X exiting from L, and if the only stop is the E station, then it will be necessary to enter the paths E-X and vice-versa, as in the following example:

    Path:
	From: E
	To: X
	Times: 8/9/9/10 L
    Path:
	From: X
	To: E
	Times: 6/7/7/7 L
    Path:
	From: H
	To: X
	Times: 4/5/5/6  L
    Path:
	From: X
	To: H
	Times: 3/4/4/4 L

The first simple scenario that uses this feature is the Casale Monferrato station, my hometown. The layout is available for download. Please take a look at the casale.pth file to check how the path feature works.


This page is maintained by g_caprino@gmail.com
(remove the _ before sending your message).
Created on: October 19, 2001