Jump to content

Automated computer control chapter 3 - Advanced blocks

Martijn Meerts

Recommended Posts

Martijn Meerts

Automated computer control chapter 3 - Advanced blocks.



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:





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:






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:





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.






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.







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







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.







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.







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.






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.

  • Like 4
  • Thanks 1
Link to comment
Martijn Meerts

Sorry for the large images, but I figured its better to make them readable ;)


Also sorry for the long wait for this one.. Work and real life in general seems to always get in the way of fun  ::)

Link to comment
Martijn Meerts

If there are any questions, just let me know =)


Not sure what the next chapter will be, but likely something to do with routes and turnouts.

Link to comment

I'll have some questions when I can afford a block detector, in a few months ;)


Not sure what the next chapter will be, but likely something to do with routes and turnouts.

In that vein, maybe you could say something about automating staging yards, perhaps?

Link to comment

Thanks - that was very useful.


I have one quick question regarding the stop zones immediately before the signal. Roughly, how long do you think they should be?


I know it depends on the speeds of the trains etc - but lets presume that upon entering the 'braking zone' i have the computer set the speed of the train to a relatively slow speed (eg 20% of full power). After crawling along, the train will hit the stop zone.


Should this stop zone be at least the size of the largest engine?  Or can it be smaller - eg 5-10 cms? Just enough to stop the train in front of the signal?


Your thoughts are greatly appreciated.


Kind regards


  • Thanks 1
Link to comment
Martijn Meerts

Ryan, it depends a bit on the program and setup. For example, when I had my blocks divided in 2 sections (brake and stop, so travel in 1 direction only), the trains tended to stop the moment the stop section was occupied. However, when I had 3 sections per block, with the middle section non detected (stop, no detection, stop) usually the trains had to completely drive into the stop section.



