LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Parallel Stacked Structure

All,

 

Wouldn't it be nice if I had a structure that was visually arranged like the stack sequence structure but allowed every sub-diagram to execute in parallel? Perhaps my wish for this is because I'm coding incorrectly! Who knows? Let me know your thoughts.

 

- Ken 

0 Kudos
Message 1 of 9
(3,947 Views)

Lets start with the functionality:

- put code in a structure

- have some inputs, and some outputs to the structure

- there can be several of these structures running in parallel

- you may not want to see the code within all of the structures

 

 

Wait a minute, that sounds remarkably like a subVI Smiley Surprised

Cory K
0 Kudos
Message 2 of 9
(3,942 Views)

Hi Ken,

 

in addition to Cory's comments:

Did you notice that LabView runs code in parallel by default? It's called dataflow Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 9
(3,932 Views)

Thanks for the sarcastic comments! But, let's say I've got a three or four blocks of code I'd like to run in parallel, take up a pretty significant portion of screen size, and shouldn't really be modularized in SubVIs!

 

Thanks!

 

- Ken 

0 Kudos
Message 4 of 9
(3,925 Views)

..and yes, I do know that LabVIEW runs code in parallel, but once again if I've got quite a few blocks that take up significant amount of screen space, I'm going to be doing quite a bit of scrolling! Yay......

 

0 Kudos
Message 5 of 9
(3,923 Views)

Hi Ken,

 

this wasn't meant to be sarcastic. Your question just leads to that conclusion...

 

Anyway, there's a product suggestion page at NI.com. And there's the new Idea page to post your idea.

 

My personal comment:

I wouldn't use such a structure as it hides code (similar to stacked sequences). And it could break dataflow.

And there would be synchronization problems: what happens if one "frame" is finished faster than others? Will it wait until the whole structure has finished execution (changes execution order compared to have all in parallel) or should it's output get propagated earlier (breaks dataflow)?

I still opt for subvis as suggested before...

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 9
(3,914 Views)

I wouldn't use such a structure as it hides code (similar to stacked sequences).

 

What's wrong with hiding code..? SubVIs in a lot of cases simply hide code, they're not always broken into modular statements as in other languages. 

 

And it could break dataflow.

How?

 

And there would be synchronization problems: what happens if one "frame" is finished faster than others? Will it wait until the whole structure has finished execution (changes execution order compared to have all in parallel) or should it's output get propagated earlier (breaks dataflow)?

 

Well honestly it should never exit if it's meant to have continually running processes.. but I imagine it would wait for them all to finish. Good point.

 

This is exactly why I bring up things like this no matter how stupid I might sound so that I can expand my thinking and find the proper understanding.

 

- Ken 

0 Kudos
Message 7 of 9
(3,910 Views)

Hi Ken,

 

"What's wrong with hiding code..? SubVIs in a lot of cases simply hide code"

 

I like to see what's happening in a vi. With a stacked sequence this isn't possible. Using subvis I still see what the main vi does as I create descriptive icons and useful documentation texts.Smiley Wink

 

"they're not always broken into modular statements as in other languages."

 

I don't get this...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 9
(3,904 Views)

xkenneth wrote:

All,

 

Wouldn't it be nice if I had a structure that was visually arranged like the stack sequence structure but allowed every sub-diagram to execute in parallel? Perhaps my wish for this is because I'm coding incorrectly! Who knows? Let me know your thoughts.

 

- Ken 


Without seeing your code it is hard to answer that question.

 

You could literally put the code from each seq fram in a unique, single frame flat seq structure. Do that for all of your frames and then literally stack them on top of each other.

 

The two amin draw backs I see from doing that is

 

1) You will only be able to see the one on the top of the pile unless you move around.

2) You will not be able to click on something to switch which frame you want to look at.

 

But it will do what you are asking.

 

So let say we don't stack them on top of each other but side by side. These will still execute in parallel but that will take up a lot of realestate. No problem, just size down the frames (shut auro-grow off) so they all fit on the screen.

 

This will still work but it will be a pain in the arse to edit and find code. So the first instinct would be to size them back up but there is another way of handling this. instead of using a seq frame use a sub-VI with an icon that represnts what is going on the sub-VI. Using this approach, you have everything side by side executing in parallel on the main diagram and when you want to edit something the sub-VI diagram is big enough to let you see everything.

 

But what if I want to use an event structure to handle the events from the GUI?

 

Use dynamic event registration in the sub-VI to register for the events.

 

What if I want to manipulate a property or update the GUI from teh sub-VI?

 

Use control references.

 

Here is a screen shot of the app I am working on today.

 

Use_subVIs.PNG

 

 

It has about 400 sub-VIs so far and will probably reach 600-800 before I am done. Yes I use many more techniques than I listed above.

 

The following is just my opinion:

 

A "Top Level" VI should be like a "top Level" report. It should imply the over-all concept but not get tangled up in low level details.

 

If you want more help from us, we do much better when we have concreate images rather than a lot of words. Post up your code and the other volunteers here ly post some tips.

 

Just trying to help,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 9 of 9
(3,895 Views)