05-19-2010 02:38 AM
Hi,
I have a sequence with several frames and I need to overgive some values from frame to frame via Sequence Locals.
Where should I place the Sequence Local? On the top or on the bottom of the frame? Maybe on the right?
If I place them on the right side of the frame the wiring looks good in the one frame but it is ugly in the other frame.
How do you do it?
Greetings
Johannes
Solved! Go to Solution.
05-19-2010 02:49 AM
Hi Johannes,
A good practise instead of using a sequence would be to create a statmachine.
You might have future changes in you code which could be done easier then when using a statemachine.
There you can pass data between the states with a cluster, which elements you save once in a typedef.
There should be some examples for statemachin or a short paper online, just do a search under ni.com
Thanks,
Christian
05-19-2010 03:24 AM
Thanks for the answer Christian!
I don't think that a state machine is necessary in my case. I use the sequence only, because the VI becomes too large otherwise. The VI prepares data for displaying in a chart and there is a lot of preparation (sorting data, filtering, calculating tolerances, managing chart properties, etc.). The order is always the same, so no really need for a statemachine. I could put all that data preparation in a sub VI, but that will make it just more complicate if it is possible at all (I can't put property nodes of my chart in a sub VI). If you want, I can attach a part of my VI or screenshots.05-19-2010 04:48 AM
Johannes,
the decision to use a sequence structure above a proper statemachine is the worst thing you can do. Honestly, i would have the stacked sequence structure to be removed from LV at all, the flat sequence structures for all targets except FPGA. OK, a single sequence frame comes handy at time, but usage of sequence structures has several sever backdrafts:
a) Exit?????
b) Readability
c) Scalability
d) Maintainability
So the sequence structure lacks in all parts necessary to create professional software. So: Please do not use it.
Norbert
05-19-2010 04:50 AM
Hi Johannes,
Even when its not necessary, it's better programming practice.
You might need to implement some changes in the future, or to use the code in another, similar project, then its way easier to implement when you used a state-machine before. And it's not much work changing from a sequence to a statemachine, except you have hundreds of frames/states.
Back to your first question, it depends on your taste where you place the tunnels in the sequence.
Christian
05-19-2010 08:52 AM
johanneshoer wrote:Hi,
I have a sequence with several frames and I need to overgive some values from frame to frame via Sequence Locals.
Where should I place the Sequence Local? On the top or on the bottom of the frame? Maybe on the right?
If I place them on the right side of the frame the wiring looks good in the one frame but it is ugly in the other frame.
How do you do it?
Greetings
Johannes
Wize-crack answer:
In the bit-bucket along with the stacked seq structure.
Serious Answer:
To the best of my knowlege, there is no standard established since Stacked Sequences are shunned.
The suggestions above about using a state machine with Shift Registers is good and I hope that you will reconcider.
Thank you,
Ben
05-19-2010 09:18 AM
05-19-2010 09:20 AM
ErnieH wrote:
Or use a case statement in a for loop. Tie the loop counter to the case input. [...]
Which would reduce scalability and maintanability to nearly zero again. So there is only one valid way: introduce a proper architecture for the software which would be a statemachine at least....
Norbert
05-19-2010 09:33 AM - edited 05-19-2010 09:33 AM
johanneshoer wrote:
(I can't put property nodes of my chart in a sub VI). If you want, I can attach a part of my VI or screenshots.
Yes, you can put property nodes of your chart in a subVI. You just need to create a reference to the chart and pass that into the subVI
05-19-2010 09:39 AM
for(imstuck) wrote:
johanneshoer wrote:
(I can't put property nodes of my chart in a sub VI). If you want, I can attach a part of my VI or screenshots.Yes, you can put property nodes of your chart in a subVI. You just need to create a reference to the chart and pass that into the subVI
In fact, there's an example that ships with LabVIEW that shows exactly this. Search for "properties" and open the "Property Nodes" example.