LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can i reset elapsed time VI

I am using the elapsed time express VI along with an "in range" comparison VI as the exit control for a torque test.  If the voltage signal from the torque transducer is within the specified range for the target time, the loop exits.  If the voltage signal is out of range, the elapsed time resets to zero.
 
My problem arises when i exit the loop prematurely due to excessive torque.  Like if torque reaches the transducer limit, I want to exit the loop to prevent damage.  When i exit the loop like this, the elapsed time VI continues counting even though the loop has been stopped.  The next time the program enters the state, it exits immediately (because torque is initially zero, and the timer has passed the set time).  After that iteration the program behaves as i expect it to, because the VI has reinitialized I assume.  I have been stuck on this problem for several days, and I'm going to start breaking company computers if i can't fix it.
 
So my question(s)... is there a way to reset the elapsed time VI upon entering the while loop?  is there a way to reset the VI from the 'torque limit' state immediately following the exit?  I also use a 'resume test' button so the user can restart the test after checking the unit,hardware,etc.  can i wire something to that button press to restart the elapsed time VI?
 
My 7.1 vi is attached, the elapsed time problem being in the 'exercise' state.  immediately following an 'exercise' torque limit, it goes to the 'torque limit' state, which i thought could be used to reinitialize the elapsed time somehow. 
 
Thanks,
 
Evan
0 Kudos
Message 1 of 6
(4,591 Views)

Hello Evan,

Have you tried the "Auto Reset" input of the Elapsed Time VI?  From your explanation, I would try wiring the "i" terminal in the while loop to the "==0?" function and wire the output of that to "Auto Reset".  Perhaps I'm missing something, I'm not sure.

Good luck!

Message 2 of 6
(4,573 Views)
Evan
I just looked at this really fast. If every time that loop starts you want the time reset just use a simple case structure right before the elapsed time function. If i == 0 then write reset to the function, else write the value that comes from "in range".
I think that should work. That way each time the loop starts it will restart the timer.  If that doesn't work because on the first iteration you may actually have a torque problem then include a extra case for that also.

Hope that helps you,
Tom
Message 3 of 6
(4,569 Views)

AHHHHHH, the equals zero from the loop iteration box was a perfect fix.  So simple.  I keep forgetting I can wire from that thing.  Now I am done with my first LabVIEW program!  On to testing!

 

Thanks so much,

Evan

0 Kudos
Message 4 of 6
(4,557 Views)
I have a similar problem ,

I use a elapsed tiem function ,with a target of 1s time.
i want to caluclate mean of samples in this 1 second
but what i see i get 8-9 mean values in 1 second
i also wired my i of while loop to auto reset with case structure,but even then i see so many average sample values in a second
to be more precise i want data like this:


when my DAQ board gives some 1000 samples per second. i need mean of these 1000 samples,but not all 1000 sanmples.
for this i included a elapsed time vi with taget of 1s. (didnt forget to reset after 1s).

but what i see is it gives values like this

12:12:01     d1 d2 d3
12:12:01     d1 d2 d3

but i expect like
12:12:01   d1 d2 d3
12:12:02   d1:d2:d3
 did i go any where wrong in my Vi.

how can get out of it!


0 Kudos
Message 5 of 6
(4,549 Views)
It's hard to tell from your description what is going wrong. You might consider posting some code that demonstrates your problem.

However, from your description, it sounds like it's completely unnecessary to use the Elapsed Time VI. If your DAQ board is set to read 1000S/s, and it outputs data in 1000 sample sections, then that there is automatically 1 second of data. There's no need to check elapsed time. You know the time has elapsed because you have a certain number of samples in the buffer. Just average that array output of 1000 samples and voila, you're done.
Jarrod S.
National Instruments
0 Kudos
Message 6 of 6
(4,521 Views)