MSTS and EP Braking

What what I can determine – MSTS believes a EP brake is what we Aussies would call a “straight air” brake – with an emergency function. This is irritating as the Red Rattlers had a dual EP/Westinghouse system in which there were electric application and holding valves – but a full Westinghouse system was also available if the EP brake failed or by selection on the brake stand.

This is proving hard to simulate – I can almost get there by using EP mode and directly manipulating the brake pipe pressure externally – however MSTS won’t activate the brakes on the cars unless the BP pressure drops to near 0 – i.e. it won’t allow gradual Westinghouse and EP – however there are some more avenues of poking around inside the MSTS memory space to see what we can find…

I’ll keep working on it – any ideas email me!

Getting data in and out of MSTS

One of the key challenges to building a simulator such as this one is to utilise good software.

The Simpit builders have it lucky – as they have such great sims as Flight Simulator X and Falcon 4. Both of these include support for external interfacing.

The train simulator community isn’t so lucky – MSTS is still an excellent program and it is the one that I have chosen to power my simulator, however lacks any form of API – something that is a huge drawback. There have been an number of attempts to over come this – the Raildriver product uses a “screen scrape” of the data – a novel idea but something I would like to avoid.

Doug Johnson, with his “My Ultimate Toy Train” project, provided some answers – if you read his excellent project report (site link on the Blogroll) he did a lot of the ground work in getting data out of MSTS using the excellent “Cheat Engine” tool.

However, I have taken his ideas one step further. MSTS allows for data to both be extracted and input back into the simulator – avoiding any need to develop a keyboard emulator or the like.

Utilising the same concepts as Doug, I developed a series of patches for MSTS that create a code cave in which a sequence of pointers is stored to key values within MSTS. Then it is simply a matter of writing and reading to these addresses and you can control MSTS externally!

What is also interesting is that as well as providing input for the brake and master controller inputs, MSTS will also allow you to change other operational parameters and it will behave accordingly.

For example, it is easy to simulate a breakaway by reducing the value of the brakepipe to 0, MSTS then automatically applies the brakes (as is prototypical of the Westinghouse system). Also prototypically, it does attempt to keep recharging the brakes – until of course you lap the brake valve.

It’s a bit hard to see in the screenshot below – however this is Chris Jennings’ B-Set sitting at Central platform – on the right is a quick piece of VB code that is reading (and writing) data into the memory space of MSTS. The number at the top reads 95.6666 which is the brake pipe pressure – the number on the left is 0 which is the current amps being pulled. (The throttle is closed here). The words are “CAFEBABE” which is a test hex string for debugging and the buttons activate the brakes externally to MSTS.

Simulator Software - MSTS showing connection to a VB6 app

This next screenshot shows us accelerating at the end of the platform – the amp gauge now reads 379.5977 and the brake pipe 110. Note – this is configured as “straight westinghouse” in MSTS. The Red Rattlers used an EP brake – but I’ll get to that in the next post.

Simulator Software - Accelerating Screenshot


One of the key challenges in this project is to interface all the various cab components to MSTS. I will deal with the hardware aspects first – and move onto the software in a post a bit later on.

The master controller and the brake controller are reasonably straight forward – they both have electrical contacts in all the relevant positions. My intention for these is to utilise a commercial USB 32-port input/output unit I purchased from eBay, which has not arrived yet.

As for the gauges – I unfortunately don’t have a full set of air gauges as these were missing from C7487 and I don’t wish to destroy my Elcar ones. However – a simple solution will be to make my own utilising stepper motors – more on this one to follow.

The amp gauge, line lights etc were much easier – I was able to get a hold of some K-3090 Dick Smith Electronics Serial I/O Kits – going cheap from a large kit clearance through Allbids. These are in fact the Silicon Chip project from November 2005 – they provide 10 inputs, 10 outputs some analog inputs and a couple of relays. Most interestingly – they are driven by a PIC16F877A – quite a powerful processor for such a simple kit. The analog inputs aren’t much use however, the digital outputs are driven from the microcontroller through a ULN2003 in an open collector setup. Installing a pot and adjusting accordingly leads to being able to drive the gauge from 0 to full based on the digital output… not so useful really .. however… we should now be able to drive the amp gauge by utilising the hardware PWM of the 16F877A to vary the average voltage seen by the meter.. (remember there is a variable resistance as well)

Simulator Construction - Amp gauge being driven by the DSE kit on right

I have not yet started on rewriting the PIC code to achieve this – however it shouldn’t take me all that long to get the amp gauge up and running properly. I will post a photo when I do.

The relay outputs will come in very handy for switching on and off the line lights and brake stand control lights.

