LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CLD Practice exam

Could anyone offer up suggestions to better the code? I probably spent too much time getting it to work because when I stopped at four hours I realized I hadn't done half the commenting I wanted too.

 

Thanks in advance for any help or suggestions.

 

-Ian

0 Kudos
Message 1 of 5
(2,758 Views)

Overall the code looks pretty good. It is neat and organized. Thiings you should do:

  • Use a project file for the project.
  • Use a custon icon for ALL of your VIs, including the main.
  • Avoid unnecessary wire bends. While your code is not that bad you do have some wires that are off just a bit. The VI analyzer will flag these. For example, take a look at your Init case.
  • Pay attention to typos and misspellings in your comments.
  • I would avoid some of the cluster to array conversions you do. Your code would be much more readable and understanable using the unbundle.
  • While I understand your use avoid using the "Use default if unwired" option on your case structure tunnels. You generally get dinged for this.
  • I would change the type on your slider. No need to use a double. An initeger would be a better choice and you could avoid a possible bug with doing equality comparisons on doubles.
  • There is no documentation in your code to identify your "registers". Again, using the bundle/unbundle would make the code more readable.


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 2 of 5
(2,747 Views)

Down convert to 8.5 for those of us who don't have LV 11.  More people will be able to give you advice.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 3 of 5
(2,742 Views)

Saved as 8.5. 

 

-Ian

0 Kudos
Message 4 of 5
(2,738 Views)

-Put a description of your top-level VI under VI Properties/Documentation.  An over-all description of what the program does.

-Use wire labels where appropriate (such as your shift registers).

-I would use some sort of error handling and make sure all your property nodes are wired through with the error clusters.  This will also help with flow control since most of your property nodes are not wired to anything.

-Mark is correct in using the Use Default if Unwired on the tunnels.  Although this is programmatically correct, I avoid using this just for the sake of clarity on what the default value is.  Wire a default constant to these.  The reason you may get dinged is it's not self-documenting.

-Your shift registers are uninitialized in your main loop.  Was this your intention?

-In SetAllIndicatorsOff.VI there is no need for the Array Size function.  You can use auto-indexing on your For loop.  Or you can input your cluster and cycle through your cluster elements inside the For loop which will eliminate the need for the cluster to array function.

-In StationStepper.VI, your inner case structure does nothing.

-In DefaultWash.VI, the operation does not seem to agree with the documentation.  The High Pressure Wash is enabled regardless of which wash setting is selected.

-In NeedStationOne.VI, like the unwired default for tunnels, wire constants to the index array function.  Necessary?  No, but it's easier to see what the default settings are for the function, in this case 0 and 1; although your description of the VI mentions nothing about these selections (Under Body Wash and Bug Remover).

-In TimeElapsed.VI, position your controls and indicators on the FP in the order they appear on the connector pane.  This makes it easier to follow with the context help. Unless you're opening this VI during run, you don't have to worry about the look and feel of the FP.  You could make this VI simpler by using an FGV.

-Edit:One last thought, make sure you create a project from the start.

 

All together your programming style is clean and well documented.  I would definetly concentrate more on getting the documentation down right than proper operation, and as Mark stated, check your spelling.  It makes it harder to understand what your intentions are.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 5 of 5
(2,728 Views)