Average wind direction calculation method and device, computer equipment and storage medium
By performing coordinate transformation and cosine similarity calculation on wind direction data, and combining it with box plot method to detect outliers, the bias problem in wind direction data analysis in traditional methods is solved, and a more accurate wind energy resource assessment is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG TONGJI VOCATIONAL COLLEGE OF SCI & TECH
- Filing Date
- 2025-05-30
- Publication Date
- 2026-05-08
AI Technical Summary
Traditional arithmetic mean and box plot methods suffer from bias and inaccurate outlier detection in wind direction data processing, affecting the accuracy of wind energy resource assessment.
By converting wind direction data into unit vectors in a Cartesian coordinate system, cosine similarity is calculated, and outliers are detected and removed using box plots. The average vector is then calculated and quadrants are adjusted to obtain an accurate wind direction angle.
It improves the accuracy of wind direction data analysis, reduces errors and biases, and ensures the precision of wind energy resource assessment.
Smart Images

Figure CN121997016A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for assessing wind energy resources in wind farms, and more specifically to a method, apparatus, computer equipment, and storage medium for calculating average wind direction. Background Technology
[0002] In the early stages of wind farm construction, accurately assessing the wind energy resources around the site is crucial. This assessment requires detailed analysis of wind measurement data, including evaluation of key indicators such as 10-minute average wind speed and 10-minute average wind direction. The accuracy of this data directly impacts the reliability of subsequent key indicators such as correlation analysis and turbulence intensity calculations.
[0003] Wind speed data is collected as the instantaneous wind speed at each test time point, measured in meters per second (m / s), typically ranging from 0 to 40 m / s. Wind direction data, on the other hand, records the clockwise rotation angle from true north at each test time point, measured in degrees, ranging from 0 to 359 degrees. In traditional methods of calculating wind speed and direction, wind speed data is usually calculated using an arithmetic mean, suitable for numerical processing. However, wind direction data differs from wind speed data; it is angular data representing the direction of the wind, with values within a circle ranging from 0 to 359 degrees. Due to the unique nature of wind direction, directly calculating the average wind direction using the arithmetic mean method may lead to significant deviations, affecting subsequent analysis results.
[0004] For example, when wind direction data is distributed on both sides of due north, the wind direction values for the northeast direction are 0 to 45 degrees, while those for the northwest direction are 345 to 359 degrees. Although these wind direction values differ significantly, they actually represent wind directions close to due north. If the arithmetic mean is used directly to calculate the wind direction, a result deviating from the actual wind direction will be obtained. For instance, for a set of wind direction data (350, 355, 357, 5, 15, 23, 28, 31, 40, 43), the prevailing wind direction is northeast. If the arithmetic mean is used directly, the result is 124.7 degrees, which is southeast, a significant deviation from the actual prevailing wind direction, leading to a significant error in the analysis results.
[0005] Furthermore, outlier detection plays a crucial role in the preprocessing of wind direction data. Traditional outlier detection methods, such as box plots, primarily rely on statistical methods to identify outliers in the dataset. However, due to the circular nature of wind direction data, simply judging outliers based on numerical magnitude can lead to significant bias. For example, the difference between 15 degrees and 345 degrees is substantial numerically, but they actually represent wind directions very close to true north. Therefore, when using box plots for outlier detection in wind direction data, some actually normal wind directions may be misclassified as outliers, or some actual outliers may be missed. For example, in a set of wind direction data (7, 8, 11, 14, 21, 25, 199, 201, 202, 203, 208, 212, 315, 316, 319, 325, 326, 329, 332, 335, 336, 339, 341, 343, 345, 346, 347, 348, 349, 350, 354, 357), the prevailing wind direction is north-northwest. Traditional box plot methods might misclassify the north-northeast direction (7, 8, 11, 14, 21, 25 degrees) as an outlier, while omitting the south-southwest direction (199, 201, 202, 203, 208, 212 degrees). Such misclassification and omission can severely affect the accuracy of wind direction data, thus impacting the calculation of average wind direction and subsequent analysis.
[0006] In summary, the shortcomings of traditional box plot and arithmetic mean methods in wind direction data processing pose significant challenges to the accuracy of wind direction data analysis. In the early stages of wind farm construction, to ensure the accuracy of wind measurement data, especially wind direction data analysis, it is urgent to develop more precise and efficient algorithms to address these issues, thereby improving the accuracy of wind energy resource assessment and providing reliable data support for subsequent wind farm design and operation.
[0007] Therefore, it is necessary to design a new method to improve the accuracy of wind energy resource assessment, in order to address the shortcomings of traditional box plot and arithmetic mean methods in wind direction data processing, which leads to challenges in the accuracy of wind direction data analysis. Summary of the Invention
[0008] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method, apparatus, computer equipment and storage medium for calculating average wind direction.
[0009] To achieve the above objectives, the present invention adopts the following technical solution: an average wind direction calculation method, comprising:
[0010] Obtain raw wind direction data;
[0011] Each of the original wind direction data points is then subjected to coordinate transformation to obtain the transformation result;
[0012] Calculate the cosine similarity between each of the transformation results and the unit vector in the due north direction;
[0013] The cosine similarity is used to detect outliers, identify outliers in the original wind direction data, and remove outliers from the transformation results to obtain intermediate data.
[0014] Calculate the average value of all the intermediate data to obtain an average vector representing the average wind direction;
[0015] Calculate the angle between the average vector and due north, and adjust according to the quadrant to obtain the final wind direction angle;
[0016] Output the final wind direction angle.
[0017] The further technical solution is as follows: The process of performing coordinate transformation on each of the original wind direction data to obtain the transformation result includes:
[0018] The original wind direction data is converted into a unit vector in a rectangular coordinate system to obtain the conversion result.
[0019] The further technical solution is as follows: The method of using box plots to detect outliers in the cosine similarity is used to identify outliers in the original wind direction data, and outliers are removed from the transformation result to obtain intermediate data, including:
[0020] The cosine similarity values are combined to form a sequence, and the values in the sequence are detected as outliers using a box plot method to obtain an outlier sequence. The outlier sequence is then removed from the transformation result to obtain intermediate data.
[0021] A further technical solution is as follows: The step of calculating the average value of all the intermediate data to obtain an average vector representing the average wind direction includes:
[0022] The mean of the horizontal and vertical axes of the intermediate data is calculated to obtain an average vector representing the average wind direction.
[0023] The further technical solution is as follows: calculating the angle between the average vector and the due north direction, and adjusting it according to the quadrant to obtain the final wind direction angle, includes:
[0024] Calculate the angle between the average vector and due north. If the average vector is located in the first or second quadrant, the angle is determined as the final wind direction angle. If the average vector is located in the third or fourth quadrant, the angle is converted into the correct wind direction angle range to obtain the final wind direction angle.
[0025] The present invention also provides an average wind direction calculation device, comprising:
[0026] The data acquisition unit is used to acquire raw wind direction data;
[0027] A coordinate transformation unit is used to transform the coordinates of each of the original wind direction data to obtain the transformation result;
[0028] A similarity calculation unit is used to calculate the cosine similarity between each of the transformation results and the unit vector in the due north direction;
[0029] The elimination unit is used to perform outlier detection on the cosine similarity using the box plot method, identify outliers in the original wind direction data, and remove outliers from the transformation result to obtain intermediate data.
[0030] The mean calculation unit is used to calculate the average value of all the intermediate data to obtain an average vector representing the average wind direction.
[0031] An angle determination unit is used to calculate the angle between the average vector and the due north direction, and adjust it according to the quadrant to obtain the final wind direction angle;
[0032] The output unit is used to output the final wind direction angle.
[0033] The further technical solution is as follows: the conversion unit is used to convert the original wind direction data into a unit vector in a rectangular coordinate system to obtain the conversion result.
[0034] The further technical solution is as follows: the elimination unit is used to combine the cosine similarity to form a constitutive sequence, and use the box plot method to detect outliers in the sequence to obtain an outlier sequence. The outlier sequence is then eliminated from the transformation result to obtain intermediate data.
[0035] The present invention also provides a computer device, the computer device including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the above-described method.
[0036] The present invention also provides a storage medium storing a computer program that, when executed by a processor, implements the above-described method.
[0037] The advantages of this invention compared to existing technologies are as follows: By performing coordinate transformation on the original wind direction data and calculating cosine similarity and using box plots for outlier detection, this invention can eliminate outlier data, ensuring more reliable intermediate data. Next, the average value of its unit vector is calculated to accurately represent the average wind direction; finally, the angle between this average vector and true north is calculated, and quadrant adjustment is performed to obtain a more accurate final wind direction angle. This method solves the problems of traditional arithmetic mean methods ignoring directional characteristics and box plot methods failing to effectively handle outliers in wind direction data, improving the accuracy of wind energy resource assessment and reducing errors and biases in wind direction data analysis.
[0038] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. Attached Figure Description
[0039] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 A flowchart illustrating the average wind direction calculation method provided in an embodiment of the present invention;
[0041] Figure 2 A schematic diagram of outlier detection coordinates provided by the present invention;
[0042] Figure 3 A schematic diagram of the final wind direction angle provided by the present invention;
[0043] Figure 4 A schematic block diagram of the average wind direction calculation device provided in an embodiment of the present invention;
[0044] Figure 5 A schematic block diagram of a computer device provided for an embodiment of the present invention. Detailed Implementation
[0045] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0046] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0047] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the invention. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0048] It should also be further understood that the term "and / or" as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0049] Please see Figure 1 , Figure 1 This is a schematic flowchart illustrating the average wind direction calculation method provided in this embodiment of the invention. This method is applied in a server. The server interacts with sensors and terminals to accurately calculate the average value of wind direction data, overcoming the shortcomings of traditional box plot methods and arithmetic mean methods in wind direction data processing, thus improving the accuracy of wind energy resource assessment. The specific implementation steps include: First, acquiring raw wind direction data; converting the wind direction data to a standard coordinate system through coordinate transformation; and calculating the relationship between each data point and the unit vector in the due north direction using cosine similarity. Then, using the box plot method to detect and remove outliers to ensure data reliability. Next, calculating the average vector representing the wind direction. Finally, combining quadrant adjustment and angle calculation, the precise final wind direction angle is obtained. This method significantly improves the accuracy of wind direction data analysis by removing outliers, performing refined coordinate transformations, and conducting vector operations, thereby more accurately assessing wind energy resources.
[0050] Figure 1 This is a flowchart illustrating the average wind direction calculation method provided in an embodiment of the present invention. Figure 1 As shown, the method includes the following steps S110 to S170.
[0051] S110. Obtain raw wind direction data.
[0052] In this embodiment, the raw wind direction data generally comes from wind speed and direction measuring instruments, typically anemometers, wind vanes, or other types of meteorological equipment. These devices can record the wind direction in real time and collect data at set time intervals (e.g., every 10 minutes). Each data point usually represents the average wind direction during that period, and the common unit is degrees (°), which is the angle clockwise from true north.
[0053] The acquired raw wind direction data sequence is typically an array or sequence of wind direction data, representing the wind direction recorded within a specific time period. For example, assuming the collected data is wind direction data within a 10-minute interval, this set of data would be represented as: d = {d1, d2, ..., d...} n}; where each data point d i (1≤i≤n) represents the wind direction measured at that moment or within that time period. Each element d in the wind direction data... i It is a value between 0° and 359°, representing a clockwise angle relative to true north.
[0054] Raw wind direction data is typically collected through automated weather stations or sensor networks. To ensure data accuracy, the acquisition equipment needs to possess high precision and stability, enabling accurate measurements under various weather conditions. Simultaneously, the equipment must smooth wind fluctuations to avoid errors caused by instantaneous wind speed changes, ensuring that the recorded wind direction data represents the long-term trend of the wind rather than occasional fluctuations.
[0055] The accuracy of raw data acquisition is crucial to ensuring the accuracy of subsequent analysis. Typically, wind direction data requires an accuracy of at least 1°, meaning each wind direction data point must be recorded with an accuracy of 1° or higher. Furthermore, the data acquisition time interval is also very important. Excessively long time intervals may fail to capture the details of wind direction changes, while excessively short time intervals may increase the proportion of noisy data. Therefore, a suitable time interval needs to be selected based on the specific application scenario (such as wind energy resource assessment, weather forecasting, etc.).
[0056] After acquiring the raw wind direction data, certain preprocessing steps are usually required, such as removing obvious outliers or correcting erroneous readings caused by equipment malfunctions. These preprocessing steps help improve the accuracy of subsequent outlier detection algorithms. Through preprocessing, it is ensured that the wind direction data entering step S120 is of high quality, avoiding any impact on the final detection results.
[0057] Suppose that during a certain period, the wind direction data sequence collected by the wind direction measuring instrument is as follows:
[0058] d = {7, 8, 11, 14, 21, 25, 199, 201, 202, 203, 208, 212, 315, 316, 319, 325, 326, 329, 332, 335, 336, 339, 341, 343, 345, 346, 347, 348, 349, 350, 354, 357}; these data reflect wind variations, with each data point representing the wind direction over a specific time period. The following steps will transform and calculate based on this raw wind direction data to obtain more accurate results in subsequent outlier detection.
[0059] Step S110, "acquiring raw wind direction data," is a crucial step in this embodiment. Using high-precision anemometers and at reasonable time intervals, the collected raw wind direction data provides accurate input for subsequent anomaly detection. Based on data preprocessing, subsequent steps will perform mathematical processing, transformation, and analysis on this raw data to accurately detect anomalies in the wind direction data.
[0060] S120. Perform coordinate transformation on each of the original wind direction data to obtain the transformation result.
[0061] The original wind direction data is converted into a unit vector in a Cartesian coordinate system.
[0062] In this embodiment, the original wind direction data is typically presented as angles, representing the direction of the wind. To calculate the similarity between wind direction data, these angles need to be converted into coordinate points in a Cartesian coordinate system. Specifically, let's assume the original wind direction data is d. i Its value ranges from 0° to 359° (representing the wind direction), and the angle can be converted into unit vector coordinates using the following formula: x i =sin(d i ), y i =cos(d i ); where d i Let x represent the angle of the i-th wind direction data. i and y i These are the coordinates in the Cartesian coordinate system corresponding to that angle. Since a unit vector is being calculated, its length is always 1.
[0063] For example, suppose a certain wind direction data d i =30°, then the unit vector of this data in the rectangular coordinate system is:
[0064] x i=sin(30°)=0.5,yi=cos(30°)≈0.866; the coordinates of this vector are (0.5, 0.866), which is the unit vector of the wind direction data in the two-dimensional plane.
[0065] In this embodiment, the original wind direction data sequence d = {d1, d2, ..., d...} is... n Each wind direction data d i (1≤i≤n; i, n∈positive integers), convert it to a Cartesian coordinate system, starting from the origin (0,0) and going to the point (sin(d i ), cos(d i unit vector (1≤i≤n; i, n∈positive integers), is called Original wind direction data d i The corresponding wind direction vector, The original wind direction data sequence is d = {d1, d2, ..., d...} n The corresponding wind direction vector sequence.
[0066] In other embodiments, each of the original wind direction data can be converted into coordinate points in a polar coordinate system, and then into coordinate points in a rectangular coordinate system.
[0067] The polar coordinate system is adapted to the wind direction measurement method, with the polar axis pointing due north and the polar angle pointing clockwise.
[0068] Construct a polar coordinate system adapted to wind direction measurement methods. The polar axis of the polar coordinate system is set to true north, and the polar angle is set to clockwise, conforming to the specifications for wind direction measurement.
[0069] Converting to polar coordinates: Each raw wind direction data point is converted into a polar coordinate point o according to the polar coordinate system constructed above. i , where o i The polar radius is set to unit 1, and the polar angle is d. i Thus, the intermediate data d i It will be directly converted into a coordinate (1, d) i ), representing the position on the unit circle.
[0070] Next, using the formula for converting polar coordinates to rectangular coordinates, we will convert each coordinate point o... i Convert to coordinates x in a rectangular coordinate system i In a rectangular coordinate system, the coordinates of the point are (sin(d)). i ), cos(d i )), where d i This is the raw wind direction data.
[0071] For example, suppose a certain wind direction data is d i =30°, then its coordinates in the polar coordinate system are (1, 30°), and the coordinates after conversion to the rectangular coordinate system are (sin(30°), cos(30°)), that is (0.5, 0.866).
[0072] Through this series of transformation steps, each wind direction data point is converted into a unit vector in a Cartesian coordinate system.
[0073] S130. Calculate the cosine similarity between each of the transformation results and the unit vector in the due north direction.
[0074] Specifically, the cosine similarity between the unit vector in each transformation result and the unit vector in the due north direction is calculated.
[0075] In this embodiment, in step S121, the unit vector corresponding to each wind direction data is obtained. Next, it is necessary to calculate the cosine similarity between these unit vectors and the unit vector in the due north direction (i.e., (0, 1)) to measure the similarity between the wind direction data and the due north direction.
[0076] The formula for calculating cosine similarity is: in, It is the wind direction unit vector obtained from step S121. It is a unit vector pointing due north. Since the length of a unit vector is 1, the formula simplifies to: cosine_similarity = x i ·0+y i ·1=y i Therefore, the cosine similarity between wind direction data and the unit vector in the due north direction is equal to the y-coordinate of that wind direction unit vector, i.e., cos(d i ).
[0077] For example, if the unit vector of a certain wind direction data is (0.5, 0.866), then its cosine similarity with due north is 0.866.
[0078] By calculating the cosine similarity between each original wind direction data and the unit vector of due north, a sequence containing the similarities between all wind direction data and due north can be obtained.
[0079] S130. The cosine similarity is used to detect outliers using the box plot method to identify outliers in the original wind direction data and remove them from the transformation result to obtain intermediate data.
[0080] In this embodiment, the intermediate value refers to the transformation result after removing outliers, that is, the unit vector after removing outliers.
[0081] Specifically, the cosine similarity values are combined to form a sequence, and the box plot method is used to detect outliers in the sequence to obtain an outlier sequence. The outlier sequence is then removed from the transformation result to obtain intermediate data.
[0082] In this embodiment, in step S120, a cosine similarity sequence between each unit vector and the unit vector in the due north direction is obtained. These similarity values will serve as the basis for the next step of outlier detection.
[0083] Box plots are a commonly used statistical method for detecting outliers in a dataset. The box plot method primarily determines the range of outliers by calculating the quartiles (Q1, Q3) of the data. The specific steps are as follows:
[0084] Calculate the quartiles: Calculate the first quartile Q1 and the third quartile Q3 in the dataset. Calculate the interquartile range (IQR) = Q3 - Q1.
[0085] Determine the range of outliers: The lower bound of outliers is Q1 - 1.5 × IQR.
[0086] The upper bound for outliers is Q3 + 1.5 × IQR.
[0087] If the cosine similarity value is less than the lower bound or greater than the upper bound, it is considered an outlier.
[0088] For example, if the cosine similarity sequence is:
[0089] The sequence {0.9925, 0.9903, 0.9816, 0.9703, 0.9336, 0.9063, -0.9455, -0.9336, -0.9272, -0.9205} can be identified as outliers by using a box plot. For example, if calculations show that -0.9455, -0.9336, and -0.9272 exceed the normal range, they will be identified as outliers.
[0090] Once an outlier sequence is detected, i.e., we determine which cosine similarity values are anomalous, we can remove the data corresponding to these outliers from the original wind direction data. For example, if the outlier sequence is: {-0.9455, -0.9336, -0.9272, -0.9205, -0.8829, -0.848};
[0091] Therefore, data points in the original wind direction data corresponding to these similarity values (such as 199, 201, 202, etc.) will be removed, and the transformation results corresponding to the remaining wind direction data will be used as intermediate data. This data can be used to further analyze wind direction patterns or for other related calculations.
[0092] By combining cosine similarity and box plot methods in steps S120 and S130, outliers in wind direction data can be effectively detected and removed, thereby improving the accuracy of wind direction data analysis. Compared with traditional outlier detection methods based on numerical similarity, this method can more accurately identify true outliers in wind direction data, especially when the wind direction is close to due north, significantly reducing false positives and false negatives.
[0093] The above-described outlier detection process effectively addresses the misjudgment and missed detection problems in existing wind direction data outlier detection methods, significantly improving the accuracy of outlier detection. This method is particularly suitable for the precise calculation of important indicators such as wind energy resource assessment and wind direction correlation analysis. Compared with traditional methods, this invention can more accurately identify outliers in wind direction data, thereby providing reliable data support for further wind energy analysis.
[0094] This invention describes the similarity of wind direction data by converting wind direction data into wind direction vectors and calculating the cosine similarity between the vectors. Compared to traditional numerical comparisons, this method can more accurately measure the similarity between wind direction data, especially for data close to true north (e.g., 15 degrees vs. 345 degrees). Traditional methods directly judge the similarity of wind direction data based on the magnitude of the wind direction values, which is prone to false positives and false negatives, especially for data with similar directions but large numerical differences (e.g., 15 degrees vs. 345 degrees). This invention effectively solves this problem by calculating the cosine similarity between wind direction data and the unit vector in the true north direction, thus improving the accuracy of wind direction anomaly detection. Combining cosine similarity values and box plot methods for anomaly detection can accurately identify real anomaly data and avoid false positives and false negatives in traditional methods.
[0095] For example: A set of wind direction data is as follows:
[0096] The data {7, 8, 11, 14, 21, 25, 199, 201, 202, 203, 208, 212, 315, 316, 319, 325, 326, 329, 332, 335, 336, 339, 341, 343, 345, 346, 347, 348, 349, 350, 354, 357} shows a predominantly north-northwest wind direction. If the traditional box plot method is used directly for outlier detection, {7, 8, 11, 14, 21, 25} will be incorrectly identified as an outlier, while {199, 201, 202, 203, 208, 212} will be missed.
[0097] The method in this embodiment first converts wind direction data into wind direction vectors, then calculates the cosine similarity between each wind direction vector and the unit vector in the due north direction, resulting in the following cosine similarity sequence:
[0098] {0.9925, 0.9903, 0.9816, 0.9703, 0.9336, 0.9063, -0.9455, -0.9336, -0.9272, -0.9205, -0.8829, -0.848, 0.7071, 0.7193, 0.7547, 0.8192, 0.829, 0.8572, 0.8829, 0.9063, 0.9135, 0.9336, 0.9455, 0.9563, 0.9659, 0.9703, 0.9744, 0.9781, 0.9816, 0.9848, 0.9945, 0.9986};
[0099] Outlier detection using box plots on cosine similarity sequences can accurately identify outlier sequences.
[0100] {-0.9455, -0.9336, -0.9272, -0.9205, -0.8829, -0.848};
[0101] The corresponding original wind direction data are: {199, 201, 202, 203, 208, 212}; for example... Figure 2 The red markers indicate wind directions in the south-southwest direction. After removing outlier data such as {199, 201, 202, 203, 208, 212}, the intermediate data is obtained as: {7, 8, 11, 14, 21, 25, 315, 316, 319, 325, 326, 329, 332, 335, 336, 339, 341, 343, 345, 346, 347, 348, 349, 350, 354, 357}.
[0102] It effectively solves the problems of misjudgment and omission in traditional wind direction data outlier detection methods, ensuring the accuracy of wind direction data analysis.
[0103] S150. Calculate the average value of all the intermediate data to obtain an average vector representing the average wind direction.
[0104] In this embodiment, the mean of the horizontal and vertical coordinates of the intermediate data is calculated to obtain an average vector representing the average wind direction.
[0105] In this embodiment, to obtain the final average wind direction, it is necessary to calculate the average value of these intermediate unit vectors. Unit vector x i =(sin(d) i ), cos(d i )) represents the distance from the origin (0, 0) to (sin(d) i ), cos(d iA vector is a vector that has directionality and a unit length.
[0106] All the transformed unit vectors, i.e., the intermediate data x1, x2, ..., x... n Perform vector addition, then divide by the quantity n to obtain the average unit vector v. avg :
[0107] This average unit vector v avg The direction represents the true average wind direction of all wind direction data.
[0108] For example, suppose we have three wind direction data points: d1 = 10°, d2 = 20°, and d3 = 30°, with corresponding unit vectors (sin(10°), cos(10°)), (sin(20°), cos(20°)), and (sin(30°), cos(30°)). Calculate the average of these three unit vectors to obtain v. avg That is the final average wind direction vector.
[0109] S160. Calculate the angle between the average vector and the due north direction, and adjust according to the quadrant to obtain the final wind direction angle.
[0110] In this embodiment, the angle between the average vector and due north is calculated. When the average vector is located in the first or second quadrant, the angle is determined as the final wind direction angle. When the average vector is located in the third or fourth quadrant, the angle is converted into the correct wind direction angle range to obtain the final wind direction angle.
[0111] Specifically, the obtained average vector v avg This represents the true average wind direction. Calculating the angle of this vector requires finding the angle between it and true north (i.e., the unit vector (0, 1) in the positive y-axis direction) to determine the specific wind direction angle.
[0112] The average vector v is calculated. avg The direction represents the true average wind direction, which is more accurate than the average wind direction calculated by the conventional arithmetic mean method. Find the average wind direction vector v. avg Unit vector in the direction of the positive y-axis (true north) The angle θ between the two sides can be determined using the inverse cosine formula. The calculated value ranges from 0 to 180, based on the average vector v. avg The quadrant attribute is used to transform θ into an angle within the range of 0 to 359, corresponding to the value range of the original wind direction data, to obtain the final average wind direction value. The transformation rule is as follows: if the average vector v avg If it is located in the first and second quadrants of a Cartesian coordinate system, then If the average vector v avg If it is located in the 3rd and 4th quadrants of a rectangular coordinate system, then
[0113] Due to the characteristics of wind direction data, if the average vector lies in different quadrants, the included angle needs to be adjusted:
[0114] First or second quadrant: The included angle value is directly used as the final wind direction angle.
[0115] In the third or fourth quadrant: the included angle value needs to be adjusted to convert it into the correct wind direction angle within the range of 0 to 359 degrees. Specifically, To obtain the final wind direction angle.
[0116] For example, θ = 110°, if v avg If it is located in the second quadrant, then the final wind direction angle θ = 110°, indicating the southeast direction. avg If it is located in the third quadrant, then the final wind direction angle θ = 359° - 110° = 249°, indicating the southwest direction.
[0117] Through the above steps, the final wind direction angle can accurately reflect the actual distribution of wind direction and overcome the error of the traditional arithmetic mean method.
[0118] In another embodiment, for the above calculation process, a special polar coordinate system is defined based on the method of measuring wind direction data. The polar axis of this coordinate system points due north, and the polar angle is clockwise. Each intermediate data point d... i (1≤i≤n) is converted to the coordinate point o in this polar coordinate system. i The polar radius is 1, and the polar angle is d. i The coordinates are (1, d) i ).
[0119] The coordinates of each wind direction data point obtained in the polar coordinate system are converted to coordinates in the rectangular coordinate system. These coordinate points lie on the circumference of a unit circle with the origin as the center and a radius of unit 1. The conversion rule is as follows: for a point o in the polar coordinate system... i (1,d) i Its corresponding rectangular coordinate is x. i =(sin(d) i ), cos(d i This yields the rectangular coordinate sequence of wind direction data: x = {x1, x2, ..., x...} n}
[0120] The coordinates of the obtained rectangular coordinate system are x i =(sin(d) i ), cos(d iThis can be converted to a point starting from the origin (0,0) and ending at coordinate point x. i The unit vectors are used to calculate the average vector of these wind direction vectors. The direction of the average vector represents the accurate average wind direction, providing a more realistic wind direction calculation compared to the traditional arithmetic mean method.
[0121] Based on the obtained average wind direction vector, calculate the angle between it and true north (i.e., the unit vector (0, 1) in the rectangular coordinate system). Use the cosine formula of the angle to obtain the angle between the average wind direction vector and true north.
[0122] Specifically, vectors have both direction and length attributes, which can more accurately describe wind direction data. Calculating the average vector of these vectors will give us a more realistic and accurate average wind direction. Finally, we can calculate the angle between the average wind direction vector and the north direction vector (0, 1) in a clockwise direction to obtain the final average direction angle value.
[0123] Since the mean wind direction angle calculated using the cosine formula ranges from 0 to 180 degrees, it doesn't perfectly correspond to the actual wind direction range. For example, a 36-degree angle could represent northeast or northwest (323 degrees). Therefore, the angle range needs to be adjusted to 0 to 359 degrees based on the quadrant of the mean vector. The conversion rules are as follows:
[0124] If the average vector is located in the first or second quadrant of the rectangular coordinate system, then the included angle value is used directly.
[0125] If the average vector is located in the 3rd or 4th quadrant, the included angle value is adjusted according to the quadrant attribute.
[0126] Therefore, this invention effectively solves the deviation problem that occurs when calculating wind direction using the arithmetic mean method. Compared with traditional methods, this invention can significantly improve the accuracy of wind direction calculation, thereby enhancing the precision of wind energy resource assessment and analysis, and has high technical value.
[0127] This embodiment uses coordinate transformation and vector calculation to calculate the average wind direction more accurately. A polar coordinate system adapted to the wind direction data measurement method is defined, with the polar axis pointing due north and the polar angle changing clockwise, allowing wind direction data to be directly converted into polar angles in the polar coordinate system. Wind direction data is represented by vectors, and an average vector algorithm is used to calculate the average wind direction. This approach more accurately describes the wind direction data and avoids the biases of traditional arithmetic averaging methods. For the obtained angle values, based on the quadrant attributes of the wind direction data, the angle values are adjusted to a range of 0 to 359 degrees to ensure that the final average wind direction angle correctly reflects the actual wind direction.
[0128] For example, such as Figure 3As shown, for the aforementioned set of wind direction data {7, 8, 11, 14, 21, 25, 199, 201, 202, 203, 208, 212, 315, 316, 319, 325, 326, 329, 332, 335, 336, 339, 341, 343, 345, 346, 347, 348, 349, 350, 354, 357}, outlier detection was performed. After removing outliers, the intermediate data d = {7, 8, 11, 14, 21, 25, 315, 316, 319, 325, 326, 329, 332, 335, 336, 339, 341, 343, 345, 346, 347, 348, 349, 350, 354, 357}, calculated using the arithmetic mean method, yielded an average wind direction of 263.0 degrees, which showed a significant deviation. However, the method used in this embodiment, based on coordinate transformation and average vector calculation, yielded an average wind direction of 344.97 degrees, significantly improving accuracy.
[0129] S170, Output the final wind direction angle.
[0130] The final wind direction angle is output to the terminal display.
[0131] The aforementioned method for calculating average wind direction, by performing coordinate transformation on the original wind direction data and applying cosine similarity calculation and box plot outlier detection, can eliminate outlier data and ensure more reliable intermediate data. Next, the average value of its unit vectors is calculated to accurately represent the average wind direction; finally, the angle between this average vector and true north is calculated, and quadrant adjustment is performed to obtain a more accurate final wind direction angle. This method solves the problems of traditional arithmetic mean methods neglecting directional characteristics and box plot methods failing to effectively handle outliers in wind direction data, improving the accuracy of wind energy resource assessment and reducing errors and biases in wind direction data analysis.
[0132] Figure 4 This is a schematic block diagram of an average wind direction calculation device 300 provided in an embodiment of the present invention. Figure 4 As shown, corresponding to the above-described average wind direction calculation method, the present invention also provides an average wind direction calculation device 300. This average wind direction calculation device 300 includes a unit for performing the above-described average wind direction calculation method, and the device can be configured in a server. Specifically, please refer to... Figure 4 The average wind direction calculation device 300 includes a data acquisition unit 301, a coordinate transformation unit 302, a similarity calculation unit 303, a elimination unit 304, a mean calculation unit 305, an angle determination unit 306, and an output unit 307.
[0133] The system comprises: a data acquisition unit 301 for acquiring raw wind direction data; a coordinate transformation unit 302 for transforming each piece of raw wind direction data into coordinates to obtain a transformation result; a similarity calculation unit 303 for calculating the cosine similarity between each transformation result and a unit vector in the due north direction; a removal unit 304 for using a box plot method to detect outliers in the cosine similarity, identifying outliers in the raw wind direction data, and removing outliers from the transformation results to obtain intermediate data; a mean calculation unit 305 for calculating the average value of all intermediate data to obtain an average vector representing the average wind direction; an angle determination unit 306 for calculating the angle between the average vector and the due north direction, and adjusting it according to the quadrant to obtain the final wind direction angle; and an output unit 307 for outputting the final wind direction angle.
[0134] In one embodiment, the coordinate transformation unit 302 is used to convert the original wind direction data into a unit vector in a rectangular coordinate system to obtain the transformation result.
[0135] In one embodiment, the elimination unit 304 is used to combine the cosine similarity to form a constitutive sequence, and use the box plot method to detect outliers in the sequence to obtain an outlier sequence. The outlier sequence is then eliminated from the transformation result to obtain intermediate data.
[0136] In one embodiment, the mean calculation unit 305 is used to calculate the mean of the horizontal and vertical coordinates of the intermediate data to obtain an average vector representing the average wind direction.
[0137] In one embodiment, the angle determination unit 306 is used to calculate the angle between the average vector and the due north direction. When the average vector is located in the first quadrant or the second quadrant, the angle is determined as the final wind direction angle. When the average vector is located in the third quadrant or the fourth quadrant, the angle is converted into the correct wind direction angle range to obtain the final wind direction angle.
[0138] It should be noted that those skilled in the art can clearly understand that the specific implementation process of the above-mentioned average wind direction calculation device 300 and each unit can be referred to the corresponding description in the foregoing method embodiments. For the sake of convenience and brevity, it will not be repeated here.
[0139] The aforementioned average wind direction calculation device 300 can be implemented as a computer program, which can, for example, Figure 5 It runs on the computer device shown.
[0140] Please see Figure 5 , Figure 5This is a schematic block diagram of a computer device provided in an embodiment of this application. The computer device 500 can be a server, wherein the server can be a standalone server or a server cluster composed of multiple servers.
[0141] See Figure 5 The computer device 500 includes a processor 502, a memory, and a network interface 505 connected via a system bus 501. The memory may include a non-volatile storage medium 503 and internal memory 504.
[0142] The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions that, when executed, cause the processor 502 to perform an average wind direction calculation method.
[0143] The processor 502 provides computing and control capabilities to support the operation of the entire computer device 500.
[0144] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can perform an average wind direction calculation method.
[0145] This network interface 505 is used for network communication with other devices. Those skilled in the art will understand that... Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device 500 to which the present application is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0146] The processor 502 is used to run a computer program 5032 stored in the memory to perform the following steps:
[0147] Obtain raw wind direction data; perform coordinate transformation on each raw wind direction data to obtain a transformation result; calculate the cosine similarity between each transformation result and the unit vector of true north; use box plot method to detect outliers in the cosine similarity, identify outliers in the raw wind direction data, and remove outliers from the transformation results to obtain intermediate data; calculate the average value of all intermediate data to obtain an average vector representing the average wind direction; calculate the angle between the average vector and true north, and adjust according to the quadrant to obtain the final wind direction angle; output the final wind direction angle.
[0148] In one embodiment, when the processor 502 performs coordinate transformation on each of the original wind direction data to obtain the transformation result, it specifically implements the following steps:
[0149] The original wind direction data is converted into a unit vector in a rectangular coordinate system to obtain the conversion result.
[0150] In one embodiment, when the processor 502 performs outlier detection on the cosine similarity using the box plot method, identifies outliers in the original wind direction data, and removes outliers from the transformation result to obtain intermediate data, the processor specifically implements the following steps:
[0151] The cosine similarity values are combined to form a sequence, and the values in the sequence are detected as outliers using a box plot method to obtain an outlier sequence. The outlier sequence is then removed from the transformation result to obtain intermediate data.
[0152] In one embodiment, when processor 502 performs the step of calculating the average of all the intermediate data to obtain an average vector representing the average wind direction, it specifically implements the following steps:
[0153] The mean of the horizontal and vertical axes of the intermediate data is calculated to obtain an average vector representing the average wind direction.
[0154] In one embodiment, when the processor 502 calculates the angle between the average vector and true north, and adjusts it according to the quadrant to obtain the final wind direction angle, it specifically implements the following steps:
[0155] Calculate the angle between the average vector and due north. If the average vector is located in the first or second quadrant, the angle is determined as the final wind direction angle. If the average vector is located in the third or fourth quadrant, the angle is converted into the correct wind direction angle range to obtain the final wind direction angle.
[0156] It should be understood that in the embodiments of this application, the processor 502 may be a central processing unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0157] It will be understood by those skilled in the art that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program includes program instructions and can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.
[0158] Therefore, the present invention also provides a storage medium. This storage medium can be a computer-readable storage medium. The storage medium stores a computer program, wherein when executed by a processor, the computer program causes the processor to perform the following steps:
[0159] Obtain raw wind direction data; perform coordinate transformation on each raw wind direction data to obtain a transformation result; calculate the cosine similarity between each transformation result and the unit vector of true north; use box plot method to detect outliers in the cosine similarity, identify outliers in the raw wind direction data, and remove outliers from the transformation results to obtain intermediate data; calculate the average value of all intermediate data to obtain an average vector representing the average wind direction; calculate the angle between the average vector and true north, and adjust according to the quadrant to obtain the final wind direction angle; output the final wind direction angle.
[0160] In one embodiment, when the processor executes the computer program to perform coordinate transformation on each of the original wind direction data to obtain the transformation result, it specifically implements the following steps:
[0161] The original wind direction data is converted into a unit vector in a rectangular coordinate system to obtain the conversion result.
[0162] In one embodiment, when the processor executes the computer program to perform outlier detection on the cosine similarity using the box plot method, identify outliers in the original wind direction data, and remove outliers from the transformation result to obtain intermediate data, the specific steps are as follows:
[0163] The cosine similarity values are combined to form a sequence, and the values in the sequence are detected as outliers using a box plot method to obtain an outlier sequence. The outlier sequence is then removed from the transformation result to obtain intermediate data.
[0164] In one embodiment, when the processor executes the computer program to implement the step of calculating the average of all the intermediate data to obtain an average vector representing the average wind direction, it specifically implements the following steps:
[0165] The mean of the horizontal and vertical axes of the intermediate data is calculated to obtain an average vector representing the average wind direction.
[0166] In one embodiment, when the processor executes the computer program to calculate the angle between the average vector and true north, and adjusts it according to the quadrant to obtain the final wind direction angle, the processor specifically implements the following steps:
[0167] Calculate the angle between the average vector and due north. If the average vector is located in the first or second quadrant, the angle is determined as the final wind direction angle. If the average vector is located in the third or fourth quadrant, the angle is converted into the correct wind direction angle range to obtain the final wind direction angle.
[0168] The storage medium can be any computer-readable storage medium capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), magnetic disk, or optical disk.
[0169] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0170] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of each unit is merely a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0171] The steps in the method of this invention can be adjusted, merged, or reduced in order according to actual needs. The units in the device of this invention can be merged, divided, or reduced according to actual needs. Furthermore, the functional units in the various embodiments of this invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0172] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0173] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and these modifications or substitutions should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for calculating average wind direction, characterized in that, include: Obtain raw wind direction data; Each of the original wind direction data points is then subjected to coordinate transformation to obtain the transformation result; Calculate the cosine similarity between each of the transformation results and the unit vector in the due north direction; The cosine similarity is used to detect outliers, identify outliers in the original wind direction data, and remove outliers from the transformation results to obtain intermediate data. Calculate the average value of all the intermediate data to obtain an average vector representing the average wind direction; Calculate the angle between the average vector and due north, and adjust according to the quadrant to obtain the final wind direction angle; Output the final wind direction angle.
2. The method for calculating average wind direction according to claim 1, characterized in that, The step of performing coordinate transformation on each of the original wind direction data to obtain the transformation result includes: The original wind direction data is converted into a unit vector in a rectangular coordinate system to obtain the conversion result.
3. The method for calculating average wind direction according to claim 1, characterized in that, The method of using box plots to detect outliers in the cosine similarity, identifying outliers in the original wind direction data, and removing outliers from the transformation result to obtain intermediate data includes: The cosine similarity values are combined to form a sequence, and the values in the sequence are detected as outliers using a box plot method to obtain an outlier sequence. The outlier sequence is then removed from the transformation result to obtain intermediate data.
4. The method for calculating the average wind direction according to claim 1, characterized in that, The step of calculating the average value of all the intermediate data to obtain an average vector representing the average wind direction includes: The mean of the horizontal and vertical axes of the intermediate data is calculated to obtain an average vector representing the average wind direction.
5. The method for calculating average wind direction according to claim 1, characterized in that, The calculation of the angle between the average vector and true north, and the adjustment according to the quadrant to obtain the final wind direction angle, includes: Calculate the angle between the average vector and due north. If the average vector is located in the first or second quadrant, the angle is determined as the final wind direction angle. If the average vector is located in the third or fourth quadrant, the angle is converted into the correct wind direction angle range to obtain the final wind direction angle.
6. An average wind direction calculation device, characterized in that, include: The data acquisition unit is used to acquire raw wind direction data; A coordinate transformation unit is used to transform the coordinates of each of the original wind direction data to obtain the transformation result; A similarity calculation unit is used to calculate the cosine similarity between each of the transformation results and the unit vector in the due north direction; The elimination unit is used to perform outlier detection on the cosine similarity using the box plot method, identify outliers in the original wind direction data, and remove outliers from the transformation result to obtain intermediate data. The mean calculation unit is used to calculate the average value of all the intermediate data to obtain an average vector representing the average wind direction. An angle determination unit is used to calculate the angle between the average vector and the due north direction, and adjust it according to the quadrant to obtain the final wind direction angle; The output unit is used to output the final wind direction angle.
7. The average wind direction calculation device according to claim 6, characterized in that, The conversion unit is used to convert the original wind direction data into a unit vector in a rectangular coordinate system to obtain the conversion result.
8. The average wind direction calculation device according to claim 6, characterized in that, The elimination unit is used to combine the cosine similarity to form a constitutive sequence, and use the box plot method to detect outliers in the sequence to obtain an outlier sequence. The outlier sequence is then eliminated from the transformation result to obtain intermediate data.
9. A computer device, characterized in that, The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the method as described in any one of claims 1 to 6.
10. A storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 6.