07-27-2011 10:01 AM
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.
Solved! Go to Solution.
07-27-2011 10:19 AM
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.
07-27-2011 10:34 AM - edited 07-27-2011 10:36 AM
@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.
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.
07-27-2011 10:37 AM - edited 07-27-2011 10:41 AM
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:
instead of the second case structure.
07-27-2011 11:34 AM
Awesome, thanks for all the help guys