LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Timing a case structure

Solved!
Go to solution

I have a push button with mechanical action set to switch until release(so that it gives an impulse boolean ON for 1 sec). I want to know a way so that the case structure remains active for a specified time after the push button goes off.
Thanks in advance.

0 Kudos
Message 1 of 22
(4,741 Views)

Try this.

 

boolean.png

Message 2 of 22
(4,734 Views)
Can you explain a bit more what you are trying to accomplish. It sounds like you might be wandering off into the weeds just a bit in terms of your design.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 3 of 22
(4,717 Views)

Okay, I am trying to implement a bidirectional visitor counter in a room using two PIR sensors wired to a DAQ, the two sensors are kept 1m apart along a single line, and depending on what IR sensor is cut first the counter should either increment or decrement, for entry and exit respectively. However whatever logic i so far used results in negation of the two cases so the counter yields zero. So i am forced to use two doors for entry or a partition of the door to maintain a count. So right now, im thinking of some way to disable one IR sensor for some time while the other is being cut.

0 Kudos
Message 4 of 22
(4,711 Views)

I'd use a shift register to store the state of the inner & outer sensors and an Event structure timeout case to address the 1 second delay.  Like this:

 

pir.png

 

 

 The snipppet didn't show what I wanted very well, but the VI is attached.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 5 of 22
(4,674 Views)

If you are interfacing to real sensors, you probably need to poll them at regular intervals and an event structure is not the solution.  A simple state machine would suffice.

You have several states, e.g.:

 

  1. no sensor triggered
  2. sensor 1 triggered
  3. sensor 2 triggered

if you are in state 1, simply wait for any sensor to trigger and proceed to the relevant state

if you are in state 2, and sensor 1 triggers again, don't increment, because the person has left. if sensor 2 triggers, increment the count and go back to state 1.

if you are in state 3, and sensor 2 triggers again, ignore. If sensor 1 triggers, decrement the count and go back to state 1.

 

... or similar.

 

 

 

Message 6 of 22
(4,669 Views)
A couple thoughts, first that your logic is in a way similar to a quadrature encoder where the leading input telss the direction of rotation.

Second, depending on what you want the software might be working fine. Logically unless someone decides to take up residence in the area, at the end of the day (metaphorically or literally) the people going out will always equal the number of people coming in -- hence the 0. Recording either the inbound or outbound count will give you a simple headcount. The zero could be used as a security check.

Tracking the difference between the in and out counts over a limited time scale could even give you insight into how long folks are staying in the area.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 22
(4,651 Views)

This is perfect! You have implemented the logic so flawlessly! I have so much more to learn... Thank you so much!

0 Kudos
Message 8 of 22
(4,628 Views)

altenbach's comment is important to note.  My answer relied on the boolean controls while your situation relies on digital inputs that won't trigger an Event structure by themselves.

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 9 of 22
(4,626 Views)

I can wire booleans to the inputs from daq and use local variables now, can't I?

0 Kudos
Message 10 of 22
(4,623 Views)