Thursday, November 2, 2017

Market Street: The Train Departure Board

Short shameful confession time: I built the Market Street layout because it was easier to build than a video game.

A non-trivial bit of my inspiration for the Market Street layout came from the railway switching games made by SIAM Railway Simulations. These mostly-British prototype games provide accurate simulations either of a station or for dispatching a long set of track. The station simulations put you in the role of the tower man and switcher at anything from the end of a country branch to the busy through station at Crewe. The dispatch sections include British settings (Scottish Highland line) as well as realistic versions of Tehachapi Pass, either in the 1920’s or the 1960’s. I’ve played some samples and bought other games.

SIAM's samples page lets you get a taste of the games by downloading demonstration, reduced versions of their simulations. The samples include dispatching the Highland line and Tehachapi Pass, and handling switching in the stations at Crewe and Penzance. The Tehachapi dispatching game gave me a great appreciation for getting trains over Tehachapi Pass in the steam era.

Penzance, 1987 game from SIAM Railway Simulations

Of course, I wanted to try some more American prototypes - handling the traffic coming and going from the Oakland Pier, perhaps. Or why not the San Jose Market Street station? I got a fair way through making an iPad game so I could switch those places, but I found it difficult to control all the switch engines and car movements I wanted to include. After enough tries, I found myself asking "so what would a layout set up like one of these games look like?

So, I’ve built the layout, and I've got an answer to that question.

However, to make the layout operate like the game, I need to know what trains need to come and go. More importantly, if the layout is being exhibited, I want folks to see the names of the trains coming and going so they can understand the sheer number of trains that could be handled in the 1920’s, even if the station was a creaky old Victorian barn.

Suddenly, that way-too-large display on the Raspberry Pi has a use.

Snippet of departure board. Click here to try it out for real.

My inspiration was a European-style flip-card station sign; it’s not quite prototypical for the era, but anyone who’s been in a large train station has seen one of these, so showing a listing of trains should both inform and hint at the sheer number of trains they’re seeing.

And luckily, making such a sign is easy. One of the neat habits of programmers these days is to share programs they’ve written so others can use those programs. A friendly guy named Paul Cuthbertson liked the idea of drawing flip-style departure boards, and based on an inspiring article, went off and wrote a web page to draw one.

Now, I need more than just the departure board graphics for the Market Street layout. I need a sped-up fast clock to show the current simulated time on the railroad, for the compressed track plan means trains won’t take as long to move around as on the real thing. I’ll need a way to control the board when trains arrive and leave. I’ll need a way to manage problems - backing off accidental train departures, or stopping the clock in terms of problems.

I took Paul’s code and created this departure board for San Jose Market Street. (See this Github project for the source code itself.) Pressing a number key (1-9) causes the nth train to move to its next state; a train that’s on its way will go to “arriving” on the first press, then “arrived” on the second, then will be removed from the board on the third.

Paul’s card-flipping web page turns out to require a lot of computing horsepower to flip through all 26 characters for each change. The poor little Raspberry Pi, being the size of a credit card, couldn't keep up. Instead, I changed the program so that the board only performs 6 flips per letter, instead of flipping though the whole alphabet like the real flip board.

So now, when I set up the layout, I just need to set the box containing the DCC electronics somewhere both the audience and operator can see. The stationmaster can use a keyboard to advance the departure board as trains arrive and leave. The operators know what trains they're building; the audience gets an understanding of how easily they could commute from San Jose to San Francisco (or Salinas) in 1928.

And I get a modular layout that's inspired by a video game.


The modern practice of sharing sample code and reusable libraries is a great part of modern programming culture. Great thanks to Paul Cuthbertson for the core of the departure board code!

If the departure board idea might work for your layout, download the sources from GitHub and customize it for your own use. Drop me a note if you find it useful!

No comments:

Post a Comment