CN111238547B - Rotation speed calculation algorithm for zero-crossing turnover of position type encoder - Google Patents

Rotation speed calculation algorithm for zero-crossing turnover of position type encoder Download PDF

Info

Publication number
CN111238547B
CN111238547B CN202010061937.5A CN202010061937A CN111238547B CN 111238547 B CN111238547 B CN 111238547B CN 202010061937 A CN202010061937 A CN 202010061937A CN 111238547 B CN111238547 B CN 111238547B
Authority
CN
China
Prior art keywords
data
value
sampling
encoder
unsigned
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
Application number
CN202010061937.5A
Other languages
Chinese (zh)
Other versions
CN111238547A (en
Inventor
孟新光
张健
曹碧生
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Dongfang Electric Automatic Control Engineering Co ltd
Original Assignee
Dongfang Electric Automatic Control Engineering Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Dongfang Electric Automatic Control Engineering Co ltd filed Critical Dongfang Electric Automatic Control Engineering Co ltd
Priority to CN202010061937.5A priority Critical patent/CN111238547B/en
Publication of CN111238547A publication Critical patent/CN111238547A/en
Application granted granted Critical
Publication of CN111238547B publication Critical patent/CN111238547B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G01MEASURING; TESTING
    • G01DMEASURING 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
    • G01D5/00Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable
    • G01D5/12Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable using electric or magnetic means
    • G01D5/244Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable using electric or magnetic means influencing characteristics of pulses or pulse trains; generating pulses or pulse trains
    • G01D5/249Mechanical means for transferring the output of a sensing member; Means for converting the output of a sensing member to another variable where the form or nature of the sensing member does not constrain the means for converting; Transducers not specially adapted for a specific variable using electric or magnetic means influencing characteristics of pulses or pulse trains; generating pulses or pulse trains using pulse code
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01PMEASURING LINEAR OR ANGULAR SPEED, ACCELERATION, DECELERATION, OR SHOCK; INDICATING PRESENCE, ABSENCE, OR DIRECTION, OF MOVEMENT
    • G01P3/00Measuring linear or angular speed; Measuring differences of linear or angular speeds
    • G01P3/42Devices characterised by the use of electric or magnetic means
    • G01P3/44Devices characterised by the use of electric or magnetic means for measuring angular speed
    • G01P3/48Devices characterised by the use of electric or magnetic means for measuring angular speed by measuring frequency of generated current or voltage
    • G01P3/481Devices characterised by the use of electric or magnetic means for measuring angular speed by measuring frequency of generated current or voltage of pulse signals
    • G01P3/489Digital circuits therefor

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Transmission And Conversion Of Sensor Element Output (AREA)

Abstract

The invention discloses an algorithm for calculating the rotating speed of a position type encoder during zero-crossing turnover, which belongs to the technical field of encoders and is characterized by comprising the following steps: a. when the position or the rotating speed needs to be calculated through the position type encoder, the left shift multiple amplification of unsigned shaping data is carried out on the feedback data of the encoder by utilizing the data characteristic of a computer; b. then, converting the signed shaping variable into unsigned shaping data, setting the last sampling value as C1, at the moment, the sampling value is C2, and the interval time of two times of sampling is T; c. and obtaining a sampling interval value through a last sampling value C1-the sampling value C2 at the moment, and dividing the sampling interval value by the corresponding amplification factor to obtain the difference value of the two sampling feedback values of the real encoder. The invention has simple and easy calculation of the rotating speed when the device is turned over at zero passage, is suitable for calculating the rotating speed of the position type encoder with various precisions, and has high calculation precision.

Description

Rotation speed calculation algorithm for zero-crossing turnover of position type encoder
Technical Field
The invention relates to the technical field of encoders, in particular to an algorithm for calculating the rotating speed of a position type encoder during zero-crossing turnover.
Background
In the field of control, the use of a rotating part is often required, and in the automatic control process of the rotating part, the position or rotating speed feedback of the rotating part is an essential link of the whole closed-loop control.
An encoder is a device that compiles, converts, and/or formats signals or data into a form of signals that can be communicated, transmitted, and stored. Encoders convert angular or linear displacements, called codewheels, into electrical signals, called coderulers. The encoder can be divided into a contact type and a non-contact type according to a reading mode; encoders can be classified into an incremental type and an absolute type according to their operation principles. The incremental encoder converts displacement into periodic electrical signals, and then converts the electrical signals into counting pulses, and the number of the pulses is used for expressing the magnitude of the displacement. Each position of the absolute encoder corresponds to a certain digital code, so that its representation is only dependent on the start and end positions of the measurement, and not on the intermediate course of the measurement.
Chinese patent publication No. CN 106849954a, published as 2017, 06, 13 discloses a low power consumption and crosstalk-resistant encoding method for network on chip, comprising the following steps:
(1) each data line of the parallel input data takes four bits as a group of codes, and the codes are divided into two conditions according to the turning condition between adjacent data in the group: if the number of turns is more than 1, the group of data is coded by inverting the first and third bits or the second and fourth bits, and the Flag signal Flag is set to '1'; if the number of times of overturning is less than or equal to 1, the group of data is kept unchanged, and the Flag signal Flag is set to be 0;
(2) performing parallel-serial conversion on the encoded parallel data to obtain low-order parallel data, and temporarily storing the converted parallel data in a register module;
(3) performing bitwise exclusive-or operation on two columns of data adjacent in time sequence in the low-order parallel data, if two or more continuous '1' appear in an operation result, performing exclusive-or operation on a plurality of continuous data bits of which the data after the time sequence corresponds to the continuous '1', if the data is still '1', indicating that '10' → '01' or '01' → '10' appears on adjacent data lines, and setting a crosstalk Flag _ anti crosstalk to '1', thereby judging that the worst crosstalk exists; otherwise, judging that the worst case crosstalk does not exist, and setting a crosstalk Flag bit Flag _ Anticrosstalk to be 0;
(4) corresponding to the data bit of Flag _ Anticrosstalk equal to '1', inserting a mask code B t-1 between two data b t-1 and b t which are adjacent in time sequence, wherein the mask code B t-1 is calculated according to Bt-1, b t-1 and Bt + Bt-1 Bt; corresponding to the data bit of Flag _ Anticrosstalk equal to "0", data b t-1 or b t is inserted between two data adjacent in time sequence, and finally the low-order parallel data and the corresponding mask parallel data are arranged at time sequence intervals and integrated into data to be transmitted with time sequence doubled.
In the encoding method with low power consumption and crosstalk resistance disclosed in this patent document, in view of reducing the number of inversions between data, the number of inversions can be reduced by 37.56% compared to the original data by changing the encoding method of data, but the calculation of the rotation speed is still difficult and the calculation accuracy is poor when the encoder inverts at zero crossing.
Disclosure of Invention
The invention provides an algorithm for calculating the rotating speed of the position type encoder during zero-crossing turnover in order to overcome the defects of the prior art.
The invention is realized by the following technical scheme:
an algorithm for calculating the rotating speed of a position type encoder during zero-crossing turnover is characterized by comprising the following steps of:
a. when the position or the rotating speed needs to be calculated through the position type encoder, the left shift multiple amplification of unsigned shaping data is carried out on the feedback data of the encoder by utilizing the data characteristic of a computer;
b. then, converting the signed shaping variable into unsigned shaping data, setting the last sampling value as C1, at the moment, the sampling value is C2, and the interval time of two times of sampling is T;
c. and obtaining a sampling interval value through a last sampling value C1-the sampling value C2 at the moment, and dividing the sampling interval value by the corresponding amplification factor to obtain the difference value of the two sampling feedback values of the real encoder.
In the step a, the left-shift multiple amplification of the unsigned shaped data specifically means that the data type of the 12-bit encoder is set to be unsigned shaped data of 2 bytes, and the left-shift is 4 bits and the amplification is 16 times.
In the step b, converting the signed shaping variable into the unsigned shaping data specifically means converting the data into signed data of 2 bytes.
In the step C, dividing the sampling interval value by the corresponding magnification specifically means that the rotation speed value is obtained by a formula V ═ C2-C1)/T, and the rotation speed value is reduced by 16 times, so that the real speed value is obtained.
The invention has the beneficial effects that:
a, when the position or the rotating speed needs to be calculated through a position type encoder, the left shift multiple amplification of unsigned shaping data is carried out on the feedback data of the encoder by utilizing the data characteristic of a computer; b. then, converting the signed shaping variable into unsigned shaping data, setting the last sampling value as C1, at the moment, the sampling value is C2, and the interval time of two times of sampling is T; c. and then obtaining a sampling interval value through the last sampling value C1-the sampling value C2 at the moment, dividing the sampling interval value by the corresponding amplification factor to obtain the real difference value of the two sampling feedback values of the encoder, and by fully utilizing the characteristics of an unsigned shaping data format and a signed shaping data format and the characteristic of computer data overflow, the difficulty and the complexity of calculating the position difference and the rotating speed of the encoder during zero-crossing overturning can be effectively avoided.
Drawings
The invention will be further described in detail with reference to the drawings and the detailed description, wherein:
FIG. 1 is a schematic 8-bit signed diagram according to the present invention;
FIG. 2 is a schematic diagram of an 8-bit unsigned display according to the present invention.
Detailed Description
Example 1
An algorithm for calculating the rotating speed of a position type encoder during zero-crossing turnover comprises the following steps:
a. when the position or the rotating speed needs to be calculated through the position type encoder, the left shift multiple amplification of unsigned shaping data is carried out on the feedback data of the encoder by utilizing the data characteristic of a computer;
b. then, converting the signed shaping variable into unsigned shaping data, setting the last sampling value as C1, at the moment, the sampling value is C2, and the interval time of two times of sampling is T;
c. and obtaining a sampling interval value through a last sampling value C1-the sampling value C2 at the moment, and dividing the sampling interval value by the corresponding amplification factor to obtain the difference value of the two sampling feedback values of the real encoder.
Example 2
An algorithm for calculating the rotating speed of a position type encoder during zero-crossing turnover comprises the following steps:
a. when the position or the rotating speed needs to be calculated through the position type encoder, the left shift multiple amplification of unsigned shaping data is carried out on the feedback data of the encoder by utilizing the data characteristic of a computer;
b. then, converting the signed shaping variable into unsigned shaping data, setting the last sampling value as C1, at the moment, the sampling value is C2, and the interval time of two times of sampling is T;
c. and obtaining a sampling interval value through a last sampling value C1-the sampling value C2 at the moment, and dividing the sampling interval value by the corresponding amplification factor to obtain the difference value of the two sampling feedback values of the real encoder.
In the step a, the left-shift multiple amplification of the unsigned shaped data specifically means that the data type of the 12-bit encoder is set to be unsigned shaped data of 2 bytes, and the left-shift is 4 bits and the amplification is 16 times.
Example 3
An algorithm for calculating the rotating speed of a position type encoder during zero-crossing turnover comprises the following steps:
a. when the position or the rotating speed needs to be calculated through the position type encoder, the left shift multiple amplification of unsigned shaping data is carried out on the feedback data of the encoder by utilizing the data characteristic of a computer;
b. then, converting the signed shaping variable into unsigned shaping data, setting the last sampling value as C1, at the moment, the sampling value is C2, and the interval time of two times of sampling is T;
c. and obtaining a sampling interval value through a last sampling value C1-the sampling value C2 at the moment, and dividing the sampling interval value by the corresponding amplification factor to obtain the difference value of the two sampling feedback values of the real encoder.
In the step a, the left-shift multiple amplification of the unsigned shaped data specifically means that the data type of the 12-bit encoder is set to be unsigned shaped data of 2 bytes, and the left-shift is 4 bits and the amplification is 16 times.
In the step b, converting the signed shaping variable into the unsigned shaping data specifically means converting the data into signed data of 2 bytes.
Example 4
An algorithm for calculating the rotating speed of a position type encoder during zero-crossing turnover comprises the following steps:
a. when the position or the rotating speed needs to be calculated through the position type encoder, the left shift multiple amplification of unsigned shaping data is carried out on the feedback data of the encoder by utilizing the data characteristic of a computer;
b. then, converting the signed shaping variable into unsigned shaping data, setting the last sampling value as C1, at the moment, the sampling value is C2, and the interval time of two times of sampling is T;
c. and obtaining a sampling interval value through a last sampling value C1-the sampling value C2 at the moment, and dividing the sampling interval value by the corresponding amplification factor to obtain the difference value of the two sampling feedback values of the real encoder.
In the step a, the left-shift multiple amplification of the unsigned shaped data specifically means that the data type of the 12-bit encoder is set to be unsigned shaped data of 2 bytes, and the left-shift is 4 bits and the amplification is 16 times.
In the step b, converting the signed shaping variable into the unsigned shaping data specifically means converting the data into signed data of 2 bytes.
In the step C, dividing the sampling interval value by the corresponding magnification specifically means that the rotation speed value is obtained by a formula V ═ C2-C1)/T, and the rotation speed value is reduced by 16 times, so that the real speed value is obtained.
The following detailed description is made for the unsigned shaped data format and the signed shaped data format and the avoidance of zero crossing flipping:
1. unsigned shaped data format and signed shaped data format
Taking 8-bit data as an example, the unsigned shaping range is 0 to 255, and the data storage format is the original code:
+1=[00000001]original source
+128=[10000000]Original source
+129=[10000001]Original source
+255=[11111111]Original source
Signed shaping range-127 to +128, data storage format is complement, positive complement equals original code:
-1=[10000001]original source=[11111110]Inverse direction=[11111111]Supplement device
-127=[11111111]Original source=[10000000]Inverse direction=[10000001]Supplement device
It can be seen that: the storage format of the signed data type-1 is the same as the storage format of the unsigned data type 255 [11111111 ]. Signed data type-127 and unsigned data type 129 are stored in the same format 10000001. Thus converting unsigned data type to signed data type 129 will become-127,255 will become-1. The same applies to 16-bit shaped data and 32-bit shaped data.
Applying the above principle, the data is left-shifted to 8-bit, 16-bit or 32-bit data for the data bit length of the encoder, and the data type is converted into signed data.
Taking a 12-bit position encoder as an example: original numerical value range: 0 to 4095. The data was amplified 16 times and the range was changed to: 0 to 65520, the data type is converted to a signed data type. The position encoder has one cycle of: 0,16...32768, -32752... -16,0,16.
2. Avoiding zero crossing over
Two data flip zone numerical difference calculations:
forward direction: 16- (-1) ═ 32 ═ 2 ═ 16;
and (3) reversing: -16-32-2-16;
forward direction: -32752 ═ 65504 ═ 32 ═ 2 × 16;
and (3) reversing: 32752- (-32752) ═ 65504 ═ -32 ═ -2 ═ 16;
and then, the data obtained by calculation is reduced by 16 times, and a real numerical value can be obtained. No matter the forward rotation and the reverse rotation are carried out, the problem of zero-crossing inversion of the encoder data is not considered.

Claims (2)

1. An algorithm for calculating the rotating speed of a position type encoder during zero-crossing turnover is characterized by comprising the following steps of:
a. when the position or the rotating speed needs to be calculated through the position type encoder, the left shift multiple amplification of unsigned shaping data is carried out on the feedback data of the encoder by utilizing the data characteristic of a computer;
b. then, converting the unsigned shaping data into signed shaping data, setting the last sampling value as C1, at the moment, the sampling value is C2, and the interval time of two times of sampling is T;
c. then obtaining a sampling interval value through the sampling value C2-the last sampling value C1 at the moment, and dividing the sampling interval value by the corresponding amplification factor to obtain the difference value of the two sampling feedback values of the real encoder;
in the step a, the left shift multiple amplification of the unsigned shaping data specifically means that the data type of a 12-bit encoder is set as unsigned shaping data of 2 bytes, and the left shift is 4 bits and the amplification is 16 times;
in the step C, dividing the sampling interval value by the corresponding amplification factor specifically means that the rotation speed value is obtained by a formula V = (C2-C1)/T, and the rotation speed value is reduced by 16 times, so that the real speed value is obtained.
2. The algorithm for calculating the rotating speed of the position type encoder during the zero-crossing turnover according to claim 1, is characterized in that: in the step b, converting the unsigned shaped data into signed shaped data specifically means converting the unsigned shaped data into signed shaped data of 2 bytes.
CN202010061937.5A 2020-01-19 2020-01-19 Rotation speed calculation algorithm for zero-crossing turnover of position type encoder Active CN111238547B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010061937.5A CN111238547B (en) 2020-01-19 2020-01-19 Rotation speed calculation algorithm for zero-crossing turnover of position type encoder

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010061937.5A CN111238547B (en) 2020-01-19 2020-01-19 Rotation speed calculation algorithm for zero-crossing turnover of position type encoder

