LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate signal area

Hello everyone.

 

I want to calculate the signals area. And from what I learn, to calculate the signal area we can total all of the signal value. I use sum array to get the total of signal value.

signal area.PNG

But when I use sum array, all of the signals will be totaled together at one time.

How to make the program to calculate the area 1 first and after that, it will calculate the area 2. So area 1 and area 2 have their own area?

 

Here I attached the VI I made

 

Thank You

Regards

 

Rani

Download All
0 Kudos
Message 1 of 15
(2,307 Views)

Hi Rani,

 


@Rani_jcha wrote:

How to make the program to calculate the area 1 first and after that, it will calculate the area 2. So area 1 and area 2 have their own area?


Determine the parts of your signal you want to analyze, then apply ArraySubset on your data.

Calculate the sum of each array subset…

 

In your VI you should learn to simplify: the loop handling those LED indicators can be simplified to:

The FOR loop runs so fast it only makes sense to use the last element of those boolean arrays. No need to use case structures (aka Rube-Goldberg!) when there are basic boolean operations like NOT. Btw. "Up" and "Left" react on the very same conditions?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 15
(2,280 Views)

You can just mask the undesired areas, the integrate the negative and positive parts differently. Here's one possibility.

 

 

altenbach_0-1594708844628.png

 

As has been mentioned, your code was a bit confusing and especially the FOR loop made no sense and looked wrong. I think you should test that separately.

 

 

 

Message 3 of 15
(2,255 Views)

Hallo Altenbach

Thank you for replying to my question.

 

I have tried your code but i think it's not going well in my computer.

Rani_jcha_0-1594732837487.png

it's become like this in my pc. And if when I tried more than two signals, the signals after the first one can't be detected.

How to make the program that can adding one by one like it's real-time? so when the signal values are detected bigger than 0.5 the value will start to calculate. and when it is lower than 0.5 it stop and start to count again when meet value that lower than -0.5.

 

I tried using for loop for and made time delay, so the data will work one by one. But I think Array Sum doesnt work in Array Sum.

 

I'll fix the led programs

 

Regards

Rani

 

 

0 Kudos
Message 4 of 15
(2,232 Views)

Hallo Gerd, Thank you for replying my question

 

I used for loop so the indicator can be a boolean. If I am not using for loop, the indicator will be an array.

 


 Btw. "Up" and "Left" react on the very same conditions?

No, I put the wrong wire.

Up = negative negative

left = negative positive

 

Regards

 

Rani

 

0 Kudos
Message 5 of 15
(2,227 Views)

@Rani_jcha wrote:

Hallo Altenbach

 

Rani_jcha_0-1594732837487.png

it's become like this in my pc.

 

 


That's because your PC localization setting defines comma as decimal point.

 

Simple fix: Just add a format of "%.;%.3f" to read from spreadsheet file. (the %.; make sure that a period is recognized).

 

altenbach_0-1594736273867.png

 

Message 6 of 15
(2,210 Views)

@Rani_jcha wrote:

No, I put the wrong wire.

Up = negative negative

left = negative positive

 


You are missing the condition when any or both of the inputs is zero. I am sure there is an easier way....

0 Kudos
Message 7 of 15
(2,204 Views)

I recognized how to make the indicator work.

 

But can I asked about the signal area program?

the program you attached did work, Thank you.

But actually I want to recognize the signal area one by one. So one signal has its own area.

The program will be started when the signal is >0.5 and stop when the value is not fulfilled. And started to count the new value area when the signal is <-0.5 or vice versa.

I tried using for loop conditional to stop the program and start again, but I think it does not work well

 

Here I attached the vi.

 

Rani

Download All
0 Kudos
Message 8 of 15
(2,147 Views)

Check this VI.

PBP
Labview 6.1 - 2019
Message 9 of 15
(2,019 Views)

Hi PBP,

 

while it's fine to provide another example for this already solved thread, but please keep in mind the problems when comparing float values for equality:

This part of your VI most often will not give the expected result!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 15
(2,004 Views)