03-20-2009 02:16 AM
I just started working on the CLD example problems. I've been using Labview for about 10 years - so everything I do is old-school.
I'm posting this solution for the Security System example. There are arrays of switches to represent the alarm, bypass, and tamper
signals - and then a loop to go through each "zone" to logically determine the state (normal, alarm, bypass or tamper). To make the
"zone status" indicator an easily scalable indicator I have the "zone" loop change the color of a boolean LED indicator. Then I take a
picture of it and display an array of pix.
Question: This works fine, good response - but would it pass? Is there a better way? I attached the diagram...
Solved! Go to Solution.
03-20-2009 06:25 AM
I would suggest you take some time and search around for 'state machine'. Some of the points you get on this exam is your usage of some design pattern. Even more, your coding abillity will benefit.
Felix
03-20-2009 01:33 PM
03-20-2009 01:41 PM
03-20-2009 01:48 PM
I don't like the detour over an array of images and property nodes. Seems indirect and inefficient. Is that a requirement or your idea?
Also I assume that the FOR loop executes quickly, so you should probably do the timestamping once before the loop.
The "wait for FP activity is really "old school" and not very good. You typically get extra triggers, which is expensive since you write to the file every time. I would strongly suggest an event structure instead.
The small FOR loop can be replaced by "search array". Much cleaner! 😉
It might be better and more efficient to open/create the file once before the loop, write using lowlevel functions during the loop, and close after the while loop has finished.
03-20-2009 02:30 PM
I was trying to stay with the 4 hr time limit and my first instinct for expandability was the array structure (rather than clusters - as is the case in the example solution). But somehow I couldn't get the right reference/property structure to change the colors of the individual indicators once they were in the array - that's the origin of the stupid "array of pictures" work around. Apparently you can reference individual cluster elements to change their colors (but not individual array elements?). This was definitely not a requirement but a "quick-thinking" work around because i couldn't ref the individual LED elements of the array.
I like all of your suggestions - except I dislike event structures - mostly out of unfamiliarity. I'll get used to it.
03-20-2009 02:48 PM
BADVI wrote:But somehow I couldn't get the right reference/property structure to change the colors of the individual indicators once they were in the array - that's the origin of the stupid "array of pictures" work around. Apparently you can reference individual cluster elements to change their colors (but not individual array elements?). This was definitely not a requirement but a "quick-thinking" work around because i couldn't ref the individual LED elements of the array.
Correct. The only thing that can vary between elements in an array is there value. Other items such as color, display format, visibility, etc. cannot. So a boolean array can have each element has true or false. But all elements must share the same color property.
03-20-2009 03:37 PM
BADVI wrote:...
Apparently you can reference individual cluster elements to change their colors (but not individual array elements?). This was definitely not a requirement but a "quick-thinking" work around because i couldn't ref the individual LED elements of the array.
An alternative is to use an array of color boxes. The value of a color box is its color, so each color box in an array can have a different color.
This way you can still use arrays (I agree on the point of easier scalability when using arrays).
Daniel
03-20-2009 03:37 PM
Ravens Fan wrote:Correct. The only thing that can vary between elements in an array is there value. Other items such as color, display format, visibility, etc. cannot. So a boolean array can have each element has true or false. But all elements must share the same color property.
Tha'ts why we make a colorbox that looks exactly like an LED. Now the "color is the data" and arrays are easily possible.
🙂
03-20-2009 03:39 PM - edited 03-20-2009 03:39 PM
Same idea at the same time