06-12-2013 01:29 PM
What is the best method to update indicators constantly in a SM ? ...
MY INDICATORS: I want to update the cluster of OUTPUT INDICATORS for ever new update that is happening inside the FOR LOOP (see next image). How could I achieve that ?
06-12-2013 02:30 PM
Then you need to place the indicator inside the FOR-loop and undate it there. 🙂
/Y
06-13-2013 02:34 AM
Since on my machine, the second screenshot is cropped, i cannot see the complete FOR loop. You do refer to the loop writing to VISA, correct?
If so:
- Is this loop timed? If so, what is the average iteration time? Note: if this is faster than about 50ms, you should not update the indicator in every iteration as the human simply cannot see changes that fast. An average user would only see some flickering and from time to time something "readable".
- Do you update the indicators elsewhere as well?
Possible solution:
- As Yamaeda suggests: Put the indicator in the FOR loop. Works well if only this loop updates these indicators.
- Local variable: As dataflow serializes access to the indicator (variable in loop, terminal outside the state case), you wont have race conditions. On the other hand bears risks if someone introduces concurrent loops using the same indicators (variables).
- Property node "value": Same as local variable, but is bound to UI thread. Therefore, it takes more time which induces performance drawbacks. On the other hand, a property node has error in/out and is better suited to be placed in well designed dataflow programming.
- Extract UI updates from the state machine and introduce a parallel running "UI Update" loop. Refer to the Producer/Consumer template for an initial start point.
hope this helps,
Norbert