08-25-2009 07:14 AM
Hi All,
Today , I gave a shot at the security system example from CLD. I did it using LVOOP. Do leave your comments on the code. (I havent done much documentation. Also, I have given the flexibility to the program to log file in any format, as per extension entered by user. The code has been written in a hurry, so pls ignore any cleanups of BD remaining 🙂 ).
Thanks in advance! 🙂
08-25-2009 07:38 AM
08-25-2009 08:05 AM
08-27-2009 04:32 AM
Would this solution be acceptable to NI?(Because they havent mentioned the skill of LVOOP to be used in CLD topics)
Any person from NI, please comment!
08-27-2009 08:51 AM
Parag D wrote:Would this solution be acceptable to NI?(Because they havent mentioned the skill of LVOOP to be used in CLD topics)
Any person from NI, please comment!
Aritos Queue is the head of LVOOP development inside of NI. I recently read that he passed his Certified LabVIEW Architect exam with a totally LVOOP based app.
He thinks he be the first to pass the CLA riding on LVOOP.
Ben
08-27-2009 09:20 AM
Pretty good all in all, some comments though.
They like comments and descriptions in controls and indicators, points are deducted for not having this.
They also like block diagram constants to be labelled (again points off for not doing this).
Your error cluster is not handled too well, if there is an error in any of the states it will just propogate through continuously, probably not what you want. I think the app is supposed to stop on error (cant remember exactly).
The Array local variable in the "get status" state is unnecessary, you could just move the control outside, into the while loop. Locals are generally discouraged.
In the "get status" I would not recommend hiding the index display of the string array you are passing on. At first glance it seems the same state is being queued regardless!
You are not closing the file reference.
One thing to note, my CLD was a lot longer than the pratice examples (a lot!, and I code quite quickly).
Good effort though!
08-28-2009 02:50 AM
^ ^
Thanks for the comments.
One thing, on keeping the array outside the case structure, the Array control would be continuously inside the while loop, and from what I've read somewhere, its always a better practice to keep the control inside structures which are not continuously running. Here, Array control is not being used more than two times in two cases, thats why local variable would be better than keeping the control in while loop continuously.
Correct me if I am wrong.
08-28-2009 05:13 AM
I am not sure about the inner workings of LV but I don't think it "reads" to control if it doesn't need to, ie even if the control is there (its probably just a memory reference inside LabVIEW anyway), it doesnt "query" it each time the loop runs.
If this is what it is doing, I don't think the performance penalty is something you need to worry about. Premature optimisation should be avoided at all costs (accoding to Knuth we should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil). wiki
Putting the control outside allows any state to access it, whereas with your method if you needed it in another state you would need another local variable.
08-28-2009 05:27 AM
^ ^
Thats true about the optimization. Thanks for the comment.
One final question, do you think this code would clear the CLD expectations?
08-28-2009 12:54 PM
I think you would need to brush up on documenting everything much better. Have you taken a look at how the pass mark is allocated?
Style is 15
Functionality 15
Documentation 10
for a grand total maximum of 40 points.
The markers are religiously "thorough" about wire bends, data coersion, error terminals not being wired on property nodes, VI properties and constants not being documented.
As I said in an earlier post, perhaps I got a nasty one, but my CLD had far more to it than the simple examples they provide on the NI site.