Jump to content

Automated computer control - introduction


Martijn Meerts

Recommended Posts

Martijn Meerts

Automated computer control chapter 1 - An introduction.

 

 

Before I begin, I just want to say I'm no expert at this. In fact, I've only ever built 1 automated computer controlled layout, and that one had traffic in 1 direction only. However, when I was researching how to decided about things like blocks, brake sections, stop sections etc, I wasn't able to find many sites that had info available. A lot of sites had bits and pieces, but most were explanations seemingly meant for people who already knew it in the first place. The idea is that this series is mainly aimed at beginners who've never done anything with computer control, block control and automation. Also, the info here is only valid for digital control.

 

The first question many people ask, is why would anyone want to automate a layout. Isn't a large part of the idea behind a model train layout that you can operate it, and do shunting to put together consists etc.? That is of course true, but it'll limit the amount of trains you can run. Generally, people can only really keep track of 2, maybe 3 trains at a time. If you want more than those, you need to either get other people to run the layout with you, or start automating parts of the layout. Since people with an interest in model trains are getting more rare, and people with an interest in manually operating trains together with others even more rare, automation seems like a good option.

 

Before starting with automation however, there are a few things to consider. If you already have a layout, you may need to partially take it apart to get to hard to reach places. You'll also need to add a lot of wiring, and the wiring needs to be well thought out, otherwise it'll turn into a nightmare should something fail at a later time. Expenses can also quickly go up when automating a layout. But, if you do go through with it, you can easily run a lot of trains simultaneously. For example, my father's layout (the only one I've built so far that's computer controlled) is somewhere around 2.5 x 1 meter give or take. There's a fairly large main station, a couple of storage tracks, and an elevated track. Before we added computer control, we could, with the 2 of us, run about 5 trains at most. There'd be more on the tracks, but only 5 would be running. After we added computer control, it'll run 15 trains with ease.

 

Below is a link to a video of what the main station area looks like (operation wise, most platforms have been temporarily removed.) Everything you see here (including the smooth (in most cases) deceleration and acceleration) is controlled by a computer program. The program decides which train goes where, within a certain set of rules you specify, and there's various options to add routes, priorities, and even mass simulation (as in, heavy freight will have a much longer braking distance than a local passenger train.) The video is about 25Mb, it should start fairly quick though, as it's being streamed. Apologies for the rather bad quality, it's a cheap camera 😉

 

https://jr-chiisai.net/wp-content/uploads/2020/12/computer_control.flv

 

 

 

In the next chapter, I'll try to explain blocks. What are blocks, why do you need to divide a layout into blocks, why do blocks have multiple sections, etc.

 

 

Any comments, hints and tips about what you want to see in either the next chapter specifically, or in general, please post them and I'll see if I can incorporate them. Hopefully with your feedback we can turn this stuff into a decent document that should be a good help to anyone who wants to create a computer controlled layout 😉

 


 

 

 

Edited by gavino200
  • Like 2
Link to comment
gavino200

Automated computer control chapter 2 - The basics of blocks.

(by @Martijn Meerts reposted here by me. )

 

 

A vital part of automated computer control, is for the computer to know which train is where. Optimally, the locomotives would continously send a signal to the control center with such information as decoder number, speed, direction and which block its in. However, bi-diretional digital isn't that far yet, and even if it could send back most of these variables, determining which block a locomotive is in is difficult.

 

Instead, we need a system that detects on which part of the layout the train is. There are a variety of ways to do this, including using reed switches and magnets or infrared signalling. However, in my opinion, the most reliable way is block control.

 

So what is a block? A block is nothing more then the stretch of track between 2 signals. Those signals don't have to be physical signals, they can be imaginary. Prototypical railways generally use a block system to track their trains as well.

 

image.png.1d194e7754bbaf09318e81601e7f4d27.png

 

The general idea is that a layout is divided into multiple blocks. Depending on the system used, the blocks are either isolated on 1 or 2 rails. In most cases for 2-rail systems, only 1 rail is isolated. The reason for the isolation has to do with detecting when a block is occupied or not. More on that later.

 

To put everything into context, let's use an oval as an example. An oval can be divided into 4 block. The 2 straight sections are 1 block each, and the 2 180 degree curves are 1 blocks each.

 

image.png.cff727f04bb4ece5ac093297f8fddde6.png

 

Purely theoretically, 3 trains can run on an oval that's divided into 4 blocks without ever running into each other. The problem is that the moment a locomotive enters a new block, it will need to start decelarating because the next block is occupied. Its very similar to driving while in a traffic jam. You can only move when the car in front of you moves, and he can only move when the car in front of him moves. Imagine a traffic jam that runs in a circle, and you'll get a good idea of the problem.

 

