LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

calculating mean value of sorted data and drawing polar plot

Solved!
Go to solution

Hi,

 

I have made a VI that calculates mean value of wind speed/rotor-ratio in sections of 30 degrees (wind direction). It also draws polar plot of calculated data. Everything works, but I would like to make more detailed calculations and drawings, by increasing resolution to 1 degree or so...

 

Problem is, that VI I made, isn't easy to scale up. At the moment I have 12 parallel switch-case stuctures to calculate mean value, and build array function to collect calculated data for polar plot to draw realtime picture. I know this is probably the worst way to do it, but since I've done just few small things with LV , this was only way I managed to do what i wanted.

 

Now, if I continue in same way to accomplish my goal, I would have to create 360 parallel switch-case stuctures... which is insane.

 

Something like calculating average of array or matrix (zeros/empty values should not be calculated in average) inside for loop or similar way would probably be the best solution.

 

So, drawing polar plot isn't a problem, but creating reasonalbe averaging counting system is. Any ideas?

 

I also would like to rotare north up (0 deg), and degrees to increase clockwise on polar plot dial plate (like on compass).

 

Vi on attachment. (simplified version of full system)

 

Signals I have:

- wind speed

- wind direction

- rotor speed

 

I want to:

- calculate mean value of wind speed / rotor - ratio in sections (5 degree, 1 degree)

- draw polar plot of wind speed/rotor -ratio averages in propotion to wind direction

 

 

I'm using LabView 2009

 

 

 

Many thanks.

0 Kudos
Message 1 of 17
(4,381 Views)

This should be a good start. I think that I have done what you are looking to do.

Tim
GHSP
0 Kudos
Message 2 of 17
(4,360 Views)

Hi,

 

and thanks for quick reply.

 

interesting solution, but it doesn't work in the way I intend.

 

Exsample you made, counts total average of all last 1000 samples and then draw it in propotion to real time wind direction. What I wanted, is to count average of all ratio values in different sector's (one sector could be 1 degree area, or 5 deg, what ever is the best at the end... sofware I made have now 30 deg sector size). If the ratio is steady on every wind direction, I would have a nice round circle in polar plot, just one line. But because there are some obstacles disturbing rotor rotating (this is what i'm trying to measure with the VI), line wont be perfect circle any more, but still there would be only one line. Result's I get from metering system would be something like on attachment.

 

Short exsample. I have received and counted data something like this:

 

deg           ratio

10             0,60

12             0,65

12             0,63

13             0,69

12             0,65

11             0,63

10             0,61

11             0,65

13             0,65

and so on...

 

What I want to do, is to count average of each sector, max 1000 samples per sector.

 

Sorting and averaging:

10 deg  (0,60+0,61)/2                (max 1000 samples from this wind direction)

11 deg  (0,63+0,65)/2                (max 1000 samples from this wind direction)

12 deg  (0,63+0,63+0,65)/3        (max 1000 samples from this wind direction)

13 deg  (0,69+0,65)/2                (max 1000 samples from this wind direction)

and so on... for every sector.

 

 

So, If I want to count ratio average in 1 degree resolution, that mean I would need 360 average unit's to count last 1000 samples of each wind direction. When I have enough data from each wind direction, there would be max 360*1000 samples holded inside LV's memory. Now, if I get even more data, oldest data from each sector would be dropped out (working like FIFO). My VI does exactly this, except resolution is poor and this is wat I would like to improve.

 

What I have in mind, is something like pointer quided for-loop switch case structure to solve my problem... Switch case, because I can select which window I want to use. But because I dont want to create 360 identical cases, I need something like for loop. In for loop I have to create my software just once, but for loop doesn't let me select which invidual "page" I want to use, like I can do with swich case structure.

0 Kudos
Message 3 of 17
(4,349 Views)
Solution
Accepted by topic author MrHUU

Is this closer to what you are looking for?

Tim
GHSP
Message 4 of 17
(4,313 Views)

One thing I would do extra to the code is put an array for the buffer loop to keep up with the array number for each degree. This would allow me to start from the last iteration for that degree. So if it took 50 samples for 30 deg then went to 50 deg and then came back to 30 deg I would start at sample 51.

Tim
GHSP
Message 5 of 17
(4,307 Views)

Did this help?

Tim
GHSP
0 Kudos
Message 6 of 17
(4,297 Views)

Hi,

 

and thank you. This was exactly what I was looking for.

 

Like you said, there is still some things to improve, like remembering last used index number. I try to solve this problem by myself.

0 Kudos
Message 7 of 17
(4,273 Views)

Hi MrHUU,

 

is this some kind of school exercise? I know I have been reading on the exactly same topic before...

 

Have found the old thread by searching for "wind speed average"

Best regards,
GerdW


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

No, it's not a school project.

 

I'm working on small wind turbine company in Finland and we are doing some research to improve our knowledge about how telecom tower/mast affect our turbine efficiency (if it does). Out goal is to find best installation direction in propotion to mast and prevalent wind direction.

 

My little LabView knowledge come's from school, but everything after that, from trial and error... I have made few small, really simple Vi's in last few months. After school I have used LV just about 50-100 hours. This "project" is biggest and most complicated VI for me so far. The part I send on my first post, is just a small part of the whole VI I'm creating.

 

I did go thru this forum to find answer for my question, but didn't notice any similar topics. Some school exercises might be similar as my problem, and stuff used in this solution are probably as basic as possible, but I've never used this kind of stuff before, even at school. I must have a big hole in basic knowledge of LV, but without extra education... progress will be really slow. 

 

I've tried to go tru forum to find how to turn north up (0 deg) and make degrees to increase clockwice on polar dial plate, but haven't found solution yet.

 

 

 

Project engineer

Pasi Vähämartti

Cypress Wind Turbines Oy

www.cypresswind.com

0 Kudos
Message 9 of 17
(4,256 Views)

Let me know if you need more help.

Tim
GHSP
0 Kudos
Message 10 of 17
(4,242 Views)