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?
?! 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
??
?