05-19-2009 11:07 AM
I am running a gas chromatograph through LabVIEW and wanted to implement an automatic integration. I was looking at the slope of my peak and had an idea of how to make it work, but I do not know how to implement it.
My pseudocode is as follows:
Ai = array of points
pd = positve derivative count = 0 initally
nd = negative derivative count = 0 initally
for i from 0 to n:
if derivative(Ai)>threshold
pd = pd +1
else
reset pd to 0
if pd = 10
store first (x,y) as left point
if derivative(An-i) < threshold
nd = nd +1
else
reset nd to 0
if nd = 10
store (x,y) as right point
split array starting at index for left point and ending at the length (right point - left point)
send new array to integrator
So my problem is, I am having troubles with finding the 'picture' for a counter. I do not know how to make it go back to zero when my condition is false.
Thank you for any help you can offer!
05-19-2009 11:40 AM
To implement a counter use the +1 (incrementor) and use a shift register to keep the count.
Have you tried to use the built in peak find algorithms in labview? These already use 1st and 2nd derivitives for the peakfind as well as a threshold and peak width criteria.
05-19-2009 12:00 PM - edited 05-19-2009 12:02 PM
Please do not call LabVIEW VI's and functions "pictures", unless you are going to call functions and statements in a text-based language "hieroglyphics".
To reset to Zero, when the False condition arrives, send -1 to the incrementer, as shown.
Maybe try the peak detector in the Point by Point VI's ?