Jump to content

Please Review My CLD Sample Exam


Recommended Posts

I am going to take the CLD in a month or so, so I figured I would work on some of the exams and post it up here for your advice.

I started with the Car Wash exam, and will do the other ones as well.

It came out a little simpler than I have planned.

I feel that there is some way to make the diagram even cleaner. I still had some time left, so I probably could have thought of something.

Let me know what you think:thumbup1:

It is saved in LV2009.

Car Wash.zip

Link to comment

Let me know what you think

I'm not a CLD and never took the exam, so take what I'm saying with a grain of salt.

Let's start with ameliorations I would suggest:

1- You've put a "Wait Until Next Millisecond" and you use a 75ms timeout on your Get Queue primitive. If you were to remove it altogether, you'd still have the 75ms timeout to slow down your loop, except when you have something waiting in Queue.

2- That gets me to your use of the Queue repetitively for each of your actions. You parse the same string to the queue unless the time is elapsed, in which case you reset and move on. That works OK in this case, but in real life, you'll want to start a process, say "Main Wash" and you can't do that repetitively until it's finished. In fact, you call "Main Wash" a hundred times before it moves to the next action in the list. There are probably ways to salvage your design to make it call each car wash action only once while keeping track of time and position switches.

post-10515-1264457632_thumb.png

3- Probably minor, but your Queue wire is bent around a Case Structure for each car wash actions. It would probably be better style to try straightening it.

4- Your Default case executes the same code if your queue reads an empty string (timeout), "Wait" (which I haven't found in your program) and any other command that is not an handled state. You could add an "unhandled state" diagram that would correspond to your Default frame. If the queue is empty, you could use a "Idle" state (or Wait) and put an Event diagram to really wait for the user to take action of one of the switches to change state. With timeout = -1, you wouldn't have to worry about the processor running to fast when Idle and you could wait for an event to happen.

As a collateral to using an Event diagram, you would have a more expandable program. For example, take your call for activating a car wash selection:

post-10515-126445746349_thumb.png

With two choices, it doesn't clog your diagram, but what if you want to add a third one on the fly... or a fourth. You never know what the car wash owner will ask next!

5- I would have added an empty SubVI for each action: Wash, Soap, etc. just to show the routine is being executed in the right frame. To convert your program from example to real-world, only the content of these VIs would have to be filled in.

Positive points:

1- Indeed, the code is simple. You make good use of subVIs for repetitive tasks. That definitely shows you've thought about it before starting to code.

2- You've documentation all subVIs (descriptions, tip strips, frames, wires).

3- Code is clean and a lot of space to breathe. Apart from some minor wire bending, the code is easy to read.

Finally, if you had some loose time left, I would document with a little more meat and make sure the tip strips are differentiated. All your wash state indicators have the same tip strip... (Do what I say, not what I do... most of the time I don't do that myself, except during exams!!! :P)

Good luck getting the CLD! Keep us posted.

  • Like 1
Link to comment

In addition to what Francois has suggested you should note that you will most likely perform an extra step when the Stop button is pressed. The button will most likely be read before the action in your case statement is processed. Remember, just because something is on the right of the diagram doesn't mean it will execute after the stuff to the left of it. You probably want to include some artificial data dependency to force the read of the Stop button after you process your action.

Remember to initialize your controls when the program starts. If you actually press the buttons before starting the program it will immediately start the economy wash cycle. Speaking of button controls I don't recall if the requirements in the sample exam included it but it is generally a good idea to disable the controls while you are in a wash cycle. In addition, using this architecture you are able (albeit you have to be real fast) to press both buttons at the same time. The selection most likely would need to be mutually exclusive.

Remember to document everything, including constants.

Overall your code is clean and easy to read. I would avoid saving your code with the block diagram maximized. You want to try and make it fit in a single screen. When I deselected the "Maximize window" only a portion of the code would be visible at any one time and I would have to scroll around to see the code. Speaking of monitors and displays, I know that in earlier versions of LabVIEW if code was saved on the second monitor and then opened on a system with a single monitor you couldn't see the code until the window was maximized. I have not tested to see if this is still a problem or not but as a result I always save the final code opened on the primary monitor.

If you have the time and would like to really impress the folks grading your code try to align the code in each case so that when you cycle through the code you don't see it jumping around. This sample exam generally ends up with multiple cases all having essentially the same code. The final code looks especially clean when you can cycle through the cases without seeing the code jump around. (I know, this is extremely anal but it is impressive when it is done. I doubt you would ever lose points for not doing this.)

Nice job. I would suspect that this code would pass the exam. Good luck with the exam.

  • Like 1
Link to comment

Thank you all for the responses.

I was going to go with a producer consumer style program, but got hung up on how to pause the timer. When I got to coding the single loop state machine and got the Functional global timer going (first time I had done that part), I realized how I could handle that instance, but I was too far into it to start coding from the beginning.

That would have been my preferred method (I use that it most of my applications), since it would let me do the event structure and some more of the disable/enable items mentioned above.

Mark - Yes I do have dual monitors and the block diagram was saved on the second monitor. I will try to remember that.

Link to comment

Mark - Yes I do have dual monitors and the block diagram was saved on the second monitor. I will try to remember that.

My team all has dual monitors as well. However when we first started getting dual monitors they were rolled out in phases and it was interesting at first as we would open code and it would be "invisible". This was back in the 8.2 days so I am not sure if they fixed the issue or not. I just mentioned it as something to keep in mind.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.