LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find the value of the area of the XY plot (area of VI trajectory) and harmonics' amplitude value

Solved!
Go to solution

Hello everyone, I am new to Labview, please forgive me.

Question 1:
Figure 1:

lst3201_1-1642223010285.png


Figure 2:

lst3201_2-1642223032749.png

 

X input is the voltage value, Y input is the current value, if you want to find the area of the white in Figure 1, is there any way? Thank you
I searched online and tried to use Integral x(t) PtByPt VI to do it, but the values are weird (there will be negative values).

 

Question 2:
Figure 3:

lst3201_4-1642223127671.png

Is there a way to directly get the real-time amplitude value on specific frequency (such as 150Hz)? Thank you

 

0 Kudos
Message 1 of 17
(2,687 Views)

(1) All you have are lines. Please define what you mean by "area".

 

(2) Please give us your definition of all terms used ("directly", "real-time", etc.). This seems to be a frequency domain spectrum, so it needs to be based on data covering a time range. Where does the data come from? How is it transformed?

 

 

We can probably help if you attach your VI containing typical data.

0 Kudos
Message 2 of 17
(2,653 Views)

Thank you for altenbach’s attention.

(1) I want to have a value to represent this graph for compare with other VI trajectory. Thus, I want to find all the area occupied by the white line.

 

(2) This frequency domain spectrum come from the current value which is taken by a CT and DAQ USB-6008. And I have uploaded my vi file below.

 

Thank you so much.

0 Kudos
Message 3 of 17
(2,621 Views)

 

(1) Your "line" is a 1D object in 2D space and does not have any area at all unless you define what you actually want (e.g. The area enclosed by the outermost lines.) Just blindly throwing an integration function at it makes absolutely no sense.

 

(2) You only answered 25% of my questions (or less)

 

About your code:

It all seems to be "Baby LabVIEW" with almost all express VIs and opaque dynamic data. For me, this is impossible to even troubleshoot. I don't have any drivers installed, so I cannot look at your express configuration. I don't have any data. Your xy graph clears data on each call, so why do you even need that express VI? Did you know that charts can show a built-in digital display, eliminating some of your indicators? It is also very annoying if the front panel and diagram is maximized to the screen. What's the reason?

Once you'll upgrade your code to "Adult LabVIEW", things will be easier for us.

0 Kudos
Message 4 of 17
(2,603 Views)

lst3201_0-1643115766169.png

(1) I have tried to use Green' s Theorem to do this, but it is not work, because the value is still changing when the graph is stable.

How can find the biggest area of this XY graph (shown as below red line)?

lst3201_4-1643117169328.png

 

(2) I have solved the problem by using index array. Thanks a lot.

0 Kudos
Message 5 of 17
(2,566 Views)
  • Not sure what you are trying to show on your first image. Lots of it makes little sense.
  • If something does not work, attach a simplified version of your code AND some typical data. We cannot solve the problem based on sparse information. What precision do you need for the area. Seems your points are spaced quite far apart, joined by straight lines. I am sure there is a trivially simple solution! (I can think of some!). Is the data guaranteed to be convex with respect to X? (e.g. if you would turn your graph 90 degrees, things would be slightly more complicated).
  • Since most peaks cover adjacent bins, "array subset" followed by "add array elements" might be a more natural choice. Again, we cannot really tell what you are doing because there are millions of ways to use "index array", some better, some worse.
0 Kudos
Message 6 of 17
(2,554 Views)

For the first image in my last reply, it is refer to the Green's theorem. (https://forums.ni.com/t5/LabVIEW/How-to-calculate-area-of-a-XY-graph/td-p/2225898) I am using the code it this post and add it to my code's XY input (Voltage and current value). And I also tried Polygon Area VI.

 

The XY graph is VI trajectory plotted by the voltage and current waveform which are taken by USB-6008 real-time. The current waveform will change depended the power load.

 

Power load 1)

lst3201_3-1643212831779.png

lst3201_4-1643212849113.png

lst3201_5-1643212912812.png

 

Power load 2)

lst3201_6-1643212998887.pnglst3201_7-1643213032085.png

lst3201_9-1643213153875.png

 

You can see that there is fluctuation in the "V-I index" when the graph have no significant change in above two examples. I think that I need to simplify the graph to outermost edge line only like the red line area photo in my last reply, then use Green's theorem or Polygon Area VI. But I have no idea for the simplification.

 

0 Kudos
Message 7 of 17
(2,537 Views)

We don't have access to your measurement. You need to include some typical data!

 

(... and why is the front panel maximized to the screen. So annoying to stare at 80% useless gray! 😞 )

0 Kudos
Message 8 of 17
(2,530 Views)
Solution
Accepted by topic author lst3201

See if this can give you some ideas. It would be easy to e.g. also smooth the area outline.

Calculation is purely numerical, but most likely sufficient for this.

 

(Probably needs a few tweaks. 😄 )

 

altenbach_0-1643237756686.png

 

altenbach_2-1643238244431.png

 

 

 

Message 9 of 17
(2,522 Views)

Did you ever solve your problem?

0 Kudos
Message 10 of 17
(2,496 Views)