LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, it's the guy with the huge diagrams and messy code. Cleaned it up and learned some stuff, wondering if you could evaluate and advise.

Hello again!
 
I believe I've got the functionality I need on this program now.  Everything seems to be working correctly (albeit slow) and I've decided to take the time to pay attention to style and to create and use subVI's for some things.
 
I'm attaching my original mess and also my most recent draft and subvi's so that you can see what it's doing.  In compressing my diagram I did away with a lot of labels so it's a bit harder to 'read' but much cleaner.
 
Basically I'd just like to know if I'm on the right track and get some advice on what to do with a few of the things that I think are still a clutter factor:
 
-The split signals and merge signals primitives and their associated wiring.  What to replace them with?
-The compound boolean structure in the center with miles of wire going to it.  Any other way to achieve a multiple 'or' like that with less wire and clutter?
-The ugly 'file header' mess of string constants outside the while loop before the 'create file'.
 
Also, I'm not sure if I need more execution control.  I looked at the hierarchy and it looks insane.  Any thoughts there?
 
Just trying to improve myself so I ask less dumb questions, thanks so much for any input.
 
Also, are there any non-NI.com boards that discuss Labview?  Maybe something a bit more informal?
___________________________________________________________________
Still confused after 8 years.
Download All
0 Kudos
Message 1 of 5
(2,779 Views)
Hello,
Things are starting to shape up.  I am just going to pick off a couple of the easier questions.
1.  For the string concatenation at the beginning.  Rather than doing that, just type everything into one long string constant.  The string constants can be resized so you can see more of the text at once.  Since there are all constants, there is not need to do the concatenation on them.  If use turn on /codes, you can enter the slash codes for your separators such as \s for space, \t for tab, \r for return.  If you put an indicator after your concatenation and run your code once, then go to the block diagram and right click the indicator and select change to constant, you won't even have to retype in everything.  Then you can delete the mini strings and concatenation and just wire up your new constatn.
 
2.  I would recommend not turning off labels for indicators and controls.  Yes it takes up a little space, but it makes the block diagram much more readable for knowing what controls and indicators the wires are running to so you can spot any errors.
 
3.  There are a few more spots where right-click Clean Wire could help.
 
4.  I don't think you'll find anything cleaner than the compound AND in the middle.  Anything better would require changes in all the code leading up to it.
 
5. In the second from the bottom structure to the lower right of your loop.  You have a SC1Mod4/ao1 in the false case and a Dev2/ao1.  Seems like they should be the same channel or task.
 
6.  Having the 18000 wait in the false cases will cause an 18 second pause in the operation of your program on every loop iteration whenever one of the false cases executes.  This may cause issues with the user making it look like the interface is frozen.  You may want to use a producer/consumer architecture and send those commands out to independent parallel loops by way of queues (a bit more complicated, but there are examples on it.)  You may want to set up those case structures to execute only if false and the boolean was true on the previous iteration which you track by shift registers.)
0 Kudos
Message 2 of 5
(2,768 Views)

Yup, I caught that incorrect Dev2/ao1.  That would have buggered a lot of things up!

Would putting those delays in an outside loop with a local variable work?

___________________________________________________________________
Still confused after 8 years.
0 Kudos
Message 3 of 5
(2,738 Views)
The types of structures mentioned by Ravens Fan in item 6 are probably the best. Learning to use the Producer/Consumer state machine architecture is very worthwhile. Once you have become familiar with it, you may begin to wonder how you ever programmed without it.

When I need long delays I often create a Wait state in my state machines. One of its inputs is the "End of Wait" tick count. This is calculated from the current tick count and the desired wait time by the previous state. For your example "End of Wait" = Current tick count + 18000. The Wait state compares the (new) current tick count with the "End of Wait" value. If greater, then return to the calling state, else stay in Wait state. This process allows any user inputs, errors, or other system status changes to interrupt the wait at any time.

Lynn
0 Kudos
Message 4 of 5
(2,732 Views)

Ralph queried "Also, are there any non-NI.com boards that discuss Labview?  "

Well if you really want even more heated conversations about LabVIEW you can sign-up for LAVA. (LabVIEW Advanced Virtual Architects) (pun intended Smiley Wink )

Ben

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