My Solution for CLD Sample Exam (Traffic Light)

Hi there folks,
I was just preparing for my CLD exam and was going through the sample exam provided on ni.com.
I wanted to get any feedback for my solution. I looked at the solution and it seemed way to complex
to achieve a simple task! Then again, I am still learning.
ThanX in advance.
Attachments:
Traffic Light1.zip ‏81 KB
Traffic Light2.zip ‏81 KB

About queues vs shift registers.  Queues allow you the ability to insert elements into either end of the queue.  You can also write code to insert several elements at one time.  With shift registers, only one new element can be carried over to the next loop at one time.
Lets say you have a state machine that always executes in the same order, no matter what the outcome, like State1 then State 2 then State 3.  A shift register works fine for this simple example.  However with queues, you can use a loop to insert the 3 states before the main state machine loop, then dequeue in the state machine.  This is really a matter of preference.
Next example.  Lets say you had a situation where you want to run 3 states, but if the second one fails, you want to run 2 other states before going to the third one.  You could use a shift register, and you would have to look at each state to see which is next.  A queue would allow you to insert the 2 extra states in between states 2 and 3.  Of if you want to exit on some failure during a state.  You can use the queue to insert the exit state at the opposite end so that it is the next to be dequeued.
Another situation is if you allow the user to call certain actions that require running several states.  When the user presses button A, you enqueue states 1,2,3.  If the user presses button C you enqueue states 7,8,9.  So now you have a state machine in which states are defined by some user action.  This would be more difficult to do with a shift register. 
There are many other situations where a queued state machine is better than just a simple shift register.  For the simplest of situations, I might use a shift register only.  But I like to make it a habit to always use queues because of their versatility, and for the fact that I can go back and upgrade a simple state machine to a more complex one easily if it is done with queues.  Be sure to use shift registers on the queue error in and error out so that errors can be propogated from one state to the next.  On each state, check the error status.  If one occures, enqueue a state at the other end to jump to your error handling state (or exit).
- tbob
Inventor of the WORM Global

