开云体育

Re: Causes for conditionalNGs to not run when expressions are TRUE #logixng


 

Jim,

What is contained in "CtrlStatArray[CtrlPointer]"? ?Since you are testing for ACTIVE, that implies a sensor. ?The "CtrlPointer" index implies an array of sensors. ?If so, you can put the actual sensors in a "Listen on beans" action. ?Whenever one changes state, the ConditionalNG will run. ?

Here is an example.

?????? 1:? LogixNG: East Staging
?????? 2:????? ConditionalNG: Set gChestnut
?????? 3:????????? ! A
?????? 4:????????????? Many
?????? 5:???????????????? ::: Local variable "sensor", init to None ""
?????? 6:????????????????? ! A1
?????? 7:????????????????????? Listen on beans
?????? 8:????????????????? ! A2
?????? 9:????????????????????? If Then Else. Always execute
????? 10:????????????????????????? ? If
????? 11:????????????????????????????? Sensor by local variable "sensor" is Active
????? 12:????????????????????????? ! Then
????? 13:????????????????????????????? Set variable gChestnut to the value of variable sensor
????? 14:????????????????????????? ! Else
????? 15:????????????????????????????? Set variable gChestnut to null

The "Listen on beans" has three sensors. ?When one of them becomes active, the user name is copied to the "gChestnut" global variable.

Note: ?The three sensors are also in a "Sensor Group". ?When one becomes active, the others are inactive. ?Technically, all of them are set Inactive with one being set Active as the last event.

Dave Sand


----- Original message -----
From: "Jim Moomaw - PDX via groups.io" <JMOOMAW_COM=[email protected]>
Subject: Re: [jmriusers] Causes for conditionalNGs to not run when expressions are TRUE
Date: Saturday, February 22, 2025 1:37 PM

I think there are things I don't understand about what causes expressions to fire (or not).? In this case, events sysTCSmode and sysTCSRUNmode are essentially static... they get turned on at the start of an ops session and stay on all day.? The first term array-cell=ACTIVE is what toggles in real-time, and is essentially the trigger.? Putting the kicker-clock in the first expression group with these fixes the problem; the following two IF clauses fire properly, but its probably a workaround to the non-triggering events that follow.?
?
Dave, you mentioned "direct events are sysTCSmode and sysTCSRUNmode", which implies array-cell=ACTIVE is not.? Since that's the real trigger I should focus on that with beans.? Further, the audio trigger "end of play" is an important so that's another focus point.? My career programming predated objects, so "beans" fall into the mystery class of JMRI things.
?
Funny, this little "sound & lights" feature I'm trying to add to a CTC panel that's otherwise functional in controlling the layout is really pushing me to learn most of the "odd" JMRI features I'd been avoiding.?? Modules and beans are two more on that list, which is getting shorter.? If DaveS wasn't helping me when I get stuck this would be about impossible.? But he does, so I'm getting there.? JMRI is a funny beast... it can do essentially anything but learning its tricks is a challenge for a legacy programmer.?
--
Jim Moomaw
Portland, OR
- Willamette Model Railroad Club (WMRC)
- NMRA, Pacific NW

Join [email protected] to automatically receive all group messages.