07-01-2014 08:09 PM
07-01-2014 08:27 PM
07-01-2014 08:29 PM
07-02-2014 12:52 AM
Ok... thanks so much for the advice. At least now I know I am thinking about it correctly. Honestly, from the way that the program is structured, I am amazed that it works at all. They are also using a Queued State Machine (QSM) architecture to talk with our Real Time PXI box. The structure is a new one for me, and VERY difficult to follow. Because of the ability to name the queue's (and being able to reference them in any vi without wire connection), program flow is completely broken. It is almost impossible to try to figure out which VI's are enquing which elements to which queues, and then dequing them out again. At the very least I would think that if you are going to brake program flow, due to no wires connecting anything, then at the very least you should have some comments letting others know which VI's to go to. Otherwise it is just random searching untll you can find what you are looking for.
One more question if that is OK. In this program they used functional global variables. I would think that you could (and should) use shared variables instead. I have been reading about it, and maybe the reason they needed functional globals vs. shared variables is because of the QSM you need clusters instead of arrays or single elements? Thanks for the education.... and forgive my ignorance....
Dan
07-02-2014 02:06 AM
FGV/AE is an ok solution, shared variables are mainly for interprocess communication. The main problem, as you notice, is the tendancy to drop and use them everywhere. This gets extra fun as new AEs wrap old ones and both are used everywhere ... an AE is an "light object" and should be handled as such.
It seems you need to refactor stuff, the QSM isn't a bad design, and if you already to most of the work in this structure, why not add a "supercluster" with all information you need that loops around with a shift register. (Maybe you can remove some AEs this way)
/Y
07-02-2014 08:49 AM
07-02-2014 09:00 AM
@mikeporter wrote:
WIth FGVs I consider them as write-once (or -rarely) and read-many type structures. For example, say you are storing setup information in a database, something I will do is create what is essentially a FGV but the first time it's called it automatically goes to the DB to read the data it needs to initialize itself.
With that setup, you might as well use an actual Global Variable. It does the same job and has less overhead.
07-02-2014 10:23 AM
Finding the where used cases for named queues and where obtained cases for vi server references to controls can get frustrating. The "find" feature in LabVIEW does allow text searches with several options.
Finding the String "<QueueName>" within the application instance on BD only and ignoring hidden stuff gets you to string constants that are exact matches to the queuename:
Searching for property node to a specific FP Object throughout a hierarchy can get devistating. Especially if the developer used the call chain to obtain a ref to the top level vi panel and pulled a rerence to a control that way
(DO NOT DO THIS) but I've seen it done:
Its "Legal" but almost garunteed to cause the guy who inherits your code to denigrate your parentage and intelligence. HOWEVER: that same text search for the control label text will find those string constants too.
Then document that code when you find out who is messing with what and how.
Chart it out over the app and e-mail that scribbling to the original developer too! Feel free to add a thank you note.
07-02-2014 12:45 PM
Except I haven't figured out how to put anything inside an actual Global Variable...
Mike...