Jump to content

Jason H

Members
  • Posts

    25
  • Joined

  • Last visited

Everything posted by Jason H

  1. I found a nasty bug where a control that has units associated with it somehow appears to get corrupted. When a corrupted control and a normal control are fed into the equals function, it returns false. It's not limited to controls either, a corrupted and normal constant will return as not being equal. Example vis are attached. labview bug with units example original.vi labview bug with units simple example.vi
  2. I was going to post this suggestion on the Idea Exchange. I think it would be a good way to effectively give us constructors, without all the headaches of a real constructor that AQ has posted about.
  3. Is there a specific reason for that? I'm going to make that accessor vi protected, so that only the children can see it. That way, nothing outside of the object can ever access the entire cluster, but the children still have full access. The only reason the parent even has this data is as a placeholder to be overridden. Also, I think that accessor is only ever going to be used once - in the constructors. I can't think of a reason to use it anywhere else.
  4. I've created a constructor.vi and am forcing all children to override this vi. Inside the parent's private data cluster, I have another cluster called "data for override" and a single accessor can write the entire cluster. That cluster is also a type-def, which is used on the front panel of the child as well. So all I have to do in the constructor is take that cluster and write it to the parent's cluster.
  5. Thanks jgcode. I'm trying to wrap my head around what you're saying here. From what I can tell, national instruments doesn't have any type of constructor built into LVOOP. What you are saying is that to essentially create one and work around that, I can simply create a method inside the class where the object is created that does the initialization stuff. Then when I want to use that object in a program I just plop down the constructor.vi on the block diagram and use it's output terminal as the object instance. I don't put the bare object constant on the block diagram as is typically done. Unless someone here can tell me that this isn't the best way to accomplish what I'm trying to do, I'll try it out and see if it works. Unfortunately I don't think there is a way to "force" someone to use constructor.vi on the block diagram instead of the object constant, so the programmer will have to keep that detail in mind. Also, there is no way to "force" those certain data fields to be initialized in the constructors of each child that I can see.
  6. I'm new to OOP, there may be a common method to solve my problem that I'm not aware of. The problem is this: I have a parent class "CNC table". It contains private data that all CNC tables have, for example, the minimum and maximum ranges for x, y, and z axes. I have have child classes which represent specific CNC tables, say different models. They control the hardware, and when I say "move to point" the proper subvi will be dynamically dispatched to control the hardware. The problem is that each child must have its own unique values for the x, y, and z ranges because different models of table will have different ranges. When I run the parent's "is point in range" function (which is called inside of the child's overridden "move to point" function), I want to read in the child's defaulted values for those specific private data members and compare against those. Optimally, I'd like to override the defaults of those data fields, and require all children to override them. If there was a constructor, I could just read in the defaults off of the child's front panel and then populate the parent's fields, which would be a little more work. However, from what I can tell neither of those are possible. So how can I make sure the parent's private data fields are set appropriately to what the child's defaults are?
  7. Thanks for the response. Based on that I'll just move forward with using the other control and making some things transparent to mimic the native 3d graph. I'll let you file the bug and look for the fix in an updated version, either service pack 2 or LV2011. Let me know if I should file a bug or anything.
  8. First let me say that the new 3d stuff is much better than the old cw graph stuff. One problem I'm having however is the mesh overlay on the 3d graph control when I turn on overlay lines. When I use the 3d surface that comes with the ni helper vi, it looks fine, as it should. However when I use the native 3d graph and turn on overlay lines, the lines are fragmented and appear to be rendered at the exact same location as the plot itself as opposed to on the surface of the plot. The picture and vi below demonstrate what I'm talking about. In the picture, on the left is ni's xcontrol with helper vi. However, I only want the rendering screen and want to make my own custom color bar. To the right is the same plot but the rendering looks different - the overlay lines do not render smoothly like in the first plot. Is there any way to fix this? Thanks 3d graph.vi
  9. I was scheduled to take my CLD tomorrow and, even though I took each of the three practice tests twice (car wash, security system, traffic light), I still wanted to look at them one last time. When I checked, it appeared there were four new exams up: ATM machine Boiler controller Car wash (different) Sprinkler system https://lumen.ni.com/nicif/us/ekitcldexmprp/content.xhtml Good thing I double checked again...
  10. I've been working with the CWGraph3D library for plotting 3D antenna patterns. Overall it works quite well. However, there are a few limitations that I'm not sure can be worked around. The problem is that the rotation is not truly 3D. There are only 2 axes of rotation, not 3. You can see the pattern at every (theta, phi) point, but at any given point, you cannot rotate about that point except for at the poles. For example, you can rotate about the z axis (the poles) but you cannot rotate about the x or y axes. Its difficult to think about unless you have a model in front of you. Another issue is performance. The CWGraph3D performance seems a little sketchy at times, and I don't have low-level control. For example, when plotting a new set of data, the whole control frame goes blank briefly before showing the new plot. With a 3D picture control however, I could just update a single object in the scene. Finally, I would like to import an STL file and overlay it with my antenna pattern to easily visualize what is going on. However, I don't think the CWGraph3D mesh can plot triangles. Perhaps it can but I don't understand how to use it properly. The only problem with using a 3D picture control however is the color map. If I could figure that out then I would have no reason to use the CWGraph3D control other than all the work involved in building up what I need from low-level components. I've attached a picture from my program. Note that the top right corner is an overlaid 3D picture control showing an STL file, and the main plot is a CWGraph3D picture. I want to create something identical but with a 3D picture control. How would I create a color map and grid lines?
  11. anyone who can figure this out? And if its not possible, is there a way to export a CWGraph3D object into a 3D picture control?
  12. QUOTE (Ton @ May 14 2009, 09:24 PM) Thanks, I cooked the openg vi's down to what I need. Here is an example of compressing and decompressing a string.
  13. try this http://www.scicos.org/ScicosModNum/modnum_...web/eng/eng.htm
  14. Could somebody convert the vi's listed here http://zone.ni.com/devzone/cda/epd/p/id/3662 to LV 8.5? I searched around and didn't see any up-to-date vi's and these are exactly what I need.
  15. Good discussion guys, I find it very interesting. I understand the argument for queues and I'm also trying to understand the argument for event structures as well. It seems to me that if you had n event sources, you have two (almost) functionally equivalent options 1) have n queues inside n while loops, or 2) have a single event structure with n cases the benefit of queues is that 1) if they are named they can act as both global variables and detect events (you can also pass data through event structures so I don't know if this is really a difference), and 2) since they are in multiple loops, executing code from events is done in parallel the benefit of event structures is that 1) your code is compacted down to a single structure and is smaller 2) you can write code which does one-off events without having to create a completely new queue just to handle that event-type or going through the hassle of using variants and typedefs 3) the event structure can register events generated by software (eg, front panel controls) With this in mind, perhaps it would be nice to converge the functionality of both so that users can use one or the other depending on their coding styles/application. For example, register events from controls, or indeed any software events, into a queue so that an event structure is no longer necessary for things like GUI control (improving queues). Or, allow named events which are available globally like named queues (improving event structures -- coincidentally, this is exactly what ShaunR and shoneill are asking for). Wouldn't this allow one to, theoretically, use queues and event structures interchangeably? Is there a fundamental reason why there shouldn't be more than a superficial difference between the two? AQ?
  16. If you do write your own program to write to a word document, make sure it is a high performance box you run it on, because from my experience you may run into performance issues.......like the report generation portion of your program taking longer than the test itself (ahem..).
  17. Another solution would be to use a separate loop for the GUI.
  18. QUOTE (Mark Yedinak @ Apr 22 2009, 02:58 PM) Rumor is that in the next version of labview you'll be able to right-click on a for loop and select how many cores to run it on.
  19. 2and4, Thanks for your reply. I would not need a separate complete state machine for every variable, since for any single variable it is just a couple vi's that do all the work. So if they were separate loops, they would just be plain while loops with code in them (ie, a single state). Also, my code doesn't need to run in a parallel fashion. I don't want to change all variables at once, I just want to progress through a number of steps, similar to what you would do if you were manually testing. In any case, regardless of whether I have a single state machine which executes the commands, or whether I have parallel consumer loops which execute the commands, I still need to generate the correct commands in the correct sequence. After posting this thread, I have thought of another way to do it. Basically run the nested for loops but only enqueue the states. See example code below. I don't like this approach because it stores all the state information in memory. Also, I like to flush the queue when I encounter an error and I don't like having more than a couple states queued up at once. Also I don't want to put things at the front of the queue (such as pause, etc) because I would like to use the queue like a queue. I shouldn't have to break from that except perhaps for errors. Perhaps instead of enqueuing that array, I could put it in my settings cluster and just pull off the next item in my "update user settings" state. Keep the ideas coming. I know a lot of other people have solved this problem before.
  20. Recently I created an automated test that must collect data over a number of variables. For example, collecting temperature data on a wifi radio over a number of test cases. The most natural way to write the code would be nested for loops. It would look something like this for every voltage, for every temperature, for every channel, for every data rate, take power measurement; end end end end however my test must be robust and flexible. I cannot simply put 4 nested for loops on my block diagram. For one thing it will be huge. Also I cannot pause, run special error handling code, and do a number of other things that a state machine allows me to do. The problem is if I have a number of discrete states, such as init set voltage set temp set channel set data rate measure power stream data to file exit I must figure out how to simulate the state transitions of nested for loops. Currently I have a separate state "update user settings" which has all the logic built into it. This logic is implemented as a mathscript node with a large number of if-statements in it, which is about 3 screens high. It works fine, but it doesn't seem very ideal. It makes my code more difficult to understand and more error prone. This seems like a common problem, so I would like to know how other people are solving it.
  21. QUOTE (santi122 @ Apr 17 2009, 02:07 AM) Scooter, Notice that he has "concatenate inputs" checked so that instead of making a 2 dimensional array when he combines his two previous arrays, he makes a longer 1 dimensional array. Right-click on your "build array" vi to check that option. I think this is the source of your problems.
  22. labc, There is nothing magical about making your own driver. I almost always write my own drivers because I find that the drivers from NI are more complicated and detailed than my simple needs require. The difficulty really depends on how detailed the programmers manual is. If there is no documentation, it may be very difficult to write a driver. If there are documented scpi commands, it may be very simple. The first step is to locate the programmer's manual or something that tells you what commands are available for the instrument. The second step is to make contact with the instrument. Is it a serial connection, GPIB, or ethernet? Make a simple vi that sends a command to the instrument and can read the result. Try to send the command "*IDN?" without quotation marks and read what the device sends back to you. It should tell you its model number. Do the measurement by hand with the instrument. Note which buttons you need to press. Look up which commands are the same as the buttons you press. Try sending these commands one at a time and get it working. Once everything is working a piece at a time, write a vi that does all the commands. I'm assuming the equipment you are trying to control may be old and/or not well documented because otherwise it would likely have driver available in the first place. So I think finding good documentation may be the most difficult part for you.
  23. QUOTE (flarn2006 @ Mar 29 2009, 05:40 PM) It really depends on what you are trying to do. If you want to access your wireless card in LabVIEW from your PC, Then you need to go through the driver in windows. The driver itself is proprietary, so you cannot, for example, transmit your own raw CCK or OFDM signals. You can only send 802.11 packets, at best. If you are interested in taking your wifi card and making a separate embedded system out of it, then you run into the issues just mentioned. You would essentially have to build your own driver. Even then you may not be able to send your own raw modulated signals because the MAC may be embedded onto the chip. So you could still be stuck with the 802.11 protocol. Even if the MAC wasn't on the chip, I doubt it would be feasible to make a driver for it. I think, however, you are talking about just sending 2.4 GHz RF, for example, a 2.4 GHz continuous sine wave. And you most likely want to do this from your PC. There are a couple of problems with this. First of all, you have very limited control over your RF from windows. This is because all radios must comply to regulatory FCC and ETSI restrictions which strictly limit the power output, modulation type and quality, and a number of other things. So basically, it is impossible for you to send anything other than perfect wi-fi packets. Second, assuming you could hack every aspect of the chip, the chip can only physically output OFDM and CCK modulations. Software defined radios, as has already been mentioned, are designed for this type of arbitrary RF control. I think that is probably what you are interested in.
  24. QUOTE (Vincent Wong @ Mar 22 2008, 06:54 PM) Thank you very much Vincent. But how do you generate the XML code from a cluster? Did you have an example that could do that, or is it beyond your needs?
×
×
  • Create New...

Important Information

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