LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

same VIs with different settings at runtime

HI!

I'm new to LV so I would need quite some help on the following problem:
I want to set up a test program. In this program one should be able to select different tests (subVIs?e.g. Test 1, 2, 3) from a list box to be performed when the start button is pressed. The parameters for this tests should be adjustable before starting and one should be able to save these special settings (e.g. test 1 ID: bias+10V). The same test should be able to be run with different settings (e.g. test 1 ID: bias+10V and test 1 ID: bias-5V).
How could I be able to do this? Is this possible in LV 6.1 or at all (could use 7.1 too but only if not necessary)? I've attached a example front panel in order to clarify what I want to do. Are tex
t rings more suitable to do the selections than listboxes?
If somebody has done something similar could you please provide sample VIs? If not please provide tips how I can manage this!
Thanks very much.
Andreas
0 Kudos
Message 1 of 21
(3,520 Views)
1... It's not a good idea to use toggle-style buttons as action buttons. Yes, it can be done, but it's not natural. Using a square button with mechanical action set to LATCH WHEN RELEASED is my favorite.

2... What's missing from your description is an important item for me - is the list of tests a known fixed quantity, or is it completely adjustable?

If it's a fixed set of tests that need to be run, I would populate a ring control with "Bias 10V" "Bias 5V", "Bias 0V", "Bias -5V", and "Bias -10V", for example. The ring control would have a value of 0,1,2,3,or 4 in those cases. You would pass that value to the test subVI, and it would do whatever it needs to do in order to change the bias to -5 V.

If you need a bias of some arbitrary voltage, then p
rovide a bias knob, and feed that value to your subVI at test time.

Either way, the values can be saved in a setup file.

If that doesn't answer your question, keep asking.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 2 of 21
(3,520 Views)
to 1.: I'll change that to the square buttons

to 2.: the number of items in the first listbox is fixed. There the category of the test should be selected (e.g. 1: Bias, 2: sweep, 3: Cycle...) The number of items in the second listbox is not fixed and could change at runtime. There the already existing customized tests should be displayed (e.g. if 1: Bias is selected in the first Listbox it should present: Bias 10V, Bias 5V, Bias 0V, Bias -5V, and Bias -10V. One should be able to add or delete customized tests from this second listbox.
Is it possible to create, save and delete this customized tests as VIs at runtime? Or do I have to work with files where the settings are saved and depending to what customized test is selected the one exixting VI will tak
e its values out of a file depending to the selection? Would this be possible? How does this setup file work? I havn't heard about that up to now, but I'll try to get information about that, if you could provide something as well I would be very happy!
0 Kudos
Message 3 of 21
(3,520 Views)
Is it possible to create, save and delete this customized tests as VIs at runtime?


It's not possible to CREATE a VI at runtime, but I don't understand why you need to.
If the "customized" tests follow the same logic flow, just with different parameters, then it's very easy to save those parameters into "setup" files (call them what you will). Then just list all datalog files of type .XYZ, and let the user choose one. When a file is chosen, read it, and set your parameters accordingly.

I would definitely do it using DATALOG files, not text files. They're easier, more bulletproof, and smaller (if your setup data is large).

Read up on them, if you can.

Try this:

Create a cluster on a new front panel and put several things in it. Booleans, strings, I32s, DBLs, I don't care what.

Create a PATH control on the front panel, and set it to something like ERASE THIS FILE.DAT (some new name)

Place a NEW FILE function, a WRITE FILE function, and a CLOSE FILE function on the diagram.

Wire the PATH to the NEW FILE function (with TRUE as the OVERWRITE input).
Wire the refnum and error from NEW FILE into the WRITE FILE.
Wire the cluster to the DATA of the WRITE FILE function.
Wire the refnum and error from WRITE FILE into the CLOSE FILE.

Run it.

You have written all that data into a file.


Try this (separate VI).

Copy the same cluster control from before onto this new front panel. Make two of them: one a control, one an indicator.

Place a FILE DIALOG function, an OPEN FILE function, a READ FILE function, and a CLOSE FILE function.

Wire the cluster into the DATALOG TYPE input of the FILE DIALOG, and the DATALOG TYPE of the OPEN FILE function.

Wire the path from the dialog to the OPEN FILE.

Wire the refnum and error lines from OPEN FILE to READ FILE, and from READ FILE to CLOSE FILE.

Wire the DATA output from READ FILE to your cluster indicator.

Run it and choose the file you wrote earlier - there's your data.

Note that you don't see any .TXT files, or other files in your dialog - by using DATALOG files, you exclude those from even appearing - the user cannot choose an invalid file.

You can write as many records as you want to a single file, although these setup files usually only have one.

CAVEAT: If you add or remove some item from the cluster, you cannot read older files, created with the previous version. I get around this by using spare fields in the cluster.

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 21
(3,520 Views)
HI!

Tried all that. Worked fine. You mentioned spare fields in the cluster. Are those just controls you don't need or how do you create them?
So the thing I have to do is:
-if I create one of the customized VIs to save the settings into a datalog file.
-when I want to use this again I have to read the datalog file
-there are not more than one SubVI for each test I creat but several test VIs


-Are there possibilities/functions to detect if any changes were made in a specific vi and depending on that a save file dialog will appear?
-what is the best way to create a list where all the tests/SubVIs included in the list are executed one after another?

Thank you very much for your help. It helped me already very much. I really ap
preciate this. 🙂
0 Kudos
Message 5 of 21
(3,520 Views)
Sorry..
"-there are not more than one SubVI for each test I creat but several test VIs"
wanted to write:
-there are not more than one SubVI for each test/Measurement I create but several Datalog Files with different contents
0 Kudos
Message 6 of 21
(3,520 Views)
You mentioned spare fields in the cluster. Are those just controls you don't need or how do you create them?

You just define your cluster with everything you know you need. Then you throw in a few more I32s, a few more DBLs, and a few more STRs, and a few more BOOLs.
Hide the spares under the edge of the cluster (outside the cluster border.

If you ever need to use one, bring it inside the border, label it something besides "Spare 3", and use it. It's already in the file.

Are there possibilities/functions to detect if any changes were made in a specific vi and depending on that a save file dialog will appear?


I don't know what you're after - please be specific.
Why do you need to know if ch
anges were made in a VI?

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 7 of 21
(3,520 Views)
What I meant is: In many programes you can load settings (like i want to load the VI with specific values) If there are no changes nothing will happen but if you make changes to any setting then as soon as you close the specific file you will be asked if you wante to save the altered settings.
0 Kudos
Message 8 of 21
(3,520 Views)
is it possible to make the cluster invisible but not the contents of the cluster to make it look like there is no cluster?
0 Kudos
Message 9 of 21
(3,520 Views)
Oh, you mean changes in the SETUP, not changes in the VI.

Sure - just keep a copy of the original data cluster.
When you close the file, do a NOT EQUALS operation on the original cluster (from the file), and the new cluster (from the screen). Pop up on the NOT EQUALS function and choose COMPARE AGGREGATES. That gives you a single boolean output: TRUE if something was changed by the user, FALSE if not.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 10 of 21
(3,398 Views)