04-14-2010 10:55 PM
I'd like to achieve a function that when new modules are added into the existing FP system or hot swapping modules around, the VI can update its configuration file. I don't want the VI to stop as we're collecting data 24/7.
I'm using cFP2220 and couple of modules of different types. I have my VI working and it's pretty straight forward FP read.vi in a time loop. All data are stored in the database using the Labview database toolkit. My VIs are hosted on the local PC, not on the controller. I'm using Labview 8.6.
I assume I need to get the configuration file (iak file), whenever new modules are added, the iak file can be modified (without opening MAX). Anyhow, I'd like to have the flexibility to run the VI continuously. I know there's a similar code here: http://zone.ni.com/devzone/cda/epd/p/id/3221, and they get the configuration file as ini file. But I'm not sure how it's done as I can only save the configuration file as iak file for FP system.
Another potential problem associated with that, I guess, is the database format. Right now I'm using a three-column structure, i.e., DateStamp, Value and ChannelID. In this case, if I want to add/delete/swap channels, I can just change the corresponding channel ID. What if I have a horizontal layout of the database, i.e. 10 columns corresponding to 10 sensors, would it be some trouble if I modify the modules/channels?
Many thanks.
Solved! Go to Solution.
04-16-2010 10:35 AM
There is a way to change out the module and programatically update the IAK file without stopping the VI. You will have to change from using the straight forward FP read.vi with the FieldPoint I/O constant. You will need to use the FP Open, FP Create Tag, FP read, and FP close. The trick to this is that you will need to prebuild your IAK files in MAX first. The way to do this is to set up your backplane in one configuration and then find devices in MAX. Then save the iak file. Then rearrange your backplane to the next configuration you would want, and have MAX find the devices and save that to a different iak file. You will need to do this for each configuration you will have. Then, you will need to place the code shown below when you want to chagne the configuration file. I also have included a screen shot of MAX so you can see what the strings correlate to.
04-16-2010 05:36 PM
Thanks Scott. I can tell what you want me to do. I should have a path control to select different iak file that I pre-defined. So, instead of reading from MAX, I will read from those iak files, right? If that's the case, I guess the string inputs for the FP Create Tag should be changeable as control (not constants as shown in your diagram)? Because what if the module is a different type in the new configuration? Would those constant strings give the wrong configuration?
The other thing, I just found a code written by Justin, http://decibel.ni.com/content/docs/DOC-3881, to read iak file as 2D array of string. I'm wondering is that possible to edit the 2D array of string when MAX is changed?
04-16-2010 06:25 PM
Precisely, I only have those set as constants so you can see what data nees to be enterred in. You most definitely should have controls, or an array that you index or however you want to do it. LabVIEW is now your playground. You get to decide how to get the data you want into the tag VI.
To answer your second question, that 2D array outputs what is in the IAK file, it doesn't link to MAX specifically. However, if the configuration file is changed in MAX and saved, and you run the example again, you will have the new configuration 2D array. you can do what ever you need to edit the 2D array, but you want to make sure that what you put in the create tag.vi is the correct channel as seen in the IAK file you associate the FP open with.
04-19-2010 03:30 PM
04-20-2010 02:57 PM
I found an example that may help you out in this situation.
http://decibel.ni.com/content/docs/DOC-10764
Hope it gives you some ideas.