Saturday, 21 February 2015

The switch list works

I spent a lot of time building a spreadsheet to make a timetable for the layout. Although there is only one station on the layout, it is supposedly at the centre of a feeder line between Hartford CT and Boston MA. The vital bits of the spreadsheet look like this:


BM2-101 BM2-103 SNE2-1 SNE2-2 NH1-67 NH1-69 NH1-71
Hartford 10:10 06:04 02:00 05:00 06:00 10:00 14:00
Tolland 11:46 07:40 05:07 08:07 06:52 10:52 14:52
Stafford 12:19 08:13 06:30 09:30 07:11 11:11 15:11
Southbridge 13:14 09:08 08:30 11:30 07:42 11:42 15:42
Charlton 13:42 09:36 09:45 12:45 07:58 11:58 15:58
Auburn 14:19 10:13 11:15 14:15 08:19 12:19 16:19
Sunset 14:42 10:36 12:22 15:22 08:33 12:33 16:33



SNE3-1 SNE3-2


Sunset 14:42 10:36 06:00 13:00 08:35 12:35 16:35
Westborough 15:33 11:27 07:52 14:52 09:04 13:04 17:04
Framingham 16:33 12:27 10:00 17:00 09:37 13:37 17:37
Wellesley 17:05 12:59 11:22 18:22 09:56 13:56 17:56
Newton 18:14 14:08 13:45 20:45 10:34 14:34 18:34
Allston 18:33 14:27 14:45 21:45 10:45 14:45 18:45
Boston 18:56 14:50 15:52 22:52 10:59 14:59 18:59

BM1-102 BM1-104 SNE4-1 SNE4-2 NH1-68 NH1-70 NH1-72
Boston 03:00 07:15 02:00 06:00 08:00 12:00 16:00
Allston 03:23 07:38 03:07 07:07 08:14 12:14 16:14
Newton 03:41 07:56 04:07 08:07 08:25 12:25 16:25
Wellesley 04:50 09:05 06:30 10:30 09:03 13:03 17:03
Framingham 05:23 09:38 07:52 11:52 09:22 13:22 17:22
Westborough 06:23 10:38 10:00 14:00 09:55 13:55 17:55
Sunset 07:13 11:28 11:52 15:52 10:24 14:24 18:24



SNE1-1 SNE1-2


Sunset 07:13 11:28 10:00 14:00 10:26 14:26 18:26
Auburn 07:36 11:51 11:07 15:07 10:40 14:40 18:40
Charlton 08:13 12:28 12:37 16:37 11:01 15:01 19:01
Southbridge 08:41 12:56 13:52 17:52 11:17 15:17 19:17
Stafford 09:36 13:51 15:52 19:52 11:48 15:48 19:48
Tolland 10:09 14:24 17:15 21:15 12:07 16:07 20:07
Hartford 11:46 16:01 20:22 00:22 12:59 16:59 20:59

The above matrix shows all of the possible trains that run in a single day. This took a lot of manipulating to ensure that locos, cabooses and RDCs were always in the right place to enable the next required train to run. The timings were calculated as follows:

Type Avge Speed Max Speed Stop Time
RDC 25 45 2
Through Freight 13 25 0
Way Freight 8 25 30

This lets me calculate the times between stations on the route and thus get the appropriate times for action through Sunset. I have to admit that I haven't gone the next step and ensured that there aren't any problems with passing of trains between stations. As the rest of the railroad doesn't exist, it would have been a lot of work for nothing. Mind you, the plan for the layout includes me building a second station later when I complete the full circuit of the room. I will probably have to rework the timetable at that point.

Anyway, I got all the information sorted and put it into the CSV that defines the trains. This CSV looks like this:

Name Route Capacity Stopping HasCaboose SingleUnit Times RunOrder
SNE Way Freight #1 SNE1 5 y y n 10.00:20.22 4
SNE Way Freight #2 SNE1 5 y y n 14.00:00.22 12
SNE Way Freight #1 SNE2 5 y y n 02.00:12.22 9
SNE Way Freight #2 SNE2 5 y y n 05.00:15.22 16
SNE Way Freight #1 SNE3 5 y y n 06.00:15.52 1
SNE Way Freight #2 SNE3 5 y y n 13.00:22.52 11
SNE Way Freight #1 SNE4 5 y y n 02.00:11.52 8
SNE Way Freight #4 SNE4 5 y y n 06.00:15.52 15
BM Thru Fr. #102 BM1 7 n y n 03.00:07.13:11.46 2
BM Thru Fr.  #101 BM2 7 n y n 10.10:14.42:18.56 14
BM Thru Fr. #104 BM1 7 n y n 07.15:11.28:16.01 7
BM Thru Fr. #103 BM2 7 n y n 06.04:10.36:14.50 6
NH Commuter #67 NH1 1 y n y 06.00:08.35:10.59 3
NH Commuter #68 NH2 1 y n y 08.00:10.26:12.59 5
NH Commuter #69 NH1 1 y n y 10.00:12.35:14.59 10
NH Commuter #70 NH2 1 y n y 12:00:14.26:16.59 13
NH Commuter #71 NH1 1 y n y 14.00:16.35:18.59 17
NH Commuter #72 NH2 1 y n y 16.00:18.26:20.59 18

From this data, the software can work out each train in the correct order. I ran the whole thing through, yesterday, and it worked fine. It might look a bit strange when you see the start times - these don't correspond with the running order - but you must remember that the aim is to get a train through Sunset so start times from Hartford or Boston are irrelevant and only the Sunset time matters.

So far, there is only one small problem. It seems that the software delivered a Reefer to the Lumber Yard! I am going to run the software for a few logical days before I try looking for the problem. I have looked at the code but I couldn't see why it should have happened so maybe it was a carry over from all of the test runs. Let's wait and see. 

What was good was that when I did a full 18 train run, the system reverted back to train number 1 and all of the locos and cabooses were in the correct places to start the next day. We shall see whether it actually keeps to track capacities.

For those of a technical bent, the software is written in Instantiations VisualAge Smalltalk 8.6.1 with all of the web design being built using the Seaside add-on. I have been writing software in Smalltalk for 24 years now and cannot recommend it too highly. If you want to build bug free software quickly and efficiently, Smalltalk is the way to go. For more on Instantiations VA Smalltalk, check out their  Web Page and for more information on Smalltalk, check out Wikipedia. More information about Seaside is available here