Running 2 trains is much better, but if 1 train is faster than the other, you will still have the problem that the faster train will regularly need to slow down.

 

The most optimal solution would actually be running only 1 train. Generally, a train will want to have at least 2 free blocks in front of it. That way there's little chance it needs to slow down, unless you have a fast training running behind a slow train. For example, an express train would be faster than a freight train. (That situation can be avoided though, but adding either sidings so the express train can overtake the freight train, or make sure the express train has priority over the freight train at a train station or other stop.)

 

So, dividing in oval into blocks is really rather pointless, but an oval is something everyone will recognize, and the blocks are easy to set up 😉

 

 

Now that we have a basic idea of what a block is, the next chapter will talk about some more advanced topics related to blocks, including brake and stop sections, occupancy and feedback, and deciding where to install blocks.

Edited by gavino200
  • Like 2
Link to comment
gavino200

Automated computer control chapter 3 - Advanced blocks.

(by @Martijn Meerts reposted here by me.)

 

In this chapter, we'll look at ways to divide a layout into blocks. Dividing the layout can be a rather daunting task, especially if you already have an existing layout. If you're still planning a layout, you can keep the blocks in mind when designing the layout.

 

Before you decided how to divide a layout though, you need to decided which directions trains run, and whether some or all blocks should allow for travel in both directions. You will also need to decide on the method of detection you want to use, as well as how secure you want this detection to be.

 

The most common method of detection in a 2-rail scenario, is to check for a change on the tracks. Usually, there's no current flow between the plus and minus. However, if for example a locomotive drives on the track, there'll be a current flowing from plus through the motor to minus. What we then do, is to connect a device to the minus to detect when there's a current flowing. When there is a current flow, the device will know something is occupying the track.

 

So, when dividing the layout into blocks, we only add plastic rail joiners in 1 rail, rather than both. Instead of plastic rail joiners, you can also just cut the rail where you want a block section to begin or end. Below is a very basic diagram:

 

image.png.18a8ef3b061f99ca1c0c9261262a4223.png

 

Now that we know how to create basic blocks, we need to look at brake and stop sections. These sections are contained within each block. For example, if a block only has 1 section in total, and a train needs to stop in that block, the train will start braking using a certain deceleration, and then come to a stop. You can't control exactly where it comes to a stop though. It might stop way before coming to a signal, or it might stop just past the signal. There are programs that can calculate the braking distance based on locomotive speed and length of a block, but driving characteristics of trains change over time, so it's not a reliable method in the long run. Some decoders also have constant braking features built in, but this will cause the same problems as calculating the distance by a program.

 

To solve this, and to make sure a train stops pretty much exactly where we want it to stop, we create brake and stop sections within a block. A brake section is a section where the train slows down to a crawl, but doesn't come to a complete stop. Only at a stop section will it stop. Below is a diagram:

 

image.thumb.png.2e2e0f2de3896432d30ceedacd0dbe56.png

 

 

So, a train enters a block at say 120 km/h. In the previous block the distant signal indicated the driver should expected a stop sign. The moment th train enters the brake section, it'll start slowing down to for example 20 km/h (usually you can set the "crawling speed" of a locomotive in the program used to control the layout). When it gets to 20 km/h but hasn't arrived at the stop section yet, it'll continue at 20 km/h until it does. When it arrives at the stop section, it'll decelarate and come to a complete stop. If it arrives at the stop section before having decelerated to 20 km/h, it'll still decelerate all the way to 0.

 

In terms of feedback to the computer program, this means that we need at least 2 detection points for each block. The program needs to know when a train enters the brake section, so it can decide whether or not the trains needs to decelerate, and it needs to know when a train arrives at a stop section, so it knows exactly where to halt the train. The problem however, is that with 1 brake section and 1 stop section, the train can really only travel in 1 direction. Should it drive in the other other direction, it'll first come across the stop section, and then the brake section. To solve that, we add a brake section on both ends of a block as seen below:

 

image.thumb.png.ebcf8c7e5bfc6a39e3e494642ace0ef3.png

 

Obviously, this is getting expensive, and is starting to require a lot of wiring. If the program supports is, you can leave out the brake section (and the detection of it), and instead the train will start decelerating the moment it enters the first stop section, and stop when it arrives at the 2nd stop section. The program will decide which direction the train is running in based on from which block to which block the train is traveling. The problem with that is that you have no detection in parts of a block. Should a train loose several cars on that section, the program won't be able to figure that out.

 

