LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save and load controller values to ini?

Quite new to labview so please bear with me if the question is stupid 🙂

Making a GUI where a subvi is opened from a frontpanel.In this subvi the user is supposed to input values to the different controllers. These controller values are force, pressure, frequency etc. for a hydraulic cylinder operating in a test rig.

What I want to do is be able to save the current controller values to a file like "testprogram_1" and be able to open/load it later with those predefined controller values.Much like "save as" and "open" in windows. This is because the operator should be able to change values according to different test specifications and save&load them as he wants.

I know maybe the OpenG "write and read panel to ini" should be able to do it, but I'm not sure how to work it out, so if anyone could code me an short example of how to do this including refnum etc. (if needed) it would be much appreciated.

Using Labview 8.0 by the way.

Added a pic of the subvi front panel just to give you an idea of what I'm talking about.

Thanks in advance.
0 Kudos
Message 1 of 4
(2,852 Views)
Hi,

If you are new to LabVIEW you may have a look at the example VIs that comes with LabVIEW, to launch the example finder, go to "help" > "Find examples..."
In the search tab, dial "config", there are 2 example VIs to read and write a configuration file. I suggest you start from here as a first step before using OpenG VIs.
The OpenG "write and read panel to ini" can do what you need, it is not really complicated to use it.

Have a try and then post your VI if there are issues you can't solve 😉

Haapy wiring !

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 4
(2,843 Views)
Thank you for the advice. Managed to get my problem kinda solved with the example VIs you referred to 🙂

Now I got two other problems:

1.If you look at the attached picture of the "create new test program" frontpanel there are a total of up to hundred values that need to be saved (20 per cylinder, 5 cylinders = 100 values). Is there another more clean way to do this than having to add every single controller in a loooong string like you see on the second picture. With that many controller values needed to be saved the code will look all cluttered.

2.This is a GUI where the user got no access to the source/block code. Each program created consist of different cycles, e.g program1=20k cycles with a force of 100kN, 30k cycles with a force of 70kN etc.

There is no predefined amount of cycles per program, so the user should be able to input cycle 1, input controller values for cycle 1, input number of iterations/cycles for cycle 1 -> input cycle 2, input controller values for cycle 2, input number of iterations/cycles for cycle 2, and so on for each cylinder.

How will this be possible to achieve as simple as possible for the user? Lets say he should just have to define which cycle of the current program the controller values correspond to, how many iterations/cycles with those values, and then be able to save this and run the program where each cycle is executed when the previous one is finished.

Sorry if I haven't made myself clear, please ask and I'll try to express myself better.

Thanks.
0 Kudos
Message 3 of 4
(2,810 Views)
You can get a reference to the front panel. Using property nodes will give you an array of references to all the controls on the panel. The tab control property node can be used to get arrays of references to the controls on each page of the tab. You can put the config file VIs in a for loop auto-indexed from the reference arrays. You need to use some care in matching labels or soemthing to correctly associate a value with a control. If you have clusters with arrays of clusters or something very complex this can get really messy. But since you seem to have scalars it should be OK. I recommend that you use unique Labels for each control. If some of the controls need to have the same text for the user, use captions.

This is not trivial, but it scales nicely if you need to add a cylinder for example. It an be put into a subVI to minimize the diagram space.

Lynn
0 Kudos
Message 4 of 4
(2,797 Views)