CN117147945A - Estimation method for effective value of embedded acquisition alternating current signal - Google Patents
Estimation method for effective value of embedded acquisition alternating current signal Download PDFInfo
- Publication number
- CN117147945A CN117147945A CN202310893468.7A CN202310893468A CN117147945A CN 117147945 A CN117147945 A CN 117147945A CN 202310893468 A CN202310893468 A CN 202310893468A CN 117147945 A CN117147945 A CN 117147945A
- Authority
- CN
- China
- Prior art keywords
- value
- alternating current
- effective value
- current signal
- signal
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 23
- 238000005070 sampling Methods 0.000 claims abstract description 6
- 238000004364 calculation method Methods 0.000 claims description 20
- 230000004044 response Effects 0.000 abstract description 3
- 230000006872 improvement Effects 0.000 description 4
- 238000012360 testing method Methods 0.000 description 4
- 125000004122 cyclic group Chemical group 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 238000012935 Averaging Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000005259 measurement Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01R—MEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
- G01R19/00—Arrangements for measuring currents or voltages or for indicating presence or sign thereof
- G01R19/02—Measuring effective values, i.e. root-mean-square values
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Measurement Of Current Or Voltage (AREA)
Abstract
The invention discloses an estimation method of an effective value of an embedded acquisition alternating current signal, which comprises the following steps: step one, obtaining an alternating current signal sampling square average value x; step two, if x=0, directly outputting an effective value y of the alternating current signal, wherein y=0; step three, if x is not equal to 0, searching for 2 i <=x, and 2 i+1 >I value where=x holds, i represents a power exponent of 2; step four, calculating a y value; and step five, outputting a y value. The invention greatly improves the running speed of the computer, saves the computing resource and improves the response speed of the computer under the condition of ensuring the accuracy of the effective value estimation value of the alternating current signal.
Description
Technical Field
The invention relates to the field of signal processing, in particular to an estimation method for an effective value of an embedded acquisition alternating current signal.
Background
The effective value of the alternating current is also called as a root mean square value, and the effective value of the alternating current is measured by that the alternating current passes through a certain resistor, the heat generated in a period is equal to the heat generated in the same time when the direct current passes through the resistor, and the magnitude of the direct current is the effective value of the alternating current. At present, the method mainly comprises the following steps:
1. the peak detection method measures the signal peak value with a peak detection circuit and divides by the crest factor (1.414) to obtain the signal effective value, but it is only suitable for sine waves.
2. The method of rectifying and averaging full-wave rectifies the measured signal, then uses an integrating circuit to find the average value of the signal, and multiplies the signal by a form factor (1.1107) to obtain the effective value of the signal, but it is only suitable for sine waves.
3. The true effective value method directly measures the square root value of the signal and adapts to any waveform, and the method mainly comprises the following steps of:
3.1 standard C language evolution function double sqrt (double x) (VC 6.0 math.h) can calculate double-precision floating point evolution; the algorithm I is hereinafter referred to as algorithm I; calculate the effective value v=sqrt (x). The method is suitable for the evolution calculation of double-precision floating point data, the calculation result is also double-precision floating point number, the application range is wide, the precision is high, and the time consumed by the algorithm is longest.
3.2 the 32-bit unsigned integer can be squared using the dichotomy: unsigned short u32sqrt (unsigned int x), return value is 16-bit unsigned integer; the algorithm II is hereinafter referred to as algorithm II; the effective value v=u32sqrt (x) is calculated. The method is suitable for the evolution calculation of the 32-bit unsigned integer, the calculation result is the 16-bit unsigned integer, the application range is relatively narrow, the calculation precision meets the integer requirement, and the time consumed by the algorithm is greatly shortened compared with the standard evolution algorithm.
The alternating voltage and the alternating current have positive amplitudes, and the requirement on the accurate position after the decimal point is not high in certain application occasions, and the principle is that for any positive integer x, the square root y of the alternating voltage and the alternating current has y < = x/2+1, and the square root y can be found quickly by carrying out cyclic search in the whole range of [0, x/2+1] through a dichotomy, but because the definition field of x is larger, the search range is larger, the cyclic times are more and are 16 times, and the time consumption is still longer.
However, in the embedded system, the operation resources of the processor are limited, so that the memory occupied by the operation and the operation time are required. The input and output data type of the algorithm I is far higher than the requirement of practical application, the time spent is longest, and the input and output data type of the algorithm II is matched with the practical application, but the time spent is still not short.
Under the condition that three-phase voltage and current are required to be roughly measured, the effective values of the common six-phase voltage and current amplitude are required to be calculated in each period, and the calculation of the effective values belongs to time-consuming operation, so that a method for improving the estimation speed of the effective values as much as possible on the premise of meeting the requirement of measurement precision is required, and the overall response speed of the whole system is effectively improved.
Disclosure of Invention
In order to solve the problems, the invention discloses an estimation method for an effective value of an embedded acquisition alternating current signal.
In order to achieve the above purpose, the technical scheme of the invention is as follows:
an estimation method for an effective value of an embedded acquisition alternating current signal comprises the following steps:
step one, obtaining an alternating current signal sampling square average value x;
step two, if x=0, directly outputting an effective value y of the alternating current signal, wherein y=0;
step three, if x is not equal to 0, searching for 2 i <=x, and 2 i+1 >I value where=x holds, i represents a power exponent of 2;
step four, calculating y value:
wherein, if i is an odd number:
then calculate 2 i+1 Difference v from i, v=2 i+1 -x;
i’=INT(i/2+1);
s=2 i’ ;
v’=v/2 i’+1 ;
y=s- (v' ×k); k is an empirical coefficient; INT () represents an integer;
if i is an even number:
difference v=x-2 i ;
i’=i/2;
s=2 i’ ;
v’=v/2 i’+1 ;
y=s+(v’/k);
Wherein y is the effective value of the alternating current signal.
Step five, if y is larger than or equal to 65535, outputting y=65535; otherwise, directly outputting the y value obtained by the calculation in the step four.
Further improvements, i values are obtained by dichotomy.
Further improvement, the value range of x is [0,2 32 -1]。
Further improvement, k=1.15.
Further improvement, in the fifth step, if y is greater than or equal to 65535, y=65535 is output; otherwise, directly outputting the y value obtained by the calculation in the step four.
The invention has the advantages that:
the technical scheme of the invention has the beneficial effects that:
the invention greatly improves the running speed of the computer, saves the computing resource and improves the response speed of the computer under the condition of ensuring the accuracy of the effective value estimation value of the alternating current signal.
Detailed Description
The invention is further illustrated by the following examples.
Examples
The same signal is calculated and compared with the algorithm II by using the method:
v1=u32sqrt(x) (1)
v2=u32sqrt_near(x) (2)
e=abs(v1–v2) (3)
p=(e/v1)*100% (4)
the current waveform signals of 6 cycles are arbitrarily collected as shown in the following table:
the six cycle current samples are shown in table 1:
table 1 six period current sample value data table
The square average value of each sampling value of each period (namely, each 100 continuous points) is calculated, so that 6 different x are obtained, as shown in the following table 2:
table 2 is a data table for calculating 6-period data for V1 and V2 methods, respectively
Wherein x is a single-period sampling square average value of the same alternating current signal, v1 is an effective value result calculated by adopting an algorithm II, v2 is an effective value result calculated by adopting the method, e is an absolute error of results of two effective value calculation methods, and p is an absolute error percentage of an effective value. u32sqrt represents the use of the algorithm two-way square, u32sqrt_near represents the use of the algorithm three-way square disclosed in the present invention, abs () represents the absolute value, and P represents the percentage error. v1 is the calculation result of algorithm two, v2 is the calculation result of algorithm three provided by the invention, e is the error value, and p is the error percentage of the two.
The calculation error of the effective value of the alternating voltage/current is as follows:
when the square average value x epsilon [0,22500], e < = 3;
when x is E (22500,2) 32 -1],p<1.7%;
Tests show that the calculation execution speed of the method is improved by about 20 percent compared with that of the algorithm II. For the 6 inputs x of the above embodiment, the evolution calculation is repeated 100 times in succession, the algorithm two takes 7.1ms; the algorithm three of the invention takes 5.6ms.
Description of principle:
for the second background algorithm, the principle is that for any positive integer x, the square root y must have y < = x/2+1, and the square root y can be found quickly by circularly searching in the whole range of [0, x/2+1] through a dichotomy, but because the definition field of x is larger, the searching range is large, and the number of times of circulation is more than 16.
For the technical proposal of the invention, the principle is that any square number x (corresponding to the square average value of the sampling value of the alternating current signal in the invention) is provided with i, so that 2 i <=x, and 2 i+1 >=x. Due to the exponential relationship, the definition in x [0,2 ] 32 -1]The corresponding i range is very small (x=0 is not considered, the result is directly 0): [0,31]By dichotomy, at most, only cycle log 2 32 =5 times, the corresponding i can be found.
y is the square root of x and,
let m=i/2, n= (i+1)/2, there must be:
2 m <=y<=2 n (5)
the range of y is greatly reduced.
Let i be an even number, where m is an integer, y=2 m +b; (6)
Let i be an odd number, where n is an integer, y=2 n -b’;
The parity of i is distinguished to distinguish which of m and n is an integer because integer computation saves time over floating point computation.
Taking the example that i is even, where m is known, only one b needs to be found, i.e., y is calculated by one addition.
Let b=2 r I.e. with y=2 m +2 r Can be obtained (2) m +2 r ) 2 =x, there are:
x=2 2m +2 2r +2*2 m 2 r (7)
in the formula (5), since the range of y has been greatly reduced, r in the formula (7) can be simply obtained<m, then 2 2r Must be much smaller than 2 2m For quick solution, the approximate calculation will be 2 2r Omitting, obtaining:
x≈2 2m +k*2 m+r+1 (8)
wherein k is because the approximate solution in equation (8) omits 2 2r And then the compensation coefficient introduced after the calculation result becomes smaller.
Yielding v=x-2 2m =k*2 m+r+1 Pushing out:
k*2 r =v/(2 m+1 )=(x-2 2m )/(2 m+1 ) The method can obtain:
b=2 r =(x-2 2m )/(2 m+1 )/k; (9)
substituting into equation (6), an approximate expression of the output value y is obtained:
y≈2 m +b=2 m +2 r =2 m +(x-2 2m )/(2 m+1 )/k (10)
the same applies to the approximate expression of the output value y when i is an odd number:
y≈2 n -b’=2 n -k*(2 2n -x)/(2 n+1 ) (11)
through multiple substitution test verification, when k=1.15, the calculation speed is not affected, and meanwhile, the precision is better.
According to the technical scheme, only 5 times of circulation are needed when i is searched, and the parity of i is distinguished to carry out a plurality of times of simple mathematical operations, so that the calculation speed can be improved according to the operation times of software.
Actual running speed test (time test of calculating effective values of alternating current signals for the same times by different algorithms) shows that the calculation speed is obviously improved:
although embodiments of the present invention have been disclosed above, it is not limited to the details of the description and the embodiments, which are well suited to various fields of use, additional modifications may be readily made by those skilled in the art without departing from the general concept defined by the claims and their equivalents.
Claims (5)
1. An estimation method for an effective value of an embedded acquisition alternating current signal is characterized by comprising the following steps:
step one, obtaining an alternating current signal sampling square average value x;
step two, if x=0, directly outputting an effective value y of the alternating current signal, wherein y=0;
step three, if x is not equal to 0, searching for 2 i <=x, and 2 i+1 >I value where=x holds, i represents a power exponent of 2;
step four, calculating y value:
wherein, if i is an odd number:
then calculate 2 i+1 Difference v from i, v=2 i+1 -x;
i’=INT(i/2+1);
s=2 i’ ;
v’=v/2 i’+1 ;
y=s- (v' ×k); k is an empirical coefficient; INT () represents an integer;
if i is an even number:
difference v=x-2 i ;
i’=i/2;
s=2 i’ ;
v’=v/2 i’+1 ;
y=s+(v’/k);
Wherein y is the effective value of the alternating current signal;
and step five, outputting a y value.
2. The method for estimating an effective value of an ac signal for embedded acquisition as recited in claim 1, wherein the i value is obtained by a dichotomy.
3. The method for estimating an effective value of an ac signal as recited in claim 1, wherein x has a value in the range of 0,2 32 -1]。
4. The method for estimating an effective value of an ac signal for embedded acquisition according to claim 1, wherein k=1.15.
5. The method for estimating an effective value of an ac signal according to claim 1, wherein in the fifth step, if y is greater than or equal to 65535, y=65535 is output; otherwise, directly outputting the y value obtained by the calculation in the step four.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310893468.7A CN117147945B (en) | 2023-07-20 | 2023-07-20 | Estimation method for effective value of embedded acquisition alternating current signal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310893468.7A CN117147945B (en) | 2023-07-20 | 2023-07-20 | Estimation method for effective value of embedded acquisition alternating current signal |
Publications (2)
Publication Number | Publication Date |
---|---|
CN117147945A true CN117147945A (en) | 2023-12-01 |
CN117147945B CN117147945B (en) | 2024-04-12 |
Family
ID=88885727
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310893468.7A Active CN117147945B (en) | 2023-07-20 | 2023-07-20 | Estimation method for effective value of embedded acquisition alternating current signal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117147945B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005337980A (en) * | 2004-05-28 | 2005-12-08 | Hioki Ee Corp | Alternating current signal measuring instrument |
CN102539892A (en) * | 2012-01-16 | 2012-07-04 | 南京磐能电力科技股份有限公司 | Method for obtaining true effective values of AC (alternating current) signals |
JP2012154764A (en) * | 2011-01-26 | 2012-08-16 | Hioki Ee Corp | Measurement device and measurement method |
CN109444525A (en) * | 2018-10-29 | 2019-03-08 | 南京国电南自维美德自动化有限公司 | Transformer station measurement and control device AC sampling data valid and power factor calculate method |
CN112505391A (en) * | 2020-11-27 | 2021-03-16 | 陕西航空电气有限责任公司 | Frequency-adaptive alternating current signal effective value obtaining method |
CN115236633A (en) * | 2021-04-23 | 2022-10-25 | 日立乐金光科技株式会社 | Distance measuring system |
CN115985238A (en) * | 2023-03-22 | 2023-04-18 | 成都利普芯微电子有限公司 | Data processing method, circuit and driving chip |
-
2023
- 2023-07-20 CN CN202310893468.7A patent/CN117147945B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2005337980A (en) * | 2004-05-28 | 2005-12-08 | Hioki Ee Corp | Alternating current signal measuring instrument |
JP2012154764A (en) * | 2011-01-26 | 2012-08-16 | Hioki Ee Corp | Measurement device and measurement method |
CN102539892A (en) * | 2012-01-16 | 2012-07-04 | 南京磐能电力科技股份有限公司 | Method for obtaining true effective values of AC (alternating current) signals |
CN109444525A (en) * | 2018-10-29 | 2019-03-08 | 南京国电南自维美德自动化有限公司 | Transformer station measurement and control device AC sampling data valid and power factor calculate method |
CN112505391A (en) * | 2020-11-27 | 2021-03-16 | 陕西航空电气有限责任公司 | Frequency-adaptive alternating current signal effective value obtaining method |
CN115236633A (en) * | 2021-04-23 | 2022-10-25 | 日立乐金光科技株式会社 | Distance measuring system |
CN115985238A (en) * | 2023-03-22 | 2023-04-18 | 成都利普芯微电子有限公司 | Data processing method, circuit and driving chip |
Non-Patent Citations (5)
Title |
---|
EYNARD, B AND BONNET, G: "The Potts-q random matrix model: loop equations, critical exponents, and rational case", PHYSICS LETTERS B, 30 September 1999 (1999-09-30), pages 273 - 279 * |
叶载良: "不能被3整除的指数完全数的一个必要条件", 商洛学院学报, vol. 21, no. 02, 15 June 2007 (2007-06-15), pages 14 - 17 * |
张蓓: "谐波电能计量方法的研究", 中国优秀硕士学位论文全文数据库 工程科技Ⅱ辑, no. 04, 15 October 2007 (2007-10-15), pages 042 - 269 * |
邵龙: "实用的真有效值/直流转换电路", 电子技术, no. 7, 31 December 1988 (1988-12-31), pages 38 * |
金镇浩, 宣钟业: "开方器及其在有效值测量中的应用", 电测与仪表, 10 March 1980 (1980-03-10), pages 1 - 9 * |
Also Published As
Publication number | Publication date |
---|---|
CN117147945B (en) | 2024-04-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109752584B (en) | Method for measuring effective value of periodic signal | |
CN102981045B (en) | Normalized self-adaptive electric power measuring method | |
CN114166768B (en) | Conversion method and device for detecting homogeneity of same index by different equipment and electronic equipment | |
US20170277656A1 (en) | Method and apparatus for reducing power and cycle requirement for fft of ecg signals | |
Kalibera et al. | Benchmark precision and random initial state | |
CN109739470A (en) | A kind of computing system based on 2 type hyperbolic CORDIC arbitrary characteristics functions | |
CN102967761B (en) | Method for analyzing frequency adaptive signals | |
CN102809687B (en) | Digital measurement method for alternating-current frequency | |
WO2017113754A1 (en) | Method for detecting dynamic reactive power of grid and reactive power detector | |
CN115048613B (en) | Index homogenization conversion method and device, electronic equipment and storage medium | |
Isupov | Using floating-point intervals for non-modular computations in residue number system | |
CN103018557B (en) | Normalization master-slave type harmonic wave and inter-harmonic wave real-time analysis method | |
CN103018546B (en) | Assigned-frequency electric power metering method | |
CN117147945B (en) | Estimation method for effective value of embedded acquisition alternating current signal | |
CN102566965B (en) | Floating-point number logarithmic operation device with flat errors | |
CN107064634B (en) | The detection method of Harmonious Waves in Power Systems | |
CN115618176A (en) | Moire fringe signal error compensation method and system based on improved particle swarm optimization and storage medium | |
CN113203997B (en) | FPGA-based radar super-resolution direction finding method, system and application | |
CN104849551B (en) | Harmonic phase angle analysis method | |
CN104215924B (en) | Synchronous demodulator, power standard source comprising synchronous demodulator and control method of power standard source | |
CN107590105B (en) | Computing device and method towards nonlinear function | |
CN110672947A (en) | Intelligent electrical engineering measurement system and measurement method | |
CN113358926B (en) | Signal frequency measuring method and device suitable for chip relay protection | |
Yan et al. | The Method of Real-Time Data Weighting Operations of CPLD/FPGA in Measurement Systems. | |
Mostafa et al. | Reducing power and cycle requirement for fast fourier transform of electrocardiogram signals through low level arithmetic optimizations for cardiac implantable devices |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |