CN109163752A - The first value-based algorithm of least square method curve matching correction magnetic coder - Google Patents
The first value-based algorithm of least square method curve matching correction magnetic coder Download PDFInfo
- Publication number
- CN109163752A CN109163752A CN201811084805.3A CN201811084805A CN109163752A CN 109163752 A CN109163752 A CN 109163752A CN 201811084805 A CN201811084805 A CN 201811084805A CN 109163752 A CN109163752 A CN 109163752A
- Authority
- CN
- China
- Prior art keywords
- value
- curve
- square method
- period
- zero point
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01D—MEASURING NOT SPECIALLY ADAPTED FOR A SPECIFIC VARIABLE; ARRANGEMENTS FOR MEASURING TWO OR MORE VARIABLES NOT COVERED IN A SINGLE OTHER SUBCLASS; TARIFF METERING APPARATUS; MEASURING OR TESTING NOT OTHERWISE PROVIDED FOR
- G01D18/00—Testing or calibrating apparatus or arrangements provided for in groups G01D1/00 - G01D15/00
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F17/00—Digital computing or data processing equipment or methods, specially adapted for specific functions
- G06F17/10—Complex mathematical operations
- G06F17/18—Complex mathematical operations for evaluating statistical data, e.g. average values, frequency distributions, probability functions, regression analysis
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Optimization (AREA)
- Pure & Applied Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Mathematical Physics (AREA)
- Computational Mathematics (AREA)
- Mathematical Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- Operations Research (AREA)
- Probability & Statistics with Applications (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Algebra (AREA)
- Evolutionary Biology (AREA)
- Databases & Information Systems (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- Bioinformatics & Computational Biology (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
The invention discloses a kind of first value-based algorithms of least square method curve matching correction magnetic coder, the method comprises the following steps: the most value of the original state lookup known data point in matched curve, it is assumed that the extreme value that most value is current data section, calculates amplitude A by extreme value;The boundary zero point of calculated curve calculates the period of data volume according to boundary zero point, and distribution of the data group within the period is carried out repeatedly fitting as the initial value in period and obtains frequency B;DC component D is calculated by amplitude A;It is derived according to the reference representation of curve and calculates phase C, calculated initial value A, B, C, D is brought into least square method to carry out curve fitting, by fast and accurately being calculated initial value, initial value is efficiently calculated to reach, improves the efficiency of least square method curve matching correction magnetic coder and the purpose of accuracy rate.
Description
Technical field
The present invention relates to least square method curve matchings to correct magnetic coder technical field, and in particular to a kind of least square
The first value-based algorithm of method curve matching correction magnetic coder.
Background technique
Magnetic coder is a kind of novel angular transducer based on magnetoresistance or Hall effect, is widely used in work
Industry, agricultural and space industry.The output of sine and cosine magnetic coder is the cosine and sine signal of rotor angle location.But due to vertical how non-
Often there is DC error, amplitude error and phase error in the cosine and sine signal of the influence of desirable factors, magnetic coder output, directly
Biggish demodulating error will be caused by tapping into row demodulation.And usually according to specifically used environment only from a certain in prior art
Kind main error considers that increase is relevant hardware corrected, and debugging method is also required to manual type and carries out cooperation amendment, on solving
Problem is stated to be corrected magnetic coder using the curve matching based on least square method.
But the fitting for nonlinear cyclic curve, the algorithm need iteration, that is, need given first
Value, and whether initial value be properly directly related to iteration and restrain, whether fitting succeeds.This algorithm be required to it is given with most
Initial value similar in good result, wherein the fitting for curve, the estimation of frequency is complicated, influences the accuracy rate of magnetic coder correction.
Summary of the invention
In order to solve the above technical problems, the invention proposes a kind of the first of least square method curve matching correction magnetic coder
Value-based algorithm efficiently calculates initial value to reach, and improves the efficiency and accuracy rate of least square method curve matching correction magnetic coder
Purpose.
In order to achieve the above objectives, technical scheme is as follows: a kind of least square method curve matching correction magnetic coding
The first value-based algorithm of device, the algorithm steps are as follows: searching the most value of known data point in the original state of matched curve, it is assumed that most
Value is the extreme value in current data section, calculates amplitude A by extreme value;The boundary zero point of calculated curve is calculated according to boundary zero point
Distribution of the data group within the period is carried out repeatedly fitting as the initial value in period and obtains frequency B by the period of data volume;Pass through width
Value A calculates DC component D;It is derived according to the reference representation of curve and calculates phase C, calculated initial value A, B, C, D are brought into
Least square method carries out curve fitting.
Further, the most value includes: maximum value and minimum value, and the extreme value includes: maximum and minimum, described
The specific method for calculating amplitude A is: (maximum-minimum)/2, it is assumed that the maximum and minimum in current data section is exactly
Best curve maximum value and minimum value (under actual conditions to match point may integrated distribution a waveform certain is a bit of such as
1/4 period or 1/8 period, maximum value and minimum value on this bit of section are known as maximum and minimum, that is to say, that
It is not necessarily amplitude), then subtract minimum with maximum and obtain the range of ordinate, it is assumed that in the case where amplitude be most
Big value subtracts the half of the difference of minimum value, is here exactly amplitude.
Further, to be using X be the boundary zero point zero as line of demarcation, the method for the boundary zero point of the calculated curve
Be: the average value after taking all ordinates to sum cannot be guaranteed to guarantee that all curves are made with x=0 as boundary zero point
When for line of demarcation, mean value calculation is utilized to demarcate zero point.
Further, the specific method in period for calculating data volume according to boundary zero point is: by the point on curve by
One is compared with boundary zero point, when there is next point and a upper point is exactly in boundary zero point two sides, records zero passage
The variable of point number defines the number cont_num of zero crossing, is twice a cycle T through zero crossing, so T from increasing by one
=(cont_num-1)/2.
Further, the distribution by data group within the period carries out repeatedly fitting as the initial value in period and obtains frequency
The specific method of B is: by data group successively 1,1/2,1/3 ..., 1/i period be fitted, until the bangle degree of fitting
Reach specified precision, frequency B=2* π * f, f=n/ (1/ (1+lum))=n* (1+lum), if upper one when being successively fitted
Secondary fitting failure then continues fitting downwards, until being fitted successfully.
Further, the specific method for calculating DC component D by amplitude A is: DC component D=maximum-width
Value A.Further, the reference representation of the curve is sinusoidal reference representation: Y=A*sin (B*X+C)+D, institute
State is according to the specific method that the reference representation of curve derives calculating phase C: known A, B, D, X, Y can be obtained: C=asin
((Ydata[m]-D)/(1.0*A))-B*Xdata[m]。
The present invention has the advantage that
(1) the present invention is by fast and accurately calculating initial value, to improve least square method curve matching to magnetic
The efficiency and accuracy rate of encoder correction.
(2) the present invention can automatically adjust frequency, and more flexible utilization least square method is calculated to curve matching.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described.
Fig. 1 is the initial value algorithm flow that least square method curve matching disclosed by the embodiments of the present invention corrects magnetic coder
Figure.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description.
The present invention provides a kind of first value-based algorithms of least square method curve matching correction magnetic coder, its working principle is that
By fast and accurately being calculated initial value, initial value is efficiently calculated to reach, least square method curve matching is improved and corrects magnetic
The efficiency of encoder and the purpose of accuracy rate.
Below with reference to embodiment and specific embodiment, the present invention is described in further detail.
As shown in Figure 1, a kind of first value-based algorithm of least square method curve matching correction magnetic coder, the method step is such as
Under: the most value of known data point is searched in the original state of matched curve, it is assumed that the extreme value that most value is current data section passes through
Extreme value calculates amplitude A;The boundary zero point of calculated curve calculates the period of data volume according to boundary zero point, by data group in the period
Interior distribution carries out repeatedly fitting as the initial value in period and obtains frequency B;DC component D is calculated by amplitude A;According to curve
Reference representation, which derives, calculates phase C, brings calculated initial value A, B, C, D into least square method and carries out curve fitting.
Wherein, the most value includes: maximum value and minimum value, and the extreme value includes: maximum and minimum, the calculating
The specific method of amplitude A is: (maximum-minimum)/2, it is assumed that the maximum and minimum in current data section are exactly best
Curve maximum value and minimum value (under actual conditions to match point may integrated distribution a waveform certain is a bit of such as 1/4
Period or 1/8 period, maximum value and minimum value on this bit of section are known as maximum and minimum, that is to say, that it is not
Must be amplitude), then subtract minimum with maximum and obtain the range of ordinate, it is assumed that in the case where amplitude be maximum value
The half for subtracting the difference of minimum value is exactly amplitude here.
Wherein, it is zero as line of demarcation that the boundary zero point, which is using X, and the method for the boundary zero point of the calculated curve is:
Average value after taking all ordinates to sum cannot be guaranteed to guarantee all curves to be all using x=0 as dividing as boundary zero point
When boundary line, using mean value calculation boundary zero point, it is the boundary of positive and negative semiaxis, actual waveform that boundary zero point, which is the zero point of broad sense,
In not ensure that all curves all be using x=0 as line of demarcation.
Wherein, the specific method in period for calculating data volume according to boundary zero point is: by the point on curve one by one with
Boundary zero point is compared, when there is next point and a upper point is exactly in boundary zero point two sides, record zero crossing
Several variables defines the number cont_num of zero crossing, is twice a cycle T through zero crossing, so T=from increasing by one
(cont_num-1)/2。
Wherein, the point on curve is compared specific method with boundary zero point one by one is: by the ordinate of first point
Compared with zero point, if the point is less than zero point, compares the ordinate of second point, if also less than zero point, continue to compare third
A point;When finding that be greater than zero point at k-th point, one is added to the variable of record zero passage points, continues to compare, according to sinusoidal feature I
Know that finally necessarily progressively reach amplitude in data volume then approaches to zero point again, then continuing to compare, then will appear certain
The case where a point is greater than zero point, and next point is less than zero point;It is available by calculating above, the number cont_ of zero crossing
Num is twice a cycle T through zero crossing, so T=(cont_num-1)/2.
Wherein, it should be noted that above situation assumes that number of cycles greater than 1, so point under practical fit solution
It may all in one cycle, that is to say, that T=0;In this case the failure that will result directly in fitting result, for the monocycle
Under need to handle again, i.e., setting work as cycle T≤0, when, pressure make the period 1.Because data must will be had by being fitted, there is number
According to the period is not just centainly 0
Wherein, the distribution by data group within the period carries out repeatedly fitting as the initial value in period and obtains frequency B's
Specific method is: by data group successively 1,1/2,1/3 ..., 1/i (i is natural number) a period be fitted, until fitting
Bangle degree reach specified precision, frequency B=2* π * f, f=n/ (1/ (1+lum))=n* (1+lum) is successively fitted
When if last time fitting failure if continue downwards fitting, until be fitted successfully, wherein n be data amount check, lum initial value be 0, mistake
It loses once from adding one, is carried out in outer circulation.
Wherein, the specific method for calculating DC component D by amplitude A is: DC component D=maximum-amplitude A.
Wherein, the reference representation of the curve is sinusoidal reference representation: Y=A*sin (B*X+C)+D, institute
State is according to the specific method that the reference representation of curve derives calculating phase C: known A, B, D, X, Y can be obtained:
C=asin ((Ydata [m]-D)/(1.0*A))-B*Xdata [m], wherein Xdata [m] and Ydata [m] is exactly to count
According to the array that is respectively formed of transverse and longitudinal coordinate, it is to be herein pointed out usually we select the transverse and longitudinal coordinate of first point, but
There is kind of this symbol of special case arcsin that there is domain, so need to judge,
It is used when ((((Ydata [m]-D)/A)>1) | | (((Ydata [m]-D)/A)<-1.000)) meets next
Transverse and longitudinal coordinate, that is, i++ of a point.
Above-described embodiment is by taking sine curve as an example, and the present invention is suitable for having formula and periodically variable curve, such as just
Chord curve, cosine curve etc..
Magnetic coder is corrected, specific method includes: Step 1: the electric signal of magnetic coder conversion output is discrete
Change, periodic sampling is carried out by A/D, sampling number n obtains data sequence to for (ti, vs [i]), the value range of i is 1,
2,3….n;Step 2: carrying out global analysis to the sampled data of sinusoidal signal and cosine signal respectively, sine is estimated respectively
Four parameters of curve and cosine curve and the initial value in this, as least square method, carry out curve fitting, respectively obtain minimum
The sine and cosine fit curve equation formula of square law.Step 3: in the hope of sine curve equation on the basis of, calculate sinusoidal
The amplitude deviation of fitting equation and sinusoid equation formula, with phase deviation.To compensate correction.
Above-described is only a kind of initial value of least square method curve matching correction magnetic coder disclosed in this invention
The preferred embodiment of algorithm, it is noted that for those of ordinary skill in the art, do not departing from the invention structure
Under the premise of think of, various modifications and improvements can be made, and these are all within the scope of protection of the present invention.
Claims (7)
1. a kind of first value-based algorithm of least square method curve matching correction magnetic coder, which is characterized in that the algorithm steps are such as
Under: the most value of known data point is searched in the original state of matched curve, it is assumed that the extreme value that most value is current data section passes through
Extreme value calculates amplitude A;The boundary zero point of calculated curve calculates the period of data volume according to boundary zero point, by data group in the period
Interior distribution carries out repeatedly fitting as the initial value in period and obtains frequency B;DC component D is calculated by amplitude A;According to curve
Reference representation, which derives, calculates phase C;Calculated initial value A, B, C, D is brought into least square method to carry out curve fitting.
2. the first value-based algorithm of least square method curve matching correction magnetic coder according to claim 1, which is characterized in that
The most value includes: maximum value and minimum value, and the extreme value includes: maximum and minimum, the specific side for calculating amplitude A
Method is: (maximum-minimum)/2.
3. the first value-based algorithm of least square method curve matching correction magnetic coder according to claim 2, which is characterized in that
It is zero as line of demarcation that the boundary zero point, which is using X, and the method for the boundary zero point of the calculated curve is: all ordinates being taken to ask
Average value with after is as boundary zero point.
4. the first value-based algorithm of least square method curve matching correction magnetic coder according to claim 3, which is characterized in that
The specific method in the period for calculating data volume according to boundary zero point is: the point on curve is compared with boundary zero point one by one
Compared with when there is next point and a upper point is exactly in boundary zero point two sides, the variable for recording zero crossing number increases certainly
One, the number cont_num of zero crossing is defined, is twice a cycle T through zero crossing, so T=(cont_num-1)/2.
5. the first value-based algorithm of least square method curve matching correction magnetic coder according to claim 4, which is characterized in that
The distribution by data group within the period carries out repeatedly being fitted the specific method for obtaining frequency B as the initial value in period: will
Data group successively 1,1/2,1/3 ..., 1/i period be fitted, until the bangle degree of fitting reaches specified precision,
Frequency B=2* π * f, f=n/ (1/ (1+lum))=n* (1+lum).
6. the first value-based algorithm of least square method curve matching correction magnetic coder according to claim 5, which is characterized in that
The specific method for calculating DC component D by amplitude A is: DC component D=maximum-amplitude A.
7. the first value-based algorithm of least square method curve matching correction magnetic coder according to claim 6, which is characterized in that
The reference representation of the curve is sinusoidal reference representation: Y=A*sin (B*X+C)+D, the mark according to curve
The specific method that quasi- expression formula derives calculating phase C is: known A, B, D, X, Y can be obtained:
C=asin ((Ydata [m]-D)/(1.0*A))-B*Xdata [m].
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811084805.3A CN109163752A (en) | 2018-09-18 | 2018-09-18 | The first value-based algorithm of least square method curve matching correction magnetic coder |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811084805.3A CN109163752A (en) | 2018-09-18 | 2018-09-18 | The first value-based algorithm of least square method curve matching correction magnetic coder |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109163752A true CN109163752A (en) | 2019-01-08 |
Family
ID=64879570
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811084805.3A Pending CN109163752A (en) | 2018-09-18 | 2018-09-18 | The first value-based algorithm of least square method curve matching correction magnetic coder |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109163752A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110940371A (en) * | 2019-12-13 | 2020-03-31 | 浙江禾川科技股份有限公司 | Calibration method, device and equipment of rotary magnetoelectric encoder |
CN113739748A (en) * | 2021-08-13 | 2021-12-03 | 连云港杰瑞电子有限公司 | Induction type angle sensor parameter acquisition method |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH08184618A (en) * | 1994-12-27 | 1996-07-16 | Fuji Electric Co Ltd | Frequency detecting method for sine wave ac signal |
CN104482949A (en) * | 2014-12-29 | 2015-04-01 | 哈尔滨工业大学 | Precise code zero offset and amplitude self-adaptation compensation method of optical-electricity encoder |
CN104613986A (en) * | 2015-02-05 | 2015-05-13 | 哈尔滨工业大学 | Method for compensating reference voltage of photoelectric encoder based on least square fitting curve |
CN108333420A (en) * | 2018-04-02 | 2018-07-27 | 三峡大学 | A kind of Low Frequency Sine Signals peak detector and peak-value detection method |
-
2018
- 2018-09-18 CN CN201811084805.3A patent/CN109163752A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH08184618A (en) * | 1994-12-27 | 1996-07-16 | Fuji Electric Co Ltd | Frequency detecting method for sine wave ac signal |
CN104482949A (en) * | 2014-12-29 | 2015-04-01 | 哈尔滨工业大学 | Precise code zero offset and amplitude self-adaptation compensation method of optical-electricity encoder |
CN104613986A (en) * | 2015-02-05 | 2015-05-13 | 哈尔滨工业大学 | Method for compensating reference voltage of photoelectric encoder based on least square fitting curve |
CN108333420A (en) * | 2018-04-02 | 2018-07-27 | 三峡大学 | A kind of Low Frequency Sine Signals peak detector and peak-value detection method |
Non-Patent Citations (1)
Title |
---|
吴义华: ""正弦信号四参数的高精度估计算法"", 《中国科学技术大学学报》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110940371A (en) * | 2019-12-13 | 2020-03-31 | 浙江禾川科技股份有限公司 | Calibration method, device and equipment of rotary magnetoelectric encoder |
WO2021114419A1 (en) * | 2019-12-13 | 2021-06-17 | 浙江禾川科技股份有限公司 | Calibration method, apparatus and device for rotary magnetoelectric encoder |
CN113739748A (en) * | 2021-08-13 | 2021-12-03 | 连云港杰瑞电子有限公司 | Induction type angle sensor parameter acquisition method |
CN113739748B (en) * | 2021-08-13 | 2024-04-02 | 连云港杰瑞电子有限公司 | Induction type angle sensor parameter acquisition method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104038134B (en) | A kind of permanent-magnet synchronous motor rotor position error calibration method based on linear Hall | |
CN106018958B (en) | Secondary side current electric voltage frequency tracking in isolated network frequency conversion system | |
CN109163752A (en) | The first value-based algorithm of least square method curve matching correction magnetic coder | |
DE102015122484A1 (en) | System and method for measuring power in a power factor converter | |
CN104597320B (en) | A kind of method calculated suitable for multiple frequency alternating current signals | |
CN105629060B (en) | Power grid frequency measurement method and device based on optimal baseband filtering | |
Paris et al. | The sinefit spectral envelope preprocessor | |
CN105652085B (en) | A kind of fundamental wave and harmonic parameters method of estimation based on the incomplete S-transformation of improvement | |
EP2979344B1 (en) | Algorithm for passive power factor compensation method with differential capacitor change and reduced line transient noise | |
CN103399213B (en) | A kind of high-tension apparatus dielectric dissipation factor computing method based on fundamental frequency correction | |
CN103018555A (en) | High-precision electric power parameter software synchronous sampling method | |
CN104410408B (en) | A kind of single-phase phase-lock technique and device | |
WO2017028617A1 (en) | Phase angle acquisition method and system | |
CN110112776B (en) | Grid-connected inverter power grid impedance identification method considering power grid background harmonic waves | |
CN108599547B (en) | Robust model prediction control method for three-phase voltage type power factor correction converter | |
CN104569581B (en) | Multi-level set and single-cycle estimation method of power grid frequency measuring | |
CN105067882B (en) | A kind of assay method of electricity amplitude | |
CN110133381A (en) | A kind of determination method of pulse rise time uncertainty | |
CN109066685A (en) | A kind of line parameter circuit value modification method based on parametric sensitivity | |
CN107276591A (en) | The mismatch error method of estimation and system of a kind of parallel sampling system | |
CN107944405A (en) | A kind of cubic spline part mean decomposition method based on extreme value point calibration | |
CN109191543B (en) | AC sampling common-section data generation method | |
CN104407197A (en) | Signal phasor measurement method based on trigonometric function iteration | |
CN109521269A (en) | A kind of am signals digitlization frequency measuring method | |
US9588152B2 (en) | Digital signal processing method for measurement of AC voltage with power converters at light load operation |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20190108 |