User:X-BT/Edge detectors

From #openttdcoop wiki

< User:X-BT
Revision as of 14:57, 17 July 2009 by X-BT (Talk | contribs) (Changed text to match new image)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Edge detectors are circuits that output a pulse when the input changes state. In TTD that is a pulse for each transition from red to green or from green to red. This type of circuit is commonly used in train counters. A signal connected to a block on the line will be red while a train is passing, and green otherwise. The counting circuit usually requires a short green pulse to advance one step. This is solved by using some sort of edge detector, that outputs a pulse for every rising or every falling edge. I have experimented with a couple of different designs for edge detectors. Those I present here are both simple, compact and reliable (no chance of jamming). Other designs I have looked into include the use of a NOT-gate to control a pulse generating train. The design used in PSG 149 is of this kind (not my work). Also a single train NOT-gate (which occationally jams) can be modified to an edge detector that also jams sometimes and therefore misses some of the edges.

Basic idea

The basic idea was to modify a two train NOT-gate to make an edge detector with only two trains running in a signle loop. This two train NOT-gate works by letting the trains run around the circle while the input is green. The output is then connected as an AND (same principle as prios) between two the blocks. The blocks will never be green at the same time unless both trains are waiting for the input to turn green. We need the output to be red when both trains are running and when both trains are waiting, and green for a short time either when they start or when they stop. This will result in a red to green or a green to red detector as described above.

How I implemented them?

Both my designs uses an AND of three blocks in the loop. This means that the output only turns green when all three blocks are green. The idea behind the green to red detector is to let the output turn green for a short time when the first train has stopped. To achieve this I input the the block behind the waiting point to the AND gate. The block on the opposite side of the loop is large enough to fit a train and is not connected to the AND. Also the block just before the waiting signal can not be connected to the AND, as this would mean that output could only be red when the first train had stopped. So the block that the second train waits in must also be connected to the AND gate. With these requirements stated, it was only a matter of tuning the signal placement before it worked correctly.

The red to green is quite opposite. The block where the first train is waiting is connected to the AND gate, but not the block where the second train is waiting. The idea is to generate a short green pulse when the first train have left its waiting block. This means that the block that this train is entering must not be connected to the AND gate, and it must be large enough to fit the train. To stop the second train from reaching the block connected to the AND gate at the instant the first train has left, I added a pre sign to delay it. When the second train is in the block behind the waiting signal the first train will be in a block covered by the AND gate.

Examples

The red to green detector to the west is a copy of my first working edge detector. The middle one is a more compact version. The green to red detector is also a redesign of a less compact version. The compact designs have been tested both with maglev Lev4 'Chimaera' and with these monorail trains. The less compact editions was made with 'AsiaStar' (Electric). I do not guarantee that they will work with other trains or other config, but you should be able to get them working by tweaking the signal placement and loop length.

X-BT Edge detectors.png

Powered by MediaWiki
  • This page was last modified on 17 July 2009, at 14:57.