Quote:[size=1" face="Verdana" id="quote]quote:Originally posted by frankie
<br />To be honest I haven't catched this "Action & Condition" thing so far [:I], sound like if-then-else in VBScript, correct?
Yes, you could say the "Actions And Conditions" tables represent "IF THEN" statements as in common programming languages.
<u>As an example:</u>
- The layout exists of 3 blocks: B(1), B(2) and B(3). Each block has a feedback item(track occupancy detector) attached to an input of a feedback decoder (Feedback Module(1)).

<u>Scenario for slowing down a train Train(1) before a signal S(1):</u>
The train Train(1) with a speed of 140km/h enters the block B(1).
1.The train speed is set to 100 when signal S(1) is Hp0(red) and B(2) is not occupied and B(1) becomes occupied.
This extra condition "B(2) is not occupied" is necessary when the train covers/occupies both blocks B(1) and B(2) otherwise the train speed would be set simultaneous to 100 and to 50. And this would cause the train to accelarate and to slown down cyclic as long as B(1) and B(2) are occupied.

2. The train speed is set to 50 when S(1) is Hp0 and B(3) is not occupied and B(2) becomes occupied.

3. The train stops when S(1) is Hp0 and B(3) becomes occupied.

In case 3 only one condition is necessary, when the train occupies all three blocks, the actions related to block B(1), B(2) will not be executed as the conditions are not forfilled.
In this simple example all the conditions are set on each action individually.
But there is also the possibility to set one or more conditions that is valid for all the actions. And to make it complicated you can have a mix: global conditions on all actions and individual conditions set per action.
<u>How does the evaluation algo works in LC:</u>
1. First are the global conditions evaluated.
2. When the global conditions are forfilled then the individual conditions set per action are evaluated. Only when all the conditions are forfilled the action is executed.
Important an action on a controllable object is only executed once when the state of the object doesn't change in the meantime.
Example:
A turnout has 2 states: straight and derived.
Thus when a feedback item becomes occupied it will trigger only once the action on this turnout eg. set it straight. Only when another feedback item becomes occupied switching it to derived the first action can set the turnout back to straight when the feedback item is still occupied or becomes again occupied.
Thus as long as a feedback item is occupied it triggers only once an action as long as no other feedback item triggers a different state on this same object. Errors can be seen when the state of a switch object alters continuosly. For a train when speed goes up and down, or a train function is activated and deactivated continously.
Alessandro I hope this explains better the actions and conditions concept implemented in LC. In later versions I would like to simplify this process but you can also use the route concept but this is less powerfull.
With the "Actions and Conditions" concept you are programming yourself a part in LC.

Best regards,
Frank