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 post

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 post

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 post

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 post

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.

  • Similar Content

    • By cyro2015
      Hi,
      I tried to create a template based on OOP for QMH. During development I have been confronted with infinite crashes of LabVIEW so I decided to slow down with this project and open it to the community. I finished my working example and stopped for now.
      So if anyone is interested to play around with the code, see attached ZIP file (LV 2020).
      Cu,
      Peter
       
      MHT.zip
    • By Marko Hakkarainen
      I had some time to learn about new interfaces and finally I could implement my collection class as I had envisioned. I didn’t want to use iterable and iterator names, because I thought that would have been too bold a claim.
      The original version of the collection class was (and is) used as a collection of sequence steps. Each element can be either a sequence command (send message, wait timer, wait complete etc.) or another collection of commands (sub-sequence). That’s the reasons for the labels and search method. Otherwise it is just a fancy (Rube Goldberg) array.
      Next method is recursive and it steps through all elements in the collection. Execute is only method, which requires override.
      For now, it’s at least an exercise in new interfaces. I don’t know if it’s useful enough to be in the code repository, but I can polish it up if needed.
       
      --
      Marko H
      Certified LabVIEW Architect
      www.optofidelity.com
      Iterable Collection LV2020.zip
    • By Zyl
      Hi everybody,
       
      I'm running into something I don't really understand. Maybe you can help me here !
      I've got a LVLIB that is used as an 'Interface': it exposes public VIs which wrap around public functions of a private class (see code attached) . The class is private because I want to force the users to use the 'interface' functions.
      In one of my interface VI, I create a DVR on the private class (Interface_init). The DVR is stored into a typedef (FClass_DVR.ctl) and this typedef is the 'reference' that link all the interface public functions.
      In TestCode.vi (which is not part of the lvlib and illustrates the standard code that a user can create to use my driver), I can call my public interface functions and link them without any problem.

      But as soon as I create an indicator on that reference (to create a state-machine-context-cluster for example), my TestCode VI breaks !

      The error returned is : This VI cannot use the LabVIEW class control because of library access scope. The LabVIEW class is a private library item and can only be accessed from inside the same library or libraries contained in that library.
      I understand that the class is private. But the DVR is contained into a public control. Using an In Place structure on that DVR into TestCode would not work, since the class is private. So why is the DVR control problematic at that point ? Creating it do not breaks any access protection...
      Am I missing something ?
      DVR Private POC.zip
    • By Brains
      Hi,
      Does anybody know the best way to make a copy of a byref object (open gds v4) at runtime and pass all the attributes values (including inherited attributes) to the new object?
      Thank you!
      Craig
    • By GregFreeman
      I currently have a project that I am refactoring. There is a lot of coupling that is not sitting well with me due to typedefs belonging to a class, then getting bundled into another class which is then fired off as event data.
      Effectively, I have class A with a public typedef, then class B contains ClassA.typedef and then class B gets fired off in an event to class C to be handled. Class C now has a dependency on class A which is causing a lot of coupling I don't want.
      For my real world example I query a bunch of data from our MES, which results in a bunch of typedef controls on the connector panes of those VIs. Those typedefs belong to the MES class. I then want to bundle all that data into a TestConfig class and send that via an event to our Tester class. But, now our tester has a dependency on the MES.
      I see a few ways to handle this. First is move the typedefs currently in the MES class, to the TestConfig class. The MES VIs will now have the typedefs from the TestConfig class on their connector panes, but at least the dependency is the correct "direction." Or, I can move the typedefs out of classes all together, but then I am not sure the best way to organize them. Looking for how others have handled these sorts of dependencies.
       
×
×
  • Create New...

Important Information

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