LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Case structure: selecting number of cases and boundaries

Hi everyone,

 

I'm looking to create a VI where I can change the number of cases and their boundaries for a case structure from the front panel. I'll need roughly 10 different cases, ranging from 2 minutes to 24 hours, if that makes any difference.

 

Attached is what I have so far; the contents of each case are always the same, just with a different value. Any resources that you know of that might help me would be much appreciated.

 

Thank you

0 Kudos
Message 1 of 5
(2,782 Views)

Make a lookup table that is an array of the start and end times for a range.  Use Threshold 1D Array and Round To -Inf to get an index and then Index Array to get the values you actually want.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 5
(2,754 Views)

Hi crossrulz, thank you for your help.

 

As I understand it the start and end times in the array will be in seconds and the Threshold 1D Array will compare the start and end times in the array to the current elapsed time and from that output whether it's in range 1/2/3 etc. 

 

Will the case structure automatically update its number of cases as the number of ranges changes? Will I be able to change the number of ranges I want? This will be running on a machine without labVIEW so i just want to check there's no problem there.

 

Thank you

 

Download All
0 Kudos
Message 3 of 5
(2,743 Views)

No, a Case Structure is fixed.  You cannot dynamically change the number of cases it has.  That requires compiling.  I am telling you to build your output values into an array that you can then index based on the value coming out of the Threshold 1D Array.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 5
(2,734 Views)

Hi crossrulz, thank you again for your help. Unfortunately I wasn't able to get the VI to work properly, it would continue what was defined in the 1st case for the subsequent cases as well.

Would you be able to look at the VI and see if there's any obvious mistake I've made? I've attached the setup I used as well. The spray control part of the VI is in the while loop in the bottom right.

It works fine if I manually enter the cases as, for example, 0-100s and ..-1,101.. with controls for spray and wait time for each case so it seems I haven't implemented something properly with this new method.

 

Thank you again

Download All
0 Kudos
Message 5 of 5
(2,704 Views)