LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cumulative timing of measurement above a threshold

Hi,

 

I have managed to create a simulator where the "Raw Data" numeric controller is scaled and a threshold is set at 3500.  When the scaled reading on the gauge goes above 3500, a timer is started and elapsed time is indicated on the slider.  After the preset time (set to 10 sec for this demo) is reached, the loop stops itself.   

 

My first problem is that I need to maintain a hydraulic pull for a cumulative time above a threshold, not just an absolute time after the first crossing.  The test may involve the load falling below the threshold and then rising again, and the total time above the threshold is what I need. 

 

Secondly, this is a simplistic prototype.  In my app I will need to control hydraulics with DIO and read a force transducer throughout the test.  A binary "Pull" code will be sent to start the pull, then a "hold" code will be sent as the threshold is reached, and when the load tries to fall below the threshold, another "Pull"  code is sent, followed by another "hold" code, etc until the cumulative time above the threshold is reached.  Then a "stop" code is sent and I'd like to continue to record and display readings until the load relaxes to its resting state. 

 

Is the sequence structure the way for me to go here?   I've been using TestPoint so my current app is event driven.  I want to twist my head around the way LabView is supposed to work and do it properly instead of forcing Labview to do what I'm used to doing.    

 

Thanks,

Jim

 

 

 

0 Kudos
Message 1 of 2
(3,077 Views)

I would not use a sequence structure for this. I would convert your VI to use a state machine. Using a shift register on the loop for the state machine you can accumulate the total time above the threshold. I would also use a producer consumer architecture where the producer task is what monitors the value of and determines if the threshold has been crossed. It would have to detect which crossing occured (either going above or below). The producer woudl send a message to the consumer task which would control your hydraulics. This task could also keep track of the elasped time above the threshold.

 

A simpler architiecture would be to use an event structure only. (If the actions you take to control the hydraulics take a considerable amount of time I would avoid using the event structure only and use the producer/consumer architecture.) Again, you would have an event for the value change of your threshold measurement and then control the hydraulics accordingly. Using a shift register on the while loop you can acculate your elapsed time.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 2
(3,071 Views)