CN105806200B - A kind of analytic method of encoder - Google Patents
A kind of analytic method of encoder Download PDFInfo
- Publication number
- CN105806200B CN105806200B CN201610345063.XA CN201610345063A CN105806200B CN 105806200 B CN105806200 B CN 105806200B CN 201610345063 A CN201610345063 A CN 201610345063A CN 105806200 B CN105806200 B CN 105806200B
- Authority
- CN
- China
- Prior art keywords
- signal
- qep
- encoder
- values
- comparison
- 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.)
- Active
Links
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01B—MEASURING LENGTH, THICKNESS OR SIMILAR LINEAR DIMENSIONS; MEASURING ANGLES; MEASURING AREAS; MEASURING IRREGULARITIES OF SURFACES OR CONTOURS
- G01B7/00—Measuring arrangements characterised by the use of electric or magnetic techniques
- G01B7/003—Measuring arrangements characterised by the use of electric or magnetic techniques for measuring position, not involving coordinate determination
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Transmission And Conversion Of Sensor Element Output (AREA)
Abstract
The invention discloses a kind of analytic methods of encoder to include:Utilize the corresponding original QEP values of the original signal of QEP circuit counting encoders;The initial position signal of encoder is obtained according to original QEP values, the sine wave signal of encoder and the cosine wave signal of encoder;Obtain comparison QEP values;Compare QEP values be original QEP values and offset and;Obtain second angle signal;The comparison position signal of encoder is obtained according to comparison QEP values, second angle signal;In one cycle, judge whether current location meets the first predetermined condition, if met, using comparison position signal as the actual position signal of the motor of encoder, if do not met, using home position signal as the actual position signal of the motor of encoder.This method can be to avoid position deviation caused by due to hardware handles are nonsynchronous.
Description
Technical field
The present invention relates to field of computer technology, more particularly to a kind of analytic method of encoder.
Background technology
Encoder (encoder) be signal (such as bit stream) or data are worked out, be converted to can be used to communicate, transmission
With the equipment of the signal form of storage.It is an important step to carry out parsing for the waveform of encoder output.
In the prior art, it is mainly sine wave and cosine according to encoder output for the analysis mode of encoder
Wave, specific analysis mode are as follows:
1) output signal P1 is obtained by QEP circuit countings;
2) it by sine wave and cosine wave, calculates each sine wave period using atan2 and cosine wave period is corresponding
Angle signal P2;
3) output signal P1 is added to obtain position signal P with angle signal P2, position signal P is exactly the motor of encoder
Position.
It can be seen that the precision of output signal P1 and angle signal P2 determine the precision of position signal P.
Fig. 1 is the result figure that the critical point of P1 variations and the critical point of P2 variations obtain P when being the same time.Fig. 2 is P1
The critical point of the critical point of variation and P2 variations obtains the result figure of P when not being the same time.Wherein, horizontal axis indicates the time, indulges
Axis indicates position.As seen from Figure 1, in the ideal case, if critical point and the angle signal P2 of output signal P1 variations
The critical point of variation is the same time, then the position signal P obtained do not have burr, once but hardware handles are asynchronous, will
It is not the same time to lead to the critical point for the critical point and angle signal P2 variations that output signal P1 changes, then the position letter obtained
There are burrs by number P, as shown in Figure 2.If using the calculation of the prior art, cause position signal P there are burr to be because
The nonsynchronous reason of hardware handles.Due to position signal P there are burr cause calculate physical location there are deviations.
It can be seen that position deviation caused by how avoiding the problem that due to hardware handles are nonsynchronous is this field
Technical staff's urgent problem to be solved.
Invention content
The object of the present invention is to provide a kind of analytic methods of encoder, for avoiding due to the nonsynchronous original of hardware handles
Caused by the problem of position deviation.
In order to solve the above technical problems, the present invention provides a kind of analytic method of encoder, including:
Utilize the corresponding original QEP values of the original signal of encoder described in QEP circuit countings;
It is obtained according to the original QEP values, the sine wave signal of the encoder and the cosine wave signal of the encoder
The initial position signal of the encoder;
Obtain comparison QEP values;The comparison QEP values be the original QEP values and offset and;
Obtain second angle signal;Wherein, the second angle signal lags the institute of half period by atan2 function pairs
The sine wave signal and cosine wave signal for stating encoder are calculated;
The comparison position signal of the encoder is obtained according to the comparison QEP values, the second angle signal;
In one cycle, judge whether current location meets the first predetermined condition, if met, by the comparison position
Actual position signal of the confidence as the motor of the encoder, if do not met, using the home position signal as
The actual position signal of the motor of the encoder.
Preferably, described according to the original QEP values, the cosine of the sine wave signal and the encoder of the encoder
The initial position signal that wave signal obtains the encoder specifically includes:
It is worth to the first output signal using the original QEP;Wherein, P1=QEP/4*4, P1 indicate first output
Signal, QEP indicate original QEP values;
The sine wave signal of the encoder is calculated using atan2 functions and the corresponding first angle of cosine wave signal is believed
Number;Wherein, P2=K*atan2 (cos θ, sin θ), P2 indicate that the first angle signal, K are planning coefficient, and cos θ are cosine
Wave signal, sin θ are sine wave signal;
Calculate first output signal and the first angle signal and obtain the initial position signal;Wherein, P
=P1+P2, P indicate the initial position signal.
Preferably, the offset is 2;
Wherein, QEP '=QEP+2, QEP ' indicate the comparison QEP values.
Preferably, P2 '=K*atan2 (cos θ ', sin θ '), wherein P2 ' indicates that the second angle signal, cos θ ' are
The corresponding cosine signal of cos θ lag half periods, sin θ ' it is that sin θ lags the corresponding sinusoidal signal of half period.
Preferably, described that the comparison position of the encoder is obtained according to the comparison QEP values, the second angle signal
Signal specifically includes:
The second output signal is calculated according to the comparison QEP values;Wherein, P1 '=QEP '/4*4, P1 ' indicate described second
Output signal;
Calculate second output signal and the second angle signal and obtain the comparison position signal;Wherein,
P '=P1 '+P2 ', P ' indicate the comparison position signal.
Preferably, first predetermined condition is:[90°,270°].
The analytic method of encoder provided by the present invention is compared by increasing an offset for original QEP values
QEP values, to obtain the second output signal;Calculate the sine wave signal and cosine wave signal pair of the encoder of lag half period
The second angle signal answered obtains comparison position signal on the basis of with the second output signal and second angle signal.Due to
Comparison position signal and initial position signal are only different in the place for burr occur, other place all sames, therefore, current
When position signal meets the first predetermined condition, actual position signal of the comparison position signal as the motor of encoder is chosen, such as
Fruit does not meet, then using home position signal as the actual position signal of the motor of encoder.This method can be to avoid due to hard
Position deviation caused by the nonsynchronous reason of part processing.
Description of the drawings
In order to illustrate the embodiments of the present invention more clearly, attached drawing needed in the embodiment will be done simply below
It introduces, it should be apparent that, drawings in the following description are only some embodiments of the invention, for ordinary skill people
For member, without creative efforts, other drawings may also be obtained based on these drawings.
Fig. 1 is the result figure that the critical point of P1 variations and the critical point of P2 variations obtain P when being the same time;
Fig. 2 is the result figure that the critical point of P1 variations and the critical point of P2 variations obtain P when not being the same time;
Fig. 3 is a kind of flow chart of the analytic method of encoder provided by the invention;
Fig. 4 is a kind of corresponding result figure of home position signal provided by the invention;
Fig. 5 is a kind of corresponding result figure of comparison position signal provided by the invention;
Fig. 6 is the comparison diagram of a kind of home position signal provided by the invention and comparison position signal.
Specific implementation mode
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 describes, it is clear that described embodiments are only a part of the embodiments of the present invention, rather than whole embodiments.Based on this
Embodiment in invention, without making creative work, what is obtained is every other by those of ordinary skill in the art
Embodiment belongs to the scope of the present invention.
Core of the invention is to provide a kind of analytic method of encoder.
In order to enable those skilled in the art to better understand the solution of the present invention, with reference to the accompanying drawings and detailed description
The present invention is described in further detail.
Fig. 3 is a kind of flow chart of the analytic method of encoder provided by the invention.As shown in figure 3, the parsing of encoder
Method includes:
S10:Utilize the corresponding original QEP values of the original signal of QEP circuit counting encoders.
It is same as the prior art in this step, exactly the signal of encoder output calculate using QEP circuits
To original QEP values, which is corresponding with comparison QEP values hereinafter.
S11:Encoder is obtained according to original QEP values, the sine wave signal of encoder and the cosine wave signal of encoder
Initial position signal.
It is same as the prior art in this step, it is to obtain the first output signal first, then obtains first angle letter again
Number, the addition of the first angle signal of the first output signal is just finally obtained into home position signal.
Wherein, the first output signal is worth to by original QEP, specially:P1=QEP/4*4, P1 indicate the first output
Signal, QEP indicate original QEP values.
First angle signal utilizes the sine wave signal and cosine wave signal of atan2 function calculation code devices, specially:P2
=K*atan2 (cos θ, sin θ), P2 indicate that first angle signal, K are planning coefficient.
After obtaining the first output signal and first angle signal, the two addition is just obtained into home position signal, specifically
For:P=P1+P2, P indicate initial position signal.
S12:Obtain comparison QEP values;Compare QEP values be original QEP values and offset and.
In order to eliminate hardware asynchronous the problem of bringing, in the present embodiment, a comparison QEP value, the comparison is added
QEP values are worth to by original QEP, and if offset is 2, comparison QEP values can be obtained by, specially:
QEP '=QEP+2, QEP ' indicate comparison QEP values.
S13:Obtain second angle signal;Wherein, second angle signal lags the volume of half period by atan2 function pairs
The sine wave signal and cosine wave signal of code device are calculated.
Second angle signal is corresponding with first angle signal, and second angle signal is to utilize atan2 function calculation code devices
Sine wave signal and cosine wave signal, specially:P2 '=K*atan2 (cos θ ', sin θ '), wherein P2 ' indicates second jiao
Signal is spent, cos θ ' are that cos θ lag the corresponding cosine signal of half period, sin θ ' it is that sin θ lag half period is corresponding just
String signal.
S14:The comparison position signal of encoder is obtained according to comparison QEP values, second angle signal.
In this step, the second output signal is calculated according to comparison QEP values;Wherein, P1 ' indicates the second output signal, P1 '
=QEP '/4*4.
Comparison position signal is obtained using the second output signal and second angle signal, comparison position signal P ' is indicated,
P '=P1 '+P2 '.
S15:In one cycle, judge whether current location meets the first predetermined condition, if met, enter step
Otherwise S16 enters step S17;
S16:Using comparison position signal as the actual position signal of the motor of encoder.
S17:Using home position signal as the actual position signal of the motor of encoder.
Fig. 4 is a kind of corresponding result figure of home position signal provided by the invention.Fig. 5 is that one kind provided by the invention is right
Result figure more corresponding than position signal.Fig. 6 is the comparison of a kind of home position signal provided by the invention and comparison position signal
Figure.In. fig. 6, it can be seen that compared with sine wave, [0 °, 360 °] home position signal is in each period within each period
Burr point is generated at 180 °, comparison position signal is in 0 ° of each period place's generation burr point.Therefore choosing the first predetermined condition is:
[90 °, 270 °], i.e., in [90 °, 270 °] range when, take comparison position signal value as encoder motor actual bit
Confidence number when in [0,90 °] and [270,360 °] range, takes the value of initial position signal as the reality of the motor of encoder
Position signal.
The analytic method of encoder provided by the invention obtains comparison QEP by increasing an offset for original QEP values
Value, to obtain the second output signal;The sine wave signal and cosine wave signal for calculating the encoder of lag half period correspond to
Second angle signal, obtained on the basis of with the second output signal and second angle signal comparison position signal.Due to right
It is only more different in the place for burr occur than position signal and initial position signal, other place all sames, therefore, in present bit
When confidence number meets the first predetermined condition, actual position signal of the comparison position signal as the motor of encoder is chosen, if
It does not meet, then using home position signal as the actual position signal of the motor of encoder.This method can be to avoid due to hardware
Handle position deviation caused by nonsynchronous reason.
The analytic method of encoder provided by the present invention is described in detail above.Each embodiment in specification
It is described by the way of progressive, each embodiment focuses on the differences from other embodiments, each embodiment
Between identical similar portion just to refer each other.For the device disclosed in the embodiment, due to itself and side disclosed in embodiment
Method is corresponding, so description is fairly simple, reference may be made to the description of the method.It should be pointed out that for this technology
For the those of ordinary skill in field, without departing from the principle of the present invention, several improvement can also be carried out to the present invention
And modification, these improvement and modification are also fallen within the protection scope of the claims of the present invention.
Professional further appreciates that, unit described in conjunction with the examples disclosed in the embodiments of the present disclosure
And algorithm steps, can be realized with electronic hardware, computer software, or a combination of the two, in order to clearly demonstrate hardware and
The interchangeability of software generally describes each exemplary composition and step according to function in the above description.These
Function is implemented in hardware or software actually, depends on the specific application and design constraint of technical solution.Profession
Technical staff can use different methods to achieve the described function each specific application, but this realization is not answered
Think beyond the scope of this invention.
The step of method described in conjunction with the examples disclosed in this document or algorithm, can directly be held with hardware, processor
The combination of capable software module or the two is implemented.Software module can be placed in random access memory (RAM), memory, read-only deposit
Reservoir (ROM), electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technology
In any other form of storage medium well known in field.
Claims (6)
1. a kind of analytic method of encoder, which is characterized in that including:
Utilize the corresponding original QEP values of the original signal of encoder described in QEP circuit countings;
It is obtained according to the original QEP values, the sine wave signal of the encoder and the cosine wave signal of the encoder described
The initial position signal of encoder;
Obtain comparison QEP values;The comparison QEP values be the original QEP values and offset and;
Obtain second angle signal;Wherein, the second angle signal lags the volume of half period by atan2 function pairs
The sine wave signal and cosine wave signal of code device are calculated;
The comparison position signal of the encoder is obtained according to the comparison QEP values, the second angle signal;
In one cycle, judge whether current location meets the first predetermined condition, if met, the comparison position is believed
Number as the encoder motor actual position signal, if do not met, using the initial position signal as described in
The actual position signal of the motor of encoder.
2. the analytic method of encoder according to claim 1, which is characterized in that described according to the original QEP values, institute
The initial position signal that the cosine wave signal of the sine wave signal and the encoder of stating encoder obtains the encoder is specific
Including:
It is worth to the first output signal using the original QEP;Wherein, P1=QEP/4*4, P1 indicate the first output letter
Number, QEP indicates original QEP values;
The sine wave signal and the corresponding first angle signal of cosine wave signal of the encoder are calculated using atan2 functions;Its
In, P2=K*atan2 (cos θ, sin θ), P2 indicate that the first angle signal, K are planning coefficient, and cos θ believe for cosine wave
Number, sin θ is sine wave signal;
Calculate first output signal and the first angle signal and obtain the initial position signal;Wherein, P=P1
+ P2, P indicate the initial position signal.
3. the analytic method of encoder according to claim 2, which is characterized in that the offset is 2;
Wherein, QEP '=QEP+2, QEP ' indicate the comparison QEP values.
4. the analytic method of encoder according to claim 3, which is characterized in that P2 '=K*atan2 (cos θ ', sin
θ '), wherein P2 ' indicates that the second angle signal, cos θ ' they are that cos θ lag the corresponding cosine signal of half period, sin θ '
The corresponding sinusoidal signal of half period is lagged for sin θ.
5. the analytic method of encoder according to claim 4, which is characterized in that described according to the comparison QEP values, institute
It states second angle signal and obtains the comparison position signal of the encoder and specifically include:
The second output signal is calculated according to the comparison QEP values;Wherein, P1 '=QEP '/4*4, P1 ' indicate second output
Signal;
Calculate second output signal and the second angle signal and obtain the comparison position signal;Wherein, P '=
P1 '+P2 ', P ' indicate the comparison position signal.
6. the analytic method of encoder according to claim 4, which is characterized in that first predetermined condition is:[90°,
270°]。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610345063.XA CN105806200B (en) | 2016-05-23 | 2016-05-23 | A kind of analytic method of encoder |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610345063.XA CN105806200B (en) | 2016-05-23 | 2016-05-23 | A kind of analytic method of encoder |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105806200A CN105806200A (en) | 2016-07-27 |
CN105806200B true CN105806200B (en) | 2018-09-28 |
Family
ID=56452658
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610345063.XA Active CN105806200B (en) | 2016-05-23 | 2016-05-23 | A kind of analytic method of encoder |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105806200B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109654988B (en) * | 2018-11-01 | 2021-04-13 | 汉宇集团股份有限公司 | Electric automobile motor position detection and verification method and system and electric automobile |
JP7100677B2 (en) * | 2020-05-14 | 2022-07-13 | 株式会社小野測器 | Test system |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6525502B1 (en) * | 1999-09-02 | 2003-02-25 | Aspen Motion Technologies, Inc. | Closed loop control of motor position and velocity |
CN102840874A (en) * | 2011-06-22 | 2012-12-26 | 合康变频科技(武汉)有限公司 | Frequency division method and system for any integer of orthogonal photoelectric encoder |
CN103017800A (en) * | 2011-09-27 | 2013-04-03 | 比亚迪股份有限公司 | Method and device used for decoding orthogonal coding signal |
CN205193510U (en) * | 2015-11-20 | 2016-04-27 | 泉州装备制造研究所 | Novel aircraft electrical power generating system tests platform device |
-
2016
- 2016-05-23 CN CN201610345063.XA patent/CN105806200B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6525502B1 (en) * | 1999-09-02 | 2003-02-25 | Aspen Motion Technologies, Inc. | Closed loop control of motor position and velocity |
CN102840874A (en) * | 2011-06-22 | 2012-12-26 | 合康变频科技(武汉)有限公司 | Frequency division method and system for any integer of orthogonal photoelectric encoder |
CN103017800A (en) * | 2011-09-27 | 2013-04-03 | 比亚迪股份有限公司 | Method and device used for decoding orthogonal coding signal |
CN205193510U (en) * | 2015-11-20 | 2016-04-27 | 泉州装备制造研究所 | Novel aircraft electrical power generating system tests platform device |
Non-Patent Citations (2)
Title |
---|
交流伺服系统振动鲁棒M/T测速算法;秦晓飞等;《电机与控制学报》;20100531;第14卷(第5期);第97-103页 * |
正交解码电路和捕获单元在转角和转速测量中的应用;谷海涛等;《检测技术》;20050119;第24卷(第1期);第113-115页 * |
Also Published As
Publication number | Publication date |
---|---|
CN105806200A (en) | 2016-07-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105806200B (en) | A kind of analytic method of encoder | |
CN106197484A (en) | A kind of sine and cosine encoder high-precision signal processing system and method thereof | |
CN104330622B (en) | The frequency measurement method and system of sine wave signal in power system | |
CN103365965B (en) | A kind of aggregation process method and apparatus of data | |
CN101523224A (en) | Realtime spectrum trigger system on realtime oscilloscope | |
Paris et al. | The sinefit spectral envelope preprocessor | |
CN109000689A (en) | A kind of data processing method of absolute photoelectric shaft encoder, system | |
CN103543333A (en) | High-frequency signal phase difference measurement method and device | |
CN104569581B (en) | Multi-level set and single-cycle estimation method of power grid frequency measuring | |
CN110334406A (en) | It is a kind of consider the especially big value of wind speed the Maximum wind speed return period determine method and apparatus | |
CN109308291A (en) | Smoothing method, device, terminal and the computer readable storage medium of map track | |
ATE382229T1 (en) | METHOD AND SYSTEM FOR AUTHENTICATION IN A COMPUTER NETWORK | |
CN105259409B (en) | A kind of frequency power signal computational methods based on zero passage time domain specification | |
Salcic et al. | An improved Taylor method for frequency measurement in power systems | |
CN107124357A (en) | A kind of cloud computing intelligent gateway | |
CN109163752A (en) | The first value-based algorithm of least square method curve matching correction magnetic coder | |
CN106405287A (en) | Dominant harmonic wave source tracking method suitable for daily electric energy quality monitoring system application | |
CN107809345B (en) | Gateway data checking tool, method and device for checking gateway data | |
Baek et al. | Comment on “Six-state clock model on the square lattice: Fisher zero approach with Wang-Landau sampling” | |
CN104061950A (en) | Method for improving decoding precision of digital decoding system of rotary transformer | |
CN107330317A (en) | A kind of terminal unlock method and terminal | |
CN214895457U (en) | DC digital standard power source device | |
JP5631170B2 (en) | Rotational speed measuring device | |
CN103810395B (en) | Computational methods, device and the arranging system of electric network current diagram plant stand node coordinate | |
CN203482176U (en) | Timing point processing apparatus in precise navigation device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |