LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mean ptbypt not reaturning the average?

I have two signals that I would like to find the phase between. I'm not that concerned about the current phase value, but much more the average phase value. I used the instructions from NI to find phase of a square wave, and then used that output and put it into a mean ptbypt. However, I am getting the same values for the phase if I remove the mean ptbypt block. I'm not sure why it isn't finding the mean. Any help would be appreciated. I'm including the part of my vi that finds the phase and mean.

0 Kudos
Message 1 of 16
(4,263 Views)

Hi guy,

 

what are the input values to MeanPtByPt?

How often do you call it?

Did you debug your VI?

 

For me it works just fine:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 16
(4,245 Views)

Does your calculated phase even change?  Add an indicator before the the Mean PtByPt and monitor that.  A chart showing the before the mean and after the mean would be more telling.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 16
(4,232 Views)

Are your signals real or simulated? If they're simulated and have the same frequency the phase difference will be constant and in this case the mean ptbypt function will return this same constant value.

 

Ben64

0 Kudos
Message 4 of 16
(4,231 Views)

The calculated Phase is what is inputted into the Mean ptbypt. I want it to run continually as data is being acquired. I'm including my Full VI, as well as the output before and after the Mean ptbypt, which as you can see is the exact same. Also, after looking at the graph of the calculated phase, I'm thinking there has to be a better was to accomplish that as well. The phase should be steady around 90 degrees. I'm not sure why it is jumping down as often as it is.

Download All
0 Kudos
Message 5 of 16
(4,225 Views)

The signals are real.

0 Kudos
Message 6 of 16
(4,219 Views)

PS:  Use In Range and Coerce Rather than Is Less Than AND Is Greater Than.

0 Kudos
Message 7 of 16
(4,201 Views)

Hi guy,

 

I want it to run continually as data is being acquired.

Ok. Where is the loop in your VI to have it run continuously?

 

Please don't use the "run continuously" button in the menu - it is just a debugging tool with side effects as you have learned by this experiment right now!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 16
(4,200 Views)

As Gerd mentioned, don't use Run Continuously.  This Mean PtbyPt has an initialize sequence that on the first run, the average is reset.  When you run continuously like you are doing, the average is reset every time and will output the same value as the input.

aputman
0 Kudos
Message 9 of 16
(4,193 Views)

So does just the mean ptbypt need to be in a loop, or should I have the entire section that is finding the phase in a loop as well, or should the whole vi be in a loop, and then a subloop that has the mean calculation being done?

0 Kudos
Message 10 of 16
(4,186 Views)