Alarm delay problem 
Author Message
 Alarm delay problem

I am trying to write a VI that will email an alarm to users of a LN
system when the LN tank is low.  With this I'd like to have a 10
minute delay occur after the alarm condition is met to prevent
spurious emails when the tank is just being filled.  Alarm occurs -->
Delay starts --> Delay ends and the CURRENT alarm condition is checked
to see if it still met.  If so, email sent, if not, back to regular
operation.  My problem is that I don't seem to be able to get the
current (after 10 minute delay) alarm condition, but only the initial
(before 10 minute delay) alarm condition that started the delay in the
first place.  If I let the VI loop around again it grabs the new alarm
condition, but has no "memory" that it already ran the delay.  Thanks
for your help.

Mon, 15 Aug 2005 22:06:55 GMT  
 Alarm delay problem
It sounds like you should be using a finite state machine

Tue, 16 Aug 2005 13:26:15 GMT  
 Alarm delay problem
It sounds like you are running the code in a loop.  Use a shift
register to pass a boolean flag around.  If the alarm is set and the
flag is false, then set the flag true.  If the flag is true and 10 min
has elapsed and the alarm is false, set the flag false.  If the flag
is true and the alarm is true, send the email and set the flag false.

You will need a shift register (look in the shipping loop examples or
the LV user manual for an explaination), a way to measure time (it
sounds like you have that, some boolean logic, and a case structure.
The key is the shift register.

Wed, 17 Aug 2005 00:25:00 GMT  
 Alarm delay problem
Thanks, but I don't think this will work.  Reading the NI definition
of state machine: "A State Machine relies on user input or in-state
calculation to determine which state to go to next."  I have neither.
My alarm is coming from outside the state machine and I want to avoid
user input (undergrad and grad students) if at all possible :-).

Sun, 21 Aug 2005 03:13:49 GMT  
 Alarm delay problem
Thanks, but I think I tried this with no luck. How do I set the intial
state of the flag?  I can set the intial shift register value coming
into the loop, but as soon as I exit the loop to check on the current
alarm condition and then re-enter the loop with the new alarm value
the shift register also reinitializes. If I don't initialize the shift
register then obviously I have no idea where the loop is starting.

Sun, 21 Aug 2005 03:09:21 GMT  
 Alarm delay problem
I like Jeremy's answer.
What is the overall structure of your program?  Do you have one big
loop that keeps checking on the tank level?  Does it do anything else?
If you take the simplest approach that you don't want to do anything
else while you're delaying, all you need is a call to wait mS with the
input set to 10 minutes * 60 sec/min * 1000 ms/sec.  The wait mS will
be in a case: if you detect an alarm, wait, then check the alarm
again.  In the real world, you probably want to do other things in
those 10 minutes, so don't wait for the delay: check the time and see
if ten minutes have passed from the initial alarm.
Don't use a separate loop just to do the delay.  The delay (or the
check for time difference) should be in the main loop where you're
checking for alarms.  You don't want to "exit the loop to check on the
current alarm condition and then re-enter the loop with the new alarm
value".  Shift registers can keep track of whether an initial alarm
was detected and what time the alarm was detected.  Initialize both
shift registers at the start of the program: Initialize Alarm Time to
the current time; initialize Alarm Detected to False.  When an alarm
is detected, set Alarm Detected to True and use a case to get the
current time and send that to the Alarm Time shift register.
Every time through the main loop, if Alarm Detected (shift register)
is True, compare the current time to the Alarm Time.  If the
difference is greater than 10 minutes, check the current alarm
condition (by reading your instrument, not the shift register).  If
the alarm still exists, send your emails and set the Alarm Time to the
current time.  If the alarm doesn't exist, set Alarm Detected False.
Don't set Alarm Detected every time through the loop: set it (the
shift register) if it's currently False and you detect an alarm
condition or if you're at the end of your 10 minute delay.
You can also limit it to sending only one set of emails by adding
another shift register: Email Sent (initialized to False).  When you
send your first email, set Email Sent True.  Leave Email Sent True
until the current alarm goes False.  Continue to check your alarms and
time the delay as before, but at the end of the next 10 minutes, don't
send emails if Email Sent is True.  This could prevent filling up some
email inboxes if the tank goes dry overnight.

Sun, 21 Aug 2005 04:43:36 GMT  
 Alarm delay problem
Does the code I posted for you do what you need?


Sun, 21 Aug 2005 05:30:30 GMT  
 Alarm delay problem
Sorry I didn't answer you right away, but I was busy fiddling with
your vi.  I think it will work for me.  I needed to add another case
that would "reset" the timer once the alarm condition, after the time
delay, was met.  Otherwise I had a constant alarm once the delay was
satisfied and I was pumping out emails at a prodigious rate.  I'm
quite new to labview and it just amazes me the convolutions required
to do what appears to be such a simple thing on paper.  Still, this is
much better than writing regular code.  Its almost fun :-).  Thanks
for your help.  Daniel

Sun, 21 Aug 2005 06:19:43 GMT  
 [ 8 post ] 

 Relevant Pages 

1. QSCGZ delay problem (was: strange memory-access-delay)

2. OREXX alarm problem

3. 'alarm clock' problem

4. NCS client call - Alarm call problem!

5. Smalltalk/X ----- Alarm problem

6. Problem: modeling problem with non-blocking delays

7. Delays, verilog ignores my delays?

8. Unit Delay vs. Zero Delay

9. Avoiding inertial delay in delay lines

10. Transport Delay and Inertial Delay

11. delay until vs. delay relative

12. Transport Delay Vs Inertial Delay


Powered by phpBB® Forum Software