$pickup and signals I can`t get signals to clear
#1
Posted 21 September 2017 - 07:26 AM
However, the last signal before the consist always remains red. If the signal is cleared to proceed in the dispatch viewer, the light engine will pickup the static consist in trainahd mode.
It makes no difference if the $pickup is in the station or dispose field.
If signals are deleted in some cases the pickup is successful, but in others the loco halts at the last node before the static consist.
I have replicated the problem in a simple test route.
I expect I`m doing something silly, but as I have spent hours any help would be appreciated
rick
#2
Posted 26 September 2017 - 12:46 AM
Is $callon needed for to pass a stop signal? Or was it superseded in the May17 update?
With callon the signal did clear, and then I made some changes, and now it doesn`t!
Here is my attempt at integrating callon into my stop signal script. I would be grateful someone would check this, as I don`t fully understand the syntax.
//cleared to show natural state?
block_state() !=# BLOCK_CLEAR ||
// Block ahead not clear?
!route_set())
// Switch not set as per link?
{ state = SIGASP_STOP; }
else if (block_state == #BLOCK_OCCUPIED && TrainHasCallOn() ){
// clear on occupied track and CallOn allowed
state = #SIGASP_STOP_AND_PROCEED; }
else { state = SIGASP_CLEAR_2; }
// Get draw state
draw_state = def_draw_state (state);if (!enabled ||
// Not enabled
thanks, rick
#3
Posted 26 September 2017 - 03:09 PM
if (enabled && route_set() )
{
if (block_state == #BLOCK_CLEAR)
{
// normal clear, e.g.
state = #SIGASP_CLEAR_1;
}
else if (block_state == #BLOCK_OCCUPIED && TrainHasCallOn() )
{
// clear on occupied track and CallOn allowed
state = #SIGASP_STOP_AND_PROCEED;
}
else
{
// track is not clear or CallOn not allowed
state = #SIGASP_STOP;
}
}
// Get draw state
draw_state = def_draw_state (state);
With this script both player and AI trains will now pass a stop signal and perform a pickup or transfer, under a restricted aspect in the track monitor. They would not without the callon added to the signal script.
So I guess the next step is to ask Rob if this is what was intended, or for clarification if I`ve been mistaken.
rick
#4
Posted 29 September 2017 - 10:24 AM
It is indeed necessary to use TrainHasCallOn (or TrainHasCallOn_Restricted, see manual for differences).
Because all actions on a signal are performed through the script, it is not possible to 'directly' change the state of the signal in case of a call-on situation (such as callon, pickup, attach, transfer). There has to be some function within the script for which the returned result can reflect that state. To change the Blockstate in such a situation would not be proper - the section ahead is occupied, the fact that the train needs to access that section to pickup or anything does not change the blockstate.
There is no other function which could be used, so the TrainHasCallOn function has been set up to perform this test.
Regards,
Rob Roeterdink
#5
Posted 29 September 2017 - 10:44 AM
Knowing that I`m on the right lines in changing the signal script is a great boost, and I can now go ahead in confidence.
When you get chance, I suggest mentioning the need for callon in the signal script, for pickup, attach, transfer in any revision of the manual.
Perhaps some of the signal experts on ET might like to offer a substitute stop signal script incorporating callon, for those who might be attempting to write a timetable using an existing route.
I will try, but I only partly understand the script syntax. At least my script above is partly working. ( The aspects in track viewer and train behaviour is correct, but I seem to have lost the signal animation)
Thanks again for providing these superb new functions,
rick
#6
Posted 30 September 2017 - 08:49 AM
#7
Posted 30 September 2017 - 09:39 AM
#8
Posted 30 September 2017 - 03:12 PM
Yes ebner, generally scripts are more forgiving than config files, but a missing white space will still crash MSTS even if OR accepts it.
To recap,
I`m trying to alter an existing stop signal script to clear when in OR the "train has callon()" function is true. The train has the callon flag set by the commands $attach $pickup $transfer etc in the station or dispose fields in the timetable.
Without modifying the signal script the stop signal will never clear, and the halted train is in danger of blocking the whole timetable.
My current script now clears signals for callon ok, but the signal remains clear after the train has passed and even after the attach is completed.
Does the code cancel the callon flag when the attach is completed so that train has callon () becomes false, returning the stop aspect?
Perhaps the problem is that my signal only has 2 aspects stop and clear_2 . whereas there are 3 conditions in the script - clear, block occupied, and block occupied with callon.
I have had block occupied with callon return a restricting aspect. This worked fine in the track monitor, but froze the signal displayed in game. So maybe I need 3 aspects in the sigcfg as well.
My script now looks like this
SCRIPT LSWRStop
// Stop
extern float block_state ();
extern float route_set ();
extern float def_draw_state ();
extern float state;
extern float draw_state;
extern float enabled;
extern float TrainHasCallOn ();
if (enabled && route_set() )
{
if (block_state == #BLOCK_CLEAR)
{
// normal clear, e.g.
state = #SIGASP_CLEAR_2;
}
else if (block_state == #BLOCK_OCCUPIED && TrainHasCallOn() )
{
// clear on occupied track and CallOn allowed
state = #SIGASP_CLEAR_2;
}
else
{
// track is not clear or CallOn not allowed
state = #SIGASP_STOP;
}
}
// Get draw state
draw_state = def_draw_state (state);
#9
Posted 30 September 2017 - 03:43 PM
rickloader, on 30 September 2017 - 03:12 PM, said:
I'd write your script like this:
SCRIPT LSWRStop // Stop extern float block_state(); extern float route_set(); extern float def_draw_state(); extern float state; extern float draw_state; extern float enabled; extern float TrainHasCallOn(); if (enabled && route_set() ) { if (TrainHasCallOn()) // clear on CallOn state = SIGASP_CLEAR_2; else if (block_state == BLOCK_CLEAR) // normal clear state = SIGASP_CLEAR_2; else // track is not clear or CallOn not allowed state = SIGASP_STOP; } // Get draw state draw_state = def_draw_state(state);
I can't speak to how the "Call-on" routines work internally, but the case of a Call-on should be above track occupancy or being enabled I would think..though I cannot imagine a signal in a Call-on state that is also not enabled. In theory there is nothing wrong with a signal in a Call-on state not returning to Stop immediately when the head-end of the train passes it. For mechanical and interlocked signaling, that would happen whenever the signalman gets around to it anyways. But if the signal is no longer enabled then it should return to Stop at that time anyways.
#10
Posted 30 September 2017 - 04:30 PM
I`m not worried about the signal returning immediately as that is just cosmetic, but if it also gives a clear to following trains that might lockup the timetable. I need to run more tests, but a second train running in the opposing direction did ignore the signals stuck at clear for the callon.
Rob has said that we do need callon with attach, pickup etc and for now we just need signals to clear correctly, avoiding blocked trains from jamming stations.
My route also has specific calling on signals, but the immediate need is to get simple stop signals working.
Rob`s new functions ( pickup,transfer etc) offer awesome scope, and the rewards for tweaking the signals are immense. I have 3 mail trains exchanging vans exactly as timetabled in 1954, but at the moment I have to act as dispatcher clearing some signals.
rick
#11
Posted 05 October 2017 - 12:44 PM
we need a "if not enabled state = stop" type statement. so that signals reset to stop.
For the callon we need a restricting aspect if the following are true - train has callon, route is set, block is occupied.
And for clear, just a block state = clear.
For the callon I have just strung together all the conditions with "and". It isn`t elegant but it does seem to work.
So here is the latest ,nearly working. Not sure it is correct- needs more testing
SCRIPT LSWRStop
// Stop
extern float block_state();
extern float route_set();
extern float def_draw_state();
extern float state;
extern float draw_state;
extern float enabled;
extern float TrainHasCallOn();
if (!enabled ||
// Not enabled/cleared to show natural state?
block_state() !=# BLOCK_CLEAR ||
// Block ahead not clear?
!route_set()) // Switch not set as per link?
{
state = SIGASP_STOP;
}
if (enabled && route_set() && TrainHasCallOn() && block_state() !=# BLOCK_CLEAR )
// clear on CallOn
{
state = SIGASP_RESTRICTING;
}
else if (block_state == BLOCK_CLEAR)
// normal clear
{
state = SIGASP_CLEAR_2;
}
// Get draw state
draw_state = def_draw_state(state);
Joseph`s tutorials have been a tremendous help - thanks!.
#12
Posted 06 October 2017 - 09:14 AM
So in the sigcfg signal type I have added another signal aspect - RESTRICTING "purple" and added a purple entry in the ltex section.
LightsTabEntry (
"Purple Light"
colour ( 255 129 0 127 )
)
Actually the LSWR never had purple for callon, but it is useful for testing.
As the route builder can`t know which signals will need a callon capability ( as set by the timetable), it seems desirable that most stop signals can have callon . Is there any reason why not?
In the UK there were specific Callon signals, but also ground (shunting) signals authorized a local move into an occupied block. (Of course in MSTS/ OR an occupied block means something different to the prototype).
I`m discussing this at length because I`m not the best person to explore signalling, having zero programming skill. So I welcome any contribution.
But I strongly believe that the timetable features, (pickup, transfer etc) deserve supporting signalling.
Here is an extract for the test stop signal cfg.
SignalType ( "LSWRStop"
SignalFnType ( NORMAL )
SignalLightTex ( "ltex" )
SemaphoreInfo ( 0.5 )
SignalFlags ( SEMAPHORE )
SignalLights ( 3
SignalLight ( 0 "Red Light"
Position ( -0.3 0 0.05 )
Radius ( 0.08 )
SignalFlags ( SEMAPHORE_CHANGE )
)
SignalLight ( 1 "Green Light"
Position ( -0.3 0 0.05 )
Radius ( 0.08 )
SignalFlags ( SEMAPHORE_CHANGE )
)
SignalLight ( 2 "Purple Light"
Position ( -0.3 0 0.07 )
Radius ( 0.05 )
SignalFlags ( SEMAPHORE_CHANGE )
)
)
SignalDrawStates ( 3
SignalDrawState ( 0
"Red"
DrawLights ( 1
DrawLight ( 0 )
)
SemaphorePos ( 0 )
)
SignalDrawState ( 1
"Green"
DrawLights ( 1
DrawLight ( 1 )
)
SemaphorePos ( 1 )
)
SignalDrawState ( 2
"purple"
DrawLights ( 1
DrawLight ( 2 )
)
SemaphorePos ( 1 )
)
)
SignalAspects ( 3
SignalAspect ( STOP "Red" )
SignalAspect ( CLEAR_2 "Green" )
SignalAspect ( RESTRICTING "Purple" )
)
SignalNumClearAhead ( 3 )
)
#13
Posted 06 October 2017 - 03:52 PM
To answer my question about most stop signals having callon - it also allows callon in free line sections.
In my route callon will only be in booked station platforms so I need TrainHasCallOn_restricted() .
The manual also says that the check for block occupancy should be block_state == #BLOCK_OCCUPIED , so I have altered the script accordingly.
Testing suggests that the revised script maybe ok!
SCRIPT LSWRStop
// Stop
extern float block_state();
extern float route_set();
extern float def_draw_state();
extern float state;
extern float draw_state;
extern float enabled;
extern float TrainHasCallOn();
if (!enabled ||
// Not enabled/cleared to show natural state?
block_state() !=# BLOCK_CLEAR ||
// Block ahead not clear?
!route_set()) // Switch not set as per link?
{
state = SIGASP_STOP;
}
if (enabled && route_set() && TrainHasCallOn_restricted() && block_state == #BLOCK_OCCUPIED )
// clear on CallOn
{
state = SIGASP_RESTRICTING;
}
else if (block_state == BLOCK_CLEAR)
// normal clear
{
state = SIGASP_CLEAR_2;
}
// Get draw state
draw_state = def_draw_state(state);
#14
Posted 06 October 2017 - 04:20 PM
SCRIPT LSWRStop // Stop extern float block_state(); extern float route_set(); extern float def_draw_state(); extern float state; extern float draw_state; extern float enabled; extern float TrainHasCallOn(); if (enabled && route_set() ) { if (TrainHasCallOn()) // clear on CallOn state = SIGASP_CLEAR_2; else if (block_state == BLOCK_CLEAR) // normal clear state = SIGASP_CLEAR_2; else // track is not clear or CallOn not allowed state = SIGASP_STOP; } else // show Stop for bad route/state state = SIGASP_STOP; // Get draw state draw_state = def_draw_state(state);
That's definitely a goof on my part. The scripts I write, I usually reset the state to Stop at the start of each script, but did not do that above while continuing to rely on it. I've made a simple correction here.
rickloader, on 06 October 2017 - 09:14 AM, said:
In the UK there were specific Callon signals, but also ground (shunting) signals authorized a local move into an occupied block. (Of course in MSTS/ OR an occupied block means something different to the prototype).
This is a fairly complicated topic, which I considered bringing up earlier, but decided to spare everyone. It's complicated because of the different ways signaling is implemented and because of how MSTS/OR implement it.
A "call-on" is an intentional invitation by the control operator (dispatcher, signalman) for a train to proceed past an absolute (Stop and stay) signal into a known-occupied signal block. A "call-on" is always indicated by signal aspect. Verbal or written authorization to pass a signal at Danger is a separate situation. Call-ons are useful in situations where trains need to queue up around a passenger station, for example.
The simplest case is in the United States (and Canada). Absolute signals can be given the ability to show a "call-on" state, which usually shows a Restricting aspect and indication to the train. "Restricting" always means proceed slowly on sight, prepared to stop for whatever reason without causing an accident. The signal would otherwise be showing Stop. A few designs of US signals could even change themselves from absolute signals to showing a permissive (Stop and proceed) indication when in the call-on state; but most signals could not do this because a number plate is their only difference between absolute and permissive, and those cannot just be turned on/off. But in all cases, the signal responsible for stopping the train is the same one responsible for conveying the call-on indication. Signals had to be especially equipped to be able to do this (e.g. to be able to show the Restricting aspect). If a signal could not show that aspect, it could not be setup to do call-on runs, either.
In many other parts of the world, the "call-on" state is shown by a special, and sometimes dedicated, signal. This signal can be part of the regular absolute signal (e.g. a Call-on semaphore arm below the Home arm[s]) or a separate signal at the same location as the absolute signal. These special signals were developed because showing a regular Clear for a Call-on is not appropriate because it implies the track is clear when it is not. Conversely, manually granting authority to pass a signal at danger removes the protection of interlocking devices which greatly increases the risk of human error inducing an accident. The Call-on signal thus gives a special aspect to trains so there is sure indication of what is going on (e.g. proceed on sight, expect the track to be occupied) while still being subject to interlocking protection (e.g. call-on can't be shown if switches aren't locked, other conflicting routes active, etc.). Here, the signal responsible for stopping the train may not be the same one conveying the call-on indication. But signals so capable are still especially equipped as in the US.
The problem here the way MSTS handles signal indications that regulate trains: each signal object/track marker is independent. If the Home signal and Call-On signal are on the same signal shape, there is no problem. But if they're separate... the game doesn't really know that it's okay to pass the STOP indication because the signal 0.3 m away in the track database is a Call-on Signal which is allowing the train to proceed. Thus it becomes necessary to construct signal shapes in such a way that the Home and Call-on signals can appear to be separate structures but are the same .s file. That way there is only one track maker, and there are no competing SIGASP_STOP indications at a Call-on location. SIGASP_RESTRICTING is the appropriate indication for a Call-on signal that is engaged.
These same constraints and complications apply to Shunting signals as well, with the caveats: Shunting signals can appear anywhere and not have an associated Home/absolute signal with them; and Shunting signals only apply to trains doing shunting/switching operations—train movements not doing shunting typically totally disregard them. In the case of stand-alone Shunting signals without an absolute signal, they should only show to trains (on the Track Monitor) that have passed another Shunting allowed indication, but should otherwise be invisible on the Track Monitor/etc. But MSTS and OR do not allow this level of sophistication. Of course, there is the SHUNTING type of signal head, which is fine to use, except it can never impose any real authority on a train (e.g. end an activity if passed at Shunting not allowed).
#15
Posted 06 October 2017 - 05:05 PM