09-20-2022 07:47 AM
Hello,
i am taking the cld exam in a few weeks.
I have attached below a zip with my solution of the sprinkler controller.
I would greatful, if I would get some feedbacks.
Please let me know, if I could improve my code.
Thanx in advance for your help
09-20-2022 08:22 AM - edited 09-20-2022 08:32 AM
Hi D,
I am not an expert but below are some issues that stood out to me:
1) Use default if un-wired termianls in cases
2) Missing error wires connections
3) Improper error handling
4) Spelling errors
I could be wrong but I do not think that you need to have a producer consumer loop for this system, unless it is asked for. To me, it is just adding complexity. This can all fit inside one while loop with a state machine architecture that has proper error handling.
Edit: Also I would specify if the timing is 1 second, 1 minute, 1 hours etc. In error case, are you asked to close the program or raise an alarm for user attention?
09-21-2022 04:32 AM
Hi X,
thanks for your reply.
1) Done
2) Done
3) Done
4) I think this is not relevant to pass the exam. I didnt put really attention on that 😉
I decided to always use the consumer Producer loop template. So I dont lose time to decide which template could be the best.
Do you think I lose points if a different template would be more apropriate?
Its not specified what the application should do if an error occurs.
I attached the new Version.
Please let me know if you have more improvments.
09-21-2022 09:10 AM
Hi D,
There are some use default if un-wired terminals in event case.
Another point that I can add would be to reduce wire bends make subVIs of parts of code to keep everything in a straight line. I generally like to use tabs and clusters to keep all control indicator the references at one place and modify them all in a subVI as needed. (not sure if time will allow you to do that)
Check out @altenbach's solutions, they are always nice a well organized. Post card solutions.
I decided to always use the consumer Producer loop template. So I dont lose time to decide which template could be the best.
Do you think I lose points if a different template would be more apropriate?
I cannot answer that as I do not know if it will make you lose points or not.
Its not specified what the application should do if an error occurs.
Okay, in that case use your best judgement. I think in a real world scenario, an alarm should be raised if some error occurs in a scenario that does not cause human harm instead of killing entire application.
09-21-2022 09:30 AM
@XM43 wrote:
Hi D,
There are some use default if un-wired terminals in event case.
Another point that I can add would be to reduce wire bends make subVIs of parts of code to keep everything in a straight line. I generally like to use tabs and clusters to keep all control indicator the references at one place and modify them all in a subVI as needed. (not sure if time will allow you to do that)
Check out @altenbach's solutions, they are always nice a well organized. Post card solutions.
I decided to always use the consumer Producer loop template. So I dont lose time to decide which template could be the best.
Do you think I lose points if a different template would be more apropriate?
I cannot answer that as I do not know if it will make you lose points or not.
Its not specified what the application should do if an error occurs.
Okay, in that case use your best judgement. I think in a real world scenario, an alarm should be raised if some error occurs in a scenario that does not cause human harm instead of killing entire application.
Regarding what template or design pattern to use: Use whatever you feel comfortable using, as long as it is recognizable. For example, I felt most comfortable using consumer/producer so that's what I used. But I've seen solutions using just one loop which looked fine to me.
Regarding error handling: Just demonstrate that you are doing something should be good enough. A graceful exit should be fine.
09-21-2022 10:03 AM
can you give me a link to those altenbach solutions?
09-21-2022 10:04 AM
Thanks for your help.