Grid frequency calculation method, device, electronic device and readable storage medium
By performing spectrum shifting and low-pass filtering on the grid voltage sampling value, the grid frequency is calculated in real time, which solves the problems of non-real-time and low accuracy in grid frequency calculation in the existing technology, and achieves fast update and high-precision grid frequency measurement. .
Patent Information
- Application Number
- CN202410791185.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-06-19
AI Technical Summary
In the existing technology, the power grid frequency calculation method needs to wait for a sufficient data window, which cannot meet the real-time requirements, and consumes a lot of computing resources, resulting in spectrum leakage and low accuracy.
By obtaining the voltage sampling value, performing spectrum shifting and low-pass filtering processing, calculating the complex phase angle value, and combining the phase angle values at adjacent sampling moments, the grid frequency is calculated in real time, achieving fast update and high-precision grid frequency measurement.
Real-time calculation of power grid frequency is realized, reducing the amount of calculation and time, avoiding spectrum leakage, and improving the accuracy of power grid frequency calculation and the reliability and stability of the system.
Smart Images

Figure CN118362779B
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of power grid frequency calculation, and in particular to a method, device, electronic device and readable storage medium for calculating power grid frequency. Background Art
[0002] In the power system, the grid frequency is one of the important indicator parameters to determine whether the power system is faulty. Accurate and timely calculation of the grid frequency is very important for the power system.
[0003] In the related art, the method for calculating the grid frequency is usually to convert the grid voltage from a time domain signal into a corresponding frequency domain signal, and use a data window of several cycles to calculate the grid frequency. However, this calculation method requires waiting for enough data windows to obtain enough periodic information, which cannot meet the real-time requirements of the grid frequency, and requires a lot of computing resources and time, increasing the calculation complexity of the system. In addition, if the selected window function length is not appropriate, it will also cause spectrum leakage problems, which will ultimately affect the accuracy of the grid frequency calculation. Summary of the invention
[0004] In view of this, the present application provides a method, device, electronic device and readable storage medium for calculating the power grid frequency. The main purpose is to solve the technical problems that the calculation method of the related technology uses several cycle data windows to calculate the power grid frequency, which requires waiting for enough data windows to obtain sufficient periodic information, cannot meet the real-time requirements of the power grid frequency, requires a large amount of computing resources and time, and has poor accuracy in power grid frequency calculation.
[0005] According to a first aspect of the present application, a method for calculating a power grid frequency is provided, the method comprising:
[0006] Obtaining a voltage sampling value of a target AC voltage at a sampling time;
[0007] According to a preset moving frequency value and a preset moving direction, a spectrum shifting process is performed on the voltage sampling value to generate a complex number of the voltage sampling value after the spectrum shifting;
[0008] Perform low-pass filtering on the complex number to generate a target complex number;
[0009] Get the first phase angle value of the target complex number;
[0010] Obtain the second phase angle value of the previous sampling moment adjacent to the sampling moment;
[0011] The grid frequency value of the target AC voltage at the sampling moment is determined according to the first phase angle value, the second phase angle value, the preset sampling frequency value and the grid nominal reference frequency value.
[0012] Optionally, the step of obtaining a voltage sampling value of a target AC voltage at a sampling time specifically includes:
[0013] Obtaining the preset sampling frequency value and the grid nominal reference frequency value;
[0014] Determine the number of sampling points according to the preset sampling frequency value and the nominal reference frequency value of the power grid;
[0015] Determine the sampling time according to the number of sampling points and the preset sampling frequency value;
[0016] Obtaining the analog signal value of the target AC voltage at the sampling time;
[0017] The analog signal value is digitally converted to obtain a voltage sampling value after digital conversion.
[0018] Optionally, the step of performing spectrum shifting processing on the voltage sampling value according to a preset shifting frequency value and a preset shifting direction to generate a complex number of the voltage sampling value after spectrum shifting specifically includes:
[0019] According to the number of sampling points, determine the length of the rotation factor sequence;
[0020] Determine the phase angle step of the rotation factor according to the signal cycle length and the number of sampling points;
[0021] Generate a discrete sequence of rotation factors according to the length of the rotation factor sequence and the phase angle step of the rotation factor;
[0022] The voltage samples are multiplied by the discrete sequence of rotation factors to obtain a complex number.
[0023] Optionally, the step of performing low-pass filtering on the complex number to generate a target complex number specifically includes:
[0024] Perform low-pass filtering on the real part of the complex number to obtain the target real part;
[0025] Perform low-pass filtering on the imaginary part of the complex number to obtain the target imaginary part;
[0026] Generates a target complex number based on the target real part and the target imaginary part.
[0027] Optionally, the step of obtaining a first phase angle value of a target complex number specifically includes:
[0028] The target imaginary part is divided by the target real part and then an inverse tangent calculation is performed to obtain the first phase angle value of the target complex number.
[0029] Optionally, the step of determining the grid frequency value of the target AC voltage at the sampling moment according to the first phase angle value, the second phase angle value, the preset sampling frequency value and the nominal reference frequency value of the grid specifically includes:
[0030] The phase difference between two adjacent sampling moments is obtained by subtracting the second phase angle value at the previous sampling moment from the first phase angle value at the sampling moment;
[0031] Divide the phase difference by the signal cycle length to get the phase angle change rate;
[0032] The relative frequency value at the sampling moment is obtained by multiplying the phase angle change rate by the preset sampling frequency value;
[0033] The grid frequency value at the sampling time is obtained by adding the relative frequency value to the grid nominal reference frequency value.
[0034] Optionally, after obtaining the phase difference between two adjacent sampling moments by subtracting the second phase angle value at the previous sampling moment from the first phase angle value at the sampling moment, the method further includes:
[0035] Compare the phase difference to the signal cycle length;
[0036] If the phase difference is greater than the signal cycle length, subtract the signal cycle length from the phase difference to obtain a new phase difference.
[0037] According to a second aspect of the present application, a device for calculating a power grid frequency is provided, the device comprising:
[0038] A first acquisition module, used to acquire a voltage sampling value of a target AC voltage at a sampling time;
[0039] A first generating module, configured to perform spectrum shifting processing on the voltage sampling value according to a preset shifting frequency value and a preset shifting direction, and generate a complex number of the voltage sampling value after the spectrum shifting;
[0040] A second generating module is used for performing low-pass filtering on the complex number to generate a target complex number;
[0041] A second acquisition module, used to acquire a first phase angle value of a target complex number;
[0042] A third acquisition module is used to acquire a second phase angle value at a previous sampling moment adjacent to the sampling moment;
[0043] The determination module is used to determine the grid frequency value of the target AC voltage at the sampling moment according to the first phase angle value, the second phase angle value, the preset sampling frequency value and the grid nominal reference frequency value.
[0044] According to a third aspect of the present application, an electronic device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the methods described in the first aspect when executing the computer program.
[0045] According to a fourth aspect of the present application, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the methods in the first aspect are implemented.
[0046] By means of the above technical solution, the present application provides a method, device, electronic device and readable storage medium for calculating the power grid frequency. Specifically, the collected voltage signal is subjected to spectrum shifting, and the complex number of the voltage signal after spectrum shifting is subjected to low-pass filtering to obtain the processed target complex number, and the first phase angle value of the target complex number is calculated. Thereafter, the relative frequency value between two adjacent sampling moments is calculated using the first phase angle value at the real-time sampling moment and the second phase angle value at the previous sampling moment, thereby obtaining the power grid frequency value of the target AC voltage. Compared with the calculation method of the related art that uses Fourier transform to calculate the entire sequence data to obtain the grid frequency value, the present application can calculate the phase angle value at the current sampling moment in real time based on the voltage sampling value at a single sampling moment, and perform difference calculation with the phase angle value at the previous sampling moment to obtain the relative frequency value, and then obtain the actual grid frequency value, thereby realizing real-time updating of the grid frequency value at the sampling frequency rate, which helps power system operators to timely understand the real-time changes of the grid frequency, improve the reliability and stability of the grid, greatly reduce the amount of calculation, shorten the calculation time, and avoid spectrum leakage caused by inappropriate selection of window function, effectively improving the accuracy of grid frequency calculation results.
[0047] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0049] Figure 1 A schematic diagram of a method for calculating a power grid frequency provided in an embodiment of the present application is shown;
[0050] Figure 2 A schematic diagram of another method for calculating power grid frequency provided in an embodiment of the present application is shown;
[0051] Figure 3 A schematic diagram of a flow chart of another method for calculating the power grid frequency provided in an embodiment of the present application is shown;
[0052] Figure 4 A schematic diagram showing a comparison before and after the frequency shifting process of the voltage sampling value provided in the embodiment of the present application is shown;
[0053] Figure 5 A schematic diagram showing the effect of low-pass filtering a complex number according to an embodiment of the present application;
[0054] Figure 6 A schematic diagram of the structure of a power grid frequency calculation device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0055] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0056] The present application embodiment provides a method for calculating the power grid frequency, such as Figure 1 As shown, the method includes:
[0057] S101. Obtain a voltage sampling value of a target AC voltage at a sampling time.
[0058] The grid frequency calculation method provided in the embodiment of the present application is mainly used in the calculation scenario of the grid frequency of the target AC voltage of one phase in the power system. The execution subject of the embodiment of the present application is a device or equipment capable of calculating the grid frequency, which can be specifically set on the server side. The server calculates the grid frequency value of the target AC voltage in the power system in real time at the sampling frequency.
[0059] Specifically, the target AC voltage is the AC voltage of any phase randomly selected in the power system. Based on the preset sampling frequency, the specific sampling time of each sampling point is determined. For any sampling time, the target AC voltage at the sampling time is sampled discretized to obtain the voltage sampling value of the target AC voltage.
[0060] S102 , performing spectrum shifting processing on the voltage sampling value according to a preset shifting frequency value and a preset shifting direction, and generating a complex number of the voltage sampling value after the spectrum shifting.
[0061] In this step, when the grid frequency is around 50Hz, there may be some interference and noise, making it difficult to extract the fundamental wave component of the grid, thereby affecting the accuracy of the collected signal frequency. Therefore, the present application proposes to translate the position of the spectrum graph of the voltage sampling value on the frequency axis according to a preset moving direction and a preset moving frequency value, so as to move the fundamental frequency component of the voltage sampling value to a new frequency position (0Hz position), and then obtain a complex number after the spectrum is moved, which contains the frequency characteristics and phase characteristics of the signal after the move.
[0062] Optionally, the preset moving frequency value can be the power frequency of the power grid (50Hz), and the preset moving direction is the moving direction towards 0Hz. In actual application scenarios, the spectrum of the power grid AC voltage is moved to the left by a power frequency of the power grid in the frequency domain to move the baseband component of the power grid to the 0Hz position, simplifying the complexity of spectrum analysis, and thus better understanding the frequency domain characteristics and spectrum distribution of the signal, facilitating spectrum analysis, signal processing and filtering operations, making the study of the spectrum characteristics of the voltage signal more effective and convenient.
[0063] By using the above method, the spectrum of the power grid signal is shifted to low frequency, that is, the 50 Hz fundamental wave is moved to 0 Hz, so that the original fundamental wave component at 50 Hz corresponds to the DC component of the spectrum, which is convenient for extraction and analysis.
[0064] S103: Perform low-pass filtering on the complex number to generate a target complex number.
[0065] In this step, the voltage sampling value is a complex number after the spectrum shifting process. After the spectrum shifting process, the AC voltage fundamental frequency component and each harmonic component are moved by a fixed frequency value. In order to filter out other frequency components and extract its fundamental frequency (DC) component, a high-order low-pass filter with high attenuation capability is used to perform low-pass filtering on the complex number to remove high-frequency noise or other harmonic interference, retain low-frequency signal components, and make the signal smoother and more stable.
[0066] S104. Obtain a first phase angle value of a target complex number.
[0067] In this step, the real signal and imaginary signal in the target complex number obtained by filtering are subjected to inverse trigonometric function calculation to obtain the first phase angle value after the voltage spectrum is shifted. This is to extract phase information from the filtered data, which helps to determine the phase characteristics of the signal in the frequency domain, and then analyze the spectrum characteristics and frequency domain behavior of the signal.
[0068] S105: Obtain a second phase angle value at a previous sampling moment adjacent to the sampling moment.
[0069] S106. Determine a grid frequency value of the target AC voltage at the sampling time according to the first phase angle value, the second phase angle value, the preset sampling frequency value, and the grid nominal reference frequency value.
[0070] In steps S105 and S106, the grid frequency value is an important indicator of the stability of the power system operation. Real-time monitoring of the grid frequency helps to promptly detect abnormal frequency changes and ensure the stable operation of the power system. In order to meet the real-time requirements of grid frequency calculation, the present application proposes to obtain the second phase angle value of the complex at the previous sampling moment, and use the first phase angle value and the second phase angle value to calculate the phase angle change rate between two adjacent sampling moments. Then, the relative frequency value at the sampling moment is calculated using the phase angle change rate and the preset sampling frequency value, and finally the relative frequency value is added to the grid nominal reference frequency value to obtain the actual grid frequency of the target AC voltage at the sampling moment.
[0071] The calculation method of the power grid frequency provided in the embodiment of the present application performs spectrum shifting on the collected voltage signal, and performs low-pass filtering on the complex number of the voltage signal after the spectrum shifting, obtains the processed target complex number, and calculates the first phase angle value of the target complex number. Thereafter, the relative frequency value between two adjacent sampling moments is calculated using the first phase angle value at the real-time sampling moment and the second phase angle value at the previous sampling moment, thereby obtaining the power grid frequency value of the target AC voltage. Compared with the calculation method of using Fourier transform to calculate the entire sequence data to obtain the power grid frequency value in the related art, the present application can calculate the phase angle value at the current sampling moment in real time according to the voltage sampling value at a single sampling moment, and calculate the relative frequency value by difference calculation in combination with the phase angle value at the previous sampling moment, thereby obtaining the actual power grid frequency value, and realizing the real-time update of the power grid frequency value at the speed of the sampling frequency, which helps the power system operator to timely understand the real-time changes of the power grid frequency, improve the reliability and stability of the power grid, greatly reduce the amount of calculation, shorten the calculation time, and avoid the spectrum leakage caused by the inappropriate window function selected, and effectively improve the accuracy of the power grid frequency calculation result.
[0072] Further, as a refinement and extension of the specific implementation of the above embodiment, in order to fully illustrate the specific implementation process of this embodiment, the embodiment of this application provides another method for calculating the grid frequency, such as Figure 2 As shown, the method includes:
[0073] S201. Obtain a preset sampling frequency value and a grid nominal reference frequency value.
[0074] S202: Determine the number of sampling points according to a preset sampling frequency value and a nominal reference frequency value of the power grid.
[0075] S203: Determine the sampling time according to the number of sampling points and the preset sampling frequency value.
[0076] In steps S201 to S203, the preset sampling frequency value and the nominal reference frequency value of the power grid are obtained, and the preset sampling frequency value is divided by the nominal reference frequency value of the power grid to obtain the number of sampling points in one power grid cycle. Further, the sampling cycle, that is, the time interval between two adjacent sampling points, is obtained by dividing 1 by the preset sampling frequency, and then the specific sampling time corresponding to each sampling point is calculated by accumulating the time interval of each sampling cycle.
[0077] Optionally, there are multiple sampling moments, and the voltage sampling values of the target AC voltage are collected in real time in the order of the multiple sampling moments to calculate the grid frequency value at the sampling moment, so as to output the grid frequency value in real time at the speed of the sampling frequency.
[0078] Through the above method, the preset sampling frequency value and the nominal reference frequency value of the power grid are used to determine the number of sampling points, and then determine the sampling time of each sampling point, ensuring that the signal is accurately sampled within the specified time range to meet the requirements of sampling accuracy and real-time performance.
[0079] In the actual application scenario, the target AC voltage of one phase of the power grid is continuously sampled at a fixed preset sampling frequency value, the preset sampling frequency value is 10kHz, and the nominal reference frequency value of the power grid is 50Hz. The preset sampling frequency value is divided by the nominal reference frequency value of the power grid to determine the number of sampling points in one power grid cycle as 200. Thereafter, the sampling time of each sampling point is determined in turn using the preset sampling frequency value.
[0080] S204: Obtain an analog signal value of the target AC voltage at the sampling time.
[0081] S205 , performing digital conversion processing on the analog signal value to obtain a voltage sampling value after digital conversion.
[0082] In steps S204 and S205, the analog signal value of the target AC voltage is sampled at the sampling time, and the sampled analog signal value is converted into a discrete digital signal (ie, voltage sampling value) by analog-to-digital conversion (ie, A / D conversion).
[0083] S206: Determine the length of the rotation factor sequence according to the number of sampling points.
[0084] S207: Determine the phase angle step of the rotation factor according to the signal cycle length and the number of sampling points.
[0085] S208: Generate a discrete sequence of rotation factors according to the length of the rotation factor sequence and the phase angle step of the rotation factor.
[0086] S209: Multiply the voltage sampling value by the discrete sequence of rotation factors to obtain a complex number.
[0087] In steps S206 to S209, it is necessary to calculate the length of the rotation factor sequence and the phase angle step of the rotation factor so that the signal can be correctly spectrally shifted. Specifically, the length of the rotation factor sequence is equal to the number of sampling points. The length of a signal cycle (i.e., 2π) is divided by the number of sampling points to obtain the phase angle step corresponding to each sampling point. Then, according to the length of the rotation factor sequence and the phase angle step of the rotation factor, the value of the discrete sequence of the rotation factor can be determined. Thereafter, the voltage sampling value is multiplied by the phase angle step of the rotation factor in the discrete sequence of the rotation factor to obtain a complex value.
[0088] In the actual application scenario, the preset sampling frequency is 10kHz, the rated frequency of the power grid is 50Hz, and the number of sampling points is calculated to be 200. Assume that the current sampling time is n, and the voltage sampling value is calculated as , n=1, 2, ..., 200; calculate the rotation factor and Discrete sequence, the length of the rotation factor sequence and the number of sampling points are consistent with 200, and the phase angle step of the rotation factor is 2π / 200=0.01 , the discrete sequence of rotation factors is expressed as: and , n=1, 2, ..., 200. Then, the voltage sampling value Respectively Multiply to get complex number , where the real part of the complex number is denoted by and the imaginary part .
[0089] S210 , performing low-pass filtering on the real part of the complex number to obtain a target real part.
[0090] S211. Perform low-pass filtering on the imaginary part of the complex number to obtain a target imaginary part.
[0091] S212. Generate a target complex number according to the target real part and the target imaginary part.
[0092] In steps S210 to S212, other subharmonics and sampling high-frequency noise or interference still exist after the spectrum is moved. In order to filter out these high-frequency components and improve the quality and reliability of the signal, the real part of the complex number, that is, the real part of the signal, is extracted, and the real signal is low-pass filtered to remove the high-frequency components and retain the low-frequency components. Then the imaginary part of the complex number, that is, the imaginary part of the signal, is extracted, and the imaginary signal is low-pass filtered to remove the high-frequency components and retain the low-frequency components. The target real part and the target imaginary part after low-pass filtering are resynthesized into a new target complex number.
[0093] Through the above method, a low-pass filter with high harmonic attenuation capability is used to perform low-pass filtering on the real and imaginary parts of the complex number respectively, thereby filtering out the harmonics and clutter interference attached to the power grid, retaining the effective information in the spectrum, improving the signal-to-noise ratio, making the signal clearer, and effectively improving the effect and performance of signal processing.
[0094] In actual application scenarios, the accuracy of the grid frequency value is directly related to the filter's ability to attenuate harmonics. Selecting a suitable filter can improve the detection accuracy of the grid frequency. The sliding average filter has the best filtering effect on periodic disturbance signals and is suitable for filtering out periodic interference such as grid harmonics, and has almost no effect on the grid fundamental wave. Therefore, the sliding average filter is used to filter the complex To improve the ability to attenuate grid harmonics, the sliding average filter's window length is selected to be a grid cycle (i.e., 200 data points). At this time, the sliding average filter has the strongest ability to suppress grid harmonics of integer multiple cycles, filtering grid harmonics and other interference. The real part of Perform filtering to obtain the real part of the target after the target , and for the imaginary part Perform filtering to obtain the target imaginary part after the target , and then get the filtered target complex number .
[0095] S213, performing an arc tangent calculation after dividing the target imaginary part by the target real part to obtain a first phase angle value of the target complex number.
[0096] In this step, an inverse tangent function is calculated for the target real part and the target imaginary part of the filtered target complex number, that is, the target imaginary part is divided by the target real part, and then an inverse tangent calculation is performed to calculate the first phase angle value of the target complex number.
[0097] In actual application scenarios, the inverse tangent function calculation formula is:
[0098] ;
[0099] Among them, the above is the first phase angle value of the target complex number at the nth sampling moment; is the target imaginary part of the target complex number at the nth sampling moment; is the target real part of the target complex number at the nth sampling moment. For the nth sampling moment, the target complex number obtained by filtering is of Divide by , and then perform the inverse tangent calculation to get the first phase angle value .
[0100] S214: Obtain a second phase angle value at a previous sampling moment adjacent to the sampling moment.
[0101] S215 , subtract the second phase angle value at the previous sampling moment from the first phase angle value at the sampling moment to obtain a phase difference between two adjacent sampling moments.
[0102] S216. Divide the phase difference by the signal cycle length to obtain the phase angle change rate.
[0103] S217: Multiply the phase angle change rate by the preset sampling frequency value to obtain the relative frequency value at the sampling moment.
[0104] S218. Add the relative frequency value to the nominal reference frequency value of the power grid to obtain the power grid frequency value at the sampling time.
[0105] In steps S214 to S218, after obtaining the first phase angle value after the voltage sampling value is shifted, the second phase angle value of the complex number of the previous sampling moment adjacent to the current sampling moment is obtained. The phase difference (i.e., the phase angle change) between two adjacent sampling moments is obtained by subtracting the second phase angle value of the previous sampling moment from the first phase angle value of the current sampling moment, and then the phase angle change rate, i.e., the rate of change of the phase over time, is obtained by using the ratio of the phase difference to the signal cycle length (2π). Thereafter, the phase angle change rate is multiplied by the preset sampling frequency to obtain the relative frequency value, which reflects the fluctuation of the frequency, while the nominal reference frequency value of the power grid provides a reference value of the frequency. By combining the two, an accurate and reliable power grid frequency value is obtained.
[0106] In actual application scenarios, the first phase angle value at the nth sampling moment and the second phase angle value at the n-1th sampling moment are used to calculate the relative frequency value of the power grid after frequency shifting. :
[0107] ;
[0108] Among them, the above ; above is the first phase angle value at the nth sampling moment; is the second phase angle value at the n-1th sampling moment; the above M is the preset sampling frequency value.
[0109] Furthermore, using the calculated relative frequency value Add the grid nominal reference frequency value f nom , get the final actual grid frequency value f grid .
[0110] In an embodiment of the present application, optionally, in order to improve the accuracy of the calculation of the grid frequency value, after obtaining the phase difference between two adjacent sampling moments by subtracting the second phase angle value at the previous sampling moment from the first phase angle value at the current sampling moment, it also includes: comparing the phase difference with the signal cycle length; if the phase difference is greater than the signal cycle length, subtracting the signal cycle length from the phase difference to obtain a new phase difference.
[0111] In this embodiment, when the phase difference exceeds the signal cycle length (2π), a phase jump occurs, that is, the phase value suddenly jumps from one value to another, resulting in the continuity and accuracy of the signal being affected. In order to solve the phase jump problem, if it is detected that the phase difference exceeds 2π, the phase difference is subtracted by 2π, so that the phase difference is kept between -π and π, that is, kept in a continuous interval.
[0112] In the above manner, for a phase difference exceeding 2π, the phase difference is subtracted from 2π to correct the phase difference, avoid sudden phase jumps, and ensure phase continuity and stability.
[0113] In actual application scenarios, judging the phase difference Does it exceed 2π? If so, subtract 2π from the phase difference to obtain a new corrected phase difference.
[0114] In one embodiment of the present application, optionally, Figure 3 As shown, the method for calculating the grid frequency in the embodiment of the present application includes the following six steps:
[0115] S301: sampling a target AC voltage according to a preset sampling frequency to obtain a voltage sampling value, and performing spectrum shifting processing on the voltage sampling value.
[0116] Specifically, in the power system, the AC voltage of any phase is sampled at a fixed period to obtain a real-time voltage sampling value.
[0117] S302: Perform spectrum shifting processing on the voltage sampling value, and multiply the voltage sampling value by the length of the rotation factor sequence and the phase angle step of the rotation factor respectively to obtain a complex number, wherein the complex number includes a real part and an imaginary part.
[0118] Specifically, the voltage sampling value is subjected to spectrum shifting processing, such as Figure 4 As shown in the figure, it is a schematic diagram of the comparison before and after the frequency shifting of the voltage sampling value. Figure 4 The grid fundamental frequency component in 4-1 ( ) is the spectrum of the 50Hz AC voltage shifted to the left by one power grid frequency (50Hz) ( In practical applications, considering that the grid frequency in the actual power system is not a constant 50Hz, but fluctuates within a small range centered at 50Hz, the spectrum shifting operation can move the grid base frequency component to Figure 4 The fundamental frequency component in 4-2 ( ) is near 0Hz. Based on the frequency shift property of Fourier transform, an AC signal f(t) multiplied by the rotation factor of angular frequency ω0 is equivalent to shifting the spectrum of the signal by ω0. Its Fourier transform is shown as follows:
[0119] ;
[0120] Among them, the above is the signal time domain function; the above F(j ) is the signal The spectral density function of is the rotation factor; is the signal frequency domain function.
[0121] After Fourier transformation, it is equal to Since the Fourier transform can be transformed in both directions, the left side of the arrow and the right side of the arrow are equivalent.
[0122] Based on Euler's formula: = ,use replace , so as to rewrite the above formula into the following formula:
[0123] ;
[0124] That is, the frequency of f(t) is After the carrier signal is modulated, the spectrum is shifted.
[0125] S303: performing low-pass filtering on the real part and the imaginary part of the complex number respectively to obtain a target real part and a target imaginary part; and using the target real part and the target imaginary part to form a target complex number.
[0126] Specifically, after the spectrum shifting operation, the AC voltage fundamental frequency component and each harmonic component are shifted by a fixed frequency value. In order to filter out other frequency components and extract its fundamental frequency component, a low-pass filter with high attenuation capability is used to perform low-pass filtering on the real and imaginary parts of the complex number after the spectrum shifting. Figure 5As shown in the figure, it is a schematic diagram of the effect of low-pass filtering the complex number. The curve in the figure represents the low-pass filter, the vertical line in the curve box is the retained fundamental frequency component, and the frequency components outside the curve box are filtered out by the low-pass filter. The real signal and the imaginary signal of the complex number are low-pass filtered respectively, so that only the fundamental frequency component of the power grid is retained, other frequency components are suppressed, and the calculation accuracy of the power grid frequency is improved.
[0127] S304: After dividing the target imaginary part of the target complex number by the target real part, an inverse tangent calculation is performed to obtain a first phase angle value of the target complex number.
[0128] S305: Calculate the relative frequency value of the power grid after the spectrum shift by using the first phase angle value corresponding to the voltage sampling value at the nth sampling moment and the second phase angle value corresponding to the voltage sampling value at the (n-1)th sampling moment.
[0129] S306: Add the relative frequency value to the nominal reference frequency value of the power grid to obtain the power grid frequency value.
[0130] Through the above method, compared with the grid frequency calculation method in the related art that needs to calculate the entire sequence data, the amount of calculation is greatly reduced. For real-time sampling of grid voltage, the current phase angle value can be calculated based on the voltage sampling value collected in real time, and the relative frequency value can be obtained by subtracting the phase angle at the last sampling moment, and then the actual grid frequency value can be obtained. The output grid frequency value can be updated in real time at the sampling frequency.
[0131] Further, as Figure 1 For the specific implementation of the method, the present application embodiment provides a power grid frequency calculation device 400, such as Figure 6 As shown, the device includes: a first acquisition module 401, a first generation module 402, a second generation module 403, a second acquisition module 404, a third acquisition module 405 and a determination module 406.
[0132] The first acquisition module 401 is used to acquire a voltage sampling value of a target AC voltage at a sampling time;
[0133] The first generating module 402 is used to perform spectrum shifting processing on the voltage sampling value according to a preset shifting frequency value and a preset shifting direction, and generate a complex number of the voltage sampling value after spectrum shifting;
[0134] The second generating module 403 is used to perform low-pass filtering on the complex number to generate a target complex number;
[0135] A second acquisition module 404 is used to acquire a first phase angle value of a target complex number;
[0136] The third acquisition module 405 is used to acquire the second phase angle value of the previous sampling moment adjacent to the sampling moment;
[0137] The determination module 406 is used to determine the grid frequency value of the target AC voltage at the sampling time according to the first phase angle value, the second phase angle value, the preset sampling frequency value and the grid nominal reference frequency value.
[0138] In a specific application scenario, the first acquisition module 401 is specifically used to:
[0139] Obtaining the preset sampling frequency value and the grid nominal reference frequency value;
[0140] Determine the number of sampling points according to the preset sampling frequency value and the nominal reference frequency value of the power grid;
[0141] Determine the sampling time according to the number of sampling points and the preset sampling frequency value;
[0142] Obtaining the analog signal value of the target AC voltage at the sampling time;
[0143] The analog signal value is digitally converted to obtain a voltage sampling value after digital conversion.
[0144] In a specific application scenario, the first generating module 402 is specifically used to:
[0145] According to the number of sampling points, determine the length of the rotation factor sequence;
[0146] Determine the phase angle step of the rotation factor according to the signal cycle length and the number of sampling points;
[0147] Generate a discrete sequence of rotation factors according to the length of the rotation factor sequence and the phase angle step of the rotation factor;
[0148] The voltage samples are multiplied by the discrete sequence of rotation factors to obtain a complex number.
[0149] In a specific application scenario, the second generation module 403 is specifically used to:
[0150] Perform low-pass filtering on the real part of the complex number to obtain the target real part;
[0151] Perform low-pass filtering on the imaginary part of the complex number to obtain the target imaginary part;
[0152] Generates a target complex number based on the target real part and the target imaginary part.
[0153] In a specific application scenario, the second acquisition module 404 is specifically used to:
[0154] The target imaginary part is divided by the target real part and then an inverse tangent calculation is performed to obtain the first phase angle value of the target complex number.
[0155] In a specific application scenario, the determination module 406 is specifically used to:
[0156] The phase difference between two adjacent sampling moments is obtained by subtracting the second phase angle value at the previous sampling moment from the first phase angle value at the sampling moment;
[0157] Divide the phase difference by the signal cycle length to get the phase angle change rate;
[0158] The relative frequency value at the sampling moment is obtained by multiplying the phase angle change rate by the preset sampling frequency value;
[0159] The grid frequency value at the sampling time is obtained by adding the relative frequency value to the grid nominal reference frequency value.
[0160] In specific application scenarios, such as Figure 6 As shown, the device further includes: a judgment module 407 and a third generation module 408.
[0161] A judgment module 407, used to compare the phase difference with the signal cycle length;
[0162] The third generating module 408 is used to obtain a new phase difference by subtracting the signal cycle length from the phase difference if the phase difference is greater than the signal cycle length.
[0163] The power grid frequency calculation device 400 provided in the embodiment of the present application performs spectrum shifting on the collected voltage signal, and performs low-pass filtering on the complex number of the voltage signal after the spectrum shifting, obtains the processed target complex number, and calculates the first phase angle value of the target complex number. Thereafter, the relative frequency value between two adjacent sampling moments is calculated using the first phase angle value at the real-time sampling moment and the second phase angle value at the previous sampling moment, thereby obtaining the power grid frequency value of the target AC voltage. Compared with the calculation method of using Fourier transform to calculate the entire sequence data to obtain the power grid frequency value in the related art, the present application can calculate the phase angle value at the current sampling moment in real time according to the voltage sampling value at a single sampling moment, and calculate the relative frequency value by difference calculation in combination with the phase angle value at the previous sampling moment, thereby obtaining the actual power grid frequency value, and realizes the real-time update of the power grid frequency value at the speed of the sampling frequency, which helps the power system operator to timely understand the real-time changes of the power grid frequency, improve the reliability and stability of the power grid, greatly reduce the amount of calculation, shorten the calculation time, and avoid the spectrum leakage caused by the inappropriate window function selected, and effectively improve the accuracy of the power grid frequency calculation result.
[0164] In an exemplary embodiment, the present application further provides an electronic device, including a memory and a processor. The memory stores a computer program, and the processor is used to execute the program stored in the memory and execute the method for calculating the grid frequency in the above embodiment.
[0165] In an exemplary embodiment, the present application further provides a readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method for calculating the grid frequency are implemented.
[0166] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by hardware, or by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile readable storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including a number of instructions for enabling an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0167] Those skilled in the art will appreciate that the accompanying drawings are merely schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily required for implementing the present application.
[0168] Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices in the implementation scenario according to the implementation scenario description, or can be changed accordingly and located in one or more devices different from the implementation scenario. The modules in the above implementation scenario can be combined into one module, or can be further split into multiple units.
[0169] The above application serial numbers are for description only and do not represent the advantages or disadvantages of the implementation scenarios.
[0170] The above disclosure only discloses several specific implementation scenarios of the present application. However, the present application is not limited thereto, and any changes that can be conceived by technicians in this field should fall within the scope of protection of the present application.
Claims
1. A method for calculating power grid frequency, characterized in that: include: Obtaining a voltage sampling value of a target AC voltage at a sampling time; According to a preset moving frequency value and a preset moving direction, the voltage sampling value is subjected to spectrum shifting processing to generate a complex number of the voltage sampling value after spectrum shifting; Performing low-pass filtering on the complex number to generate a target complex number; Acquire a first phase angle value of the target complex number; Obtain the second phase angle value of the previous sampling moment adjacent to the sampling moment; Determine the grid frequency value of the target AC voltage at the sampling moment according to the first phase angle value, the second phase angle value, a preset sampling frequency value and a grid nominal reference frequency value; The step of obtaining the voltage sampling value of the target AC voltage at the sampling time specifically includes: Obtaining the preset sampling frequency value and the grid nominal reference frequency value; Determining the number of sampling points according to the preset sampling frequency value and the nominal reference frequency value of the power grid; Determine the sampling time according to the number of sampling points and the preset sampling frequency value; Acquire an analog signal value of the target AC voltage at the sampling moment; Performing digital conversion processing on the analog signal value to obtain the voltage sampling value after digital conversion; The step of performing spectrum shifting processing on the voltage sampling value according to the preset shifting frequency value and the preset shifting direction to generate a complex number of the voltage sampling value after spectrum shifting specifically includes: Determine the length of the rotation factor sequence according to the number of sampling points; Determine the phase angle step of the rotation factor according to the signal cycle length and the number of sampling points; Generate a discrete sequence of rotation factors according to the length of the rotation factor sequence and the phase angle step of the rotation factor; Multiplying the voltage sample value by the discrete sequence of the rotation factors to obtain a complex number; The step of determining the grid frequency value of the target AC voltage at the sampling moment according to the first phase angle value, the second phase angle value, the preset sampling frequency value and the grid nominal reference frequency value specifically includes: Subtracting the second phase angle value at the previous sampling moment from the first phase angle value at the sampling moment to obtain a phase difference between two adjacent sampling moments; Dividing the phase difference by the signal cycle length to obtain a phase angle change rate; Multiplying the phase angle change rate by the preset sampling frequency value to obtain a relative frequency value at the sampling moment; The relative frequency value is added to the nominal reference frequency value of the power grid to obtain the power grid frequency value at the sampling moment.
2. The method according to claim 1, characterized in that The step of performing low-pass filtering on the complex number to generate a target complex number specifically includes: Perform low-pass filtering on the real part of the complex number to obtain the target real part; Perform low-pass filtering on the imaginary part of the complex number to obtain the target imaginary part; The target complex number is generated according to the target real part and the target imaginary part.
3. The method according to claim 2, characterized in that The step of obtaining the first phase angle value of the target complex number specifically includes: The first phase angle value of the target complex number is obtained by dividing the target imaginary part by the target real part and performing an arc tangent calculation.
4. The method according to claim 1, characterized in that: After the phase difference between two adjacent sampling moments is obtained by subtracting the second phase angle value at the previous sampling moment from the first phase angle value at the sampling moment, the method further includes: comparing the phase difference with a signal cycle length; If the phase difference is greater than the signal cycle length, the signal cycle length is subtracted from the phase difference to obtain a new phase difference.
5. A device for calculating power grid frequency, characterized in that: The method for calculating the power grid frequency according to any one of claims 1 to 4 above, the device comprising: A first acquisition module, used to acquire a voltage sampling value of a target AC voltage at a sampling time; A first generating module, configured to perform spectrum shifting processing on the voltage sampling value according to a preset shifting frequency value and a preset shifting direction, and generate a complex number of the voltage sampling value after spectrum shifting; A second generating module, used for performing low-pass filtering on the complex number to generate a target complex number; A second acquisition module, used to acquire a first phase angle value of the target complex number; A third acquisition module is used to acquire a second phase angle value at a previous sampling moment adjacent to the sampling moment; A determination module is used to determine the grid frequency value of the target AC voltage at the sampling moment according to the first phase angle value, the second phase angle value, a preset sampling frequency value and a grid nominal reference frequency value.
6. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When a processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
7. A readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Channel selection system for a displaced spectrum frequency synthesizer
CA1041185A
Measuring method of alternating current voltage frequency
CN102495282A
Grid frequency measuring method and system for digital display meter
CN103913631A
Improved phase difference correction method taking regard of power grid frequency change rate
CN106970264A
Detection method, device and equipment for power grid voltage frequency
CN108627694A
