08-11-2019 11:57 PM
Hi,
I have the following problem: Two tasks have to be performed and I would like to control the relative time between the start of the two tasks. So, I have two sub VIs which I would like to start with a certain delay to each other. This delay should be controllable from the front panel and also allow "negative" values corresponding to a situation where the order of the two tasks is reversed. What would be your approach to achieve this?
Thanks,
Peter
08-12-2019 12:49 AM
One approach would be two case structures, where the exectuion of one is delayed using Stall Data Flow.vim. The case structures would call different tasks based on whether the relative time is negative or not.
If you don't have a newer version of LabVIEW with malleable VIs, substitute Stall Data Flow with a flat sequence structure containing a Wait (ms).
08-12-2019 02:07 AM - edited 08-12-2019 02:08 AM
If you have any shared input to the two VIs, like an error wire, I'd also suggest Stall Data Flow (2017 onwards) or Flat Sequence Structure and Wait (ms) (earlier versions).
I'd put this on both branches of the input and wire a zero constant and your control to a Swap node, then enable it if the control value is less than zero.
Ensure after the swap node you take the absolute values before passing to the wait structure.
08-12-2019 02:11 AM
@cbutcher wrote:
Ensure after the swap node you take the absolute values before passing to the wait structure.
I knew I'd missed something!
08-12-2019 02:27 AM
08-12-2019 06:19 AM - edited 08-12-2019 06:20 AM
You guys are making it too complicated. You just need a Negate.