Elvas Tower: Semaphore Junction signals both clearing together - Elvas Tower

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Semaphore Junction signals both clearing together New Forest Route has both arms of a 2 arm Jn_link signal clearing toge Rate Topic: -----

#1 User is offline   rickloader 

  • Conductor
  • Group: Status: First Class
  • Posts: 493
  • Joined: 05-February 13
  • Gender:Male
  • Location:Southampton uk
  • Simulator:Open Rails
  • Country:

Posted 28 July 2023 - 08:02 AM

In the British New Forest Route Junction signals are separate semaphore arms as sub object controlled by a JN_link statement. Normally only 1 signal should clear depending on the junction links set in TSRE by the route builder.
With the current Unstable versions, ORNYMG and the stable 1.51 both signals clear together

I have a new install of New Forest Route and ORTS on W10. Unfortunately I am away from home so I can not check my old install which was working ok from about 3 months ago.
I have checked the signal links in TSRE ("show list") and these are correct. Perhaps I have done something silly or there is a fault in the Github repository.
Please would anyone with a route featuring JN_Link signals check for me, that jn_links work ok in the latest OR?
Here is a typical script. Thanks, Rick

SignalShape (
"SRJct-BS-MS.s"
"SR Jct BStop / MStop"
SignalSubObjs ( 2
SignalSubObj ( 0
"HEAD1"
"Mainline Stop arm"
SigSubType ( SIGNAL_HEAD )
SignalFlags ( DEFAULT JN_LINK )
SigSubSType ( "SRStop" )
)
SignalSubObj ( 1
"HEAD2"
"Branchline Stop arm"
SigSubType ( SIGNAL_HEAD )
SignalFlags ( DEFAULT JN_LINK )
SigSubSType ( "SRStopBranch" )
)

)
)

SCRIPT SRStopBranch

// Branch Stop

extern float block_state ();
extern float route_set ();
extern float def_draw_state ();
extern float state;
extern float draw_state;
extern float enabled;

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;
}
else
{
state = SIGASP_CLEAR_1;
}

// Get draw state
draw_state = def_draw_state (state);

#2 User is offline   rickloader 

  • Conductor
  • Group: Status: First Class
  • Posts: 493
  • Joined: 05-February 13
  • Gender:Male
  • Location:Southampton uk
  • Simulator:Open Rails
  • Country:

Posted 31 July 2023 - 12:55 PM

Martin has kindly run a test on Chiltern Route U2032-07.25-1938 . He reports no problems with linked semaphore signals. thanks m8! so we don`t blame OR , but the Route.
Check OR error log - ok. Try in timetablemode unstable, stable 1.51, ORNYMG - all show same problem. Also some graphical issues on OR, but not ORNYMG (parts of locos not displayed) noted some non linked stop signals cleared at wrong time.
Reset links in TSRE, no good. Deleted and replaced signals - still no good.
Found a backup from 2018 . (my other backups inaccessible at home) The defective signals operate correctly.
Next to do substitute models from backup. Examine signal scripts for errors
The signal problem has been more difficult being away from home, no recent backups and with a different computer. I hope I will be excused asking for help.
Rick



#3 User is offline   eugenR 

  • Conductor
  • Group: Status: Contributing Member
  • Posts: 472
  • Joined: 15-April 13
  • Gender:Male
  • Simulator:MSTS
  • Country:

Posted 01 August 2023 - 11:33 PM

I have noticed, that in the scripts, there is no Line like:

SigSubJnLinkIf ( 2 0 1 )

but I am not shure if in Your case this is needed?

regards
EugenR

#4 User is offline   roeter 

  • Vice President
  • Group: Status: Elite Member
  • Posts: 2,424
  • Joined: 25-October 11
  • Gender:Male
  • Country:

Posted 02 August 2023 - 08:52 AM

View PosteugenR, on 01 August 2023 - 11:33 PM, said:

I have noticed, that in the scripts, there is no Line like:

SigSubJnLinkIf ( 2 0 1 )

but I am not shure if in Your case this is needed?

regards
EugenR

No, that is not needed here. That line is only necessary if the link is optional, setting the flag as identified in this line defines that the link is required.
In this case here, the link is compulsary and therefor this line is not needed.

Now to the problem itself.
Rick, I'm afraid you've got yourself in a bit of a muddle here.

There are two sigcfg.dat and two sigscr.dat - one set in the main directory, one set in the openrails subdirectory (or so it seems ....) .
These two sets are not the same. The script you quote above is from the set in the openrails subdirectory.
But the script in the main directory looks like this :

///////////////////////////////////////////////////////////////////////////////

SCRIPT SRStop

// Stop with callon

	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_Restricted();  

		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);



In this script, there is an 'else' missing - if the first condition (!enabled etc.) is met (signal is not to clear), the state is set to SIGASP_STOP.
But the script then continues with the second if (with the CALLON check), and as that is not met (which it isn't), the state is set to SIGASP_CLEAR2 (as that is the 'else').
Changing the second 'if' to 'else if' would solve the problem.

But, that is only part of the issue. For this is the script in the main directory, so why is the program not using the script in the openrails directory?
Well, I needed my magnifying glass there. For the sigcfg file in the openrails directory is called "sigcfg .dat" - with a space between the 'g' and the '.'.
So the program did not find the sigcfg file in openrails and used the one in the main directory, and so it also used the sigscr file from the main directory.

By the way, the sigcfg.dat file in openrails subdirectory seems to be outdated, when I select that file, there are signals missing.

Hope this helps to sort things out.

Regards,
Rob Roeterdink

#5 User is offline   rickloader 

  • Conductor
  • Group: Status: First Class
  • Posts: 493
  • Joined: 05-February 13
  • Gender:Male
  • Location:Southampton uk
  • Simulator:Open Rails
  • Country:

Posted 02 August 2023 - 01:10 PM

Thank you Rob . The missing "else" in the else if was the cause as you said. I was indeed in "a bit of a muddle" because I completely forgot about the duplicate entry in the Open rails folder. So it became outdated. Linked signals are now working. . I still have some corrections to make shown by Ged`s sigcfg checker.

