Community Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Natt Sequence

The Natt Sequence is a mini-pattern used for executing LabVIEW code sequentially. It has multiple benefits over other sequential code constructs (like the Flat Sequence, the Stacked Sequence, or the Sequence Loop), including:

  • Self-documenting via the sequence enum
  • No extra tooling required, just edit the sequence enum to add/remove/modify/rearrange sequence steps
  • Code breakage when the case structure doesn't have frames for all steps defined in the sequence enum
  • Minimal extra code
  • Shift registers to share data between sequence steps
  • Optional early break with For Loop conditional terminal

The Natt Sequence template VI and its supporting VIM can be used in LabVIEW 2017 SP1 and later.

 

Note: The Enum to Array of Enums.vim ships with LabVIEW 2020 and later and is available in Quick Drop/palettes.

Darren_0-1584065767551.png

 

(bit.ly/nattsequence redirects here)

Download All
Comments
Ludwig72
Member
Member
on

I tried using this in LabVIEW 2017, but it's not working. The "Enum to Array of Enums.vim" returns 65.536 elements each time and not the number of elements in the cluster.

Mr._Jim
Active Participant
Active Participant
on
Hi Ludwig, I just tried this out in LabVIEW 2017 32 bit. It's working for me, but I have a U16 enum with five elements. Can you describe the enum you're using as an input?
Darren
Proven Zealot
Proven Zealot
on
@Ludwig72 wrote:

 

I tried using this in LabVIEW 2017, but it's not working.


Sorry about that. There is a bug with VIMs in LabVIEW 2017 that prevents the Enum to Array of Enums.vim from working properly. But this bug was fixed in LabVIEW 2017 SP1. I have updated the original post above to indicate that LabVIEW 2017 SP1 or later is required.

Ludwig72
Member
Member
on

@Darren wrote:

Sorry about that. There is a bug with VIMs in LabVIEW 2017 that prevents the Enum to Array of Enums.vim from working properly. But this bug was fixed in LabVIEW 2017 SP1. I have updated the original post above to indicate that LabVIEW 2017 SP1 or later is required.

Thanks Darren, this seems to be the solution - and one more reason for me to change to the newest version.

Hooovahh
Proven Zealot Proven Zealot
Proven Zealot
on

Thanks for sharing Darren.  I've seen variations on this over the years and I still think I prefer an array of string constant as the input.  The reason is because I'll resize the array of string to show all of the elements, and then the sequence steps itself can be seen without having to click on the enum constant to see the values and order.  This also allows for reusing of states, but to fair in such a simple piece of code I rarely use it for that.

 

Using the array of string constant does have the downside of losing the enum typing so it is possible to have a typo that goes to the default case.  But honestly this doesn't happen very often.  I usually find myself copying from the case to the constant or the reverse, and even if there is a typo it will be found quickly and not happen again.  I mean it isn't some string manipulation creating it, it is just a constant so once its right you're good.

Contributors