¿ªÔÆÌåÓý

LogixNG best way with multiple sensors


 

Hi, I am looking for some best practice advice / guidance here.
?
I am configuring a prototypical (UK Entrance Exit) panel with lots of fussy things that need to happen when the physical buttons are pushed. It will be about twenty buttons, already configured in JMRI as sensors and already in a sensor group so only one button will be active at any one time.? I have a requirement which initially sounds simple - whenever a button is pressed, I want to go and do some processing which needs to know which button triggered the process.
?
Approach number one - twenty ConditionalNGs one for each button. When a ConditionalNG fires, it sets a [global] variable to note which button (ie which ConditionalNG) was pressed and then calls a common module to do the processing. The module can then look at the variable to see which button caused things to happen. I think I can make that work, but twenty almost identical ConditionalNGs feels a bit clumsy and error prone.
?
Approach number two - a single ConditionalNG which is set to react to any of the sensors going active (presumably an "or"). Again, it would need to identify which sensor caused the trigger and save the detail to a variable before calling a module to do the processing.? That feels like it would be neater, but I haven't found a way to let a ConditionalNG know which specific sensor triggered it.
?
Approach number three - the obvious and much better approach which has completed eluded me so far!
?
Any thoughts or suggestions very welcome.
?
Some background of what will go on in the later processing (more for interest than anything). Each button can be either an Entrance to a route, and Exit, or both. The first button to be pressed has to be an entrance (exit buttons will be ignored). The light in the entrance button will then start to flash. The next button to be pressed should then be an exit button. If there is no valid route from entrance to exit, the flashing entrance button light will go dark and the process starts again. If there is a valid route, then the light will go steady and the route will start to set (probably using standard JMRI routes to do that).........
?
Maybe that explains why I am looking for any one of the 20 buttons to trigger the same process (where the logic will be), but that I do need to know which button was pressed.
?
Hopefully, the question makes some sense!
?
Thanks, Nick.


 

Nick,

Are you using the JMRI Entry/Exit tool? ?See?

Dave Sand


----- Original message -----
From: "nicklocke via groups.io" <nick.locke=[email protected]>
Subject: [jmriusers] LogixNG best way with multiple sensors
Date: Friday, May 02, 2025 11:44 AM

Hi, I am looking for some best practice advice / guidance here.
?
I am configuring a prototypical (UK Entrance Exit) panel with lots of fussy things that need to happen when the physical buttons are pushed. It will be about twenty buttons, already configured in JMRI as sensors and already in a sensor group so only one button will be active at any one time.? I have a requirement which initially sounds simple - whenever a button is pressed, I want to go and do some processing which needs to know which button triggered the process.
?
Approach number one - twenty ConditionalNGs one for each button. When a ConditionalNG fires, it sets a [global] variable to note which button (ie which ConditionalNG) was pressed and then calls a common module to do the processing. The module can then look at the variable to see which button caused things to happen. I think I can make that work, but twenty almost identical ConditionalNGs feels a bit clumsy and error prone.
?
Approach number two - a single ConditionalNG which is set to react to any of the sensors going active (presumably an "or"). Again, it would need to identify which sensor caused the trigger and save the detail to a variable before calling a module to do the processing.? That feels like it would be neater, but I haven't found a way to let a ConditionalNG know which specific sensor triggered it.
?
Approach number three - the obvious and much better approach which has completed eluded me so far!
?
Any thoughts or suggestions very welcome.
?
Some background of what will go on in the later processing (more for interest than anything). Each button can be either an Entrance to a route, and Exit, or both. The first button to be pressed has to be an entrance (exit buttons will be ignored). The light in the entrance button will then start to flash. The next button to be pressed should then be an exit button. If there is no valid route from entrance to exit, the flashing entrance button light will go dark and the process starts again. If there is a valid route, then the light will go steady and the route will start to set (probably using standard JMRI routes to do that).........
?
Maybe that explains why I am looking for any one of the 20 buttons to trigger the same process (where the logic will be), but that I do need to know which button was pressed.
?
Hopefully, the question makes some sense!
?
Thanks, Nick.


 

Hi Dave,
?
I'm not [yet].? I did have a look a while ago.? I think it will "out of the box" cope with setting a route between two buttons/sensors, but I don't think it will handle the complexities of flashing button lights etc.? Are you suggesting that I could use the Entry/Exit tool to handle the actual route setting, and then do something extra to drive the "button display oddities"?
?
I think, ultimately, it would still be good to now how best to get LogixNG to understand which one, from a number of sensors, triggered an action.
?
Thanks,
?
Nick


 

Nick,

The blinking icons, the route selection and highlighting and releasing signals are all part of the JMRI tool.

Here is a small movie: ?

For your LogixNG question, look at "Listen on beans" in?. ?JMRI objects such as turnouts and sensors are implemented using Java Beans.

Here is an example of a "Listen on beans" action.
And the LogixNG.

A sensor group is used to insure that only one sensor can be active.


Dave Sand



----- Original message -----
From: "nicklocke via groups.io" <nick.locke=[email protected]>
Subject: Re: [jmriusers] LogixNG best way with multiple sensors
Date: Friday, May 02, 2025 1:22 PM

Hi Dave,
?
I'm not [yet].? I did have a look a while ago.? I think it will "out of the box" cope with setting a route between two buttons/sensors, but I don't think it will handle the complexities of flashing button lights etc.? Are you suggesting that I could use the Entry/Exit tool to handle the actual route setting, and then do something extra to drive the "button display oddities"?
?
I think, ultimately, it would still be good to now how best to get LogixNG to understand which one, from a number of sensors, triggered an action.
?
Thanks,
?
Nick


 

Fantastic - thanks for taking the time.? I need to read the Entry/Exit stuff again!??Thanks also for the example.
?
Just in case anyone is interested, this is the hardware panel....
?
?
Cheers,
?
Nick


 

Wow Nick that looks fantastic!
Brett