开云体育

Locked Re: LogixNG and Execute Always/OnChange and Listen/No-listen #logixng


 

I especially like line 6 in the example.

Kind regards,
W-outer


On Sat, 28 Sept 2024 at 00:52, Dave Sand via <ds=[email protected]> wrote:
Jos,

You "listen" for events that need to start the ConditionalNG logic.? For example, the "code" button on a CTC panel.? Other items that provide state information do not need to have "listen" enabled, such as switch and signal lever positions.? In this scenario, changes to the levers don't trigger the CNG.

"On change" only runs if the expression state has changed between true and false. ?"Always execute" will do the "Then" or "Else" depending on the current state of the expression.

Note: For Modules, use "Always Execute" since Modules don't have a change of state.? They are called by a LogixNG (or another Module).

Dave Sand


----- Original message -----
From: Jos Smeele <jossmeele@...>
Subject: [jmriusers] LogixNG and Execute Always/OnChange and Listen/No-listen
Date: Friday, September 27, 2024 5:58 PM

I'm using ConditionalNGs (CNG) quite successfully to help automate my small layout but I'm lacking in understanding how to set certain options for the If-Then-Else flow control.
Where in the example below should I use Execute Always and where Execute OnChange and where do we Listen to a sensor or memory value and where do we turn that off?
Thanks,
Jos
?ConditionalNG: Example

?! A? ? If Then Else. Always execute

? ?? If ? Sensor SantaFe Sside-Syard is Active?? ? //virtual sensor to activate a Dispatch

? ?! Then Many

?? ??? ! A2? ?If Then Else. Always execute

???? ? ? If ?And. Evaluate All

????? ? E1??Sensor Stop W-outer is Inactive? ? ? ? ? ? ? ? ? //check if there is no train on the route AND

????? ? E2??Memory CROSSoccupied is equal to "0"? //check that the dblcrossing is free. Set by a Timed CNG that checks if blocks connected to the dblcrossing are free or not.

????? ? ! Then??Many? //good to go

????? ! A2??Many

????? ? ?? ! A1??If Then Else. Execute on change

??????? ?? If??Sensor Stop RV SyardMID is Inactive?

??????? ?! Then??Many ?//we reached the destination, there are two trains stacked in the yard, hence the mid-yard IR-sensor that is the end for this train

???????? ??? ! A1??Terminate train X_SantaFe_Wout_to_Syard.xml?

???????? ??? ! A2??Set sensor Occupancy S-yard to state Active

???????? ??? ! A3?Set sensor SantaFe Sside-Syard to state Inactive

??????? ?! Else?Many? //the route is clear and we are not yet in the yard so go to Wout which is the point from where we'll reverse the train.

???????? ??? ! A1??Start train using train info file X_SantaFe_Sside_Wout.xml

???????? ??? ! A2??Set memory SFdestination to "Syard"

???? ? ! Else?If Then Else. Always execute??

? ? ? ? ? ? If?And. Evaluate All

????? ? ? ? ? ?? E1?Sensor Stop W-outer is Active? //reached the point where the train needs to reverse into the yard

????? ? ? ? ? ?? E2?Memory SFdestination is equal to "Syard"

? ? ? ? ? ! Then?Many

????? ? ? ? ?? ! A1?Start train using train info file X_SantaFe_Wout_to_Syard.xml

????? ? ? ? ? ?! A2?Set turnout pin44/45 #7 S-yard to state Closed (-)

? ? ? ? ? ! Else

? ?! Else

??

?

?

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