LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Flat sequence bug

Good morning.

 

I was working on a report generation vi for my project, and it has grown way too stacked. Loop within case, within sequence etc.

To keep a large VI tidy I was using the cleanup feature.

After another cleanup my 2 stacked sequences and 1 while loop became "bugged".

I tried to restart both labview and, later, the PC. Bug did not disappear.

 

Is there any way to fix the bug? I tried to replace structures with alternatives from right click menu. After few conversions the problem is not seen, but shortly appears.

Any way maybe with HEX editor?

 

Flat sequence thinks it has a stacked sequence wall on the right side. Mouse can't be seen on screenshots though.

Download All
0 Kudos
Message 1 of 26
(4,261 Views)

Another screen and the VI.

VI will run but it requires the project in order to run completly. It will run into an error if you try to press buttons...

Download All
0 Kudos
Message 2 of 26
(4,252 Views)

Well I doubt anyone will be able to address your specific bug given such a limited view of your code. However, based on what you did post I recommend a complete redesign of the code to use tried and true design patterns such as state machines.  I would also recommend you use more subVIs. I doubt that your code is very readable, easy to understand or maintainable based on what you showed us. If this program will be around for a while a redesign is warranted.

 

I realize that this does not answer your specific question but it is often difficult to track down and fix bugs in poorly designed code. The level of nesting you have alone will make it very difficult to track the flow through your code.

 

Update: Now that you posted your VI all I can say is "Good luck!". When I need the side of a building to view all the code I don't even want to attempt diving in. This is definitely in need of some major rework. It is nearly impossible to even see a complete section of code let alone get a sense of what is going on in the application as a whole.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 3 of 26
(4,251 Views)

Putting the code aside (undoubtably overnested), Question remains: how do i convince this confused sequence that it is in fact flat sequence.

0 Kudos
Message 4 of 26
(4,242 Views)

I guess this is a little late, but whenever you decide to make a major change like 'optimizing' something, you should make sure you have a backup of your VI, since optimizations (like 'cleanup') sometimes go haywire.  Myself, I try to keep code clean from the start, because it's easier to wash a few dishes here and there than to wait until the sink is full.  (I am deathly afraid of the 'cleanup' utility.)  😄

 

Optionally, it would be a nice feature to have an LV have an 'auto-backout' that makes use of an autosave that is part of the cleanup process, in case you are not satisfied with the results.

 

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 5 of 26
(4,222 Views)

Ziv,

 

Part of your problem (beyond what others have said about the architecture of your program) is that the diagram is too large.  In older versions of LabVIEW block diagrams more than about 15000 pixels wide would become corrupted, usually irreversibly.  Your diagram is over 30000 pixels wide.  NI must ahve changed something in a recent version to even allow a diagram that large.

 

You really need to start over.  With some luck you may be able to recover enough of the pieces of your program that you do not actaully heve to rewrite everything from scratch.

 

Tread very carefully!!! Make two or three back up copies.  Then start copying out pieces (like the contents of one frame) and make subVIs, even if they are not the most logical.  Save another copy every few minutes.  You are likely to have crashes, lost work, and corrupted files.  When you get a piece that seems OK, save it separately.

 

Now is a good time to learn to do it right.  You have to do it overanyway, so fix it as you go.

 

Lynn

Message 6 of 26
(4,190 Views)

There's a limit of 16k pixel wide diagrams (or something), you're not hitting that limit?

 

/Y 

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 7 of 26
(4,159 Views)

(I was posting as Ziv yesterday)

 

I, in fact, hit the 16000 pixels limit with my event structure, not without the help of clean-up feature.

 

The code is salvageable, and its good to know that this is the cause, now i know what to avoid...

At first i was trying to reduce the the levels of containing (structure within structure etc.), with no success - the bug returned.

 

BTW, when trying to create 16K++ long structure, LabView allows this, but will coerce the size on resize attempt. Maybe when cleanup system tries to expand the structure beyond 16K, the bug occures.

 

16K long event... Smiley Very Happy

________________________________________________________________________
"When I need the side of a building to view all the code..." -Mark Yedinak
"...when you need a navigation window to view the navigation window..." -Jeff Bohrer
0 Kudos
Message 8 of 26
(4,138 Views)

Then it's already long overdue to create some sub-vi's! A general tip is that a vi shouldn't be larger than a screen, and if it needs to be, limit scrolling to one direction. If it's bigger you're probably doing too much in it and you can capsule functionality.

Ofc stacking sequences isn't considered ok as limiting the width, it's actually the other way around, it's better to have a flat sequence so you see the data flow.

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 9 of 26
(4,123 Views)

I tried to move your structures around, but this happened:

ouch.PNG

 

Clearly this happens because of the massiveness of your VI. Luckily I was able to see the whole thing on my 1789 inch TVSmiley Very Happy

 

A usefull tip: Don't create a blockdiagram that is bigger than your monitor, preferable not over todays 22 inch standards. Now-a-days I'm working on a rather big project and to be able to have the block diagram of my main VI within my screensize of 22 inches, I had to create more than 100 sub-VI's. But it's way easier to have a clear view over the whole program, than a 16k+ pixcel block diagram that can only be viewable on my 1789 inch Smiley Happy.

 

I also believe many of the flat sequence structures can be removed. You should use the error wire for dataflow control and use sub-VI's if you got repeating code. Use logical icons for you're sub-VI's. Here is an example, which I prefer to use:

Example.PNG

 

Red icons to easily see my Sub-VI's from standard LabVIEW icons, and also some text that I can refer to with comments so that other people understand what the sub-VI's do. This way my main VI does not have a block diagram larger than my monitor.

Regards,
Even
_________________________________
Certified LabVIEW Associate Developer

Automated Test Developer
Topro AS
Norway
Message 10 of 26
(4,116 Views)