So, you have multiple options:

 

- 1 section per block and let the program/decoder decide braking distance.

- 1 brake and 1 stop section per block, only allow for 1 way traffic.

- 1 brake and 2 stop sections per block, travel in both directions.

- 2 stop sections per block, travel in both directions with limited detection.

 

I'm going to a combination of the 2nd and 3rd options. If I'm certain some blocks only have 1 way travel I'll go for 1 brake and 1 stop section. Any other block will get 1 brake and 2 stop sections.

 

 

With that out of they way, we need to decided where to divide the layout. This is mostly just a matter of experimenting and trying things, but there are 2 major guidelines:

 

- A block needs to be at least as long as the longest train that will be traveling through the block.

- Turnouts should NOT be included in a block.

 

There are exceptions to the first guideline, for example an express train that doesn't need to stop at a local station could theoretically be longer than the station block. However, the controlling program specifically needs to support this one way or another. For example, the program should be able to allow you to say that a certain type of train in a certain block number should stop unless the next long block is free. That way, if the short block is occupied, the express train will halt before the short block, and will only continue when the next long block is free.

 

As for turnouts not being in a block, the reason for that is that you don't want turnouts to be "occupied" because a block is occupied. In certain situations it'll keep trains waiting for the block (and thus the turnout) to be freed, while if the turnout would've been outside the block, a different train could've run through the turnout. You can still add detection to turnouts though, so you can see when there's a train on a turnout, just don't add them to blocks. In the following image for example, the turnout is part of block 2. Even though the train on block 2 isn't occupying the turnout, the turnout is still unusable for the train in block 1. A better solution here would be to have block 2 end before the turnout, and leave the turnout outside of any block. That way if the train in block 2 would have a 5 minute scheduled stop, the train in block 1 can still drive through the turnout.

 

image.png.11cfab22c5e2cffb8dfe5e3e2124277e.png

 

Also, as mentioned before, a good guideline is to think of a block as a piece of track in between 2 signals. If you have a layout design sketched on paper or drawn on the computer, you can add signals where you think they'd be appropriate, and then base your blocks on that. There are really no rules how you should divide the layout, so its difficult to explain. The following are a few examples of various situations and how I personally would divide those into blocks.

 

 

 

The first plan is a simple oval with a siding and traffic in 1 direction (clockwise in this case.) I've drawn this one a bit big and added green circles to indicate where to isolate the track (remember, 1 side only ;)) I've also added indicators where a block starts and where a block ends. I've only done this in the first image, you can try and puzzle it out yourself for the others 😉

 

The blue section in each block is the brake section. The orange section is the stop section. As mentioned, the train will enter a blue section, the program will register this and start decelarating the locomotive. Once it reaches its  minimum "crawl" speed, it'll continue at this speed until it reaches the stop section. Again, the program will register this, and then bring the locomotive to a smooth stop.

 

The grey sections are sections that are not included in a block, however they can (and maybe should) still have an occupancy detector connected to them, in case a locomotive stalls there, or looses a car for example.

 

image.thumb.png.9296cba01240246ff640af5ec5916942.png

 

 

This plan is similar to the first one, except it adds a 2nd siding. Traffic is still only clockwise.

 

final1.thumb.png.3c7beb8ce843f67615489467efba17f2.png

 

Plan 3 is like plan 2, except this one allows traffic in 2 directions in every block. This means that now each block has a stop section on either end.

 

image.thumb.png.1977a48341f486db855d9691376543da.png

image.png.ea57280f497cccf08dab12ba3fbd39fd.png

 

 

Plan 4 is slightly more complicated. We have a double loop with the inner track going clockwise and the outer track going counter clockwise. All blocks of the outer loop are meant for traffic in only 1 direction. However, blocks 1 and 2 in the inner loop allow traffic in both directions.

 

Think of the inner loop as a local line and the outer loop as a shinkansen line. Blocks 1 to 4 would be a train station. The local train is only allowed to use tracks 1 and 2. The shinkansen normally only uses tracks 3 and 4. However, in case of emergency, the shinkansen can use tracks 1 and 2 as well.

 

 

image.thumb.png.b550f2f06cf11e2fd37060a7817b6cf7.png

 

 

Plan 5 is a fairly typical setup for a small shinkansen station. To the left and right of the double crossovers you'd just continue with blocks the same way as the other plans.

 

image.thumb.png.eaa8c04014a51a08a0e05e2d4ed6f18f.png

 

 

