04-03-2010 03:51 PM
in my program i have placed a timer inside a while loop. Depending on the status of different variales (also inside the loop) timer will start; i.e. if any one of 'n' logics (veriables value) is true timer will start. Now I have to reset the timer if the value of those variales comes under desired limit (means no logic is true) within 1 min. How to do it?
Solved! Go to Solution.
04-04-2010 12:21 AM
Hi,
What do you mean by "timer inside a while loop" and by resetting it?
A CVI "timer control"? An "asynch timer", or else?
Can you also clarify the "1 minute" requirement?
Is it like a timeout, so that, the variables are allowed to fall below the limit for 1 minute of interval?
04-04-2010 02:18 AM
Let me take an example to describe it.
Say there are two variables- temp. and pressure. The desire rage of each is specified as say, 10<t<50 and 200<p<500. Now this values are taken continuously from a running process. If they go beyond the desired values alarm will on. If no one reset the value within desired range of the variable within 1 min. The system will stop automatically, otherwise it will continue.
Now say, once it goes to critical situation; so timer starts counting to note time of alarm. But by user it is set within range and process comes to normal. But the timer continues. Now some time later if it again goes to beyond range the system stops at that moment as timer was on previously.
How to solve that hurdle?
04-04-2010 06:10 AM
You could have a timer continuously running, whose callback decide what to do depending on measure value, this way (pseudo-code):
static double time;
double tn;
if (event == EVENT_TIMER_TICK) {
tn = *(double *)eventData2; // Time from last timer execution (in sec)
if (measures_ok) {
// Reset counter
time = 0.0;
}
else {
// Accumulate time and see if alarm time expired
time += tn;
if (time > 60.0) {
// Turn-off the equipment
// Raise alarm
}
}
}
04-04-2010 10:20 AM
problem is solved. thanks to all for help and response.
by the way, no need of doing any code....just the reset linkis needed to be connected properly depending on requirement.
04-05-2010 03:45 AM
sukhiray wrote:problem is solved. thanks to all for help and response.
by the way, no need of doing any code....just the reset linkis needed to be connected properly depending on requirement.
Hi sukhiray,
did you happen to program this application in LabVIEW?
If so, please note that you have posted your question to the CVI board, and of course all reponses you received made reference to such language.
Please make sure in the future you questions are posted to the correct forum: you'll receive the best possible help and will save other person's time and effort in answering in the wrong programming language.
04-05-2010 08:51 AM