Jump to content

zack13532

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by zack13532

  1. Sorry for reviving a dead topic, but I need to do something very similar in my application and I wanted to ask a few quick questions to clarify how to implement the various suggestions in this thread. My application doesn't need to do anything funky with front panels, and probably won't need to collect any results from the VIs called besides error statuses. Would this static dispatch VI basically just implement polymorphism manually? I would still have to create some sort of case structure (perhaps not, though, because all my child classes will probably have overridden the VI in question) and/or a sequence that would rely on working with the paths of the VIs, correct? I'm just trying to figure out the best way to go about this. Also, there will be a few rendezvous in the VIs, but I'm hoping that won't mess anything up. Thanks for any help!
  2. Wow I feel pretty stupid. My issue was that I had two different VIs working with the global and one was using shift registers. In one VI I am able to edit the data and in the other I am able to add and remove devices. In the add/remove device VI I was using a shift register to store any changes until a Save button was pressed. Oftentimes I would make changes to the data in the editing VI while this was running, then go and delete a device and Save. This would take the value that was being passed along the shift register (and not the data values that had recently been updated into the global device array) and store it into the global device array. The effect was the device was removed, but none of the updates that took place in the editing VI were actually saved. My solution was to just add a boolean to the global variable that can be used to detect when a change was made in the editing VI. Sorry for wasting anyone's time!
  3. Yeah if I can't figure it out in an hour or two I'll do that. It'll probably take me a little while to strip it all down and include just the necessary stuff, but this is obviously a critical part of the program.
  4. Hmmmm. Upon further inspection (really should have done this before I posted). The data gets blanked out only when a certain type of device is removed. This device type, we'll call it "DS", has a table that should be 3x3. the other device type I've been trying it with, we'll call it "NT", has a table that should be 3x12. I thought this would be irrelevant because both tables are inside separate private data clusters for their respective classes. No VIs are being called on the devices themselves in this process, only the remove element function is called on the global array of devices.
  5. The basic setup for my program is as follows: I have a Global Array of "Device" objects (each of which is actually an object of a type that descends from Device). Each object has a bunch of different pieces of information, including a table of data. I'm having an interesting problem with removing a device from this global array. Once I do so (inside of a VI that reads the Global variable, calls the remove element array function on it with the relevant index, and sends the output back to the global variable, setting it), the data table of each device proceeding the removed element in the array gets blanked out. As in, set to the default value - the table dimension sizes are still the same, the array is not empty, just at its default value. Curiously enough, the other pieces of information stored as the private data for each object (everything besides the data table) are still intact post-removal. I have an idea of what might be causing this behind the scenes (shifted pointers in the removal process get messed up or something), but I have no idea how I can fix it. My question is, of course, how do I remove an element but ensure that all proceeding elements have all their data intact? Any help is greatly appreciated!
  6. Oh it's working now! I realized my mistake was actually very silly - I was trying to access an uninitialized index of the array. Thanks for your help anyway!
  7. That's currently how I have it set up, the Device class has a dynamic dispatch VI called Display Info and the child classes (the classes that will actually have real objects) override it with a Display Info VI that pops up. The correct VI pops up if I drag the Display Info VI from one of the child classes to the block diagram and wire in a control of that specific type. But if I get a Device object from an array that could be from any of the child classes and wire it into the Display Info VI from the Device class, the Display Info from the Device class is the one that pops up (when the device/object in question is actually a child type). The Display Info from the Device class is just the basic new VI layout because I didn't plan on actually having any objects that were specifically Device type.
  8. Hi all, I'm somewhat new to Labview so excuse any ineptitude that may arise. I have a program that is centered around an array of Devices - they are various different object types that descend from an abstract Device class. I'm trying to make a VI that can call the correct method VI for a given device in this main list (in an object oriented way, of course). So far this has been fine for most VIs, but now I'm trying to make an overridden VI in each class that opens when called, like a dialog box. As of right now, calling the "Display Info.vi" (the VI in question) on a given device opens the Display Info VI from the Device class, which is basically just a blank, unimplemented VI and therefore useless. Are there some settings I need to check to enforce polymorphic behavior on this VI? Thank you for any info you can provide!
  9. 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!
  10. 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!
×
×
  • Create New...

Important Information

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