From experience, I would say make the stop sections fairly big, definitely big enough to fit the longest detected rolling stock (this isn't necessarily a loco, but can also be a lighted cab-car) completely. The thing is, it's easier to fine tune the trains and exactly where they stop with longer stop sections, because you have more space to play with.

  • Thanks 1
Link to comment



I think the slowing down is more important than the stopping.  You need to do some testing, particularly to discover just how slow you can run your consist without it stalling.


I'm in the throes of playing around with this myself.  I've built a subway with platforms long enough for 10 car subway trains or 8 car suburban trains.  My stop sections for this are 140mm.  My key is having the "Slow Down" sections long enough to slow the train down so that the "Stop" looks as natural as possible. 


The mathematics for this is quite simple really.  Here's what I did:


I tested my Kato 10-864 Tokyo Metro Series 01 6-car set to see how slow I could reliably run it.  When it is coming off speed I can get it down to around 2cm/s or 0.02m/s.  I then decided that to allow for dirty track etc. I'm going to add an anti bugger 25% and settled on my minimum running speed of 0.025m/s.  For the record, that is 13.5kmh or 3.75m/s.


My train hits the slow-down section at 60kmh (prototypical service speed) or 16.6m/s.  At scale, that's actually 11.1cm/s or 0.11m/s.


So, I jumped on to Wiki and discovered the deceleration for the Series 01 is 4kmh/s.  I convert that to m/s2 = 1.1m/s2.


I now have the following 1:1 scale constants:

1. Initial Velocity v(i) = 16.6m/s

2. Final Velocity v(f) = 3.75m/s 

3. Acceleration a = -1.1m/s2


I can now calculate the time using the formula for velocity of an object with constant acceleration: v(f) = v(i) + at.  I rearrange the equation to make t the subject: t = (v(i)-v(f))/a. t = (16.6-3.75)/1.1 = 11.68s


I now have the following 1:1 scale constants:

1. Initial Velocity v(i) = 16.6m/s

2. Final Velocity v(f) = 3.75m/s 

3. Acceleration a = -1.1m/s2

4. Time t = 11.68s


To calculate how far the train travels I use the formula for displacement when acceleration and time are known: d = v(i)t + 1/2at2

d = 16.6*11.68 - 1/2*1.1*11.68*11.68  = 193.9 - 75 = 118.9m (note I've moved the - sign from the acceleration to the left of the 1/2 for clarity)


I now have the following 1:1 scale constants:

1. Initial Velocity v(i) = 16.6m/s

2. Final Velocity v(f) = 3.75m/s 

3. Acceleration a = -1.1m/s2

4. Time t = 11.68s

5. Distance d = 118.9m


Converting the distance back to N scale means you need 0.793m of track.  You may as well round that up to the next modular length of track you use.  For Tomix that becomes 840mm or 3 x S280.  A platform that long will hold 6 suburban cars or 7 subway cars.


I'm happy to let my train trundle along at minimum speed until it hits the the stop section.  At the moment, it stops about 5cm into that section.  Once I get everything working properly with a PC I'll set a time condition for stopping.


At the moment I'm also thinking that short Stop sections are best and just let the train trundle into it and stop.


Obviously, when you do all the calculations for different types of train you're going to get different results.  I haven't done the math on a shinkansen yet, but I'll bet that no layout is big enough to slow it down at prototypical rates from a prototypical top speed of 83.3m/s.


To summarise:


1. I tested how slow I could run a model without it stalling to get a minimal slow down speed v(f);

2. I converted v(f) to real world scale by multiplying by 150;

3. I looked up the prototypical maximum speed v(i) and deceleration a for the train in question;

4. I calculated the time it took to slow down from v(i) to v(f);

5. I calculated the distance covered in that time;

6. I converted the distance back to N scale by dividing by 150.


Mrs_Ghan thinks I'm a looney, but gawd I'm glad I took Physics ... geez I hope I didn't make a mistake.





  • Like 1
Link to comment

Well for a 400 series shinkansen using your equations I came up with:

1. Initial Velocity v(i) = 66.6m/s

2. Final Velocity v(f) = 3.75m/s 

3. Acceleration a = -.715m/s2

4. Time t = 87.9s

5. Distance d = 3091.95m


or 20.6m in n scale, That definatly is a little out of our ability to model.  I think most of us a at least at the next station if not past it by then.


Now, I was curious and decided to reverse the math a bit.  How fast would it be decelerating for my planned stations? (If I mess this up I apologize.)

My station is going to be 1m long so 150m in full scale.




t=4.25 Seconds


I am pretty sure that is right....  How fast is the negative acceleration into the station anyway?



a=-14.73 m/s2


Hmm how many G's is the train pulling?

1 g = 9.80665 m/s2


g=-1.50 g


In summary, it looks like I put some force on my n-scale riders when my shinkansen pull into station but nothing too extreme.  They are just getting sports car like acceleration ^^;

Link to comment

Hi mamochan,


Yes, a shinkansen takes a loooong time to slow down.  So the question is do you go prototypical and allow 2-3 laps of the track to slow down or do you hit the brakes hard?


Personally, I think model trains running at high speed on small layouts (less than 5-6m long) look a bit silly when they hit the curves anyway.  I wouldn't run a shinkansen at more than about half its prototypical cruising speed ... and I'd happily take those 2-3 laps of the track to slow down.  That's how I used to do it as a kid with my British steam.


I didn't check your reverse math, BTW, but I'll take your word on the -1.5g.  Those poor little N-scale people !!!  :grin





  • Like 1
Link to comment

With this enlightening information I think I am only going plan to only have a stretch of about 8 feet that will actually be full speed.  It is a straight section along a wall that goes into a bridge over my aquarium that I am designing.

Link to comment
Martijn Meerts

You should me it go through the aquarium :) It's actually an idea I toyed with a little bit a while ago :)

Link to comment

Thanks for this great write up!!!! I have all my switches working off my computer (JRMI) and am just starting to look into "blocks" and now I finally understand the concepts of how it works. When I am ready to start this phase of my set up I will start a new thread to document and ask questions as I go.

Edited by surfingstephens
Link to comment
Martijn Meerts

Good to hear such an old post is still useful :)


I was planning on adding more stuff, but things keep popping up that keep me busy. If you have any questions though, feel free to ask.

Link to comment
Martijn Meerts

The general idea of block detection doesn't change, so even though it's an old post, it's still valid.


