LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Security System CLD Exam Problem Solution? Insane?

Solved!
Go to solution

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...

0 Kudos
Message 1 of 15
(5,135 Views)

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 

0 Kudos
Message 2 of 15
(5,099 Views)
Minor corrective point: It is incorrect to wire both to the N terminal of a for-loop and to autoindex the loop. One or the other, not both. You would definitely lose points on this.
Message 3 of 15
(5,065 Views)
Remember, "no bends" in your wires and label your constants.  You may want to look into using a state machine as it will be self documenting, easier to scale.
0 Kudos
Message 4 of 15
(5,060 Views)

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.

Message 5 of 15
(5,057 Views)

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.

0 Kudos
Message 6 of 15
(5,036 Views)
Solution
Accepted by topic author BADVI

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.

Message 7 of 15
(5,023 Views)

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

 

0 Kudos
Message 8 of 15
(5,000 Views)

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.

 

Examples

 

🙂

Message 9 of 15
(5,002 Views)

Same idea at the same time Smiley Happy

 

Message Edited by dan_u on 03-20-2009 09:39 PM
0 Kudos
Message 10 of 15
(5,000 Views)