LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
asper

Shift register for Stacked Sequence Structure

Using the Stacked Sequence Structure can be an option to perform sequenced coding in a reduced space.

 

Usually some data, typically the error cluster or other wiring, have to be passed frame by frame for all frames.

A the present, the only option available is the "Sequence Local" and, in case of many frames, this becomes difficult to read and to maintains, and fills a lot of space.

 

In "While loop" the "Shift Register" passes data from an iteration to the subsequent iteration, in similar way, I suggest to introduce a "Shift Register" for "Stacked Sequence Structure", where the data are passed from a frame to the subsequent frame.


Sequences.png

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

In my opinion a "Shift Register" could simplify and clarify the use of "Stacked Sequence Structure".

 

Regards,

Asper

11 Comments
JÞB
Knight of NI

You're kidding Right?  I see no need to improve the usability of an essentially obsolete structure.  Stacked sequences can allways be replace with a state machine with vast improvements in performance and maintainability. 


"Should be" isn't "Is" -Jay
AristosQueue (NI)
NI Employee (retired)

This idea is a duplicate of this existing idea:

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Stacked-Sequence/idi-p/918243

G-Money
NI Employee (retired)
asper
Member

Thanks for the note that the idea is a duplicate.

 

Regards,

Asper

Rick Weiß
Member

Hey there, I created a template which combines your needs with the "vast improvments" of a state machine.

SequencedStateMachine.png

 

There is a default case with a TRUE for the while loop break and you just add your cases one after another!

 

Documentation:

Use this template to build a sequenced state machine design pattern. The states will be entered after their numbers in a sequenced way. If the last state you programmed is reached the default case will be entered, which stops the whole state machine. So beginning with state 1 you can easily create sequenced states one after another. Use this template to shorten your code within a VI where you would like to have an enhanced stacked sequence structure with the possibility to pass data through the cases via shift registers with vast improvements in performance.

 

Icon:

SequencedStateMachine_ICON.png

 

 

I hope this will work out for you - it did for me 😉

Rick Weiß
Member

Here again with correct error-case implementation

SequencedStateMachine.png

asper
Member

Dear folk,

after reading the negative notes on my idea and on the similar existing idea, I have learned to use the state machine in place of the Stacked Sequence Structure and I have appreciated this a lot!

 

Dear Rick Weiß,

thanks for your smart suggestion!

 

Regards,

Asper

jspinozzi
Member

I disagree about killing this idea (and I'll note it here and on the duplicate).  The stacked sequence is a brilliantly simple way to sequence actions without need for state machine, and it needs a shift register. 

VladimirP
Member

I agree with jspinozzi . Using stacked structure is excellent solution for instance for base code initialization. Error cluster must be shifted in each frame. Of course, we can use state machine, but why. State machine is solution for more robust solution.

RWD
Member
Member

It's kind of interesting to go back and look at this "old" stuff.  I didn't realize how hated Stacked Sequences were/are.  Hilariously I hated them for years (decades) and avoided them like the plague as I deemed them "non-sexy" and almost a programming no-no (i.e. The stigma of the lonely 'goto').  However, over the last decade or so I've come to appreciate them in all honesty because of their simplicity and the ability to save space in a diagram (pretty sure that's the intension).  And yes I'm guilty of "Convert to Stacked Sequence" once or twice as well. 😊 The idea of bothering to create a State Machine is frankly laughable. Obviously a suggestion from the Code Police faction.  The concept of a Shift Register isn't a bad one, but something tells me the implementation of such a construct might be a bit tricky.  Not to mention the apparent "stacked sequences bad and antiquated" mentality and the 15 years that have transpired since someone initially suggested this I'm not holding my breath. 

 

So might I recommend what I've resorted to for years a well place variable (Err).

RWD_0-1738073534879.png

It works like a charm.

 

BTW this excerpt is from a 24 frame stacked sequence (sitting inside of a very stately state machine, yup love those too) so filling the side of the diagram with error connectors isn't really an option not to mention the wiring.

 

RWD_2-1738074389025.png