From version 3.9, Train Director supports the automatic extraction of trains' schedule from a web browser.

YouTube player  Watch how to generate the timetable automatically (enable CC in the player to see the instructions)

The above method uses the European Trains Timetable Database maintained by the Swiss Federal Railways. Therefore it only contains European trains from national railways administrations. It's possible that local railway companies did not communicate their train's data. Double-check that the list of trains is complete for the scenario you are simulating.

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, it's possible to use the integrated timetable generator to read that data from web pages using the Swiss Federal Railways web 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 Swiss Federal Railways web site, at http://fahrplan.sbb.ch/bin/stboard.exe/en. Enter the name of one of the stations and press "Show".
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 the program will not work properly. Instead, enter the appropriate hour (for example 00:00) and then save that page.
The page must be saved in the directory $TDHOME/gentt/stations, where $TDHOME is the location of the traindir executable (for example C:\traindir3\gentt\stations).

Repeat the same procedure for all hours of the day, and for both arrivals and departure pages (see the video link above for detailed steps).
The same procedure must be performed for the second (e.g. E) or the third (e.g. H) and so on, station.

After having downloaded the pages 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 start the Train Director executable and open the web page

    http://localhost:8999/TDWebUI/igentt.en.html
The program will read all the pages we saved for all stations. It will then read the data for each train and it will progressively show the content of the schedule file 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 is very important to save 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 the program 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 be necessary to add the lines for trains 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