I am sorry to have taken up a lot of Rob`s time in investigating and writing a clear response. I think that we users should mostly fend for ourselves, and not waste developers time. But I would not have found the missing" else"
So thanks again Rob
Rick






#6 User is offline   roeter 

  • Vice President
  • Group: Status: Elite Member
  • Posts: 2,424
  • Joined: 25-October 11
  • Gender:Male
  • Country:

Posted 03 August 2023 - 01:12 AM

Hello Rick,

no problem, glad to help.
But on the subject of the script - the version I showed above is not correct either. I was a little too quick in stating that the missing 'else' was the error. With this script, the callon no longer works and that clearly causes all sorts of issues.
I think I now worked out the correct script, but it requires some testing. I will get back on this later today.

Regards,
Rob Roeterdink

#7 User is offline   roeter 

  • Vice President
  • Group: Status: Elite Member
  • Posts: 2,424
  • Joined: 25-October 11
  • Gender:Male
  • Country:

Posted 03 August 2023 - 01:56 PM

This is the correct script for signals with call-on :

	if (!enabled ||
                // Not enabled/cleared to show natural state?
	block_state() == BLOCK_JN_OBSTRUCTED ||		
                // Block ahead obstructed
	!route_set())							
                // Switch not set as per link?
	{
		state = SIGASP_STOP;
	}
        else if (block_state() == BLOCK_OCCUPIED )
                // Block occupied - default state is stop but test for callon
	{
		state = SIGASP_STOP;
		if (TrainHasCallOn_Restricted())
		{
                        state = SIGASP_RESTRICTING;
		}
	}
	else
                // normal clear
	{
                        state = SIGASP_CLEAR_2;
        }


I ran a test for a few hours and had no problems, both the multiple arm signals and callon now seem to work correct.
Attached is an update for sigscr.dat with all scripts for signals with callon is adapted to the code as above.

Attached File  sigscr.zip (2.56K)
Number of downloads: 59

Regards,
Rob Roeterdink

#8 User is offline   rickloader 

  • Conductor
  • Group: Status: First Class
  • Posts: 493
  • Joined: 05-February 13
  • Gender:Male
  • Location:Southampton uk
  • Simulator:Open Rails
  • Country:

Posted 05 August 2023 - 12:16 AM

Thanks very much indeed for the revised script. Linked Junction signals now working correctly. Github updated.
NF route is currently a test base for DJW `s Linux version. Linux seems less tolerant of syntax faults than OR , so a spin off will be error reduction for both versions
Thanks, Rick

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users