LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

General question about iterations

Solved!
Go to solution

Hi guys,

 

I have a hard time to understand others code.

 

Can someone tell me the 200 iterations I marked(yellow) in the file, where that number come from

 

I think it somehow relative to the left side number 4 and 50 but I am not sure

 

Thanks

0 Kudos
Message 1 of 12
(3,466 Views)

Not enough code is shown to figure it out. I'm guessing a local variable or property node for the "pause" button is written - either in another case in the case statement, or by the orange wire that drops off the bottom of the image in the middle of the right hand side.

0 Kudos
Message 2 of 12
(3,440 Views)

These yellow blobs are not LabVIEW objects and they are not even near any relevant LabVIEW code. I don't see where "iterations" would come from. You don't even show a loop (except for part of a left loop border)!

 

You need to attach the actual code.

0 Kudos
Message 3 of 12
(3,435 Views)

You need to show more code.  What you are displaying is an inner Case Structure (a conditional statement that can handle different opperations depending on True or False evaluations -- This is like an "if" and "else if" statement in textual programming languages).

 

You need to show us where the boolean for "pause" is because that is stopping the outer While Loop (and juding by the comments, there may be even more outer loops than that.  It is hard to tell).  This will likely explain why it is running 200 iterations.  The case structure just handles different opperations depending on which iteration it is on.

 

What you are seeing are just textual comments.  These are created by double clicking anywhere and typing.  They are used to help document code for future readability.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If someone helped you out, please select their post as the solution and/or give them Kudos!
0 Kudos
Message 4 of 12
(3,424 Views)

Thank you all for reply

 

The actual code are pretty big and I am not sure someone can take that much time to take a look.

 

My question was at "Sweep Conditional', the last block inside the while loop

 

The all yellow blobs were all my drawing for easy find, sorry for the confusion.

 

I knew the they are just textual comments which is why I am asking the question about 200 because I did not get it

 

Thanks

 

Download All
0 Kudos
Message 5 of 12
(3,403 Views)

The loop will stop when the stop button is pressed and under no other conditions.

 

(Sorry, this code is unmaintanable. My monitor is not big enough to really look at it.)

0 Kudos
Message 6 of 12
(3,386 Views)

I knew the stop button in this case

 

I just do not know there the 200 come from inside the "Sweep", I mean how the 200 been counts

 

Thanks anyway

 

 

0 Kudos
Message 7 of 12
(3,378 Views)
Solution
Accepted by topic author huskerli

Wow, this code shows some very bad practices.

It's not really 200, it's 50. And it's based on Temp Setpoint, Current Temp, and some value that ends up in a shift register. Oh, under the "Temperature Monitoring Graph" label, there's an Increment that gets compared to 50. Set a conditional breakpoint to pause at 49, turn on highlighting, and try to read the tea leaves.

Message 8 of 12
(3,352 Views)

Wow! About the only things you can say that are good about this code is that the wires are relatively neat (though they do flow under objects and backwards at times) and there appears to be lots of comments. Whether the comments are accurate or not is another matter. Beyond that this code is screaming to be rewritten so that it is easier to understand and maintain. There are much better design patterns to use such as a state machine. That alone would help this code dramatically. More use of subVIs would also help quite a bit.

 

Just out of curiosity I ran this through the VI Analyzer and it failed 40 out of 86 tests. Half of the tests that failed reached the maximum number to report so I am not sure how many instances of these specific tests there actually are. BTW, the block diagram is 8740 x 1124. The cyclomatic complexity was quite high. As reported: "The diagram of this VI has cyclomatic complexity of 117 which is more than the user-specified limit (20). Code with high cyclomatic complexity is difficult to debug and maintain. Move some decision points (case structures, loops, etc.) into sub-VIs so that each module can be tested independently, and easily maintained."

 

I feel sorry for you or anyone else that needs to work on this code.



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
Message 9 of 12
(3,338 Views)

Perhaps the only thing about this code that is connected to the Real World is that the FP has a "little, bitty" control to the left and above everything else that is labeled "Region of Interest" and when you go to the BD, it's not connected to anything. There's a whole lot of other stuff that's not connected to anything, too, especially error wires that start at seemingly random places and then just stop, like the original writer didn't really want to know what errors there might be.

 

Cameron

 

To err is human, but to really foul it up requires a computer.
The optimist believes we are in the best of all possible worlds - the pessimist fears this is true.
Profanity is the one language all programmers know best.
An expert is someone who has made all the possible mistakes.

To learn something about LabVIEW at no extra cost, work the online LabVIEW tutorial(s):

LabVIEW Unit 1 - Getting Started</ a>
Learn to Use LabVIEW with MyDAQ</ a>
0 Kudos
Message 10 of 12
(3,302 Views)