04-12-2010 09:38 AM
Hi Guys,
Can two while loops in parallel be stopped by the same control? I dont think I can create a Property node of a stop from one while loop and use it for the other. Is there any way to do this? All ideas welcome. Thanks!
V
04-12-2010 09:45 AM
04-12-2010
09:46 AM
- last edited on
11-11-2024
01:37 PM
by
Content Cleaner
If you use a Stop button you need to change the mechanical action from a latch-type to a switch-type. Then you can use a property node or local variable in the other loop to read the state of the button. You will need to make sure to set its value to false at the beginning of the program.
04-12-2010 09:59 AM
04-12-2010
09:59 AM
- last edited on
11-11-2024
01:37 PM
by
Content Cleaner
Maybe some kind of overkill, but you should also learn about parallel loop design patterns.
I haven't sneaked into this webcast, but at least the title fits exactly what i recommend you to learn about.....
hope this helps,
Norbert
04-12-2010 10:06 AM
04-12-2010
10:58 AM
- last edited on
11-11-2024
01:38 PM
by
Content Cleaner
smercurio_fc wrote:
If you use a Stop button you need to change the mechanical action from a latch-type to a switch-type. Then you can use a property node or local variable in the other loop to read the state of the button. You will need to make sure to set its value to false at the beginning of the program.
04-12-2010 11:52 AM
I like Altenbach's solution with the event structures. It may get tricky if you code scales up and you need to implement state machines.
Depending on your code architecture, you can also consider notifiers or using the queue (especially if you already use a queue).
04-12-2010 12:35 PM - edited 04-12-2010 12:37 PM
Good point re: the mechanical latch setting of the stop button.
Yep, I like to stop loops with the error output of Notifiers or Queues - especially sense just about any dual-loop scheme I do will contain a Notifier or Queue anyway. See picture - bottom loop stops when top loop stops.
04-12-2010 01:07 PM
Ray.R wrote:I like Altenbach's solution with the event structures. It may get tricky if you code scales up and you need to implement state machines.