Similar Messages

  • Does NI post solutions to CLD sample exams?

    Does NI post solutions to CLD sample exams?
    Thanks in advance.

    There's solutions in the CLD sample exams zip file found here and there's a sample solution for the CLA exam.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • My stoplight.vi for CLD practice exam

    I am preparing for CLD and looking for comments on my implementation of the "stoplight" CLD example question.  Any comment would be appreciated.  Kudos will be distributed liberally.
    The pdf for the example question is in this zip file:
    ftp://ftp.ni.com/pub/devzone/epd/2419.zip
    Attachments:
    CLD_Traffic_Light.zip ‏42 KB
    Sample CLD Exam - Traffic Light.pdf ‏350 KB

    It looks like your code does everything that the clad exam wants. I see that you documented everything but the main vi. You might just want to explain what the purpose of the mian vi is. I think you code is simple and east to read. The state machine is simple and works good and everything seems to flow nicely. You document well what is going on in each loop.
    I hope this was userful info.
    Tim
    Johnson Controls
    Holland Michigan

  • Security CLD sample exam

    This is my answer to the CLD sample exam "security system" Does anyone have any suggestions or comments?
    Attachments:
    Alarm4.vi ‏35 KB
    File.vi ‏16 KB

    Islandman wrote:
    ... but I'm not sure what to do about the file reference. I use this to close the file at the end (that's why I circulate it). Since I log an event every time there is a change, I access the file many times, but I want to close the file at the end, only once.
    No, you're not understanding. You are using "write to spreadsheet file", which is a high-level function. You can open it like a plain subVI and see what's inside. You will notice that it opens the file, writes (or appends) the data, then closes the file, all inside the function. Thus there is no need to open or close the file externally. At all!  Ever! You have a useless and redundant mix of high-level and low-level file functions.
    Sure, if performance is an issues, that constant file opening and closing could be a bottleneck. So an alternative would be to use all low-level file function. You would open/create the file before the loop, keep the file open during the loop and write using plain low-level functions, then close the file after (outside) the main loop once the program finishes.
    ALSO: Your subVI needs a makeover anyway. Use intuitive control labels (not "numeric"!). Arrange the FP nicely. Add some documentation. You should also do something about the icon. It is surrounded by blank space, making the wires seem to hang off in thin air. It is also a bit disconcerting that you are not doing much error handling. The main program would never know if the file program encounters an error. Then you are abusing the file open error to determine if the file exists or not. There is a function for that! You don't need to get the date/time in the error case, so this function belong inside the other case.
    LabVIEW Champion . Do more with less code and in less time .

  • Car Wash CLD Sample Exam Solution

    Attached is my solution to the CLD Car Wash Sample Exam.  Comments will be appreciated.  The main VI is Main_6.15.10.
    Thanks in advance.
    Attachments:
    CarWash_6.15.10.7z ‏60 KB

    Here are my thoughts....
    Your solution is functional, so there are points for that right away.  Where I think there could be some more work is the architecture.  The exam requirements state that the design must be "easily scalable".  To me that means new states or cycles can be added without much messing about on the block diagram.  If you notice, there are only certain... lets call them Properties of each cycle type.  You could have an array of cycle properties such as cycle time, cycle position switches, cycle name, and flags for standard or deluxe.  Then you could reduce your cycle handling to a single state that just indexes through the cycle array and executed the next appropriately flagged cycle.
    I noticed a Select node in each of your cycle states with constant True and False wired to it.  That is a total of three elements plus two wires that should have just been a Not right off of the Boolean palette.
    You stop the program with a Stop button, yet you allow the user to close the window.  You should consider a Panel Close? event in your event structure to handle a use trying to close the window so that you can execute a graceful stop.
    There is no VI Description filled out for your main VI.  You should also have an icon for the main VI.  The suggested front panel shown in the exam has an icon.
    When your VI is running, you have the scrollbars, toolbar, and menu bar shown.  None of those serves any function for the application, so they should not be shown at runtime.
    The Stop button that is used to stop your application is reset with a Property Node.  Not that there is a performance issue here, but it is generally not good practice to do that unless you are forced to.  Consider just using a Mechanical Action of Latch When Released instead of Switch When Released.  That way you do not need to force the reset to the False state.  Of course, I would rather see something like a Stop state writing to the While Loop conditional terminal.  Also, you could have used a Local Variable to write the initial state of the Sim Switches instead of the Property Node.
    The graders like to see code comments describing your algorithms.  I would say that you need more of those.
    A 10 msec timeout on the event structure is a bit hyper.  Nothing in the system runs that fast, and the only thing you are waiting for is the user.  You could actually have a -1 wired there if you add an event case for the Stop button and Panel Close.  It will greatly reduce the CPU cycles (again not that there is a huge performance issue here).
    Come to think of it, the 20 msec wait for next multiple timer is a bit hyper too.  Your timing requirements are on the order of seconds.  You do not need to loop that fast.
    In general I prefer to have the Event Structure outside the State Machine.  Either that, or I use the Event Structure as the State Machine (in place of the Case Structure).  That way, if you need to respond to the user interface, you can do so without waiting to cycle back to the Idle state.
    This one was not listed in the requirements, but it would be very helpful to see the clock.  A cycle countdown timer or elapsed time indicator is so helpful to the user and the grader.  It confirms that things are working properly and the the application has not sieved up.  Users like to see something "alive" on the screen.
    To end on a positive... good job remembering to Disable the Purchase Selection buttons once the user clicks one.  I got ding'd for forgetting about that back when I took the CLD in 2003.

  • CLD Sample Exams: How to deal with references ?

    Hi@all:
    I reviewed  the sample exams solution for the CLD provided by NI and noticed, that they trifle with references. As shown in the Security System and the ATM Machine, references were opened, but not closed at the end.
    What do you think, will this cost Style points?
    The exams can be grabbed on the NI site searching for CLD.
    Solved!
    Go to Solution.

    I would ding them for a lot of points but it is not my test but NI's so play to their rules get the cert and then do it right.
    When you get to that part of the exam just add a note saying those refs do not need t  be closed because they are static and maybe you can get some bonus points for knowing the differnence.
    How to know the difference?
    See here.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • CLD Sample Exam Solution for Review - ATM

    Please see the attached ATM controller code. I would appriciate any feedback as I am sitting the CLD exam next week.
    Matthew
    Attachments:
    ATM.zip ‏374 KB

    Its probably been a few weeks since you took the CLD. How do you think you did?

  • Please Review my CLD Sample Exam

    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.
    Thank you.
    Any and all comments are welcome.
    Kenny
    Attachments:
    Car Wash.zip ‏68 KB

    On first look (not that I'm able to give any opinions about any CLD review)
    Using a enum instead of string as a queue data type would lessen the risk of making a typo error when your programming, and makes the programming a bit faster it would also "lessen" the traffic since enum is a lesser datatype than string, and combining it with a typedef would keep changes up to date
    Im taking the CLAD tomorrow, and am hopefully ready for the CLD right after that Hope it wont be difficult. Good luck!

  • Sprinkler Controller-Solution for CLD

    Hi all,
    I have solved the sprinkler controller sample problem of CLD.
    Request you all to provide the valuable comments on it.
    Attachments:
    Sprinkler.zip ‏88 KB

    Looks pretty clean, but I have not looked at it in detail.
    Here are a few notes:
    Isn't this supposed to be inside a project?
    I hate it when diagrams are maximized to the screen (main VI and file I/O vi)
    You have an existing log file and if I run the VI, new data gets appended. The problem is that the existing entries have a comma as decimal seperators, while the new entries (run in the US) have a decimal point. This could confuse a program that later might analyze the logs. You should decide on a wordwide format.
    To blink the pilot, you can create a direct property node for the button inside the cluster (right-click button on the front panel...create....property node. see image below). No need to get all control references and index out one. (even if you get all the boiler control references, that only needs to be done once outside the loop and not every time it is needed.
    As has been said by jeff above, terminals of subVIs should be on the toplevel diagram, and not buried inside case structures.
    In the file I/O subVI (open file case), you only handle error 7. Shouldn't you handle all errors somehow? For example if the file is "read only", you would get error 8.
    It would seem more easy to format "event" and "event data" into a single string in the main VI. Now you only need one feedback node to see if anything changed. The combination of strings and numerics can easily be done with single formatting statements.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    pilotproperty.png ‏5 KB

  • Traffic Light Color for Empty Requests Disabled

    Hi Gurus!
    I'm having a trouble with a DELTA InfoPackage associated to our 0VENDOR_ATTR DataSource... For some reason the "Traffic Light Color for Empty Requests" option is Disabled (grayed out), and that's causing the failing of its respective ProcessChain (since after Initialization of the data source there are no new data to load)... I was wondering if you may have an idea about what am i doing wrong? Any help would be appreciated.
    Regards!
    Ricardo

    Hi,
    As you have selected the option for the init package, the system is not allowing the same for the Delta as the same will be applicable for Delta as well.
    The other place where you can set is at the Manage of the target or at the monitor (RSMO) level. If once set its fine for that target.
    You dont need to worry.
    Are you facing any issue for the data loads which are with 0 records at present due to the status? Do let us know.
    THanks
    Murali

  • How we can   drill-down, sorting, traffic lights,  in ALV report

    hi gurus ,
    how we can   drill-down, sorting, traffic lights,  in ALV report .
    please any one suggest that...
    regards,
    praveen

    Check the sample code for drill-down, sorting, traffic lights,  in ALV report.
    REPORT YMS_COLOURALV NO STANDARD PAGE HEADING.
    TYPE-POOLS: SLIS, ICON.
    DATA: FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA: BEGIN OF IMARA OCCURS 0,
    LIGHT(4) TYPE C,
    MATNR TYPE MARA-MATNR,
    MTART TYPE MARA-MTART,
    MAKTX TYPE MAKT-MAKTX,
    COLOR_LINE(4) TYPE C,
    TCOLOR TYPE SLIS_T_SPECIALCOL_ALV, "cell
    END OF IMARA.
    DATA: XCOLOR TYPE SLIS_SPECIALCOL_ALV.
    START-OF-SELECTION.
    PERFORM GET_DATA.
    PERFORM WRITE_REPORT.
    FORM GET_DATA.
    WRITE ICON_GREEN_LIGHT AS ICON TO IMARA-LIGHT.
    IMARA-MATNR = 'ABC'.
    IMARA-MTART = 'ZCFG'.
    IMARA-MAKTX = 'This is description for ABC'.
    APPEND IMARA.
    WRITE ICON_YELLOW_LIGHT AS ICON TO IMARA-LIGHT.
    IMARA-MATNR = 'DEF'.
    IMARA-MTART = 'ZCFG'.
    IMARA-MAKTX = 'This is description for DEF'.
    APPEND IMARA.
    WRITE ICON_RED_LIGHT AS ICON TO IMARA-LIGHT.
    IMARA-MATNR = 'GHI'.
    IMARA-MTART = 'ZCFG'.
    IMARA-MAKTX = 'This is description for GHI'.
    APPEND IMARA.
    LOOP AT IMARA.
    IF SY-TABIX = 1.
    IMARA-COLOR_LINE = 'C410'. " color line
    ENDIF.
    IF SY-TABIX = 2. " color CELL
    CLEAR XCOLOR.
    XCOLOR-FIELDNAME = 'MTART'.
    XCOLOR-COLOR-COL = '3'.
    XCOLOR-COLOR-INT = '1'. " Intensified on/off
    XCOLOR-COLOR-INV = '0'.
    APPEND XCOLOR TO IMARA-TCOLOR.
    ENDIF.
    MODIFY IMARA.
    ENDLOOP.
    ENDFORM. "get_data
    FORM WRITE_REPORT.
    DATA: LAYOUT TYPE SLIS_LAYOUT_ALV.
    LAYOUT-COLTAB_FIELDNAME = 'TCOLOR'.
    LAYOUT-INFO_FIELDNAME = 'COLOR_LINE'.
    PERFORM BUILD_FIELD_CATALOG.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    IS_LAYOUT = LAYOUT
    IT_FIELDCAT = FIELDCAT
    TABLES
    T_OUTTAB = IMARA.
    ENDFORM. "write_report
    FORM BUILD_FIELD_CATALOG.
    DATA: FC_TMP TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE.
    CLEAR: FIELDCAT. REFRESH: FIELDCAT.
    CLEAR: FC_TMP.
    FC_TMP-REPTEXT_DDIC = 'Status'.
    FC_TMP-FIELDNAME = 'LIGHT'.
    FC_TMP-TABNAME = 'IMARA'.
    FC_TMP-OUTPUTLEN = '4'.
    FC_TMP-ICON = 'X'.
    APPEND FC_TMP TO FIELDCAT.
    CLEAR: FC_TMP.
    FC_TMP-REPTEXT_DDIC = 'Material Number'.
    FC_TMP-FIELDNAME = 'MATNR'.
    FC_TMP-TABNAME = 'IMARA'.
    FC_TMP-OUTPUTLEN = '18'.
    APPEND FC_TMP TO FIELDCAT.
    CLEAR: FC_TMP.
    FC_TMP-REPTEXT_DDIC = 'Material Type'.
    FC_TMP-FIELDNAME = 'MTART'.
    FC_TMP-TABNAME = 'IMARA'.
    FC_TMP-OUTPUTLEN = '10'.
    APPEND FC_TMP TO FIELDCAT.
    CLEAR: FC_TMP.
    FC_TMP-REPTEXT_DDIC = 'Material'.
    FC_TMP-FIELDNAME = 'MAKTX'.
    FC_TMP-TABNAME = 'IMARA'.
    FC_TMP-OUTPUTLEN = '40'.
    APPEND FC_TMP TO FIELDCAT.
    ENDFORM. "build_field_catalog

  • CLAD Sample exam

    Hi,
    I'm new to this forum and this is my first post.
    I am a beginner to LabVIEW. Currently preparing for CLAD.
    I'm looking for some sample exams, which i thought would be very helpful before taking up CLAD.
    I came to know from my collegues that there was an online CLAD Sample exam available, which I've been trying to find it but had no luck
    It would be very helpful if someone could please tell me if it has been removed, or provide a link if it still does exist.
    Thanks
    Suchin
    Solved!
    Go to Solution.

    Hi there guys,
    Now I may be missing something, but to the best of my knowledge the CLAD sample papers are still up and running. In fact I was dicussing them in a meeting recently.
    So I ran a search for CLAD exam sample papers, and it was the very first search result.
    http://zone.ni.com/devzone/cda/epd/p/id/5225
    Let me know if I've mis-understood the question. Thanks.
    EDIT:
    Sorry, I to have missed the point here... by 'online' you mean 'interactive'? I hope the link is helpful though. I will get straight back to you if I hear of an interactive test around.
    Rhys
    Applications Engineer
    National Instruments

  • CLD Traffic Light Sample Exam.

    I am posting my solution for the CLD Traffic
    Light Sample Exam.  Comments and input is appreciated.  The main VI is
    Traffic Lite.vi.
    Thanks in advance.
    Attachments:
    TrafficLite_5.22.10.zip ‏47 KB

    Nice work, VI Joe.  I heve just a few comments.  The first two will get you more points from the judges, the third is personal style preference.
    Add descriptions and tip strips to your controls (and indicators).
    You go to either Idle or Display from almost every state; poll the controls before your main Case Structure executes and update the indicators afterwards instead.  You wouldn't need to use a State Queue any more if you did this.This would also get your Stop button to work as required.  As VENKATESH.J mentioned, it needs to respond immediately.
    This is a cleaner way to queue up multiple states:
    Jim
    You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice

  • Sample Exam Solutions for Review

    Good afternoon,
    I am taking the CLD exam tomorrow morning and wanted to submit my sample exam for review. I was able to finish it in just about 4 hours. 
    Here is my solution, please provide feedback.
    Thanks.
    Steven

    Manushak wrote:
    Hello all
    I have solution for "sprinkler controller".
    I would be glad if someone could take a look and give me a feedback.
    I want to write more comments, but my english is poor and there are many mistakes in my texts. Do you know, can i have any translater with me in time of exam. Or can i use online translators. It will help my very much.
    Overall a C- job  Some things you did well. Please excuse me for only pointing out the flaws as my time is limited.
    You have some bad habits that you need to break;
    Icons.  They need to convey information to the next maintainer of your code.  Is that a flame under a teakettle?  Like GUIs the color usage in icons should avoid garashness and help aid clairity.  Your file read vi icon uses a glyph I would associate with a error dialog.
    Use a project
    Tip Strips on every object the user can see on the GUI!
    Timing- you have failed to meet spec on preserving the elapsed time if rain occurs durring the servicing of a zone.  You need an elapsed timer with a pause feature.
    Wire bends.  Enough said?

  • Sample CLD (Car Wash) Solution for Review

    Hi,
    This is my first time posting. I am studying to take the CLD and I have attached my solution to the Car Wash sample exam (LV2011) using a PC-Events architecture. I ignored the time constraints for now to see where I stand as far as functionality and style. I tried to be thorough (not creative) with documentation as well. Any feedback would be greatly appreciated.
    Thanks!
    Steve T., Engineer
    NSTec
    Steve T., Engineer, CLAD
    Albuquerque, NM
    Attachments:
    Car Wash.zip ‏128 KB

    Steve Tomany wrote:
    Great, thanks for the feedback. Any chance you can show me how you use the queue naming and the sub vi in this way? I've played with it but my attempts do nothing to improve the BD.
    Thanks
    Sure,  Here is a copy of my PC loop (events) template with the consumer loop as a sub-vi (Type Defs disconnected)
    (NOTE: my template contains vi documentation template as well)  This won't save you on the CLD exam since the shipping templates are all you can use.  But having your own for "Real Life" sure speeds up programming time.
    Jeff
    Attachments:
    ProducerConsumerEventsSilver.vi ‏35 KB
    Consumer.vi ‏22 KB

Maybe you are looking for