04-16-2008 01:10 PM
04-16-2008 02:30 PM
Thanks Dave. 🙂
I'll have a look at it tonight.
04-17-2008 01:43 AM - edited 04-17-2008 01:49 AM
tst a écrit:
Ben, personally, I much prefer collecting all the SR values into a cluster and then bundling and unbundling by name. That way you have a single SR and the code is cleaner.
04-17-2008 07:53 AM
Hmmm. It took me longer to read all of your replies than it took to write the Nugget.![]()
Thanks for reading and replying!
Lynn wrote
...turn off Auto Grow for the structure before squishing.
...Duplicating and modifying that case may be a time saver also.
Yep. I generally turn off "Auto-grow" (auto-explode) on all of my work machines, not to enable this technique but to prevent my long-winded documentaion from tripling the size of my diagram. "Duplicating" is definately preferable to adding and and wiring, GOOD POINT!
smercurio wrote
Wouldn't the Tunnel Wiring Wizard do this for you?
Yes I beleive you are corect. I never use that tool in my work projects since it is based on scripting which is not supported. I have enough challenges in delivering quality code without introducing an unkown aspect that would laways make me wonder "Is that bug due to using the tunnel wiring wizard?" Yes. I am a wimp. ![]()
tst wrote
I much prefer collecting all the SR values into a cluster and then bundling and unbundling by name. That way you have a single SR and the code is cleaner.
Good point tst. But because these Nuggets are all about "splitting wires", I have to point out that I feel uncomfortable putting ALL in a single cluster. If the assorted values are realted logically, yes. But grouping unrelated values seems to break rules about "data Normalization". Without quoting from Codd (sp?) I think of it this way. If I am passing the whole cluster to a sub-VI for it to do its job, then they are probably related. On the other hand, if some are used in one sub and the others used in a differnt sub, then I will probably implement them as seperate clusters.
The other exception applies to large data sets and performance issues. Large data sets will get their own shift-registers.
JLV posted
But it does happen that a client wants additional features ...
I wish I could blame the above on the customer but I can't. I ws reviewing my code and realized that I had not accounted for a queue going dead (eg The creater of the queue going idle and LV detroys the queue.
JB wrote;
This may not be considered as a good solution by all of you but if the cluster becomes too big, I put it in a VI to save space on the diagram.
That is another good point. If a state machine has a lot of states and a value is only used in two of them, an Action Engine is a nice approach that really cleans up the state mahcine code. Of course this is not an easy method to use if the state machine has to be re-entrant since the AE would either be shared by all of the instances or else I would have to bend-over backwards to use VI-Server and invoke nodes to keep the state info distinct.
Again thatnks to all of you for reading and replying!
Ben
04-17-2008 08:07 AM
I usually leave a dummy case (Undefined State) where all wires just pass through , this handles unknown case selectors in the use of strings (not enums) To add cases I duplicate this state and all the wires are hooked up. I have always wanted a feature that added another option for tunnels out which is "Use default case value", this is different than use default value (which I never use). The use default case value would essentially duplicate the code of the default case in a case structure in the unwired cases but not make this visible to user. It would really cleanup code, It could break data flow but only the flow visible to the operator. Dont know how hard it would be for NI to add this but I would think that it would be worth the effort. There are many examples that many SR pass through a case with no reason other than to satisfy dataflow.
Paul
04-17-2008 09:07 AM - edited 04-17-2008 09:09 AM
Ben a écrit:JB wrote;
This may not be considered as a good solution by all of you but if the cluster becomes too big, I put it in a VI to save space on the diagram.
That is another good point. If a state machine has a lot of states and a value is only used in two of them, an Action Engine is a nice approach that really cleans up the state mahcine code. Of course this is not an easy method to use if the state machine has to be re-entrant since the AE would either be shared by all of the instances or else I would have to bend-over backwards to use VI-Server and invoke nodes to keep the state info distinct.


04-17-2008 09:15 AM
04-17-2008 09:24 AM
Yes ! Sorry for so many words to try to explain such a little thing ! Thank you for bringing this into a short and comprehensible sentence... and for the tip with hidden controls !
JeffOverton a écrit:Oh, so you're just initializing the proper data types for the shift register. I do the same with hidden controls, which gives the option later of initializing from a calling VI.
04-17-2008 09:37 AM
Ben,
who'da thought a little nugget about how to simplify wiring a case structure would have brought out so many good ideas? Keep up the good work!
04-17-2008 09:38 AM