LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Signal integration from Y1 to Y2

Solved!
Go to solution

Hello Guys,

 

I have a problem and would like to ask for your valuable help , look, I built a VI that supposed to be capable to integrate a signal from certain value Y1 [rising] to another value Y2 [falling]...please see the picture.

Right now I'm only able to identify points and index values on the time axis [X].

The attached program it's capable to integrate from certain X1 value to another X2 value (this is unuseful for me)

What I really want to do it's to perform an integration of the signal using the Y axis, selecting the first [Y1] value when the curve is raising and the second [Y2] value when the curve is falling

How can I do this? Do you guys have any ideas?

Please help me

 

 

I'm Attaching a schematic of what I want to do, the VI and a TXT file with the data that should be integrated

 

thanks

 

SergeArmz 

Download All
0 Kudos
Message 1 of 8
(4,000 Views)

The integration VI will work fine. Just wire the Y array subset to the X input and the array made from dt to the T input. 

 

Actually, since your data is uniformly sampled, you can use the 1D Numeric Inegration.vi and do not need the time array except possibly to get the Y array subset.

 

A simpler way to do that is to multiply the length of the array by the X cursor position. You would need to check if this works properly for different array sizes.

 

You also do not need to convert to waveform and back to array. You can sacle the graph by using the XScale.Multiplier property.

 

Lynn

0 Kudos
Message 2 of 8
(3,958 Views)

Hello johnsold,

 

Your suggestions worked perfecly, I was able to get rid of the For loop used to get the dt values, however the VI is still doing the same, as I told you What I would like to do is to use as a CONTROLS the Y1 and Y2 positions and get rid of the X1 and X2 positions to perform the integration, How can I do that?

Now we know the Y values [indicators] obtained from the two X positions [controls],  How can I tell to the program, from this Y value to this other Y value perform the integration?

 

What are your thoughts?

 

 

0 Kudos
Message 3 of 8
(3,861 Views)

That is even easier, except when it does not work!

 

For values like the default X1 and X2 values in your VI you can wire the Y cursor positions to the Threshold 1D Array functions and get the indexes of the Y array segment. However, using Threshold 1D Array that way will find the FIRST location in the array where the values cross the threshold. The same thing applies if you use Controls for Y1 and Y2 as opposed to the cursor positions.

 

For example using a threshold of Y = 2.0 starts the integration at approximately X = 0.14 rather than X = 0.21.  Similarly the signal crosses Y = 31 two times.

 

Using the X values is unambiguous. The Y values provid emutiple opportunities to confuse or to create errors.  The noise out at X = ~0.36 could result in three or more threshold crossings.

 

The attached VI uses the Y controls at the bottom of the front panel (off the decoration) to control the integration.  If you disconect those controls and wire the thresholds to the Cursor.PosY outputs from the property node, the integration will work with those values.

 

Suggestion: Get rid of both the X and Y controls. Let the user drag the cursors or move them with the Cursor Legend buttons to select the desired area.

 

Lynn

0 Kudos
Message 4 of 8
(3,837 Views)

That is exactly what I found Smiley Sad values are not going to be consistent Smiley Sad

If you get rid of the controls and leave the user to drag the cursors to the desired points you will have another issue, that issue is the scaling in the Y axis, if you drag for example the cursor 0 (X1) along the plot, the increments in Y are non uniform, let's say, the cursor it's located initially at 3.2, if you move up the cursor it won't go gradually to 3.3, 3.4 or so, it will jump to 6 or 7, you can try it to confirm what I'm saying, what can we do to drag the cursors along the plot and go let's say from 3.095, 3.096, 3.097, 3.098, 3.099, 3.100 and so on...until reach the MAX and MIN values in the Y axis?

 

 

0 Kudos
Message 5 of 8
(3,818 Views)
Solution
Accepted by topic author SergeArmz

That is because the cursors are locked to the plot. So they can only go to values where there is a datapoint.  If you create an array indicator and look at the Y data values near index 106 (the X1 Index), you will see that the intervals go from a few thousandths to 3, 4, 5 between points. 

 

You can create a Free cursor. It will not attach to the data so the cursor location can be anywhere in the plot.  The increments on that depend on the scale of the graph. I get dX = 0.002 and dY = 0.096 on the graph as shown on the version I posted earlier.  I connected the cursor.PosY to the threshold in place of Y1 2 and it changes the area under the curve in small increments when moved up and down along the steep part of the curve, which is what I would expect.

 

Lynn

Message 6 of 8
(3,808 Views)

Well looks like this the final sketch, it is working fine

What do you say Mr johnsold?

 

Thank you very much

0 Kudos
Message 7 of 8
(3,669 Views)

It looks OK.

 

Lynn

0 Kudos
Message 8 of 8
(3,643 Views)