LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing issues

Solved!
Go to solution

timing.JPG

This is a section of a program I am working on (it should be enough info to help explain), I am not finished, so it is still sloppy (case sizes are still uneven, wires are sloppy and missing in some places, etc) but I have come up with a problem.

 

The idea is that depending on an initial input value, the program needs to wait for either, 5, 10, 30, or 45 minutes.

(i.e. only ONE of those 4 inner case structures will actually activate, there are a bunch of comparisons being done below the screen so that only 1 of those 4 green true/false wires will ever be true)

 

The issue comes into play with the indicator.  I need an indicator that counts down how much time has passed, thus the elapsed time VIs. 

If I put an indicator into each of those case structures, it will work, but I will have 3 redundant indicators that stay blank, and one that runs.  This is wasted front panel space.

It will not let me wire all four elapsed time VIs to the single indicator, so I need another way to only have 1 indicator that runs no matter which case structure activates.

 

My original idea was to have all 4 case structures only contain the value (and not the time delay)  and wire all 4 case structure values to the time delay (because only 1 value would ever be sent) but this doesn't work either.

0 Kudos
Message 1 of 5
(1,171 Views)
Solution
Accepted by topic author LarsUlrich

You need to select the number of seconds in a single case structure and wire that to the time delay. You can build an array of booleans and convert that to a number. If one and only one boolean is true then the cases you need are 1,2,4 and 8. You need a default case when wiring a number to the case selector.

 

Try something like this.

 

Time Delay.png

=====================
LabVIEW 2012


Message 2 of 5
(1,161 Views)

@Steve Chandler wrote:

You need to select the number of seconds in a single case structure and wire that to the time delay. You can build an array of booleans and convert that to a number. If one and only one boolean is true then the cases you need are 1,2,4 and 8. You need a default case when wiring a number to the case selector.

 

Try something like this.

 

Time Delay.png


The problem with this is that the Indicator won't update because the Time delay is a wait. To get the indicator to update and get it to wait that amount of time just place a while loop around the Elapsed Time and the indicator. Then wire the Time you wanted to wait into Time Target (s). Then Wire the Time has Elapsed to the stop Condition.

0 Kudos
Message 3 of 5
(1,150 Views)

I came up with the same solution as Steve but just used a simple Wait and triggered off the Time Elapsed.  This should update the indicator as you go.

 

Basically just add one of these:

Delay with indicator.png

instead of the second case structure.

Message 4 of 5
(1,143 Views)

Awesome, thanks for all the help guys

0 Kudos
Message 5 of 5
(1,130 Views)