Publications (2)

Publication Number Publication Date
CN111238547A CN111238547A (en) 2020-06-05
CN111238547B true CN111238547B (en) 2022-02-08

Family

ID=70871864

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010061937.5A Active CN111238547B (en) 2020-01-19 2020-01-19 Rotation speed calculation algorithm for zero-crossing turnover of position type encoder

Country Status (1)

Country Link
CN (1) CN111238547B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009284461A (en) * 2008-04-25 2009-12-03 Fujitsu General Ltd Symbol synchronization method and digital demodulator
CN107211164A (en) * 2014-11-12 2017-09-26 弗劳恩霍夫应用研究促进协会 For decoding the decoder of media signal and for encoding the encoder comprising the metadata of main medium data or the auxiliary media data of control data
CN108923711A (en) * 2018-07-02 2018-11-30 沈阳新松智能驱动股份有限公司 A kind of absolute value encoder adjusting zero method of servo-system zero point check and correction
CN109108969A (en) * 2018-08-21 2019-01-01 珠海格力智能装备有限公司 Robot zero point processing method and device

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS62162968A (en) * 1986-01-13 1987-07-18 Hitachi Ltd Speed detecting device
JP3994231B2 (en) * 1997-07-28 2007-10-17 株式会社安川電機 Data conversion circuit
JP4223195B2 (en) * 2000-02-10 2009-02-12 オークマ株式会社 Absolute encoder
US7330137B2 (en) * 2003-12-12 2008-02-12 Mediatek Inc. Method and apparatus for RLL code encoding and decoding
CN101571906B (en) * 2009-06-02 2011-11-16 北京大学深圳研究生院 Decoder and decoding method of RFID receiver
CN102494711B (en) * 2011-12-12 2013-09-25 中国科学院长春光学精密机械与物理研究所 Absolute angular displacement measuring device for photoelectric encoder
CN105823504B (en) * 2016-04-13 2018-05-22 北京航天发射技术研究所 A kind of more zero point processing method of encoder
JP6877168B2 (en) * 2017-02-14 2021-05-26 日本電産サンキョー株式会社 Rotary encoder and its absolute angle position detection method
CN109959400B (en) * 2017-12-25 2021-06-04 深圳市优必选科技有限公司 Method and device for calculating absolute encoder parameters and terminal equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009284461A (en) * 2008-04-25 2009-12-03 Fujitsu General Ltd Symbol synchronization method and digital demodulator
CN107211164A (en) * 2014-11-12 2017-09-26 弗劳恩霍夫应用研究促进协会 For decoding the decoder of media signal and for encoding the encoder comprising the metadata of main medium data or the auxiliary media data of control data
CN108923711A (en) * 2018-07-02 2018-11-30 沈阳新松智能驱动股份有限公司 A kind of absolute value encoder adjusting zero method of servo-system zero point check and correction
CN109108969A (en) * 2018-08-21 2019-01-01 珠海格力智能装备有限公司 Robot zero point processing method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
反射式光电编码器;王显军;《光学精密工程》;20131231;第21卷(第12期);第3066-3071页 *
增量式编码器自动检测系统;杜颖财等;《电子测量与仪器学报》;20121130;第26卷(第11期);第993-998页 *

