Jump to content

Questions about getting generic data from children classes


Recommended Posts

Hi all, I've been learning LabView recently and am still having a few issues trying to get OOP (a concept I am already quite familiar with) working the way I want it to. My particular set up has a generic, abstract class called "Device." This is basically a dummy class from which several other classes inherit properties. One of these is specific device info which is represented by different AO Channels in the different subclasses (which I only have two of for now for simplicity's sake). However I can see no easy solution to make a VI that takes an array of devices and outputs an array of these -different- device info channels. The way I had it working was to make an array of subpanels that display a VI that each subclass overrides: DIsplay Info. But this is very clunky and not at all preferable. I also want to do something very similar except with 2D arrays of data in each class (minor question: how can I make an array of tables? As in 2 dimensions would be displayed at a time). Any thoughts on how this should be done? I feel like it shouldn't be as complicated as I'm making it...

Thanks for any help!

Link to comment

For the first question, post your code and someone will be able to help you do what you're trying to achieve.

Question 2:

you really cant use a table in an array because you need to get the reference to the array objects (MCLs in this case) and labview doesn't provide you with a way to do that. If you hack a little bit you'll notice that the reference you from the Arrayelement get will just populate all the tables in the array. I'm not gonna say its impossible, but you are not using the control the way the designers intended, and might get some strange behavior.

you can achieve your table in a 2D array by doing the following:

make a cluster of a 2D string array and put that cluster in another 2D array.

It might not look as pretty as you want, but the behavior will be a little simpler. Watchout as this will be a pretty slow FP object to display and arrays of arrays are pretty hard on the memory manager as well.

Link to comment

Ok I'm thinking that for the table of data I should just be storing it as a an array of 2D arrays (so 3D) and dealing with the output separately (which I have a whole design set up for, not dependent on exactly how the data is stored). In terms of the other question, I think I'd need to upload several VI's which I'll want to clean up first. Either way, I won't have time to deal with this problem for the next 2 weeks so I'll just come back to it then and post a question when I have a better idea of exactly what I need to do. Thanks for preventing me from trying to do something impossible!

Link to comment

However I can see no easy solution to make a VI that takes an array of devices and outputs an array of these -different- device info channels.

If you supply a UML diagram it might be easier to understand your design.

I did a similar project a while back. I had an abstract base class called Sensor and sub classes like Temperature Unit, Web Camera Unit. The objects where running as active objects and updating their own sub panel on the Main VI's GUI. I had over 40 SubVI panels that arranged them self when the GUI's front panel was resized.

post-941-0-07662400-1336608694.jpg

//Mike

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.