LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating Cycles from Data Array

I am trying to calculate the number of cycles a valve has cycled from data that is being acquired, for a 10,000 cycle endurance test. I would then like to keep a total count of cycles so far. What can I use to calcuate a cycle from the data array? Peak Dectector?
0 Kudos
Message 1 of 7
(2,723 Views)
If you give me more infor information about your application, may be I can help you .. (Iam good with arrays!!)

What is exactly a "number of cycles a valve has cycled" ?
and what is "endurance test"?

sorry for asking that, but Iam intersting in this, and to know how can I help you.
-----------------------------
Ayman Mohammad Metwally
Automation Engineer
Egypt - Cairo
0 Kudos
Message 2 of 7
(2,715 Views)
An endurance test is a test to see how long something will last under normal operating conditions before failing. Which in my case is a industrial valve.

I am outputing a squarewave from Labview to a shutoff valve, and I am going to monitor pressure(in volts) on our valve, which will also be a squarewave. I would like to keep a count of the number of cycles since I press start on the vi.

I want to monitor the pressure on our valve rather than the actual squarewave being outputed from Labview. The pressure will go from zero to say 5.00 +/- 0.50 volts, then return to zero. I need to monitor the signal and count each time a top or peak (approx. 5.00 volts) of the squarewave occurs and add +1 to the total count. This will give me the # of cycles the valve has cycled.
0 Kudos
Message 3 of 7
(2,710 Views)
Loop through your pressure readings array. Each time the data crosses 2.5 volts in one direction, increment the count. You can achieve this by comparing the data to 2.5, perhaps using the greater than or equal to function (X >= 2.5). Count each time the boolean output goes from false to true. I have attached a vi that count every time the boolean goes from false to true. Just wire the >= output to the input of this vi.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 7
(2,705 Views)
Easier still, just use Threshold Peak Detector.vi (Analyze >> Signal Processing >> Time Domain).

It should accept your complete waveform or data array, and requires only a threshold input (2.5 should be fine) and a width input that can be a small number or the default of 1 if you don't have any noise to speak of.

--John
0 Kudos
Message 5 of 7
(2,701 Views)
I actually got the Advanced Peak Detector PtbyPt.vi to do what I was looking for. It appears that if the Analog In voltage is cycling faster than .5HZ the Peak Dectector will not pick up a cycle. I also found that it stops counting cycles once I reach about 93 cycles? It does not resest it just continues to display 93. Any ideas?
0 Kudos
Message 6 of 7
(2,689 Views)
You have too much code inside your loop. You have several For loops, a case that opens and writes to file, etc. You need to separate these into separate processes. Have one loop do nothing but read the AI. Have other loops to process the data. In the read AI loop, you can send the data to a queue. In the process data loop, you can read from the queue. This way, you should not miss any data because your processing time is too long to keep up with the incoming data rate. Be sure to use timers in your loops to avoid one loop hogging all the CPU time. You will have to play with the values to get it right. For the read AI loop, set a timer just slightly larger than the incoming data cycle time.
- tbob

Inventor of the WORM Global
Message 7 of 7
(2,684 Views)