That said, computer control programs have improved, and in many cases you can get away with 1 detection section per block. Programs can keep track of train speeds and deceleration, so if you set everything up correctly, you can get very accurate stopping of trains without a specific stop section. It does require more time though, and since train driving characteristics change over time, the stopping might become less accurate.


Personally, I still go for the brake and stop section combination for my blocks.

  • Like 1
  • Thanks 1
Link to comment

I would like to add that threadle type sensors are the most accurate if the front car doesn't have lights in it, so it can't trigger current sensors. The Tomix TCS sensors work just like TTL level pushbuttons (5V 10k pullup, pull to ground on sense) and could also provide direction info in analog mode. Accidentally they are the nearest in operation to the balise based japanese ATC/ATS systems. (this means they can be used to add sound effects and automatic override during manual operation) Kato had a similar sensor in the past but switched to a more complex optical variant.

Link to comment

These are great, what I don't understand how you wire the sections, I assume they are some type of non-track power detection, like IR dots.  But how to you get their information back to RR&Co?

Link to comment



Are you asking what goes between RR & Co Train Controller and the track sections?


If so, the simple answer is "block detection hardware".  Train Controller is compatible with many of the different brands of DCC system.  You cans see a list here.


I use Digitrax.  In it's simplest form, for train control with a PC, you need:

  1. A starter set such as the DS52;
  2. A Decoder in each power car.  The DZ126 and DZ123 are my decoders of choice.  Kato has the EM13 for their DCC ready trains, which happens to be manufactured by Digitrax;
  3. An Occupancy Detector.  This one will do 4 section; and
  4. A Loconet to USB interface.

There's a whole lot of other options available for controlling other aspects, such as turn-outs, signalling, and Transponding (proprietary ability to know which train is where), which is also included in the Kato decoders.


You don't need to use Digitrax.  Other DCC systems are just as good.  All have their pros and cons.  It's just a matter of what works best with you.



  • Like 1
  • Thanks 1
Link to comment

I was more specifically asking about the stop section, where a sensor is used, not a block.  I have since found out I can us a DAC 20, which i was favoring for my turnouts, but it also has sensor inputs, so i can kill 2 birds on that one.  Found this while looking at IR-Dots, and a install guide for the DAC 20 popped in the google results. 

Link to comment
Martijn Meerts

If you're going computer control, you'll still want blocks, since the software will need to know where trains are on the layout. Which method you use to detect wether a block is occupied or not doesn't really matter.


Occupancy detection by detecting the current in blocks is the most common one, since it doesn't require any visible hardware to be added to the layout, and the detectors are cheap. It's also proven to be very reliable. However, IR detection, reed contacts, or even some sort of physical switch are all possibilities. A lot of digital systems will allow for a variety of inputs.


Link to comment

This will end up being a specific example of a setup, Loco-net based architecture.


Command Station

BXP88 for Block detection, one of the 8 zones for the each Block, which is also used as the Brake Section.

DAC20 with IRDOT-1D for detection for the Stop Section, this also can control switches.


There are many ways to skin this cat, I happen to need 5 switches and 3 blocks/detections each way on my layout.  So 1 BXP88 (8 blocks) and 2 DAC20 (8 switches/10 sensors) and 6 IRDOT-1D cover what I need.  I won't be detecting the blocks outside my "station".



Edited by EdF
Link to comment
Martijn Meerts
7 hours ago, xten said:

Very good topic, but where can I found the lost images for more clarification. Thank you very much.


Didn't think I still had them, but apparently I've gotten better at making backups. I've re-added the images for this one. I'll re-add them for chapter 2 as well, but the videos in chapter 1 and 2 are no longer usable, since they're Flash videos 🙂


  • Like 3
Link to comment
2 hours ago, Martijn Meerts said:


Didn't think I still had them, but apparently I've gotten better at making backups. I've re-added the images for this one. I'll re-add them for chapter 2 as well, but the videos in chapter 1 and 2 are no longer usable, since they're Flash videos 🙂


Many thanks for your kindness. ❤️

  • Like 1
Link to comment

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...