Jump to content

Stagg54

Members
  • Posts

    130
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Stagg54

  1. So here is my situation I inherited some code that has a bunch of parallel loops. Several of them share hardware. Specifically we have 1 channel of AO that goes to amplifier/speaker setup. Normally we use this channel to output realtime signals from our sensors. But there is a portion of the program that can "hijack" this AO channel and use it to output data from a file. The problem is not only interrupting the realtime output but also that the 2 tasks have different parameters/setup (for example sample rate, continuous vs. finite samples, etc.) So when this was developed they previously had 2 seperate programs and when they combined them they ran into all kinds of problems, so they invented this crazy scheme using all kinds of global variables to coordinate and do some handshaking. It's a mess. Its super-buggy and it needs rewritten. We also have a similar issue with an AO that is used for injecting test signals (we have 2 different types of test signals). I would like to implement an OOP solution. I'm still trying to wrap my mind around the problem, but I'm thinking about having some sort of arbiter class. It would decide who gets control of the resources. I'm thinking that to do it that way the arbiter would have to be by-ref. I was thinking of having some sort of "Output Data" method, where you pass it the data you want to ouput and tell it what type of output it is and it handles setting up the resources and coordination. Any thoughts? Am I on the right track? Would you use a different approach? Also, I'd kind of like to draw this up in UML. Anyone know of any good UML tutorials (as it pertains to OOP and classes)? thanks, Sam
  2. I use Yairs solution quite often and it works very well. (although I often use a shift register - I haven't quite adopted the feedback node yet). I've always referred to it as a "self-intializing functional global constant".
  3. That sounds like agreat idea! Thanks for the suggestion.
  4. That assumes that they are the same, which they are not. I could search through all VIs in memory, but that could be a bear (the app has 1000's of vis). Also then I how do I figure out which one is active? I could try the FP.Is Frontmost property but according to its help entry it ignores floating windows. Anyone have any other thoughts? On a side note: does anyone know what the Application.Active VI property is returning? I haven't been able to decipher it.
  5. Here is what I need to accomplish: The powers that be want all front panels in a particular application to have this feature they call "auto-snap". Basically all visible front panels should "snap" back into place if the user tries to moves them around (by clicking on the title bar and dragging them). The user should be able to hit the F2 key to unlock the window and move it where ever they want. Pressing F2 again should lock it again and snap it back into its original position. My original design was to create a "brat vi" (I got that term from Norm Kirchner - he calls it that because it manipulates its parent). Basically you dropped it into each vi that had a visible front panel. All you had to pass it was a notifier to tell it when to exit. It ran in parallel and automatically pulled out the callers ref and registered for the key down event and took care of everything. Very cool and it worked very well. Only downside is that you had to drop it into every vi with a frontpanel. A bit of a pain for anything you may want to reuse for another project. Now here is my problem. Now they want to pull in this reusable library that I have. I don't want to drop this brat vi into my reusable library. Most of the timeI don't want this feature and I don't want to pollute my library with something that is only going to be used for this one special case. Now this reusable library has one main entry point/UI vi. Now I can modify my brat vi to accept a reference and run it in parallel with the main UI of my reuse library. All works well until my reuse library calls up a subvi that shows its front panel. What I would like to do is launch a vi in parallel with everything that would automatically detect when a new vi is opened and becomes the active front panel and then to act upon that. That would be nice because then instead of dropping it into every UI vi, I can just drop it once and run it in parallel with my main vi. I guess my question is: How do I get a reference to the vi that is active (ie. that the user is currently interacting - ignoring subpanels for the moment -although my reuse library uses those heavily so maybe that will cause some problems as well.) I found the Application.Active VI property which I thought would do want I wanted. (Its a scripting node, but is supposedly works in the run-time which is what I need.) Unfortunately it does not appear to be returning what I am looking for. I'm nost sure what its returning. Even though Scripting is now supported (I'm using LV2009 by the way) there is not any documentation on what the term Active VI means. I does not appear to mean what I thought it did. Anyway, is what I'm trying to do possible? Does anyone see a better way to solve my problem? Did I do a good enough job explaining it? thanks,
  6. They had a booth at NI week. It looked pretty impressive, but that was as far as I got.
  7. Those are some good thoughts. I really like #4, although I'm not entirely sure if that fits into my paradigm. If I was going to do something like that I would like some way to implement it "globally" within a specific application, rather than having each process specify which Logger to use. I already have a "Master Table" that records what process is registered for what messages. Perhaps I just define the logger there. Obviously I am thinking the end-user (who in this case happens to be me as well). My end goal is to develop a framework where when I start a new project I can just grab a copy of this framework and I already have certain tools built in (ie. I already have a debugging window that lets me view who is registered for what message, and I can view all the message traffic.) I'm trying to include some kind of logging and basic error handling in that. Then I can take that basic library and I can start building my application from there. Obviously I should be able to customize the logger or error handler, etc. as needed, but I'm hoping that I can design something that will cover 90% of my uses cases. Right now I've got the messaging framework built up pretty well and I'm very happy with it. It's just a matter now of how to extend it. I'm kind of new to this whole object oriented thing. I'm just trying to make sure I get the design right. Also I was kind of thinking of the logger as more of a template. When you get a new copy of the framework, you get a copy of this logger and then you edit it to suit the needs of your specific application. In most cases it would already do 90% of what you need.
  8. That was my initial though. I had some misgivings and things got a little hazy when I started thinking about who was responsible for what. But I think that idea might work after all.
  9. Ok, so here goes. Basically I have set up an observer pattern and I have a few questions about how I should handle a few things, most notably logging. Here's how my pattern basically works. I have a variety of independant processes running. Each one has it's own Message Interface Object. Through the Message Interface Object (really just a sophisticated queue based system with a "global" registry) it can send any messages that are descendants of "Message Parent". When any message is sent, the parent class captures the sending process and a time stamp and then sends it out to whoever is registered for it. I also have a hook so that any child class cna execute a specific piece of code right before the message is sent for error-checking or whatever. So any process can send any message and then it can also register to recieve specific messages. I also worked in an inheritance scheme, so if you register for a particular class you get all its children as well. One of the main design considerations though is that is a broadcast type system. That means when a process sends a message, it doesn't care if it gets a response or if anyone is listening. The only time it cares is when it is waiting to recieve a message. Even then it shouldn't care who sends it, it should just care about the message itself. So far I have the messaging scheme all worked out as far as sending and recieving messages. I'm trying to build a nice demo program to demonstrate it (I don't have an actual project to use this on at the moment). So I have nice debugging tool that is registered for the parent class, so it recieves every message that is sent out and it pulls out the timestamp and sending process etc. And I have a few dummy processes just sending data out. Now I'm trying to work on a logger. Something that would run in the background and just log important events. I'd like to make it as generic as possible, but I also want to have my other modules not care about the logger (ie. I don't like the idea of them determining what gets logged.) My question is what is the best way to log things? I guess my real question is whose responsibility should it be to determine what text gets logged? As I see it I have 3 options: 1. Add a logtext field to the parent class and allow children to update it. Then when a child can update that when its private data is changed. In this case the responsibility would belong to each message child class. 2. Add a loggable message class and have it contain a logtext field, which its children can update. This is nice because then I can just register my logger for the loggable message parent class and get all loggable messages. 3. Have the logger itself determine what text to put in the file for each type of message. I think I am ok with this. My main concern is that the sending process be unaware of what is out there. THe recieving process kind of has to know what's out there or what to expect, or do I have this all wrong? Anybody have any thoughts?
  10. That sounds like it might be easier than scripting. In general I find scripting to be a pain to write. Once written it tends to be invaluable, although I find that most of the scripting I write tends to be very narrowly focused and address one specific use-case (maybe it's just me using poor programming practices and not being general enough.)
  11. I found it!! Double clicking on the terminal did not work. It just brought up the icon editor (perhaps that's some sort of LabVIEW options setting?) Anyway I found it by making sure I had saved all my changes in SVN. Then I just started deleting things with the Context help open. As soon as I saw it disappear from context help, then I knew I must have deleted it, so it must be inside that structure. Then i just hit ctrl+z and went down into the next nested layer. thanks everyone for the help/advice. oh and on a related note apparently the search function by default does not search for hidden items. So if the label of the control terminal is not visible searching for it by the label will not get you anywhere. You can always change this though.
  12. I'm cleaning up some old code (not mine) and I have run into the following problem. I have an indicator that is wired to the connector to pass data out of this vi. Unfortunately I can't find the thing on the block diagram. I've tried searching for it by name and haven't really had much success. (If you think this should be simple then you haven't seen the vi I'm dealing with) Is there any way to right click on the connector pane terminal and find the terminal of the corresponding indicator/control? This would also be useful because in this particular vi there are several controls/indicators with the same label. (I know - bad practices. They are not mine. Unfortunately the responsibility to make this code work is now mine. I can't throw it all away and start from scratch. As much as I'd like to, my boss seems to think it is more productive to remove cards from the house of cards instead of building the house out of bricks.) Any ideas?
  13. That sounds like an idea for the Idea Exchange.
  14. If you use SVN and VI Analyzer, you should consider voting for this idea: http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Let-VI-Analyzer-ignore-paths-matching-patterns/idc-p/1251344#M7775
  15. How about a third? Why not a tab control? One tab for indicator. One tab for control.
  16. If you think that is bad, you should see what I have to put up with on a daily basis! Making huge messy diagrams is a great method of job security (because no one else can understand it), but it sure sucks for the guy who replaces you when you retire.
  17. Now the real question is can anyone tell me where those templates are stored? I remember seeing that in a post before but I can't seem to find it now.
  18. If I remember correctly there is an ini token to show hidden objects.
  19. That makes sense. And thanks Darren. That tool will come in very handy.
  20. When I create a new vi for my class using New-> New vi from Dynamic Dispatch Template or New vi from Static Dispatch Template, Autogrow is always enabled on the error case structure, even though my in LabVIEW options settings I disabled the place new structures with Autogrow enabled. This is in LV2009SP1. I haven't checked in other versions. Has anyone else run into this?
  21. I have several channels worth of data. I want to be able to have a horizontal bar plot where each bar represents the RMS value of the channel. I also need to have some kind of marker to mark the peak value. Anyone have any experience with bar plots in LabVIEW? I've done a little research and I haven't found a lot. It doesn't seem like it should be this hard.
  22. You could probably just wire it through a case structure. In one case jus pass the refnum. in the other case (ie. when you want to set it to not-a-refnum) just leave the output tunnel unwired and select "use default if unwired" that should do the trick.
×
×
  • Create New...

Important Information

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