Soldering
Turnouts
Track
Parts
Locomotives
Q&A Forum
Turnout Control
Sound
Booster Network
Decoder Installations
Block Detection
Wire Resistance
Site Map / Index
DCC for Beginners
DCC in the Garden
HO RR Photos
Home
Manufacturers
DCC Topics
Garden Rwy Photos

Computer-aided Model Railroading

Please be sure to see Do It Yourself  for others interested in developing computer control systems. See the Manufacturers page for software that you can buy or get free to operate your model railroad.

INFORMATION #15-1:  For Information DCC Control of Turnouts, Go To the Section On Turnout Control.

INFORMATION#15-2:  Manufacturers and Non-Programmers:  An Argument For Ladder Logic.

Non-Programmers:  Read this.  If you like it, let your favorite manufacturer know!
Manufacturers:  Consider this alternate method for programming your computer control systems.
 

I've programmed in just about every high level and assembly language there is.  Like many programmers, I thought ladder logic was a joke.  It's no joke.  For some applications like controlling machines (read model trains), it's ideal!  It's worth a serious look.

Most PLCs program using a graphical interface that shows relay contacts.  This method of programming is even easier to learn than procedural language programming like C or BASIC.  Many people who wouldn't dream of trying to learn to program a computer, do ladder logic and do it well.  This is because that for the most part, ladder logic could really be implemented using relays.  This is a visualization process that is easier to grasp than bytes, memory pointers and for-next loops.  This makes it very popular.

Here is the above as it might be written in a computer language. With the exercise you just did, you should be able to make sense of this below.

If B_Occupied or T1_Thrown Then Red
If Not(B_Occupied) and C_Occupied and Not(T1_Thrown) Then Yellow
If Not(B_Occupied) and Not(C_Occupied) and Not(T1_Thrown) Then Green

Which approach agreed with you more?  If you thought you understood it, but now you don't, don't feel bad.  Now you appreciate ladder logic!

Below is an example of what you might see if the T1 turnout is thrown.  In this simple example, T1 being thrown is all it takes to cause the red signal to light.  It shows that blocks "B" and "C" are not occupied. Any input that is active is highlighted.  Then the power is highlighted from left to right as far as it can go.  Only the first rung makes it all the way across.

Troubleshooting is a breeze, too.   I have been called to assist repair of machines that were totally unfamiliar to me.  All I had to do was ask, what is the next thing this machine should be doing if it was working right?  I'd search for the output that controlled that function. Inputs on the screen that were active would be highlighted.  Just look at the rung from left to right, looking for inputs that weren't active, but should be.  Then the sensor for that input was bad, needed adjusting, or a wire had broken or come loose.  Total time to identify problem: under 15 minutes.   In a model railroad, look for the block that has a train on it, but its input wasn't highlighted.

What makes ladder logic so successful as a troubleshooting tool is the graphical user interface.

So manufacturers, please give this some serious thought.   I realize is a simple example.  I'll be glad to discuss with you how ladder logic deals with timing, latching, comparing, counting, and more complex issues like math, dealing with data files and communicating on a network.   I made those PLCs justify their cost every day!

A-B, I believe, now has their PLC-5 series being emulated on a PC.  They are proud of their products and charge accordingly.  I have a few good contacts at A-B and might be able to get to someone in A-B who might be in a position to licensing some bit of their technology at a reasonable price.

FAQ'S

FAQ #15-3:  Can I Use A PLC?

A programmable logic controller is an industrial control computer. It should not be confused with a PC — the personal computer you are using right now.

PLCs use something called ladder logic.  When graphically displayed, it looks like rungs on a ladder.  See above.

Many have logic elements that light up as a particular input is made.   Allen-Bradley's progressively lit rungs make troubleshooting easy.

Until I actually worked with PLCs, I looked down at them as most programmers do.  I was a hard sell.  In the old days, they simply mimic'ed relay logic — which was the use of relays to control things.  How smart could a cabinet full of relays be?  Not very!

The modern PLC is sophisticated.  It is ideally suited for controlling many things at once — like several model trains!

They typically have LEDs on their inputs and outputs.  So looking at the front of the PLC, you can get a good idea what inputs the system is getting and what outputs it is controlling.  In a factory, this is a big plus.  Many technicians can troubleshoot a machine without hooking up a terminal to the PLC and looking at the program.  If programming isn't your bag, this is very nice.

Of A-B, GE, and Siemens — the three biggest PLC manufacturers — A-B was by far the best.  Easiest to use, reliable, system software that was bug free, operated just like the manuals said, and never crashed.  Don't you wish your PC and its system software could be like this???

The systems that have lots of inputs and outputs are quite expensive.  They do offer scaled down versions that are ideal for running things like candy machines.  These units have limited expandability and typically have more inputs than outputs - since the typical machine needs more inputs than outputs.

Anyone thinking a PLC for model railroading is probably thinking signals.  Here you need a lot of outputs compared to inputs.  So these low cost models are not usually adequate for our needs.

Another thing to watch out for is that many inputs on these industrial machines are looking for 16-24V for an input signal — since 24V is what is typically used to run machine controls.  Some DCC block sensors only put out about 5V.  Typical PLC inputs would not detect this.

The way to look at PLCs is to see if you can do what you want to do for less than $14 per function.  That's what a function, like a crossing signal, costs on a DS54.  The DS54 can operate rail switches, crossing signals, and a few other things for the creative modeler.  And you can network it, too!

While I feel that ladder logic is ideal for programming your DCC computer control system, the lack of low cost PLCs with lots of outputs makes them an uneconomical choice.

The one place a PLC may be the right thing is turntable control.  You still have the problem of it not talking to your DCC network.  Using DCC products on the market today, I haven't worked out how this might be done.  In about a year, I will face that challenge.  So stay tuned.

FAQ #15-4:  DO I Need A Computer for DCC?

Absolutely, positively not!  Unless you buy a super low cost DCC system that says "uses your computer to save you money," the answer is definitely no. The mainstream systems on the market today do not require a computer.

FAQ #15-5:  Would A Computer Help Make DCC Easier to Use?

Except for loading speed tables, the answer is no. For one thing, the current DCC systems are not that hard to use. For another thing, a computer is hardly a walk around throttle!  Lastly, setting up a computer to display your layout, indicate block detectors, and turnout positions is a good bit of tedious work.  If you are brand new to DCC, trying to start out with a computer is a good bit of additional complexity you don't need.  As I noted above, most DCC systems will work just fine without them.

Adding a computer later won't obsolete anything you buy now.  So take two small steps — buy a DCC system, add a computer later — rather than a quantum leap to the computer.

IF YOU WANT TO GET SERIOUS ABOUT USING SPEED TABLES, then yes, a computer will make it much easier.   Setting up speed tables without a computer is tedious.  Fortunately, using a computer to set up speed tables doesn't require you to be a computer programmer.

Computer Control Software Suppliers

Please see the Manufacturers section for suppliers of DCC computer control software.


 
GENERAL
FAQ's
 

Copyright by Allan Gartner 1996 - 2010 © All rights reserved. You may print this for your own, personal, non-commercial use. Non-commercial, non-personal reproduction may be requested by visiting www.WiringForDCC.com/writeme.htm . All users, commercial and non-commercial, may link only to this site at www.WiringForDCC.com.

Thanks to all who contribute to this site and the Q&A forum!