Jump to content

maz

Members
  • Posts

    3
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Chicago

LabVIEW Information

  • Version
    LabVIEW 8.5
  • Since
    2007

maz's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Perhaps I should have presented my original question in a different way. Stepping back a little now... There exists a power meter class that includes all the commands required to operate meters and read sensors. It queries the equipment on initialization and then sends the appropriate commands for whichever piece is found. It is true that sensors are not always connected to meters. They can be connected to other equipment or directly to the PC via USB. We don't currently use these approaches, but it is not impossible in the future. I figured if I had to, I could create commands for those other types of devices in my power meter class, but that is seeming a bit clunky now. The meat of the application will be a sequence of commands that executes. I would like to use something like inputSensor.read and let the sensor and instrument classes take care of where said sensor is connected and how to read it. So I wanted a way to store both a meter and a port in a single structure that would reference the correct location of that sensor. Mikael has it exactly right, I want the user to not worry at all about how the sensor is connected. He just asks for the power at the input sensor and it is returned to him. There will be a configuration file that maps logical sensor names to physical locations, but the user won't need to know about it. It does appear that I need a more robust structure that will, at the very least, handle the different interfaces that a sensor might be connected to. A couple of questions, then: For academic purposes, let's say I want to create the structure I used in my previous post. I have a power meter object that I can access independently from the sensors, and I have multiple sensor objects that reference a single meter object. Daklu, you said that you thought that DVR was unnecessary. How do I do it without DVR? I couldn't figure out how to create a pointer (not a real pointer, I know) to that meter object in the sensor object.. SEQ? That's creating an unnamed queue and storing it's reference? I was originally envisioning this: Power meter class with functions to read power, set offsets, open windows, etc Power sensor class that simply held a reference to a meter object and the port that the sensor was connected to. Wrapper functions that call methods of the power meter class. Perhaps my structure should look something like this: Power meter class that handles meter related tasks - windows on the display, calibration... but not anything sensor related A sensor interface class that is roughly analogous to my original meter class without meter-specific functions. It will include an device address (or ref to an instrument object) and port. Since the commands will be interface dependent, they have to go here, right? In an earlier post, you talked about creating subclasses of this class for each type of interface. So for a sensor connected to a power meter, you'd have a power meter subclass with power meter object in its private data. Each subclass would have the specific commands necessary to communicate with that device. A power sensor class that has includes its own unique sensor interface object. Although it has functions to read power, set offsets, filtering, etc. they are simply wrappers for the appropriate interface class functions. A related question - I was going to code this so that there was a single "Power Meter" class with a number of methods. Each method would read the instrument type from private data and then send the appropriate command. How much do I gain from making the power meter class virtual each instrument it's own subclass? The host approach above requires it, but it seems like it might be better regardless... Thanks so much for all of your help. I'm sure your replies take as long as mine, and that's no small amount of time. Pete
  2. Thanks for all the quick and detailed responses. After examining Mikael's code and watching the GOOP demo videos, I have now figured out how to do what I wanted. I knew there had to be a way to store a reference to an object, but because I've been using 8.5, I wasn't familiar with DVR. I was looking for a good enough reason to upgrade from 8.5, and I wasn't sure that cluster icons was enough, but DVR is... A better question is - did I have to worry about it? If I have a meter object created, and then wire it to the private data of several power sensor objects, do I still have only one meter object shared among all the sensors? I was under the impression that I would now have a bunch of copies of the original meter object each with its own private data. I've already generalized my Power Meter class to handle different models (and they don't accept anything but sensors), so I'm not sure I need to add an interface layer between the meter and the sensors. I'm also a little worried about making it too complicated for other people to work with. This should work, yes? I don't have to wire the output terminal of the IPE? And I'll still have only a single meter object instantiated? Thanks again for the help! Pete
  3. Hi everybody - Long time listener, first time caller. I'm in the initial stages of planning an object framework for control of RF test equipment. Most of the decisions are pretty simple, but there's one that I'm having a hard time figuring out how to code. I have a number of RF power sensors. You can't (well, you can, but we don't) communicate with them directly; they plug into another device (generally a power meter, but increasingly other devices support them). The power meters (let's generalize for now) have a variable number of ports for sensors. One or two is typical, but they go up to four. The tricky part is that in my code I'd like to reference the "input power sensor", but that sensor could be attached to any port on any meter. Approach one - power meter object and no power sensor object My sensors have to be statically assigned because I only have a handle to the meter. I always have to put "input power sensor" on "power meter 1:port 1". Or is there something I've missed? Approach two - no power meter object but power sensor objects Now "input power sensor" is dynamically assignable, but if a meter has multiple sensors, I now have multiple indirect handles to the meter, which creates a whole new set of problems: initialization? reset? meter specific commands that have nothing to do with sensors now look strange in the sensor class I could also create a meter class to handle the third problem, but I'm still not so crazy about this idea. The sensor should just point to a meter and a port. Approach three - power meter object and separate, not-inherited-from-the-same-base-class power sensor object Now I have a meter object that makes sense and a sensor object that I can refer to by name that points to that meter object. But how do I store this reference? I thought it would be easy to include a reference to the meter object in the sensor class, but I can't figure out how to do that. I'm sure I'm missing something trivial, so if someone could point me in the right direction, I'd be most appreciative. Thanks! Pete
×
×
  • Create New...

Important Information

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