Fast forward to 2010…and the build starts

After three house moves and six years, I finally bit the bullet and decided to start building the simulator proper.

With the wife’s encouragement (she was sick of hearing about how I was going to get to it one day) – I started the build.

Some compromises had to be made – the simulator slightly narrower and is about half the length of the original cab – in other words, it is the portion of the cab facing forward from just behind the driver’s seat.

As I was expecting my first attempt to fail – I neglected to take any pictures during initial construction – however the simulator is basically a wooden frame on which I have nailed up coreflute as a lining material. Coreflute is a great material – it is light, easy to paint (if you use the correct plastic primer) and I got most of it for free.

After I had completed the frame, lined it and installed the basic cab equipment – I started to believe that my first attempt would result in a working sim!

Simulator Construction - Brake stand and master controller

Note the brake stand above is mounted on a wooden frame – the original frame is the one part we couldn’t get out of the cab of C7487 as it was piped below the carriage and we didn’t have an oxy to cut the bolt that wouldn’t budge. However I have the original cover and it is indistinguishable when the cover is on – it also serves as a useful place to house the electronics.

Simulator Contruction - Master Controller

This is actually the Master Controller I got from Elcar in 1992 – C7487’s original controller was in very bad condition.

Simulator Construction - breaker panel

Simulator Construction - Amp Gauge

Simulator Construction - Gauge Panel

Some history of C7487

A bit of history of C7487 – courtesy of John Horne, Michael Kerry and Paul Rogers.

C3487 – available for service – 19.12.1952.

C3487 – to Tulloch Ltd (for four-motor conversion) – 14.12.1969.

C7487 (ex C3487) ex Tulloch Ltd – 13.10.1970.

C7487 – withdrawn – 3.12.1992.  (interestingly this makes it one of the last “manual door”cars to be withdrawn – it must have featured on the M-Sets that survived post Jan-1992)

C7487 – condemned – 22.12.1992.

C7487 – sold – 27.4.1993.

Colour Schemes

C3487 – 12.1952 (as built) – indian red with buff lining.

C7487 – 10.1970 (as remotored) – venetian red with State Coat-of-Arms on white oval background.

C7487 – 5.1975 – blue & white with “Sydney-NSW-Transport” logo.

C7487 – 7.1980 – indian red with white “L7” logo.

C7487 – 9.1990 – indian red with blue/yellow “L7” logo.

When remotored in 1970, the leading passenger vestibule of C7487 was enlargened by moving the transverse bulkhead separating that vestibule from the guard’s area slightly forward. All cars in the 7480-7510 range (except for 7500, the first four-motor conversion) had this modification.

In the beginning

I’ve always been somewhat of a tinkerer – I’m also somewhat of a train enthusiast –  I shy away from the term gunzel – as I’d rather drive the things than photograph them.

I’ve also always had an interest in simulators and have often been impressed by the activities of the Simpit community – and to further top it off I’m an Engineer by profession.

So why not combine all three interests and build a full-sized train simulator using real parts?

Back in 1992 I was on the last “Red Rattler” tour, organised by the Sydney Electric Train Society (SETS) – of which I was a member at the time. It was during this tour that a discussion took place about obtaining cab parts and using them as controllers for model trains.

C3200 - on the last single deck tour of Jan 1992

After this I got in contact with the then SRA of NSW Electric Car Depot (ELCAR) at Chullora – who were happy to supply me with a Master Controller, Brake Controller, some gauges and some other bits and pieces.

During the scrapping of these carriages, I went out to Eveleigh depot and managed to purchase another brake stand, including all the piping from the scrappy as my Elcar one was missing a number of parts.

As this was long before simulators at home were feasible, I didn’t think to purchase an entire cab – much to my regret later on. However, I was given a break when in 2004 I was lucky enough to be able to purchase the remaining cab parts from C7487 which was then at Revolve in Belconnen, Canberra, shortly before the site closed and the carriage was moved. (I believe it went up the North Coast somewhere – I’d be interested to hear if anyone can pinpoint its location)

Removing all the controls wasn’t easy, especially since there was no power to that part of the site – so all of the work had to be done with hand tools. However, I did manage to get most of the equipment out.

This was also long before I had a decent digital camera – so apologies for the poor quality of these photos.

C7487 - amp gauge and circuit breakers

C7487 - Brake Stand and Master Controller

C7487 - Switch Panel

C7487 - brake stand and horn control

C7487 - Brake stand removed

C7487 - Master Controller Removed

With this – and the purchase of one more master controller on eBay – I finally had a complete cab of a Sydney Red Rattler!