There are a few special situations as well. For example, certain train stations have platforms that are long enough to fit 2 local trains or 1 express train. This track could be divided into 2 blocks for the local trains, but again the program would need to have features so that an express train can drive in and stop in the 2nd block rather than the first. Some blocks should also allow you to override their occupied status for situations where you're manually shunting or where 2 trains should connect to eachother.

 

There are also terminal stations, where the tracks are driven on in both directions, but they still only need 1 brake and 1 stop section considering the trains will only ever stop at 1 end of the block.

 

In general though, no matter the situation, setting up blocks is quite straightforward. The best thing to do, is if you already have a digital system, pick up a few occupancy detectors and download a trial version of a computer control program and play around. I can recommend Railroad & Co Train Controller (http://www.freiwald.com/) due to a fairly easy learning curve to get a basic oval with siding up and running.

 

 

 

Edited by gavino200
  • Like 2
Link to comment
gavino200

Signalling

 

A question was asked in the comments to the original thread where Martijn posted Chapter 2, about whether Japanese signals can be controlled in iTrain. The answer is yes, in iTrain at least but not directly. I don't know about JMRI or Roco rail but perhaps someone can answer that for me. iTrain supports signals from a list of different countries. Japan isn't one of them. However, the outputs can be reconfigured so that the physical signals on the layout show authentic Japanese signals. The graphics in on the computer screen, however will have to be from one of the countries listed.

 

A detailed discussion of this can be found in this thread below. For beginners I'd recommend ignoring this for now.

 

 

Edited by gavino200
  • Like 2
Link to comment
gavino200

Components: What do you actually need to do automation?

 

The whole system and everything you need can be summed up by the following four categories.

 

1. A DCC system - Command Center, Locos with Decoders, Throttles

2. A turnout control system.

3. A block detection system.

4. A Computer running an automation program.

 

 

1. DCC system. Most DCC systems are compatible with automation programs. Generally the Command center may have direct connector (USB or orther) for you to connect it to a computer running the automation program. This is the case with my Digikeijs DR500. Or you may need to buy a small device from the Command center manufacturer to allow you to connect to a computer. An example of this would be a Digitrax PR4 which allows you to connect a Digitrax command center to a PC. Check the manual for your DCC command center to see how to connect it to a computer.

 

2. You need to have your turnouts electrically controlled. Most systems do this with a DCC function decoder which is connected to the DCC command center. The decoder then operates a relay or actuator which then switches the turnout. I use a Dijikeijs DR4018. It's basically a stationary decoder, connected to my DCC command center. This unit in turn is connected to 8 separate DR4101 units, each of which are connected to a Kato turnout. Most manufacturers, Digitrax, ESU, etc, haver their own version of this hardware.

 

3. A block detection system. Basically, instead of having one continuous track, you bread your layout up into separate little segments that are each isolated from each other. Technically these are "power districts", but most people call them blocks, so I will too. When a train enters a block it will use some electricity and create a voltage drop. An electronic circuit can detect this voltage drop, and therefore know that a train is in the block. It is both a power supply to the train and a sensor to detect whether there is a train in the block.

 

So, the DCC signal goes from your DCC controller to your Block detector. The block detector then divides the DCC signal into a number of separate branches (pairs of wires). Each pair of wires goes to on block.

 

This diagram is from the manual for my DR4018RC block detection unit. Each unit can supply 16 blocks and a section of undetected track. You actually only need to isolate one track for blocks supplied by the same detector. The system can be extended by simply daisy-chaining more detection units. Blocks supplied by different units need to have both rails separated by isolated joiners

 

Most manufacturers, Digitrax, ESU, etc, have their own versions of this hardware.

 

 

 

 

. 4088.thumb.png.1bc44e5ca71fc039ec7999910319980b.png

 

 

4. Train automation program. There are quite a few of these available. The best known are JMRI, Rocrail, TrainController, and iTrain. Rocrail is free, and JMRI is both free and open source.  iTrain and TrainController are commercial. With iTrain you can get a trial license and buy at different levels if you like it. I know many people who are satisfied with JMRI, and I have no issues with it at all. I chose a commercial option because I'm not very technical, and need the technical support offered by a paid service. JMRI has excellent forum based support, but I tend to get left behind by what to me is advanced level discussion. But if you're computer savvy, then the price of JMRI certainly can't be beat.

 

All programs are fairly similar. They connect to a DCC command center and give it commands. The software has a decoder programming function and stores all the information about your trains and decoders. You need to use the program to measure the physical speed of each loco at all speed steps of the decoder. You also have to measure each section of your track and enter it into the program. You make a diagram of your layout and assign DCC address to all the turnouts. The program then uses this information as well as the block detection to control your trains.

 

This is a view of the switchboard of iTrain from my iTrain manual. JMRI and Rocrail are similar.

 

 

 

 

switchboard.thumb.png.db1d4ecfc70b790c033b9521c555e187.png

 

 

Below are some links to different systems available on the market.  (To be added)

 

 

 

 

 

Edited by gavino200
  • Like 2
Link to comment
gavino200

Actually setting up your layout and learning the software - my experience

 

Knowing what needs to be done and actually doing it are two different thing. I did my research and bought all the correct items as above. Getting it working was more trouble. If I know months ago what I know now things would have been easier. My goal here is to suggest an approach to getting started once you have all the equipment you need.

 

There are three components of learning automation

1. Setting up a representation of your layout in the software

2. Preparing your locos/decoders for use in the software

3. Learning the fun things that the software can do.

 

A problem is that there are many variables. The software isn't very complex as software goes, but for me it is. Personally I find higher functions in word and excel difficult, so learning the automation software was no piece of cake.  I'd advise any learner not to start with a complex layout. Make a very simple small layout to practice on.

 

I strongly recommend starting with a simple oval with four blocks. Then use that for preparing your locos. After your locos/decoders are working, then add some sidings and turnouts. This is my simple practice layout. I started with a more complex layout but stripped it down for simplicity so I could learn how to prepare the locos.

 

qeaaNrV.jpg

 

This is the topside of the practice layout at an earlier stage before I simplified to a simple oval.

 

lNL0MCJ.jpg

 

Preparing the locos is a bit of a process. By now it's a routine thing. But it was baffling at first. Below is a slide from Bob Fuller's YouTube iTrain tutorial series that summarizes the steps.

 

1713094480_Locopreparation.thumb.png.b22366a481e085c88bb546681459497d.png

 

Step 1. You can't just read the decoder CVs on the programming track directly into iTrain, without first making a template. This involves simply choosing a "DCC default" list of CVs and pressing apply. It's not hard but if you forget it, nothing will work.

Step 2. You have to make some specific CV changes. These involve turning off the simulated acceleration within the decoder so the automation software can make it's own simulation. The other adjustments are to set a minimum and maximum speed, so that the software can take advantage of all the speed steps.

Step 3. The software has a speed measuring function. It knows the length of the blocks. It then measures the time taken to cross the blocks at different speeds steps and uses that to calculate a speed profile for the loco.

Step 4. I just used the inertia simulation parameters suggested in the YouTube tutorial. In future I'll play around with these. 

Step 5. Reaction delay is an adjustment to adjust for the actual physical momentum of your loco. You make the loco go forward and backward along a route. You mark where it's supposed to stop. If the loco overshoots the mark, you increase the value of "reaction delay" until it stops where it should. If it undershoots, you do the opposite.

 

Only when You've finished this process will your loco actually do what the program wants it to do. You can now increase the complexity of your layout. And start learning to make make routes for your trains.

 

4AUzY5Y.jpg

 

After this you have a decent basic knowledge of how automation works. At this point I reread the iTrain manual and unlike the first time I read it, it actually made sense. From this point on the process is fun.

 

For iTrain there are four basic learning sources available. I'd like to add resources for JMRI and Rocrail if someone who uses those programs could supply the information.

 

1. This is the manual in English . It's pretty good as manuals go. But it would be difficult to learn something like DCC automation from a manual like this alone.

 

This is a step-by-step guide for setting up a small layout. This is probably the best place to start. Set up an oval, get your trains working and later add some turnouts. When you're comfortable move on to the video series.

 

This is an excellent video series that explains all the subtleties of iTrain. If you're a sophisticated, tech savvy user you could probably go straight to using these videos together with the manual. You can find it directly on YouTube but this link has an index which is useful in case you don't have a photographic memory.

 

Lastly, an perhaps most importantly there is an iTrain forum. Here you can post your layout file, and seek help if you can't otherwise find an answer. That will occur for sure. People here are very knowledgeable. Most of the people are polite and helpful. One or two are consistently borderline rude and minimally helpful. It's an excellent resource.

 

Edited by gavino200
  • Like 2
Link to comment
gavino200

Features and Videos

 

I'm going to add features that can be acomplished with automation with links and videos as I find them. If anyone posts any examples below I'll add them here.

 

 

Edited by gavino200
  • Like 2
Link to comment
  • gavino200 pinned this topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...