LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

find peak before another peak

Hi,

 

VI attached.

 

I am using a CSV file with data collected from a load cell. In some of my data, the peak occurs and this is the peak I want to collect. However, in some data, a peak occurs, and then there is a secondary peak, which is higher than the original peak. The original peak is what I need to use to calculate things. Is there a way to selectively choose which peak to record? Or to do some post-hoc analysis/editing after identifying the data which needs to be analysed differently.

 

Any thoughts would be greatly appreciated.

 

0 Kudos
Message 1 of 7
(2,370 Views)

There is a way to do what you want, but first you need to cleanup what is there:

 

  1. Lose the sequence structure - it is doing nothing but taking up space (of which there is already too little)
  2. Create some subVIs for the duplicated code
  3. Get rid of the local variable. The way the code is right now the local is in the same space as the indicator with which it is associated. Because the logic driving the indicator involves several steps, the local variable will always report the value of the indicator before it is updated. Is this the correct behavior or a bug? If it is what you want, use a shift-register or a feedback node.

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 7
(2,367 Views)

In addition to Mike's good advice there are several othre things you may need to consider:

 

1. The file path control on the front panel should be set to allow selection of folders. Look at the Browse Options in the control properties.

2. Search 1D Array will return a useful result only if it gets an exact match. A value of 1e-15 is clsoe to zero and might display that way depending on the display setting but Search will not find it because it is not exactly zero. Threshold 1D Array might be a better choice, although it has its limiations as well. Without seeing your data it is impossible to recommend an approach which will always work.

3. Use Index Array (expanded to three outputs) rather than 3 Delete from Array functions. 

4. Move the Write to Spreadsheet File.vi which writes the header outside the loop. There is no need to write the same data N times. With the append to file? input at the default (false) the VI will overwrite the existing file.

5. You can just wire the zero constant to the outputs of the case structure which selects the peak force. No need to multiply by zero.

 

I do not see anything which looks like an attempt to select the peak. What have you tried? What are the characterstics which define the peak to use? Computers are fast but not too smart. You need to be able to define precisely which peak to use if you want to automate the process.

 

Please post a typical data file (or a reduced file if the regular files are large). Tell us how many peaks it has and which ones are teh ones you want to measure.

 

Lynn

0 Kudos
Message 3 of 7
(2,346 Views)

Thanks for the help so far. I am fairly new to labview.

 

here is a sample of the data. I need the peak before the valley occurs at the top of the data. not the max value which occurs after the valley

0 Kudos
Message 4 of 7
(2,330 Views)

Here are the contents of the file you posted:

 

File name,LL RTD,RL RTD
RTD analysis.csv,Rejected,Rejected

 

Lynn

0 Kudos
Message 5 of 7
(2,307 Views)
Hi Lynn,

The VI is set up so that when I open a folder containing all these files, I can do a quick visual check on the force trace and select the analysis button if I am happy with it. If not, I don't click anything and it gets rejected. So to analyse the max, I just click the analysis button on the VI. But with this file for example, it analyses the max force. I want the peak force that occurs before the valley in this trace.
0 Kudos
Message 6 of 7
(2,293 Views)

I hate programs which overwrite files without warning.

 

When I went back to the orginal file, it does have data. This is what I see near the rising edges:

 

force peak.png

 

Where is the peak you want to analyze?  In the LL force trace the largest peak is the first peak. In the RL force trace it looks like you have some ringing on the rising edge and it it not at all clear what chould be considered the peak.  Although not exact the LL force trace looks like the derivative of the RL trace.  Is that a reasonable expectation based on the physics of your system?

 

What is the physical phenomenon you are trying to measure and how does it relate to the choice of peak?

 

Lynn

0 Kudos
Message 7 of 7
(2,286 Views)