Speed Proving


Prototypical railways sometimes have signals that clear only when an approaching train is proven to be travelling at a speed below a predetermined threshold. These sorts of arrangements are used to enforce speed limits where it is of particular importance that the train be not exceeding any limit.

How it works

There is usually a device of some description located before the signal, which measures the speed of an approaching train. If the train speed is below the threshold, the signal in question will clear (if a route is available).

This sequence of images shows a train travelling at an acceptable speed, where the route is set for the diverge. (Note: S.D. stands for Speed Detector; its symbol is not conventional by any means…)

On the other hand, if the train speed is too great, then the signal will fail to clear. In this case, the train may be required to come to a stand, a certain amount of time must elapse, or some other extra condition must be satisfied, before the signal will clear.

In the following sequence, the train comes to a stand before signal B before being allowed to continue.

This doesn’t prevent trains running red signals and causing spads, but additional safeguards, such as trainstops, may limit the danger caused by a spad in these cases. I think it’s even possible to get cases where the signal will clear but the trainstop remains raised until the train is below the speed limit, thus tripping the train if it is still too fast when passing the signal.

Uses in Rail 3D

Scripting a speed-proving signal is fairly pointless in Rail 3D, unless:

  • you want the authenticity when driving trains around your layout, or
  • you plan to deliberately have some Rail 3D-driven trains approach the signal too fast

The other, more conventional, way of doing it is with a simple hold/release arrangement.

How to script it

Set up the whole arrangement as follows:

  • Let’s call the speed proving signal “B”, and the signal in the rear “A” (as per the above diagrams).
    • It doesn’t matter if signal A is controlled or automatic.
    • Signal B can be either controlled or automatic, but usually you’ll want it to be controlled. Be sure to set the Hold flag.
  • Insert a new signal in place of the speed detector. Set the Hidden and Repeater flags. We’ll call this signal “sd” (for speed detector).
  • Insert a node about 25m in the rear of signal B. Link a new release to signal B on this node. Make sure that any train stopping at signal B will have passed this node in order to come to a halt.
  • Insert a new signal on the first node in advance of signal B. Also set the “Hidden” and “Repeater” flags for this signal, which we’ll call “C”.

The intention is:

  1. A script on signal sd measures the train speed.
  2. If the train is slow enough, it unsets the Hold flag on signal B. This should also cause signal B to clear if possible.
  3. If the train is too fast, signal B will remain at danger until the train passes the release just before signal B, by which stage it should have almost come to a stop.
  4. A script on signal C re-sets the Hold flag on signal B in preparation for the next train to arrive.

Now you need to add some scripts.

  • On signal sd:
	float spd;
	signal sigx;


  • And on signal C:
	signal sigx;


In this case, the threshold speed is 7 m/s, which is about 16 mph or 25 km/h. I used this speed in a fictitious example involving the descent of a train down a steep hill into a yard, where trains going too fast were theoretically diverted into a runaway siding.


  • We use a signal to detect the speed because no other static objects are capable of taking scripts. Ensure you designate it as a repeater signal otherwise you’ll mess up your signalling.
  • There’s no reason you couldn’t put the “speed detector” elsewhere, or even have more than one of them.
  • Remember to use speed values in m/s (not mph or km/h) when writing scripts. (Conversion: 1 m/s = 2.25 mph = 3.6 km/h)
  • You can add lines to the script so that the speed proving applies only to the diverging route.
  • The poor-man’s version is, of course, a simple hold and release, but isn’t this much more fun? :-)
  • The reason we put the hold resetting script on signal C and not on signal B is that, if you reset the hold on signal B, it will return to danger. Upon doing so, any train moving in the track link section from signal B to the first node in advance of signal B will be stopped and a spad will occur. Thus, you can’t reset the hold until after the train is clear of the first track link after signal B.