LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I automate the creation of a cluster in LabView using the data structure created in an autogenerated .CSV, C header, or XML file?

Solved!
Go to solution
Can I automate the creation of a cluster in LabView using the data structure created in an auto generated .CSV, C header, or XML file?  I'm trying to take the data structure defined in one or more of those files listed and have LabView automatically create a cluster with identical structure and data types.  (Ideally, I would like to do this with a C header file only.)  Basically, I'm trying to avoid having to create the cluster by hand, as the number of cluster elements could be very large. I've looked into EasyXML and contacted the rep for the add-on.  Unfortunately, this capability has not been created yet.  Has anyone done something like this before? Thanks in advance for the help.

 

Message Edited by PhilipJoeP on 04-29-2009 04:54 PM
Message 1 of 12
(7,831 Views)

Is this something you're trying to do at runtime? Clusters are fixed data structures so you can't change them programmatically. Or, are you just trying to create some typedef cluster controls so that you can use them for coding? What would your clusters basically look like? Perhaps another way of holding the information like an array of variants?

 

You can try LabVIEW scripting, though be aware that this is not supported by NI. 

0 Kudos
Message 2 of 12
(7,818 Views)

smercurio_fc wrote:

Is this something you're trying to do at runtime? Clusters are fixed data structures so you can't change them programmatically. Or, are you just trying to create some typedef cluster controls so that you can use them for coding? What would your clusters basically look like? Perhaps another way of holding the information like an array of variants?

 

You can try LabVIEW scripting, though be aware that this is not supported by NI. 


 Wow!  Thanks for the quick response!  We would use this cluster as a fixed data structure.  No need to change the structure during runtime.  The cluster would be a cluster of clusters with multiple levels.  There would be not pattern as to how deep these levels would go, or how many elements would be in each.   Here is the application.  I would like to be able to autocode a Simulink model file into a DLL.  The model DLL would accept a Simulink bus object of a certain data structure (bus of buses), pick out which elements of the bus is needed for the model calculation, and then pass the bus object.  I then will take the DLL file and use the DLL VI block to pass a cluster into the DLL block (with identical structure as the bus in Simulink).  To save time, I would like to auto generate the C header file using Simulink to define the bus structure and then have LabView read that header file and create the cluster automatically.   Right now I can do everything but the auto creation of the cluster.  I can manually build the cluster to match the Simulink model bus structure and it runs fine.  But this is only for an example model with a small structure.  Need to make the cluster creation automated so it can handle large structures with minimal brute force. Thanks!

 

Message 3 of 12
(7,814 Views)

Well, I can completely understand why you would want to do this, and it would be a neat tool. Unfortunately, there's no mechanism that can programmatically create clusters (unless you consider scripting, as I mentioned).

 

Since your cluster is complicated (cluster of clusters of who knows what), then I'm not sure how feasible/practical an array of variants will be. Sorry I can't provide a good answer for you.

Message Edited by smercurio_fc on 04-29-2009 10:37 PM
Message 4 of 12
(7,794 Views)
Thanks again for the response.  I was afraid there was no easy way.  Hopefully the need can be identified and included in a future release.  From a scripting point of view, how hard would that be and how would you go about doing this?  Would this involve the import and export string capability in LabView? I was playing around with importing strings and ran into a problem.  I could export a VI block as an XML file in LabView.  When I went to import that same file into LabView, it wouldn’t work.  Not sure why this happens.

 

0 Kudos
Message 5 of 12
(7,759 Views)

The LabVIEW scriptors are found on LAVA.

 

I have done something simlar a couple of years ago but when I demo'ed it for my boss (I devloped it at home) it threw an "Insane Object" error and LV crashed. I have not touched it since.

 

That functionality is built into a lot of LV already but just not exposed to the users.

 

Talk to your Ni rep about acquiring a license for scripting. Who know's there may be a back-door way of doing this .

 

Ben

 

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

Scripting is an entirely different beast from importing/exporting strings. The link I provided in my previous response is to the LAVA board that talks about scripting. As I indicated, that's the best place to research this topic. There is no documentation available for scripting. Also, be aware that you need LabVIEW 7 in order to create new code (using the methods discussed on LAVA).

 

Importing/exporting strings is intended for localization, not for what you're trying to do. It allows you to change the text displayed on your VI to target a different (human) language.

Message Edited by smercurio_fc on 04-30-2009 09:37 AM
0 Kudos
Message 7 of 12
(7,752 Views)

Ben wrote:

 

That functionality is built into a lot of LV already but just not exposed to the users.


Hi Ben,

 

You mentioned that this fucntionality is built into LV already.  Are you referring to autogenerating clusters based off an XML or header file structure?  I read somewhere that there are VI blocks that are hidden in LV that can be turned on by changing a flag in the LV config file.  Here's the link to that post.  http://forums.lavag.org/VI-Scripting-Readme-First-t1207.html

 

 

0 Kudos
Message 8 of 12
(7,732 Views)

PhilipJoeP wrote:

Ben wrote:

 

That functionality is built into a lot of LV already but just not exposed to the users.


Hi Ben,

 

You mentioned that this fucntionality is built into LV already.  Are you referring to autogenerating clusters based off an XML or header file structure?  I read somewhere that there are VI blocks that are hidden in LV that can be turned on by changing a flag in the LV config file.  Here's the link to that post.  http://forums.lavag.org/VI-Scripting-Readme-First-t1207.html

 

 


There are methods and properties that let you insert a control into a cluster control that could in theory be used to build up your desired cluster. The ability to do this has been taken away from the casual user and is now protected under a scripting license (which I understand is not easy to get). So talk to your loacl NI rep about what you want to do. They may be able to get you going.

 

Re: LAVA

 

I am "neBulus" on the LAVA forum.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 9 of 12
(7,724 Views)

If you have a way to read in the file descriptor (CSV/C/XML) and build the data structure as a variant you could use my 'Variant to Control' tool for creating a cluster.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
Message 10 of 12
(7,694 Views)