LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What kind of code structure is good when target is to save and read huge amount scalar parameters?

Hi All,
 
LV 8.5.1 + DSC
 
In my project I need to save many scalar parameters to file and also read them. There is about 100 logical parameter groups and inside those groups there is about 10 to 50 parameters. Every parameter have own describe name e.g. "TAG1_measurement_upper_limit". Parameter type is string and length about 1 to 7 characters. 
 
In my first solution I made a typedef rings for every parameter group. This structure is not good because when there is a new parameter I must update many things manully. This means that number of parameters can vary. One good thing in this structure that it is documenting my code very effcient. I also like to keep my code simply as possible so I wan't write and read all parameters by using only two VIs. All parameters were saved to one CSV-file. Every column is one parameter group and every row is certain parameter. So there are many empty "cells" in this structure.
 
I have consired different structures as database, CSV-file etc.. Does anyone thought this same issue before? Is there efficient way to solve this issue.
 
-Jim
0 Kudos
Message 1 of 7
(2,906 Views)
How abt using global variables?
0 Kudos
Message 2 of 7
(2,899 Views)
What is the source of the values that you need to write? Shared variables? Clusters?

With clusters the structure can be extracted via VI server. A reference of the cluster lead to an array of references of the groups, etc.
Regards,
André (CLA, CLED)
0 Kudos
Message 3 of 7
(2,889 Views)

Hi, Andre

The source of these variables is user interface. Parameters of one parameter group are divided even more smaller groups. User interface is intialized from wfile and after that user can see  and change the values. One minor parameter group is writed to array and then array elements are writed to file.

Shared variables are not good solution because the amount of variables is quite large.

-Jim

0 Kudos
Message 4 of 7
(2,885 Views)
Values of FP variables can be easily captured.

1. Create a reference to the pane of the FP.
2. With that reference you can fetch all the controls(/indicators) on the FP.
NOTE: make sure that the label of the control/indicators is unique and have a distinct pattern e.g. IOgrp_IOitem_parameter (use caption for user viewing and label in blockdiagram)
3. Using the label naming pattern you can store them in a file.

The label can also be used to restore the value of the control.
1. Read the file
2. Get all control references
3. For each value in the file
3a. Find label name in control references
3b. if found set value
Regards,
André (CLA, CLED)
0 Kudos
Message 5 of 7
(2,869 Views)

Hi Jim,

My Adaptive Save-Restore Nugget will read or write the entire contents of a cluster to/from an ini file. It also adapts to changes to the type-def automatically. The code included in that example support string numerics and the more common data types. Others can be added as required.

That code may give you some ideas.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 7
(2,865 Views)

Hi Andre,

Thank you very much. I tested what you suggested. This solution is great!  It is documenting my code very efficient and it is easy use. And one advantage is of course that every labels etc. are updating automatically. If people ever need to save huge amount parameter data I really recommend this code structure.

-Jim

 

0 Kudos
Message 7 of 7
(2,863 Views)