From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Understanding the flow of data

Hello,

I have a very complex and messy looking block diagram that I need to clean up. I want to put all the code into sequence diagrams so it is easier for others to follow and understand. My approach is as follows:

 

I run execution highlight to understand the flow of data so I can put the code into the correct sequence.

My problem is that data is jumping from one case structure to another to a for loop to another case structure to random areas to stacked sequence structures, etc.

 

Qeustion: How can I get my code into sequence diagrams without changing the functionality since the data jumps all over the place?

0 Kudos
Message 1 of 3
(2,576 Views)

First, sequence structures are generally to be avoided in LabVIEW programming because they disrupt the dataflow paradigm which makes LabVIEW so powerful.  That jumping around you see is likely code executing in parallel and making your program more efficient.

 

A better way to clean up messy diagrams is to create subVIs from sections of code which logically belong together.  The wiring between subVIs defines the dataflow and, thus, the behavior of the program.  You can select a portion of the code on a block diagram and go to Edit >> Create SubVI.    This will create a subVI with all the necessary connectors.  You will need to open the new subVI, clean up the panel and diagrams, edit the icon, add documentation and save it.  This is much faster than creating a subVI from scratch and then using it to replace code on the messy diagram.

 

Look at the style guides for other hints.

 

Lynn 

Message 2 of 3
(2,573 Views)

Sequence structures are not tools to cleanup the diagram, their only use is to impose execution order where dataflow cannot do it.

 

Sequence structures, especially the "stacked" kind, are not used by better LabVIEW programmers. They make code fragmented and difficult to debug.

0 Kudos
Message 3 of 3
(2,572 Views)