Rail3D*


 

German Distant Signals



Vr2

Hp2

In the classic German “Hp/Vr” signalling system, there are the usual “Stop” and “Clear” aspects (Hp0 and Hp1 for main signals, Vr0 and Vr1 for distants) but there is also a third aspect, Hp2/Vr2, which allows trains to pass the main signal at a reduced speed (normally 40km/hr). This corresponds to the “J” state in Rail3D.

One way that you can model this is to make sure that the track over which the routes corresponding to the “J” state run is provided with a speed limit. However, it would be nicer if the automatic driver recognised the Vr2 aspect as a warning to reduce speed.

It is possible to implement this by adding a simple script to the distant signals.

When a train passes the distant signal, the script tests whether the next signal (the corresponding main signal) is in the J state. If it is, and the train’s existing speed limit is greater than 40km/hr, it changes the train’s speed limit to 40km/hr.

Notice that nextsig is only assigned in the OnTrain() function, not Init(), because the function Signal.NextSignal() only works when a route has been set from the signal. Of course, a distant signal can only have one corresponding main signal, but Rail3D doesn’t know that.

Note that, if you use signals incorporating this script, you will have to place speed limits in the appropriate places to restore the train’s speed to normal when it has passed the pointwork protected by the Hp2 aspect.

 Init()
 {
	//Script for distant signals capable of showing Vr2
	//sets speed limit of train to 40km/hr on passing distant
	//place a speed limit manually at the end of the pointwork
	//to restore trains to line limit
	//mh  28.04.2005



	signal nextsig;  

	//speed limit in m/s
	float jlim=40/3.6;

 }
 OnTrain()
 {
	nextsig=Signal.NextSignal();  //find the corresponding main signal
	float lim=Train.GetLimit();

	if((lim>jlim)&&(nextsig.IsJct()))
	{
		Train.SetLimit(jlim);
	}
 }


import