LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Input Scenarios

Hi,

 

I am having a problem and I can't find a better way of doing this without confusing myself into oblivion. I have read a couple of tutorials but even then trying to do this with labview is harder than I thought.

 

My goal is rather simple the user will be able to choose from three frequencies, three voltages , and three currents. At first I thoughts that I can simply add a true and false statement if the user selects X freq Z Voltage and Y Current do this. This where my problem starts there will be a total of eight possible combinations with just the frequencies and the same will apply for voltage and current which totals a possible of and I am taking a guess but roughly 32 combinations if the user were to select just one frequency with different currents. 

 

What is the most efficient way of handling this in labview I ask because in a programming language I can simply add if else statements and case conditions from here to oblivion without any problems.

 

I will add my vi which is incomplete and only includes frequencies but I stopped and decided to ask for input because taking the current path I am on would be a complete nightmare if a problem were to arise.

0 Kudos
Message 1 of 19
(3,958 Views)
Sorry Here is the vi.
0 Kudos
Message 2 of 19
(3,956 Views)

Just wire the number directly to the case selector (thats the question mark). You now will have the cases 1, 2 and so forth instead of the nested true/false. You also can join cases by naming them '2,5 ..7'.

By the way Labview is a programming language.

 

Felix

0 Kudos
Message 3 of 19
(3,933 Views)

MrSafe wrote:

Hi,

 

What is the most efficient way of handling this in labview I ask because in a programming language I can simply add if else statements and case conditions from here to oblivion without any problems.


You can do this in LabVIEW as well. But it would still be the wrong way to do it. Smiley Wink

 

Your VI doesn't really give an indication of what you're trying to accomplish. Are the selections of freq/voltage/currents interdependent? Or, are they simply supposed to control iterations of loops? For instance, do you want to sweep across a set of frequencies, and for each frequency you want to sweep across a set of voltages, and for each voltage you want to sweep across a set of currents? What are all the dialog boxes supposed to accomplish?

 

One way to do this is to simply use array controls. Then auto-index your loops (assuming you're trying to perform a sweep like I described). When the VI is in run-mode the right-click menu on the array controls allow you to add/delete elements. This method has the advantage that it's scalable.

 

If you want to use separate controls then simply build an array based on what's enabled. For example, the following is a simple method, though it's best used for only small arrays:

 

 

Side-note: You should not use string controls to enter numeric values. Use numeric controls. What's the point of using string controls?

 

Download All
0 Kudos
Message 4 of 19
(3,932 Views)

smercurio_fc wrote:

 

Your VI doesn't really give an indication of what you're trying to accomplish. Are the selections of freq/voltage/currents interdependent? Or, are they simply supposed to control iterations of loops? For instance, do you want to sweep across a set of frequencies, and for each frequency you want to sweep across a set of voltages, and for each voltage you want to sweep across a set of currents? What are all the dialog boxes supposed to accomplish?

 


( not worried about the current values at the moment so lets ignore it for now)

 

Bascicaly if the user were to choose two frequencies ( lets use the names F1 and F3 ) he/she will also put values for all voltage inputs. The software will then Use F1 with V1 .

 

Then F1 with V2; F1 w/ V3;F2 w/ V1....and so forth. The idea is to use the frequencies with the voltages in any combinatio. (i.e F1 with V2 or F2 with V3) Meaning the user than put in any combination and the software will run it without giving you an error.

 

I understand the vi doesnt give any idea what I am trying to accomplish I am used to writing in a assembly or C based language where I would assign variables. Sorry for the problem I think we are on the same page though despite the poorly made VI you were able to get the bulk of what I am trying to do correctly. I will work with what you have advised me with. I have read  many help files labview is damn powerful and suprises me everyday. 

 


 smercurio_fc wrote:


 

Side-note: You should not use string controls to enter numeric values. Use numeric controls. What's the point of using string controls?

 


         The idea was once the boolean statement was activate the string control would feed the value for frequency and voltage.

0 Kudos
Message 5 of 19
(3,925 Views)

Then it sounds like you simply want the 3-loop structure I showed in Example 1. Auto-indexing will control the loops. As I indicated you can either use array controls or use the technique in Example 2 to create the arrays of selected values and then drive the loops with these arrays.

 


MrSafe wrote

 smercurio_fc wrote:

Side-note: You should not use string controls to enter numeric values. Use numeric controls. What's the point of using string controls?


         The idea was once the boolean statement was activate the string control would feed the value for frequency and voltage.


You still shouldn't use string controls for numeric values. What if somebody enters letters? Or funny characters? Why deal with that?

 

Message 6 of 19
(3,917 Views)
As an additional note: I don't know how complex your program is intended to be, but you may want to look at the State Machine architecture. This can also be used to iterate through your individual arrays.
Message 7 of 19
(3,914 Views)

I see your point. Noted 😃 I will post/update this thread if I have more problems I hope you will continue to assist the community you have helped me more than once. Thank You.

0 Kudos
Message 8 of 19
(3,913 Views)
Looking at your example #2 could the array be 2 diminsional so I can include the voltage settings the user wants?
0 Kudos
Message 9 of 19
(3,900 Views)

The problem you will have is that for 2D arrays LabVIEW will automatically fill in zero values to make sure the 2D array is rectangular. For example, let's say you decide to use a 2D array with column 1 being frequency and column 2 being voltage, and you have 2 frequencies and 3 voltages. Let's say you use f1=100, f2=200, and V1=10, V2=15, and V3=20. The 2D array will look like this:

100   10

200   15

0     20

The zero gets added by LabVIEW to ensure the 2D array is rectangular.

0 Kudos
Message 10 of 19
(3,875 Views)