A wind speed measurement method, device, apparatus and readable storage medium
By introducing overflow events and selecting appropriate target acquisition events into the rotating anemometer, the limitations of the rotating anemometer in terms of measurement accuracy and range at high and low wind speeds are solved, achieving higher accuracy and a wider range of wind speed measurements.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-27
- Publication Date
- 2026-03-27
AI Technical Summary
The wind speed measurement results of the rotary anemometer are inaccurate, mainly due to the influence of the microcontroller clock count and the processing error of the grid gap distribution, which leads to limitations in the measurement accuracy and range under high and low wind speeds.
A timer with a preset clock frequency is used to capture the pulse edge of the photoelectric pulse signal. When the counter reaches its maximum value, an overflow event is triggered, the number of overflows is recorded, and the wind speed is calculated by combining the number of overflows and the difference between the counter value. Increasing the timer frequency increases the measurement accuracy, and the impact of processing errors is reduced by selecting appropriate target capture events.
It enables accurate wind speed measurement across high and low wind speed ranges, improves the measurement accuracy and range of rotary anemometers, and solves the measurement error problem caused by the upper limit of counting in traditional methods.
Smart Images

Figure CN121208381B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the meteorological technical field, specifically to a wind speed measurement method, device, equipment and readable storage medium. BACKGROUND
[0002] The wind speed meter is a key tool for measuring air flow speed, and is widely used in meteorology, environmental protection, energy and other fields. The commonly used wind speed meter is divided into the following types, which are thermal wind speed meter, differential pressure wind speed meter, ultrasonic wind speed meter and rotating wind speed meter. The thermal wind speed meter calculates the wind speed by measuring the heat dissipation rate change of a heating element (such as a nichrome wire) in the airflow, but it is only suitable for measuring 0.1-0.5m / s breeze. The differential pressure wind speed meter calculates the wind speed by measuring the difference between the total pressure and the static pressure of the airflow, but it needs to be installed vertically to the airflow direction and is sensitive to turbulence. The ultrasonic wind speed meter calculates the wind speed by emitting ultrasonic pulses and measuring the time difference between the downstream and upstream propagation, which has fast response speed, but high cost and high installation precision, and needs to be calibrated with a temperature sensor. The rotating wind speed meter calculates the wind speed by driving the wind cup to rotate by wind power and using the linear relationship between the rotation speed and the wind speed to convert the data, which has simple structure, low cost, strong durability and wide wind speed measurement range (0-70m / s), and has been widely applied.
[0003] Therefore, the rotating wind speed meter is the most widely used wind speed meter. The rotating wind speed meter usually adopts a three-cup design. The wind blows the wind cup to rotate, and the end of the wind cup rotation shaft is connected with the grid to rotate synchronously. The grid is distributed with equal-width slits (the grid is divided into light-transmitting and non-light-transmitting parts). A light source and a photosensitive element are installed on both sides of the slitted grid. When the grid rotates with the shaft, a light-dark change of light occurs once every slit, and after shaping and amplification, an electric pulse signal with a certain amplitude and frequency is obtained. The pulse width is equal to the time of rotating the current grid (or a slit), and then the wind speed is measured. However, the rotating wind speed meter still has the problems of inaccurate wind speed measurement results due to the influence of single-chip clock counting and the machining error of the space distribution of the slits of the grid between the shielding and the non-shielding. Therefore, there is an urgent need for a method for improving the measurement accuracy of the rotating wind speed meter. SUMMARY
[0004] The present application aims to provide a wind speed measurement method, device, equipment and readable storage medium, which increases the wind speed measurement range and improves the wind speed measurement accuracy.
[0005] To achieve the above-mentioned purpose, the present application provides the following technical solutions:
[0006] In a first aspect, the present application provides a wind speed measurement method for measuring wind speed by a wind speed measurement device, the wind speed measurement device comprising a rotatable wind cup, a grating rotating synchronously with the wind cup, and a photoelectric sensor generating a photoelectric pulse signal through the grating, the wind speed measurement method comprising:
[0007] capturing time of pulse edges of the photoelectric pulse signal by a timer with a preset clock frequency, and recording a counter value of the timer at a time when a capture event occurs;
[0008] triggering an overflow event and accumulating an overflow number when the counter value reaches a maximum counter value, and recording the accumulated overflow number at a time when the capture event occurs;
[0009] calculating a target counter value of pulse width between two target capture events according to a difference between the accumulated overflow numbers, a difference between the counter values, and the maximum counter value;
[0010] calculating a wind speed measurement result according to the target counter value, the preset clock frequency, and a number of grids of the grating.
[0011] In some embodiments, the calculating of the target counter value of pulse width between the two target capture events according to the difference between the accumulated overflow numbers, the difference between the counter values, and the maximum counter value comprises:
[0012] multiplying the difference between the accumulated overflow numbers by the maximum counter value to obtain a difference between overflow counter values;
[0013] adding the difference between the overflow counter values to the difference between the counter values to obtain the target counter value.
[0014] In some embodiments, the calculating of the wind speed measurement result according to the target counter value, the preset clock frequency, and the number of grids of the grating comprises:
[0015] dividing the target counter value by the preset clock frequency to obtain an interval duration between the two target capture events;
[0016] calculating the wind speed measurement result based on the interval duration and the number of grids of the grating.
[0017] In some embodiments, the calculating of the wind speed measurement result based on the interval duration and the number of grids of the grating comprises:
[0018] calculating a rotation speed of the wind cup according to the interval duration and the number of grids of the grating;
[0019] determining the wind speed based on the rotation speed and a preset relationship between the rotation speed and the wind speed.
[0020] In some embodiments, before calculating the target count value of the pulse width between the two target capture events according to the difference value of the accumulated overflow times, the difference value of the counter values and the maximum count value between the two target capture events, the following step is further included:
[0021] When the at least one historical wind speed measurement result close to the current measurement time is greater than or equal to the preset wind speed, the first capture event and the last capture event of the photoelectric pulse signal in one period are taken as the two target capture events;
[0022] When the at least one historical wind speed measurement result close to the current measurement time is less than the preset wind speed, the capture events of the adjacent two same type edges (the capture events of the adjacent two rising edges or the adjacent two falling edges) of the photoelectric pulse signal are taken as the two target capture events.
[0023] In some embodiments, the number of wind speed measurement results obtained in one period of the photoelectric pulse signal is equal to the number of capture events in one period of the photoelectric pulse signal, and is equal to twice the number of grids.
[0024] In some embodiments, a calculation task period is set, and when each period of the wind speed calculation task arrives, it is determined whether a new pulse signal is generated; if yes, the actual rotation speed is calculated based on the timestamp of the newly generated pulse signal; if no, the current time and the latest timestamp of the pulse signal generated by the wind cup rotation are obtained, and the predicted rotation speed is calculated based on the time difference between the current time and the latest timestamp.
[0025] In a second aspect, the present application further provides a wind speed measurement device, which comprises:
[0026] A pulse capture module is configured to capture the pulse edges of the photoelectric pulse signal by using a timer with a preset clock frequency, and record the counter value of the current timer when the capture event occurs;
[0027] An overflow recording module is configured to trigger an overflow event and accumulate the overflow times when the counter value reaches the maximum count value, and record the accumulated overflow times when the capture event occurs;
[0028] A count calculation module is configured to calculate the target count value of the pulse width between the two target capture events according to the difference value of the accumulated overflow times, the difference value of the counter values and the maximum count value between the two target capture events;
[0029] A wind speed determination module is configured to calculate the wind speed measurement result according to the target count value, the preset clock frequency and the number of grids.
[0030] In a third aspect, the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the wind speed measurement method of the first aspect when executing the computer program.
[0031] In a fourth aspect, the present application provides a computer readable storage medium, and the computer readable storage medium stores a computer program, and the computer program is executable on a processor to implement the wind speed measurement method of the first aspect.
[0032] The wind speed measurement method provided by the present application has the beneficial effects that: the wind speed measurement method is used for measuring wind speed by using a wind speed measurement device, the wind speed measurement device comprises a rotatable wind cup, a grid synchronously rotating with the wind cup, and a photoelectric sensor generating a photoelectric pulse signal through the grid, the wind speed measurement method comprises: first, using a timer with a preset clock frequency to capture the pulse edges of the photoelectric pulse signal in time, and recording the counter value of the current timer when the capture event occurs; then, when the counter value reaches a maximum count value, triggering an overflow event and accumulating the number of overflows, and recording the accumulated number of overflows when the capture event occurs; subsequently, according to the difference between the accumulated number of overflows, the difference between the counter values, and the maximum count value between two target capture events, the target count value of the pulse width between the two target capture events is calculated; finally, according to the target count value, the preset clock frequency, and the number of grids of the grid, the wind speed measurement result is calculated. Since the clock frequency of the timer directly affects the accuracy and the wind speed measurement range of the wind speed measurement result, the higher the clock frequency, the more accurate the wind speed measurement result, and the wider the wind speed measurement range, therefore, increasing the clock frequency can improve the accuracy of the wind speed measurement, but increasing the clock frequency will also increase the count number of the timer, and the count number is affected by the performance of the timer, and the count number of the timer has an upper limit, therefore, increasing the clock frequency of the timer is constrained by the count number, and the scheme in the present application introduces the number of overflows, which can trigger an overflow event when the count number reaches the upper limit, and then continue counting, which is equivalent to removing the upper limit of the count number of the timer, and thus the clock frequency of the timer can be further increased, thereby increasing the accuracy of the wind speed measurement and the wind speed measurement range.
[0033] The above description is only a summary of the technical scheme of the present application, in order to more clearly understand the technical means of the present application, and to implement the content of the specification, the following will be described in detail with the preferred embodiments of the present application and with the aid of the accompanying drawings. BRIEF DESCRIPTION OF DRAWINGS
[0034] Figure 1 FIG. 1 is a structural schematic diagram of a rotary anemometer according to an embodiment of the present application;
[0035] Figure 2 FIG. 3 is a schematic diagram of a light pulse signal according to an embodiment of the present application;
[0036] Figure 3 Another schematic diagram of a light pulse signal shown in an embodiment of the present application;
[0037] Figure 4 A schematic diagram of a wind speed range under natural conditions shown in an embodiment of the present application;
[0038] Figure 5 A flowchart of a wind speed measurement method shown in an embodiment of the present application;
[0039] Figure 6 A flowchart of a target capture event determination method shown in an embodiment of the present application;
[0040] Figure 7 A flowchart of another wind speed measurement method shown in an embodiment of the present application;
[0041] Figure 8 A structural schematic diagram of a wind speed measurement device shown in an embodiment of the present application;
[0042] Figure 9 A structural schematic diagram of another wind speed measurement device shown in an embodiment of the present application;
[0043] Figure 10 A structural schematic diagram of yet another wind speed measurement device shown in an embodiment of the present application;
[0044] Figure 11 An electronic device structure schematic diagram provided by an embodiment of the present application. DETAILED DESCRIPTION
[0045] The technical solutions of the present application will be described clearly and completely below with reference to the drawings. Obviously, the described embodiments are some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application. It should be noted that the description of "one embodiment", "embodiment", "example embodiment" and the like in the specification means that the described embodiment can include specific features, structures or characteristics, but not every embodiment must include these specific features, structures or characteristics. In addition, such expressions do not mean the same embodiment. Further, when a specific feature, structure or characteristic is described in combination with an embodiment, it is indicated that such a feature, structure or characteristic is combined with other embodiments within the knowledge of those skilled in the art, whether or not it is explicitly described.
[0046] Since the wind speed measurement method in this invention is based on a rotating anemometer, the rotating anemometer will be described first before describing the wind speed measurement method according to the embodiments.
[0047] Specifically, the wind speed measurement in this invention is based on a rotating anemometer (such as a rotating anemometer). Figure 1 Based on the above (as shown), the rotary anemometer includes a rotatable wind cup, a grid that rotates synchronously with the wind cup, and a photoelectric sensor that generates photoelectric pulse signals through the grid. When measuring wind speed, the wind causes the wind cup to rotate. Since the wind cup and grid are integrated, the rotation of the wind cup causes the grid to rotate. The photoelectric sensor is located inside the grid, and a light source is located outside the grid. The grid has gaps. When the grid blocks the light source, the photoelectric sensor generates a low-level light pulse signal because it does not receive the light source. When light passes through the gaps in the grid, the photoelectric sensor generates a high-level light pulse signal because it receives the light source (the light pulse signal is as shown). Figure 2 As shown in the figure, for each high-level pulse (or each low-level pulse) generated, the corresponding grid rotates 1 / 2N times (where N is the number of grids); for each rotation, a complete electrical pulse signal is generated in a number equal to twice the number of its gaps.
[0048] The duration of the pulse (the length of the high or low level) directly depends on the instantaneous rotation speed of the wind turbine. A faster wind speed results in a faster rotation of the grid and a narrower pulse; a slower wind speed results in a slower rotation of the grid and a wider pulse. The pulse width is typically measured by capturing the pulse edge using the input capture function of a microcontroller's timer. Most microcontrollers, such as the current mainstream ARM Cortex-M0, Cortex-M3, Cortex-M4, and DSP C28, have a 16-bit capture timer. Typically, when measuring pulse width, the timer counter operates according to the system clock frequency. The counter increments by one for each clock cycle.
[0049] The timer counter has a counting range of 0-65535 (max 16bit = 65535). When it reaches 65535, the count value returns to 0 after the next clock cycle and then starts incrementing again. When the timer capture channel pin detects a change in the edge of an external input, it captures the current counter value into a register, such as... Figure 3 C1, C2, C3, and C4 are the counter values when the edge of the capture pin changes. Figure 3It can be seen that the count value of the first high level pulse width is Cnt= (C2 - C1), the count value of the first low level pulse width is Cnt= (C3 - C2), and the count value of the second high level pulse width is Cnt= (C4 - C3). (C4 - C3) is a negative number, and when assigned to a 16-bit unsigned number Cnt, the lower 16 bits are truncated, which is still positive, such as 2-65535=-65533 (dec)=0xFFFF0003 (hex). After truncating the lower 16 bits, it is 3, and the result is still the difference between the count values of the two captures.
[0050] Generally, the grid space distribution is required to be uniform, and the number of high and low level pulses is required to be equal , and the rotation speed n of the wind cup calculated from any two edge captures is:
[0051] (1);
[0052] Wherein, Cnt is the count difference between adjacent two captures, fclk is the timer clock frequency, and N is the number of grids.
[0053] Under the standard wind speed of the wind tunnel, the relationship between the wind speed and the rotation speed is calibrated, which is usually a piecewise linear relationship.
[0054] (2);
[0055] In formula (2), y represents the wind speed, n represents the rotation speed of the wind cup, the lowest wind speed section is represented by , and the wind speed is 0 when the rotation speed of the wind cup is 0.
[0056] After obtaining the corresponding relationship formula of the wind speed and the rotation speed as shown in formula (2), the current wind speed can be obtained according to the rotation speed.
[0057] The wind speed range under natural conditions is as shown in Figure 4 . Under the standard wind speed of the wind tunnel, the corresponding relationship between the rotation speed and the wind speed is calibrated as formula (3), and the relationship between the smaller wind speed / the maximum wind speed and the rotation speed is shown in Table 1:
[0058] (3);
[0059]
[0060] Suppose that a certain wind cup anemometer is needed to measure the wind speed, and the rotation shaft grid is 16 grids (N=16). If the count method of the timer is used to measure the rotation speed, the clock frequency of the timer needs to be reasonably set. In order to measure the maximum rotation speed and the minimum rotation speed between the minimum count value 1 and the maximum count value 65536, the theoretical maximum value fclk_th1 and the theoretical minimum value fclk_th2 of the timer clock frequency are:
[0061] (4);
[0062] (5);
[0063] Therefore, the timer clock frequency is set to a value between [2016, 34952] and closest to the theoretical maximum value, such as: .
[0064] Based on the set timer clock frequency value, the theoretically measurable minimum and maximum rotation speeds are obtained as:
[0065] (6);
[0066] (7);
[0067] The theoretically measurable minimum rotation speed is 0.9375, which is less than the actual minimum rotation speed of 1 rpm; the theoretically measurable maximum rotation speed is 61440 rpm, which is greater than the actual maximum rotation speed of 3780 rpm, which proves that it is reasonable to set the timer clock frequency reference value to 32768 Hz. However, its rationality does not mean high accuracy and small error. When the wind speed is maximum, the rotation speed is maximum, and the rotation speed error is also maximum. The reasons are as follows:
[0068] Based on the set timer clock frequency value, the theoretical count value Cnt corresponding to the maximum rotation speed is obtained as:
[0069] (8);
[0070] When the wind speed does not reach the maximum rotation speed, the count value is certainly greater than 16.25, such as 17. When Cnt is 17, n=3614 rpm. Compared with Cnt=16, the count value difference of 1 rotation speed deviation is (3840-3614)=226 rpm, and the wind speed deviation (3840-3614)×0.0184=4.16 m / s.
[0071] In order to reduce the error, the timer clock frequency can be increased. The higher the timer clock frequency, the smaller the time represented by each count value, and the higher the corresponding time accuracy. However, if the timer clock frequency value fclk=32768 Hz is further increased, it is impossible to measure low wind speed within the range of the maximum count value 65536, which means that it is impossible to accurately measure at low wind speed.
[0072] Embodiment One
[0073] Aiming at the dilemma of timer clock frequency setting: if the measurement accuracy under high wind speed condition is to be improved, low wind speed cannot be effectively measured, thereby reducing the range; on the contrary, if the range of full wind speed is to be ensured, the frequency needs to be reduced, which will sacrifice the measurement accuracy under high wind speed. Therefore, the embodiment proposes a wind speed measurement method. As shown in Figure 5 the flowchart of a wind speed measurement method, the specific method comprises:
[0074] S101, using a timer with a preset clock frequency to capture the pulse edges of the photoelectric pulse signal in time and recording the counter value of the current timer when the capture event occurs.
[0075] The timer adopts the existing mainstream single-chip microcomputer, such as the capture timer of ARM Cortex-M0, Cortex-M3, Cortex-M4, and DspC28, which is 16bit.
[0076] Specifically, the calculation of the known wind speed is based on the time length corresponding to the high-level light pulse signal and the number of grids corresponding to the grid. Therefore, in order to calculate the wind speed, the time length corresponding to the light pulse signal needs to be determined. In order to obtain the time length corresponding to the light pulse signal, a timer with a preset clock frequency is used to capture the pulse edges of the photoelectric pulse signal in time, i.e. the rising and falling edges of the light pulse signal are captured in time, and the counter values corresponding to the rising and falling edges of the light pulse signal are obtained.
[0077] S102, when the counter value reaches the maximum count value, triggering the overflow event and accumulating the overflow times, and recording the accumulated overflow times when the capture event occurs.
[0078] Among them, the overflow event represents the event when the counter value of the timer reaches the maximum count value, for example, if the maximum count value of the timer is 2 16 , when the counter value of the timer reaches 2 16 , the overflow event is triggered, which can be recorded as one overflow event at this time, and the counter value of the timer is reset to 0 and starts counting again, when the counter value of the timer reaches 2 16 again, the overflow event is triggered again, which can be recorded as two overflow events, and so on.
[0079] When the counter value reaches the maximum count value, the overflow event is triggered, and when the capture event occurs, the overflow may have occurred many times. Therefore, in order to determine the count number when the capture event occurs, in addition to recording the counter value of the current timer, the accumulated overflow times also need to be recorded.
[0080] S103, calculate the target count value of the pulse width between the two target capture events according to the accumulated overflow count difference between the two target capture events, the counter value difference and the maximum count value.
[0081] Specifically, multiply the accumulated overflow count difference between the two target capture events by the maximum count value to obtain the overflow count value difference; add the overflow count value difference to the counter value difference to obtain the target count value.
[0082] For example, in order to calculate the target count value of the pulse width between the two target capture events, the count values corresponding to the two target capture events need to be determined, and then the count values corresponding to the two target capture events are subtracted, that is, the target count value of the pulse width between the two target capture events is obtained. The count value corresponding to the capture event is obtained by multiplying the maximum count value by the overflow count and adding the counter value, so the calculation formula of the target count value can refer to the following formula (9):
[0083] (9);
[0084] Wherein, Cnt is the target count value, A is the count value corresponding to the first target capture event, B is the count value corresponding to the second target capture event, Q is the maximum count value, Y1 is the overflow count corresponding to the first target capture event, Y2 is the overflow count corresponding to the second target capture event, J1 is the counter value corresponding to the first target capture event, J2 is the counter value corresponding to the second target capture event, (Y2-Y1) is the accumulated overflow count difference between the two target capture events, and J2-J1 is the counter value difference between the two target capture events.
[0085] For example, in the case of uniform grid distribution, the capture events of adjacent rising and falling edges contained in one high level or one low level are obtained as the two target capture events. As shown in Figure 3 , the rising edge corresponding to the counter value C1 is taken as the first target capture event, and the falling edge corresponding to the counter value C2 is taken as the second target capture event, which corresponds to one high level; or the falling edge corresponding to the counter value C2 is taken as the first target capture event, and the falling edge corresponding to the counter value C3 is taken as the second target capture event, which corresponds to one low level.
[0086] S104, calculate the wind speed measurement result according to the target count value, the preset clock frequency and the number of grids of the grid.
[0087] Specifically, divide the target count value by the preset clock frequency to obtain the interval duration between the two target capture events; based on the interval duration and the number of grids of the grid, the wind speed measurement result is calculated.
[0088] Optionally, the optional manner of calculating the wind speed measurement result can be: calculating the rotation speed of the wind cup according to the interval duration and the number of grids of the grid; determining the wind speed based on the rotation speed and a preset relationship between the rotation speed and the wind speed.
[0089] For example, the rotation speed of the wind cup can be calculated according to formula (1):
[0090] (1);
[0091] Wherein, n is the rotation speed of the wind cup, Cnt is the target count value, N is the number of grids, and fclk is the preset clock frequency.
[0092] The wind speed can be calculated according to formula (2) as follows:
[0093] (2);
[0094] Wherein, n is the rotation speed of the wind cup, y is the wind speed, and a and b are coefficients.
[0095] It should be noted that: the larger the preset clock frequency is set, the higher the measurement accuracy is, but the more the cumulative overflow times are. When the clock frequency is increased, the maximum count at low wind speed should be considered, so that the maximum count of one rotation is limited within 32 bits, so as to avoid excessive increase of the operation burden of the single-chip microcomputer. Specifically, (65536 x the difference between the overflow times + the current capture value - the previous capture value x 2N<2 32 .
[0096] The scheme in the application can trigger an overflow event when the count reaches the upper limit by introducing the overflow times, and then continue to count, which is equivalent to removing the upper limit of the count of the timer, and then the frequency of the timer can be further increased, so as to increase the wind speed measurement accuracy and ensure the full range of wind speed measurement.
[0097] It should be noted that in the conventional scheme, although the scheme without introducing overflow event can also realize the measurement of wind speed, in order to ensure that the maximum count value is not exceeded in the process of wind speed measurement, it is necessary to set a lower frequency, but the lower frequency will cause the timer count to not accurately fall on the rising edge or falling edge of the optical pulse signal, resulting in a large error of the wind speed measurement result. In order to increase the accuracy of the wind speed measurement result, it is necessary to increase the frequency of the timer, but increasing the frequency of the timer is easy to reach the upper limit of the count, and when the wind speed is low, the count has reached the upper limit, but the grid has not rotated more than one grid, resulting in the inability to calculate the time required for the grid to rotate one grid, and thus the wind speed cannot be calculated. Therefore, the rotating anemometer in the prior art has limitations in both accuracy and wind speed measurement range. In order to break through the limitations of accuracy and wind speed measurement range, the inventors have made many attempts, such as trying to find the most suitable timer frequency, and then balancing the accuracy of wind speed measurement and the wind speed measurement range. However, such a balance is still limited, and the two are mutually balanced, and it is impossible to increase the wind speed measurement range while increasing the wind speed measurement accuracy. After many attempts, the inventors thought of increasing the overflow event to break the upper limit of the count number, so that the frequency of the timer can be increased without being affected by the upper limit of the count number, thereby increasing the wind speed measurement range while increasing the wind speed measurement accuracy. It is worth noting that the frequency of the timer should not be increased indefinitely, because when the frequency of the timer is positive infinity, the effect of wind speed measurement is the best, but this will cause the calculation to be too large. Therefore, in order to avoid this situation, the upper limit of the timer frequency can be appropriately set.
[0098] Embodiment two
[0099] The above embodiment one describes the specific process of obtaining wind speed, and is based on the premise that the grids are uniformly distributed. However, in actual operation, the width of each grid in the grid is not completely equal. Therefore, when calculating the wind speed based on each grid / slit, errors may occur. In order to avoid such errors, when determining the target capture event, it is necessary to avoid such errors as much as possible, such as Figure 6 As shown, the specific method includes:
[0100] S201, when at least one historical wind speed measurement result close to the current measurement time is greater than or equal to the preset wind speed, the first capture event and the last capture event of the optical pulse signal in one period are taken as the two target capture events.
[0101] When the wind speed is relatively stable and does not change drastically, the at least one historical wind speed measurement result close to the current measurement time can be the wind speed measurement result of the time adjacent to the current time. When the wind speed changes drastically, if the wind speed measurement result of the time adjacent to the current time is still taken as the at least one historical wind speed measurement result close to the current measurement time, the wind speed measurement can be inaccurate. Therefore, in this case, the at least one historical wind speed measurement result close to the current measurement time can also be the average of the wind speed measurement results of the two or more times adjacent to the current time.
[0102] Since the width of each grid and the width of the gap between the grids are affected by the machining precision of the grid, the widths of different grids can be different, and the widths of the gaps of different grids can also be different. In this case, when the wind speed is measured according to the photoelectric pulse signals corresponding to each grid, the result can be inaccurate. Therefore, it is necessary to eliminate the wind speed measurement error caused by the machining error of the grid.
[0103] Specifically, in order to ensure the timeliness of the wind speed update, the wind speed measurement result is usually updated once per second. When the at least one historical wind speed measurement result close to the current measurement time is greater than or equal to a preset wind speed (for example, 60 rpm), it indicates that the current wind speed is high, and the wind cup can rotate one or more times within one second. In this case, the first capture event and the last capture event of one period of the photoelectric pulse signal can be selected as the two target capture events. Since the first capture event and the last capture event of one period of the photoelectric pulse signal correspond to exactly one revolution of the grid, it is equivalent to selecting two capture events corresponding to one revolution of the grid as the two target capture events. Even if the width of each grid is not equal due to the machining error, the width of one revolution of the grid is constant. Therefore, the wind speed is measured according to the width of one revolution of the grid each time, which eliminates the influence of the change of the width of each grid on the wind speed measurement result, thereby increasing the accuracy of the wind speed measurement result.
[0104] For the wind cup anemometer with N grids of the rotating shaft, the count value of 2N pulses per revolution is as follows:
[0105] (10) ;
[0106] wherein Hn represents the count value corresponding to the nth high level, and Ln represents the count value corresponding to the nth low level.
[0107] Therefore, formula (1) can be rewritten as formula (11) as follows:
[0108] (11) ;
[0109] S202, when the at least one historical wind speed measurement result close to the current measurement moment is less than the preset wind speed, capture events of adjacent two same type edges of the photoelectric pulse signal (capture events of adjacent two rising edges or adjacent two falling edges) are taken as the two target capture events.
[0110] Specifically, when the at least one historical wind speed measurement result close to the current measurement moment is less than the preset wind speed, it indicates that the wind speed is low at this time, and the wind cup may not rotate a circle within one second. If the first capture event and the last capture event of one period of the photoelectric pulse signal are still taken as the two target capture events, the wind speed cannot be updated once per second. Therefore, the capture events of adjacent two same type edges of the photoelectric pulse signal (capture events of adjacent two rising edges or adjacent two falling edges) can be taken as the two target capture events, that is, the start of one high level and the end of one low level (such as C1 and C3 shown in Figure 3 ), or the start of one low level and the end of one high level (such as C2 and C4 shown in Figure 3 ), as the two target capture events. In this way, the two target capture events correspond to one high level and one low level in the photoelectric pulse signal, and one grid and one grid aperture in the grid. Although the width of one grid plus one grid aperture is still affected by the machining precision of the grid to some extent, compared with the method of calculating the wind speed by using only one grid or one grid aperture, the machining error of the grid is weakened to some extent, and the wind speed measurement accuracy is also improved to some extent.
[0111] For the wind cup anemometer with N-grid rotating shaft grid, the count value of one high level and one low level is as follows formula (12):
[0112] (12);
[0113] Wherein, Hn represents the count value corresponding to the nth high level, and Ln represents the count value corresponding to the nth low level.
[0114] Therefore, formula (1) can be rewritten as formula (13) as follows:
[0115] (13);
[0116] Optionally, the selection of the two target capture events can also be selected according to at least one historical wind speed measurement result close to the current measurement time, for example, when at least one historical wind speed measurement result close to the current measurement time is less than the preset wind speed but is close to the preset wind speed, the interval between the two target capture events is two capture events, the interval between the two target capture events is three capture events, etc., so that the number of grids and the number of grid gaps corresponding to the two target capture events are more, the weakening of the grid processing error is more, and the accuracy of the wind speed measurement is improved.
[0117] It should be emphasized that, in order to increase the timeliness of wind speed updating, the number of wind speed measurement results obtained in one period of the photoelectric pulse signal is equal to the number of capture events in one period of the photoelectric pulse signal, and is equal to twice the number of grids.
[0118] Specifically, since each grid corresponds to two capture events (i.e. rising edge and falling edge) in the photoelectric pulse signal, the number of capture events in one period of the photoelectric pulse signal is equal to twice the number of grids, and regardless of the selection of any target capture event selection method in S201 or S202, when the capture event at the current time is determined to be a target capture event, another target capture event can be found in the historical capture events, so the number of wind speed measurement results obtained in one period of the photoelectric pulse signal is equal to the number of capture events in one period of the photoelectric pulse signal. For example, when the number of grids is 16, then in one period of the photoelectric pulse signal, there are 32 capture events, for any capture event, when the capture event is a target capture event, another target capture event corresponding to it can be found in the historical capture events, and then two target capture events are used to determine a wind speed measurement result. The 32 capture events in one period correspond to 32 wind speed measurement results.
[0119] The target capture event determination method in the above embodiment realizes that when at least one historical wind speed measurement result close to the current measurement time is greater than or equal to the preset wind speed, the first capture event and the last capture event in one period of the photoelectric pulse signal are taken as the two target capture events; when at least one historical wind speed measurement result close to the current measurement time is less than the preset wind speed, the capture events of the adjacent two same type edges (the capture events of the adjacent two rising edges or the adjacent two falling edges) of the photoelectric pulse signal are taken as the two target capture events. That is, the target capture event is selected according to the wind speed, which eliminates the problem of inaccurate wind speed measurement results caused by uneven grid processing, and further improves the accuracy of the wind speed measurement results.
[0120] In order to more fully demonstrate the present scheme, the present embodiment gives an optional way of a wind speed measurement method, as shown in Figure 7
[0121] S301, time capture the pulse edge of the photoelectric pulse signal by using a timer with a preset clock frequency, and record the counter value of the current timer when the capture event occurs.
[0122] S302, when the counter value reaches the maximum count value, trigger the overflow event and accumulate the overflow times, and record the accumulated overflow times when the capture event occurs.
[0123] S303, when at least one historical wind speed measurement result close to the current measurement time is greater than or equal to the preset wind speed, the first capture event and the last capture event of a cycle of the photoelectric pulse signal are taken as the two target capture events.
[0124] S304, when at least one historical wind speed measurement result close to the current measurement time is less than the preset wind speed, the capture events of two adjacent edges of the same type of the photoelectric pulse signal (the capture events of two adjacent rising edges or two adjacent falling edges) are taken as the two target capture events.
[0125] S305, multiply the accumulated overflow times difference between the two target capture events by the maximum count value to obtain the overflow count value difference.
[0126] S306, add the overflow count value difference and the counter value difference to obtain the target count value.
[0127] S307, divide the target count value by the preset clock frequency to obtain the interval length between the two target capture events.
[0128] S308, calculate the rotation speed of the wind cup according to the interval length and the number of grids.
[0129] S309, determine the wind speed based on the rotation speed and the preset relationship between the rotation speed and the wind speed.
[0130] Wherein, the number of wind speed measurement results obtained in a cycle of the photoelectric pulse signal is equal to the number of capture events in a cycle of the photoelectric pulse signal, and is equal to twice the number of grids.
[0131] The specific process of S301-S309 can be referred to the description of the above method embodiments, which has similar implementation principles and technical effects, and will not be repeated here.
[0132] Embodiment three
[0133] When only relying on the pulse edge interval to calculate the wind speed, the system has a significant speed reduction response lag problem at low rotation speed. Specifically, when the wind cup suddenly stops from rotating, since no new pulse edge is captured and sent to the FIFO, the wind speed calculation unit still uses the last valid capture interval value, resulting in the output wind speed failing to reflect the actual speed drop in time. During the waiting timeout clearing period, the system will maintain the old value, resulting in a speed display "freezing" phenomenon.
[0134] To systematically improve the slow speed reduction response problem at low rotation speed, a calculation task period is set, which is responsible for the final calculation and update of the wind speed, and the passive measurement based on pulse interval in embodiments one and two is converted to active prediction based on time slice. When the calculation task period arrives, if no new pulse enters the FIFO, subtract the current calculation period time from the previous capture time, and if the difference is greater than the time difference of the previous two edge captures, calculate a predicted wind speed with this difference. Since no new pulse edge has been generated, the actual wind speed must be slower than the predicted wind speed, and the predicted wind speed can be used to produce a speed reduction display effect.
[0135] Optionally, a calculation task period T2 is set, and at the arrival of each wind speed calculation task period, it is judged whether a new pulse signal is generated. If so, the actual rotation speed is calculated based on the time stamp of the newly generated pulse signal; if not, the current time T_now and the latest time stamp T_last of the pulse signal generated by the wind cup rotation are obtained, and the predicted rotation speed is calculated based on the time difference between the current time and the latest time stamp.
[0136] It can be understood that the predicted rotation speed is an upper limit value of the actual rotation speed of the wind cup at the current time.
[0137] By changing the wind speed calculation from the event-triggered mode dependent on the pulse edge to the time-triggered mode based on the fixed period, the core problem of slow speed reduction response of the traditional rotating anemometer at low rotation speed is effectively solved. Instead of passively waiting for new pulses that may not be generated due to the wind cup stopping, the system actively performs prediction calculation using the "time difference between the current time and the previous capture time" at each calculation period. This time difference will continue to increase when the wind cup is reducing speed, thus driving the predicted wind speed value to continuously and smoothly decrease, completely eliminating the display value "freezing" or "stuttering" phenomenon caused by the lack of new pulses in the original method, and significantly improving the real-time performance, smoothness of the wind speed display and the overall response performance of the system at low speed.
[0138] Based on the same inventive concept, the application further provides a wind speed measuring device for implementing the wind speed measuring method described above. The implementation scheme of the device for solving the problem is similar to the implementation scheme described in the above method, so the specific limitations in one or more wind speed measuring device embodiments provided below can refer to the limitations of the wind speed measuring method described above, which will not be repeated here.
[0139] In one embodiment, as shown in Figure 8 a wind speed measuring device is provided, which comprises:
[0140] a pulse capture module 40, configured to capture the pulse edges of the photoelectric pulse signal by using a timer with a preset clock frequency, and record the counter value of the current timer when the capture event occurs;
[0141] an overflow recording module 41, configured to trigger an overflow event and accumulate the overflow times when the counter value reaches a maximum count value, and record the accumulated overflow times when the capture event occurs;
[0142] a count calculation module 42, configured to calculate the target count value of the pulse width between two target capture events according to the difference between the accumulated overflow times, the difference between the counter values and the maximum count value;
[0143] a wind speed determination module 43, configured to calculate the wind speed measurement result according to the target count value, the preset clock frequency and the number of grids of the grid.
[0144] In another embodiment, Figure 8 the wind speed measuring device in the above method is further configured to: when at least one historical wind speed measurement result close to the current measurement time is greater than or equal to a preset wind speed, take the first capture event and the last capture event of one period of the photoelectric pulse signal as the two target capture events; when at least one historical wind speed measurement result close to the current measurement time is less than the preset wind speed, take the capture events of adjacent two same type edges of the photoelectric pulse signal as the two target capture events, before calculating the target count value of the pulse width between the two target capture events according to the difference between the accumulated overflow times, the difference between the counter values and the maximum count value.
[0145] In another embodiment, as shown in Figure 9 , Figure 8 the count calculation module 42 in the above method comprises:
[0146] a difference calculation unit 420, configured to multiply the difference between the accumulated overflow times between the two target capture events by the maximum count value to obtain the difference between the overflow count values;
[0147] The counting calculation unit 421 is configured to add the overflow counting value difference and the counter value difference to obtain a target counting value.
[0148] In another embodiment, as shown in Figure 10 , Figure 8 The wind speed determination module 43 in the wind speed determination unit 40 comprises:
[0149] The interval calculation unit 430 is configured to divide the target counting value by a preset clock frequency to obtain an interval length between two target capture events.
[0150] The wind speed calculation unit 431 is configured to calculate a wind speed measurement result based on the interval length and the number of grids of the grid.
[0151] In another embodiment, Figure 10 The wind speed calculation unit 431 in the wind speed determination unit 40 is specifically configured to: calculate a rotation speed of the wind cup according to the interval length and the number of grids of the grid; and determine the wind speed based on the rotation speed and a preset relationship between the rotation speed and the wind speed.
[0152] In another embodiment, the number of wind speed measurement results obtained in one cycle of the photoelectric pulse signal is equal to the number of capture events in one cycle of the photoelectric pulse signal, and is equal to twice the number of grids.
[0153] Embodiments of the present application also provide an electronic device. In some embodiments, referring to Figure 11 , the electronic device 700 comprises an input unit 710, a memory 720, a processor 730 and an output unit 740. The memory 720 stores program instructions executable on the processor 730, and the processor 730 invokes the program instructions to execute the wind speed measurement method and / or technical solutions in the foregoing embodiments. The electronic device 700 can be a mobile terminal device such as a mobile phone or a computer.
[0154] In addition, embodiments of the present application also provide a computer readable storage medium for storing a computer program for executing a wind speed measurement method. For example, computer program instructions, when executed by a computer, can invoke or provide the method and / or technical solutions according to the present application through the operation of the computer. The program instructions for invoking the method of the present application can be stored in a fixed or removable storage medium, and / or transmitted and / or stored in a storage medium according to the program instructions.
[0155] Obviously, those skilled in the art should understand that the modules or steps of the present application described above can be realized by universal computing devices, and can be centralized on a single computing device or distributed on a network composed of multiple computing devices. Alternatively, they can be realized by program codes executable by the computing devices, so that they can be stored in storage devices and executed by the computing devices, or they can be respectively manufactured into individual integrated circuit modules, or multiple modules or steps among them can be manufactured into a single integrated circuit module. Therefore, the present application is not limited to any specific combination of hardware and software.
[0156] The technical features of the above embodiments can be integrated in any manner. In order to make the description simple, all possible integrations of the technical features in the above embodiments are not described, however, as long as the integration of the technical features does not exist contradictions, it should be considered as the scope of the present application.
[0157] The above embodiments only express several implementation manners of the present application, and the description is relatively specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be pointed out that for those skilled in the art, some modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the appended claims.
Claims
1. A method of measuring wind speed, characterized by, A wind speed measurement method for measuring wind speed by using a wind speed measurement device, the wind speed measurement device comprising a rotatable wind cup, a grid rotating synchronously with the wind cup, and a photoelectric sensor generating a photoelectric pulse signal through the grid, the wind speed measurement method comprising: time capturing pulse edges of the photoelectric pulse signal by using a timer with a preset clock frequency, and recording a counter value of the current timer when a capture event occurs; triggering an overflow event and accumulating an overflow number when the counter value reaches a maximum count value, and recording the accumulated overflow number when the capture event occurs; when at least one historical wind speed measurement result close to a current measurement time is greater than or equal to a preset wind speed, taking a first capture event and a last capture event of a cycle of the photoelectric pulse signal as two target capture events; when at least one historical wind speed measurement result close to a current measurement time is less than the preset wind speed, taking capture events of adjacent two same type edges of the photoelectric pulse signal as the two target capture events; calculating a target count value of a pulse width between the two target capture events according to a difference value of the accumulated overflow number, a difference value of the counter value, and the maximum count value; calculating a wind speed measurement result according to the target count value, the preset clock frequency, and a grid number of the grid; setting a calculation task period, and judging whether a new pulse signal is generated when each period of the wind speed calculation task arrives; if yes, calculating a measured rotating speed based on a time stamp of the newly generated pulse signal; if no, obtaining a current time and a latest time stamp of a pulse signal generated by the rotation of the wind cup, and calculating a predicted rotating speed based on a time difference between the current time and the latest time stamp.
2. The wind speed measurement method of claim 1, wherein, The calculating a target count value of a pulse width between the two target capture events according to a difference value of the accumulated overflow number, a difference value of the counter value, and the maximum count value comprises the following steps: multiplying the difference value of the accumulated overflow number between the two target capture events by the maximum count value to obtain a difference value of an overflow count value; adding the difference value of the overflow count value to the difference value of the counter value to obtain the target count value.
3. The wind speed measurement method of claim 1, wherein, The calculating a wind speed measurement result according to the target count value, the preset clock frequency, and the grid number of the grid comprises the following steps: dividing the target count value by the preset clock frequency to obtain an interval length between the two target capture events; calculating a wind speed measurement result based on the interval length and the grid number of the grid.
4. The wind speed measurement method of claim 3, wherein, The calculating a wind speed measurement result based on the interval length and the grid number of the grid comprises the following steps: calculating a rotating speed of the wind cup according to the interval length and the grid number of the grid; determining a wind speed based on the rotating speed and a preset relationship between the rotating speed and the wind speed.
5. The wind speed measurement method according to any one of claims 1 to 4, characterized in that, The number of wind speed measurement results obtained in a cycle of the photoelectric pulse signal is equal to the number of capture events in a cycle of the photoelectric pulse signal, and is equal to twice the number of grids.
6. A wind speed measuring device, characterized in that The device comprises: The pulse capture module is configured to capture the pulse edges of the photoelectric pulse signal by using a timer with a preset clock frequency, and record a counter value of the timer at a time when a capture event occurs; The overflow recording module is configured to trigger an overflow event and accumulate an overflow number when the counter value reaches a maximum count value, and record the accumulated overflow number at the time when the capture event occurs; When at least one historical wind speed measurement result close to a current measurement time is greater than or equal to a preset wind speed, a first capture event and a last capture event of a cycle of the photoelectric pulse signal are taken as two target capture events; When at least one historical wind speed measurement result close to a current measurement time is less than the preset wind speed, capture events of adjacent two same type edges of the photoelectric pulse signal are taken as the two target capture events; The count calculation module is configured to calculate a target count value of a pulse width between the two target capture events according to a difference value of the accumulated overflow number, a difference value of the counter value and the maximum count value between the two target capture events; The wind speed determination module is configured to calculate a wind speed measurement result according to the target count value, the preset clock frequency and a grid number of a grid. A calculation task period is set, and when each period of the wind speed calculation task arrives, it is determined whether a new pulse signal is generated. If yes, a measured rotating speed is calculated based on a time stamp of the new generated pulse signal. If no, a current time and a latest time stamp of the pulse signal generated by the rotation of the wind cup are obtained, and a predicted rotating speed is calculated based on a time difference between the current time and the latest time stamp.
7. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the wind speed measurement method in any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores the computer program, and the computer program is executed by the processor to implement the wind speed measurement method in any one of claims 1 to 5.
Citation Information
Patent Citations
Counting circuit of performance monitoring unit
CN110350911A
Starting wind speed calibration method and device based on frequency timing
CN113125804A