Puzzlemaker Posted August 14, 2007 Report Share Posted August 14, 2007 Hi. Bit over my head here. I am trying to create a configuration for a fairly complex application that reads hardware. The configuration file will have a ton of diffrent options and parameters, each of which will have other options. Think of it more like trying to write a data tree. It also has to be editable easily. Whats the best way to go about doing this? I was thinking XML, maybe. The easiest method I think would be to use Varient Attributes, but they arn't being written to the XML file (Only the varient data is, not the attributes), is there a way around this? Or a better way to store data? Some details: The data being stored is configuration data for hardware sensors, such as accelerometers. Each hardware peice will have a variant number of channels, and each channel could protentially support different sensors. Plus you have Gain and other options for each Channel, and a list of valid commands for each peice of hardware and the commands to start it running (Such as SET_CHANNEL, ect.) Also required are the sensor information. Each type of sensor will have a configuration setup. All this has to be written into a configuration file that is easy editable so new hardware can be added as they are created. Thanks in advance! Quote Link to comment
Grampa_of_Oliva_n_Eden Posted August 14, 2007 Report Share Posted August 14, 2007 QUOTE(Puzzlemaker @ Aug 13 2007, 11:31 AM) Hi. Bit over my head here.I am trying to create a configuration for a fairly complex application that reads hardware. The configuration file will have a ton of diffrent options and parameters, each of which will have other options. Think of it more like trying to write a data tree. It also has to be editable easily. Whats the best way to go about doing this? I was thinking XML, maybe. The easiest method I think would be to use Varient Attributes, but they arn't being written to the XML file (Only the varient data is, not the attributes), is there a way around this? Or a better way to store data? Some details: The data being stored is configuration data for hardware sensors, such as accelerometers. Each hardware peice will have a variant number of channels, and each channel could protentially support different sensors. Plus you have Gain and other options for each Channel, and a list of valid commands for each peice of hardware and the commands to start it running (Such as SET_CHANNEL, ect.) Also required are the sensor information. Each type of sensor will have a configuration setup. All this has to be written into a configuration file that is easy editable so new hardware can be added as they are created. Thanks in advance! :question: Clarification question: Could you post a cluster or an array of clusters that shows the data you need to write or restore from file? That will help us advise. :thumbup: Ben Quote Link to comment
Puzzlemaker Posted August 14, 2007 Author Report Share Posted August 14, 2007 QUOTE(Ben @ Aug 13 2007, 11:38 AM) :question: Clarification question: Could you post a cluster or an array of clusters that shows the data you need to write or restore from file? That will help us advise. :thumbup: Ben Well, no, because I have no idea how to even store them, and I haven't created all of them yet. I will post what I have though. This is the command information for the hardware, one of the things that has to be in the configuration. The Port A is the hardware type. There will also be a list of channels for each Port (Hardware piece), and each channel will have what controls to show on the front panel (A list of labels), plus what options each one of those controls can have. The Sensor information will also be a list of each different kind of sensor, with a list of controls to show on the front panel, plus what each option can be. Quote Link to comment
Grampa_of_Oliva_n_Eden Posted August 14, 2007 Report Share Posted August 14, 2007 QUOTE(Puzzlemaker @ Aug 13 2007, 11:48 AM) Well, no, because I have no idea how to even store them, and I haven't created all of them yet. I will post what I have though. This is the command information for the hardware, one of the things that has to be in the configuration. The Port A is the hardware type. There will also be a list of channels for each Port (Hardware piece), and each channel will have what controls to show on the front panel (A list of labels), plus what options each one of those controls can have. The Sensor information will also be a list of each different kind of sensor, with a list of controls to show on the front panel, plus what each option can be. That looks like Read from Spreadsheet or Write to Speadsheet file will handle that with not problems. Ben Quote Link to comment
Omar Mussa Posted August 14, 2007 Report Share Posted August 14, 2007 Is there any technical reason why you can't just create a database using an actual database program (MS Access as worst case)? XML file structure is the most flexible format if you can't do that but you will need to spend some design time figuring out how to best accomplish your goal. Even though XML is great in some respects, it can still be difficult to visualize the actual relationships of the data by looking at an XML Structure as compared to explicitly defining the relationships in a database. Quote Link to comment
ASTDan Posted August 14, 2007 Report Share Posted August 14, 2007 You might want to take a look at Open G's varient configuraiton files. www.openg.org It takes Clusters or arrays and saves them as .ini files. I would also sugest taking a look at the .tdm file fromat from NI. It uses an XML header with a binary file. Hope this helps Dan Quote Link to comment
David_A_Moore Posted August 14, 2007 Report Share Posted August 14, 2007 QUOTE(Puzzlemaker @ Aug 13 2007, 09:48 AM) Well, no, because I have no idea how to even store them, and I haven't created all of them yet... Puzzlemaker, I think that you're getting ahead of yourself. Figure out how you're going to represent the data on wires first, then come back to the file representation, at which point the problem is probably clearer. If you end up with some complex cluster (as most of us do) and it's going to be large, then check out the freeware http://www.mooregoodideas.com/ReadWriteAnything.htm' target="_blank">Read/Write Anything VIs that my company just released, which are a faster alternative to the OpenG Variant Configuration File VIs. Our library also has some VIs that helped me create a custom XML file using the Internet Toolkit. --David Moore Quote Link to comment
Puzzlemaker Posted August 15, 2007 Author Report Share Posted August 15, 2007 Thanks a ton! Yeah, I ended up with a super-complex cluster. I was trying to avoid that, thinking maybe there was some sort of way to store the data. Again, appreciate the help! Looking into the Open G stuff now! Quote Link to comment
Grampa_of_Oliva_n_Eden Posted August 15, 2007 Report Share Posted August 15, 2007 QUOTE(Puzzlemaker @ Aug 14 2007, 01:24 PM) Thanks a ton!Yeah, I ended up with a super-complex cluster. I was trying to avoid that, thinking maybe there was some sort of way to store the data. Again, appreciate the help! Looking into the Open G stuff now! Please let us know how things work out. There may still be other solutions, but first try the OpenG approach. Ben Quote Link to comment
LAVA 1.0 Content Posted August 15, 2007 Report Share Posted August 15, 2007 QUOTE(Puzzlemaker @ Aug 14 2007, 12:24 PM) Yeah, I ended up with a super-complex cluster. I was trying to avoid that, thinking maybe there was some sort of way to store the data. Can you explain this statement a bit further. How would the data storage avoid the need to develop a large complex data structure? As was mentioned earlier this is really two separate problems; desiging the data structure (cluster or otherwise) to contain your configuration information and, secondly, storing that data structure in a file. The cluster is the most native way to store such a structure in LabVIEW, but other options are available. Then storing such a structure is the seocnd challenge. Quick and dirty ways to store any cluster from LabVIEW into a file is the Datalog file or the conversion to XML/XML file storage VIs included in LabVIEW. The XML functions are in a sub-palette of the string palette, while the Datalog File VIs are found in a sub-palette of the Advanced File Functions. Christian Quote Link to comment
Grampa_of_Oliva_n_Eden Posted August 15, 2007 Report Share Posted August 15, 2007 QUOTE(LV_FPGA_SE @ Aug 14 2007, 03:20 PM) ... Quick and dirty ways to store any cluster from LabVIEW into a file is the Datalog file or the conversion to XML/XML file storage VIs included in LabVIEW.... Christian Don't both of those methods suffer from the "NI redefined the data format" issue that complicates reading files writen in earlier versions of LV when upgrading? Ben Quote Link to comment
Puzzlemaker Posted August 17, 2007 Author Report Share Posted August 17, 2007 Update: I got it working, reading in. I need to add more stuff now. This configuration file is getting x-treme. I put in a formula for each sensor in the configuration file (AKA a strain gauge formula). You put in names of objects on the front panel and it parses through and replaces those with constants, and then sticks them through the eval formula node VI. This lets you define the formula for each sensor type in the configuration without having to hardcode it. Its sad I can't use if statements in the formula, but whatever. Now I just have to figure out how to store how the front panel controls effect each other. Example: When Dropdown A is option 1, show dropdown B. When Dropdown A is option 2, show numeric input C. When numberic input C is shown, numeric D equals numeric C... ect I am considering writing a lab-view based script that has if statements so I can define that stuff in the configuration easily. Any suggestions? Quote Link to comment
Jan Florjanczyk Posted August 24, 2007 Report Share Posted August 24, 2007 A simple solution I've found for storing complicated data structures in xml is to have an array of clusters that each contain a name field (string) and a value field (string). Then, when writing data, flatten it to string and give it an ID in the name field. When you need that peice of data again, simply search the array for that name and unflatten the value. It's not the fastest thing in the world but if your configuration files change and you want to remain backwards compatible you will still be able to read the old values. Quote Link to comment
Grampa_of_Oliva_n_Eden Posted August 24, 2007 Report Share Posted August 24, 2007 Warning! Shameless plug follows. I will be posting a Nugget on a technique I discovered for accessing complex data structures entities starting only with a generic reference to a control on Sunday evening. It should survive LV upgrades structure redefinitions and re-ordering of clusters. I'll post here once it is posted. End of Shameless plug. Ben Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.