Also Published As

Publication number Publication date
CN111238547A (en) 2020-06-05

Similar Documents

Publication Publication Date Title
US6433725B1 (en) High speed analog-to-digital converter
CN108362208A (en) A kind of pseudorandom code channel grating scale and its read method
JPH08298463A (en) Digital absolute position encoder
CN103512598B (en) a kind of absolute type matrix encoder
CN101552607B (en) Method and system for bit polarization coding
CN103528612A (en) Method for increasing resolution ratio of absolute rotary encoder
CN106773897B (en) A kind of method that absolute encoder signal is converted to incremental encoder signal
CN203964930U (en) A kind of optomagnetic scrambler
CN109361390A (en) For sampling time error correction module and method between time-interleaved ADC channel
CN111238547B (en) Rotation speed calculation algorithm for zero-crossing turnover of position type encoder
CN103983291A (en) Photomagnetic coder and coding method thereof
FI64998C (en) MAETVAERDEOMVANDLARE FOER ROTATIONSPOSITION AV EN ROTERANDE AXL
CN104655156B (en) A kind of error compensating method of the absolute type code-disc of matrix form coded system
US4384275A (en) High resolution and wide range shaft position transducer systems
CN100546206C (en) A kind of circuit and method of decoding of realizing
CN208282777U (en) A kind of pseudorandom code channel grating scale
Denic et al. Code reading synchronization method for pseudorandom position encoders
CN111289015A (en) Multi-resolution absolute position measuring device
CN102291145A (en) Analogue-to-digital conversion method based on Gray encoding and absolute value algorithm
CN111006697B (en) Position data processing and transmission control system, method and application of encoder
CN110620584A (en) Method for collecting and processing encoder signals
CN103414471A (en) Method for improving measurement stability of integral nonlinearity and differential nonlinearity of D/A converter
JPS63187117A (en) Rotary encoder
JP2536490B2 (en) Run-length encoding device
SU493019A1 (en) Adaptive analog-to-digital converter

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