LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

config button linkage

I have a couple of config buttons for this attached VI
-'save config' is trying to collect all parameter settings and store the data in a directory
-'load config' is trying to load any saved parameter settings appropriately
 
Could you please help me on this?
Thanks in advance!
0 Kudos
Message 1 of 9
(3,791 Views)
Can anyone help me out that what I am doing wrong with this VI?
I think there could be an error adding "Aggressor1, Aggressor2, ...." for 'section' probe of 'write key.vi'
(for 'save' event)
 
thanx,
 
0 Kudos
Message 2 of 9
(3,783 Views)

basically, I am trying to retreive and save data from the front panel in 'load' and 'save' events. Did anyone have a similar problem like this? thanks a bunch!

0 Kudos
Message 3 of 9
(3,771 Views)
Hello,
 
I took a look at your code, and the first thing that came to mind is that if you would like to have events based on user interface actions, you should use an event structure. Is there a reason you can't use an event structure within a while loop?  To save the data, your save event case would simply write whatever data you wanted to a file - you can use shift registers to pass these between event cases so you have access to them in that case, or use local variables for those controls in that event case.  In your load case, you would perform one or more file reads and assign the control values/parameters with local variables.
 
You may like to use the configuration file VIs (see the Configuration File VIs subpalette of the File I/O palette) as they will help you write a standard "tagged" ini file format for storing and retrieving your parameters.  Basically, they will abstract away the details of organizing your file for writing and reading your parameters.
 
I think spending a bit of time rearchitecting your application will make your code easier to read and more efficient in execution!
 
I hope this helps! 
 
Repost if you have any trouble.
 
Best Regards,
 
JLS
 
 
Best,
JLS
Sixclear
Message 4 of 9
(3,759 Views)

Hello,

Thanks for your great response with excellent feedback. For the event structure, this feature is not available in the base package. I can run a VI built with event structure, but cannot reconfigure/modify. I suppose that it would be a simpler to use the event structure, but I do not have the choice unfortunately.

I was able to use the configuration file VIs to work with one set of parameters, but can't figure out ways to save multiple 'aggressor' parameters without populating configuration file VIs. Could you please help me on this by using other iteration method, such as for loop or while loop(???) (Please see the attached VI)

Could you elaborate on how I can rearchitecture this VI to make it more efficient in execution? I am a newbie without too much programming experience, so I would very much appreciate your advices...

Best regards,

 

0 Kudos
Message 5 of 9
(3,754 Views)
Hello,
 
Glad the last resopnse was helpful, and sorry you don't have the event structure to build with 😞
 
Anyway, to solve the multiple aggressor problem, how about defining a new section for each agressor?  You could automate the naming as aggressor1, aggressor2, and so on quite easily.  For example, you can hold a count value and use the Number to Decimal String VI to get your count in string form, then concatenate it with the word aggressor.  I attached a simple counter VI which will illustrate the count keeping and number to string conversion process (notice the count is a string), as well as the idea noted in the next paragraph.
 
As far as efficiency is concerned, there is nothing wrong with a state machine architecture - it's great and commonly used!  Ironically, I would recommend adding a small piece of code to make your program less efficient - let me explain.  You may consider adding is a 0 ms wait statement in the while loop.  The reason for this is that such a wait statement, although telling LabVIEW not to actually pause, will offer up the possibility of a thread swap to the OS.  Not that such a swap will NOT occur without the statement, but this way you are offering that possibility, which will make the overall fluidity of your system better when the application is running.  This is because when you use a state machine architecture to handle user interface events, your code is always requesting processor time (even when the user is doing nothing, the default case is executing!).  This is in stark contrast to the behavior of an event structure, which basically allows LabVIEW to sleep until a registered event occurs.  Thus, to prevent LabVIEW from being a bit of a processor hog, you can use a wait statement (such as the wait ms function in the time and dialog palette) even with a 0 ms wait time.
 
Ok, I hope this helps!
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
Message 6 of 9
(3,740 Views)

Thanks again for your help!

Could you show me a simple example VI to do the multiple aggressor front panel data saving? By using unbundle by name will make this VI look too messy/busy for save event.

I did put 10ms delay inside of for loop in the save event.

Thanks again!

Best regards,

 

0 Kudos
Message 7 of 9
(3,734 Views)
Hello,
 
Sure, but I was trying to show you the tools you'd need in the previous post 🙂
 
Attached is an example which writes 3 sections, one for each of three "aggressors", and each section contains 3 keys (one boolean, one double, and one string).  Further explanation is contained on the front panel and block diagram of the VI.
Best,
JLS
Sixclear
Message 8 of 9
(3,705 Views)
Just forgot to sign the last post 🙂
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
Message 9 of 9
(3,703 Views)