On-line actual error compensation system of sine and cosine encoder
Technical field
The present invention relates to a kind of scrambler precision compensation system, relate in particular to a kind of on-line actual error compensation system of sine and cosine encoder.
Background technology
The scrambler of emerging in recent years product sine and cosine output is good with its precision, the subsequent treatment simple and fast, and numerical value is directly perceived easy-to-use to be widely used at numerical control field, and the scrambler of sine and cosine output is the equilibrium product of high resolving power high-precision low cost, and a lot of advantages are arranged:
1, output waveform comprises relative phase information, therefore can utilize specific method of interpolation to realize that resolution improves greatly, and need not improve the physics groove.
2, the scrambler output spectrum of sine and cosine output is purer, and the special composition of frequency spectrum is few, therefore is fit to transmission at a distance more than square wave output and absolute value output coder, and it is little to decay, distance.
3, under identical mathematics resolution, the scrambler that the physics groove is exported than the square wave formula lacks a lot, and higher rotating speed can be provided.
Based on above characteristics, sine and cosine encoder is used by a large amount of in a lot of middle-grade extremely high-grade numerically-controlled machines and mapping system.(content of another patent that this technology reports for applicant simultaneously, particular content is introduced below through subdivide technology.) can improve the resolution (ranging up to up to ten thousand times) of sine and cosine output type encoder greatly.But really can't improve the precision of sine and cosine output type encoder; Because precision is fixed after the production of sine and cosine output type encoder is accomplished again; The scrambler factory chamber of commerce is divided into different class according to different precision with the sine and cosine output type encoder; The price that precision is high more is expensive more, and the extra high kind of precision is also to China embargo, and the device or the system that compensate for low precision product are not developed at present as yet; So a kind of novel subdivision system with accuracy compensation function is badly in need of being developed, and solves the problem how low precision encoding device improves precision.
Above-mentioned subdivide technology particular content as shown in Figure 1 is following: a kind of sine and cosine subdividing device; At first; Difference benefit cycle generation module produces the computation period pulse signal of whole device, starts the execution of carrying out each order with the clock period according to the rules in order to control device; Then; Sine and cosine data sampling and computing module are used for the two-way cosine and sine signal of received code device output, and (the two-way cosine and sine signal is A; B phase or C; The D phase signals), the magnitude of voltage of this two-way cosine and sine signal is carried out the A/D conversion of 12 (or 14) earlier, just can obtain the pairing digital quantity of magnitude of voltage of this two-way cosine and sine signal.This digital quantity is that 12 A/D converters obtain, so accessible maximum segmentation multiple is 12 powers of 2, and promptly 4096 times.The maximum that in like manner can reach with 14 A/D converters is segmented 16384 times of multiples; Computation process wherein is; The digital quantity of the magnitude of voltage of the two-way cosine and sine signal that sampling process is obtained carries out the operation of division, promptly with the digital quantity of the digital quantity after the A phase signals A/D conversion after divided by B phase signals A/D conversion (or the digital quantity after changing divided by D phase signals A/D of the digital quantity after changing with C phase signals A/D).Wherein the decision of the figure place of A/D is the maximal value of segmentation multiple, and the segmentation multiple maximum like 12 A/D can reach 4096 times.Also can realize littler 2048,1024,512,256,128,64,32 times than it.
Complete cycle, computing module was used for the cosine and sine signal of scrambler input is carried out the counting of complete cycle.Computing module complete cycle of cosine and sine signal; The cosine and sine signal of scrambler output is carried out the counting of complete cycle, and scrambler rotates a circle, and the increment of count value equals the line number of scrambler; To filtering to be carried out to input signal, the hysteresis phenomenon of waveform complete cycle be handled.
Method through a kind of digital filtering (be exactly under the clock control of a high frequency high level (or low level) to square-wave signal repeatedly sample, get most situation.(as to high level sampling 5 times and since disturb once be 0, four time be 1, just think that the result is 1)), high frequency interference is filtered out, in case complete cycle, deviation appearred in count value.Wherein, The hysteresis phenomenon of handling waveform complete cycle comprises that the sine and cosine ripple of wanting input carries out counting complete cycle, will align cosine wave (CW) earlier and carry out the square wave shaping, realizes through comparer; (be exactly that the voltage of cosine and sine signal is when being higher than certain value; Like 2.5V, just be made into high level, just be made into low level when being lower than 2.5V) also be method in common very.(this is the processing to waveform complete cycle).Otherwise can't count.Shaping is carried out counting operation after accomplishing, and the part that needs in the meantime to lag behind compensates.
The sine and cosine ripple carries out shaping and is included on the pure hardware foundation waveform is become tractable form, but in this course, the waveform generation that new waveform will be imported relatively lags behind.Need the lagged value of complete cycle be compensated when computation of Period is carried out in this hysteresis for solving; A synchronizing signal that obtains in sampling through the AD output valve and the computing module; Lagged value is compensated calculating, thereby make the complete cycle count value can be because of lag behind producing error.
Data after wherein sine and cosine data sampling and computing module are handled are given table look-up module, by table look-up module according to the division value of the two-way sine and cosine wave voltage value digital quantity of interior storage the tables of data of corresponding segmentation value compare, obtain the segmentation value with this.Owing to obtain their digital quantity after the A of input, B two phase cosine and sine signals change through A/D.Computation process is that these two digital quantities are carried out divide operations; This division the value that arrives with the sampling A; The value of B phase signals has been confirmed this division value jointly in the uniqueness of a sine and cosine in the cycle, thus carry out operation specific as follows with the division value that realizes two-way sine and cosine wave voltage value digital quantity the formation of tables of data of corresponding segmentation value:
Be subdivided into example with 32 times and describe, get phase differential and be 90 ° of two-way sine and cosine ripple e and f (A and B mutually or C be 90 ° with the phasic difference of D phase signals phase), the phase place of e is ahead of 90 ° of f, and (A is ahead of 90 ° mutually of B mutually; C is ahead of 90 ° of D phases), their amplitude is M, when using 12 A/D converters; A, the amplitude of B phase cosine and sine signal is 4096, therefore getting M is 4096; In the time of should using 14 A/D converters together, the value of M gets 16384, so just can guarantee the e that is got; F sine and cosine ripple and A, B phase cosine and sine signal (or C, D phase cosine and sine signal) in full accord on amplitude and phase place.Also just can guarantee e, f sine and cosine ripple and A, the division value that B phase cosine and sine signal (or C, D phase cosine and sine signal) is calculated on same position is identical.With e, what the one-period of f was impartial is divided into 32 parts, gets e; The range value of starting point of each part and terminal point carries out division (with e divided by f in 32 parts in the f sine and cosine ripple; This is corresponding divided by B with A) because first section terminal point is second section a starting point, so obtained the result of 32 divisions; Numerical value after the division is formed a table, be stored in the table look-up module.
The process of searching is the process of a comparison; Sampling and computing module obtain an A each time; After the result of division of the digital quantity after B phase cosine and sine signal is changed through A/D, this result is compared big or small operation with 32 data of having stored in the table, after relatively, can find A this time; B phase cosine and sine signal can be in 32 sections between a certain section the starting point division value and terminal point division value through the result of division of the digital quantity after the A/D conversion; Suppose that the segmentation value that obtains so is exactly 5 between the 5th section starting point division value and terminal point division value, after give summation module to carry out trying to achieve of occurrence.
The operation that summation module carries out is; Earlier with complete cycle counting module resulting to A; The count value of the complete cycle of B phase cosine and sine signal multiply by current segmentation multiple, the current A that finds with result behind this multiplication and table look-up module then, and the segmentation value of B phase cosine and sine signal is carried out add operation; With the selection of selecting module after complete cycle, calculated value and segmentation value were sued for peace through output mode, with the form output of pulse or with the form output of absolute value.
Output mode selects module to select the instruction of load module input to carry out the switch operating of output mode according to parameter, and when selecting pulsed output mode, this module passes to pulse output module with the result of the addition that summation module finally obtains; When selecting the absolute value output mode, this module passes to the absolute value output module with the result of the addition that summation module finally obtains equally.
The pulse mode output module is used for output mode is selected exporting with the form of pulse according to the definite umber of pulse of addition results of module input; Implementation procedure is following: for example: suppose that the difference benefit cycle is 800ns; The outcome record of output mode being selected the addition that summation that module passes over and module finally obtain in the starting point in this cycle once; Write down the result that output mode is selected the addition that summation that module passes over and module finally obtain again in the end point in this cycle then; Deducting the resulting numerical value of the previous record data that obtain with a back data recorded is exactly the pulse number that will export; The clock period of a pulse that just can obtain divided by the pulse number that will export exporting with 800ns then is at last with these pulses continuous output in 800ns.
The result of the addition that the summation module that output mode selects module to pass over finally obtains is exactly the absolute position data that will export.These data are exported through the mode of serial data transmission; The result who is about to the addition that summation module that output mode that the absolute value output module receives selects module to pass over finally obtains changes into binary data, then from the low level of data to high position output successively.
Parameter is selected load module, provides user selected parameter information to be read in the system, and then according to this information, the certain module of controlling the segmentation special chip carries out the switching of corresponding work mode according to user's selection.
1, parameter selects load module with A; Whether B phase cosine and sine signal needs the information of transposition to pass to sampling and computing module; Sampling just can be carried out A according to this information with computing module like this, and whether B phase cosine and sine signal the operation of transposition, and the benefit of so doing is that the personnel when the connection signal wire will be input to A phase signals in the code device signal line that segments device and receive B and go up mutually; When the B phase signals is received A and is gone up mutually; Can be from new wiring, through segmenting device special chip customer parameter input mode fast with A, B phase cosine and sine signal transposition.
2, parameter selects load module that the information of the needed segmentation multiple of user is passed to table look-up module, table look-up module just can according to this information generate the customer requirements selection the segmentation multiple form.
3, parameter selects load module that the information of the needed segmentation multiple of user is passed to summation module, and the segmentation multiple that the count value of complete cycle multiply by in the summation module just can obtain according to this letter.
4, parameter is selected load module that the needed output mode information of user is passed to output mode and is selected module, and output mode selects module just can carry out the switch operating of output mode according to this information.
Summary of the invention
The present invention is directed to the proposition of above problem; A kind ofly be the basis and develop with sine and cosine output type encoder subdivide technology; In the segmentation process that the sine and cosine output type encoder is improved resolution, error is compensated, thus the precision of raising encoder feedback value.The concrete technological means that adopts of the present invention is following:
The online actual error compensation method of a kind of sine and cosine encoder is characterized in that
1) circular index appearance and the angle-differentiated mirror with laser interferometer partly is installed on the turning axle of motor;
2) electric system is carried out the setting of test point, promptly set each test rotation angle value, simultaneously laser interferometer is also carried out the setting of equal appearance;
3) electric system is passed the segmentation value according to low precision sine and cosine output type encoder back through the segmentation device, carries out the control to the motor anglec of rotation, and laser interferometer detects the anglec of rotation simultaneously;
4) through after the week, laser interferometer is directly poor with the standard value of each test point measured value and laser interferometer inside, forms graph of errors;
5) can obtain the relative error value of low precision sine and cosine output type encoder one all arbitrfary points according to this graph of errors;
6) error amount that step 5 is obtained makes errors table, as the offset of each position of low precision sine and cosine output type encoder output, the error of low precision encoding device is revised.
Also comprise the step that the compensating error value is revised, specific as follows:
A) errors table is input in the segmentation device of low precision sine and cosine output type encoder; Continue above-mentioned 1 to 4 step; When electric system is rotated angle control, the absolute position value of hanging down each test point of precision sine and cosine output type encoder is worth corresponding modified value addition at errors table with current absolute position;
B) form graph of errors through laser interferometer, obtain error amount again;
C) whether the error amount of each test point of obtaining of determining step b satisfies the accuracy requirement of setting, satisfied then with the errors table that obtains in the above-mentioned steps to get as the errors table that finally hangs down precision sine and cosine output type encoder; Do not satisfy and then return above-mentioned steps 1 from newly hanging down obtaining of precision sine and cosine output type encoder errors table.
A kind of sine and cosine encoder accuracy compensation device comprises:
Difference benefit cycle generation module,, be used to produce the cycle sequential of starting impulse signal and the operation of whole device;
Sine and cosine data sampling and computing module; The two-way cosine and sine signal that is used for the output of received code device; And the magnitude of voltage of this two-way cosine and sine signal carried out the A/D conversion; Obtained the pairing digital quantity of magnitude of voltage of this two-way cosine and sine signal, the operation of division is carried out to the digital quantity of the magnitude of voltage of the two-way cosine and sine signal of sampling acquisition in the back;
Complete cycle, computing module was used for the cosine and sine signal of scrambler input is carried out the counting of complete cycle;
Table look-up module, the data after being used for sine and cosine data sampling and computing module handled, with the division value of the two-way sine and cosine wave voltage value digital quantity that stores in the table look-up module the tables of data of corresponding segmentation value compare, obtain the segmentation value with this;
Output mode is selected module, is used for carrying out according to the instruction of input the switch operating of output mode, and when selecting pulsed output mode, this module passes to pulse output module with the result of the addition that summation module finally obtains; When selecting the absolute value output mode, this module passes to the absolute value output module with the result of the addition that summation module finally obtains equally;
The pulse mode output module is used for output mode is selected exporting with the form of pulse according to the definite umber of pulse of addition results of module input;
The absolute value output module is used for output mode is selected directly exporting with the form of data according to the definite umber of pulse of addition results of module input;
It is characterized in that also comprising: the errors table storage module is used to store the error amount of sine and cosine output type encoder one all arbitrfary points that said method obtains;
Summation module; The error amount of the segmentation value relative error table storage module of the current cosine and sine signal that is used for table look-up module is found directly or the offset that adds up after calculating of error amount, the result who multiply by behind the current segmentation multiple with the resulting scrambler input of counting module complete cycle cosine and sine signal number complete cycle carries out add operation;
Said sine and cosine data sampling and computing module and computation of Period module are connected with scrambler and carry out synchronized sampling, said sine and cosine data sampling and computing module with complete cycle computing module be connected and send synchronizing signal to it; Said poor benefit cycle generation module is connected with computing module with the sine and cosine data sampling and sends the starting impulse signal to it, and said sine and cosine data sampling is connected with table look-up module with computing module; Said complete cycle computing module will count the input of record scrambler complete cycle cosine and sine signal number send in the connected summation module; The segmentation value of the current cosine and sine signal that said summation module is found connected table look-up module; Offset after the error amount of the errors table storage module that is connected with summation module adds up multiply by current segmentation multiple value with the input cosine and sine signal complete cycle number that complete cycle, computing module sended over sue for peace after; Sending to connected output mode selects on the module; Select the selection of module through output mode after, directly export with data mode with the form output of square wave or by the absolute value output module by the pulse mode output module.
Comprise that also individual pen counting module complete cycle is connected with summation module, be used for counting operation but the count value of this module is carried out zero clearing when scrambler zero crossing complete cycle cosine and sine signal.
Each is formed module and all is integrated in the on-site programmable gate array FPGA.
Behind the subdivide technology of having grasped the sine and cosine output type encoder; In the process of segmentation, will hang down the error of precision encoding device generation revises; Just can obtain the identical effect of high precision sine and cosine output type encoder under the prerequisite cheaply; Thereby improve the precision of using this encoder device, also can break the embarrassment that can't obtain high precision sine and cosine output type encoder.
System-on-a-chip is to concentrate design on same chip the armamentarium of electronic system, through certain coordination system each equipment in the system is carried out cooperation management, realizes to reach system-level function.System-on-a-chip generally has characteristic of simple structure; The design process of system-on-a-chip is also simplified and accelerated to silicon intellectual property nuclear multiplex technique simultaneously; Both can increase and decrease applied function module easily, and can make upgrading and modification become more easy again according to real needs.In addition, invent said method implement simple, result of use is good, and has good adaptability.Its apparatus structure is simple, not only is convenient to produce, and position measurement, measurement of angle, the motion control field that is suitable in all use cosine and sine signal outputs with low cost, extensively promote like fields such as numerically-controlled machine, high-precision surveying instruments.
Description of drawings
Fig. 1 is the structural representation of the said subdividing device of background technology;
Fig. 2 is for adopting the system architecture synoptic diagram of the online actual error compensation method of sine and cosine encoder;
Fig. 3 is the structural representation of sine and cosine encoder accuracy compensation device according to the invention;
Fig. 4 is for adopting the online actual error compensation method of sine and cosine encoder process flow diagram;
The curve map of Fig. 5 for being linked to be without the error testing point before the over-compensation and these test points among the embodiment;
The error curve diagram of Fig. 6 for after over-compensation, recording once more among the embodiment.
Embodiment
As shown in Figure 3, the employed device of this system comprises: difference benefit cycle generation module, sine and cosine data sampling and computing module, complete cycle computing module, table look-up module, output mode is selected module, pulse mode output module and absolute value output module.Its function and structure are not just being described with the identical of the subdividing device of being introduced in the background technology here.Different being increased the errors table storage module newly, is used to store the error amount of sine and cosine output type encoder one all arbitrfary points that said method obtains; Summation module originally becomes; Offset after the error amount of the segmentation value relative error table storage module of the current cosine and sine signal that table look-up module is found adds up, the result who multiply by behind the current segmentation multiple with the resulting scrambler input of counting module complete cycle cosine and sine signal number complete cycle carries out add operation.In addition, also be provided with individual pen counting module complete cycle and be connected, be used for counting operation but the count value of this module is carried out zero clearing when scrambler zero crossing complete cycle cosine and sine signal with summation module for being used this device.
The above-mentioned module of respectively forming all is integrated in the on-site programmable gate array FPGA or with form design of each module by FPGA and is integrated in the single-chip.
Introduce the compensation method that this system adopts below:
Like Fig. 2, Fig. 3 and shown in Figure 4; A kind of in addition compensation method is the online actual error compensation method of sine and cosine encoder; The procurement process that is different from error in the accuracy compensation work of scrambler own; The acquisition of the graph of errors in the accuracy compensation work of scrambler own is that low precision encoding device segmentation value deducts high-precision encoder segmentation device value; The operation of this subtraction is to be undertaken by the receiving equipment that segments the device output valve, carries out subtraction after the absolute position value that two segmentation devices of segmentation device output valve receiving equipment reception are exported and sends out operation; In the actual error compensation; Laser interferometer directly reads error on the electric machine rotational axis, and (this error comprises the trueness error of scrambler itself; Comprise the electromechanics part simultaneously; The scrambler installation waits other error), laser interferometer is directly poor with the standard value of this measured value and laser interferometer inside then, forms graph of errors then.These operations fetch the graph of errors that provides according to laser interferometer and carry out in segmentation device inside just identical with the work of the accuracy compensation of scrambler own to compensation of error work all in the inner completion of laser interferometer.Its process is specific as follows:
Circular index appearance and the angle-differentiated mirror part of 1) laser interferometer correctly being installed according to the laser interferometer instructions is on the turning axle of motor, and this is that laser interferometer is carried out the preliminary work that the motor rotation error is measured.
2) electric system is carried out the setting of test point, promptly set each test rotation angle value, simultaneously laser interferometer is also carried out the setting of equal appearance;
3) electric system is passed the segmentation value according to low precision sine and cosine output type encoder back through the segmentation device, carries out the control to the motor anglec of rotation, and laser interferometer detects the anglec of rotation simultaneously;
4) through after the week, laser interferometer is directly poor with the standard value of each test point measured value and laser interferometer inside, forms graph of errors;
5) can obtain the relative error value of low precision sine and cosine output type encoder one all arbitrfary points according to this graph of errors;
6) error amount that step 5 is obtained makes errors table, as the offset of each position of low precision sine and cosine output type encoder output, the error of low precision encoding device is revised.
Be similarly the correctness of the errors table that guarantees to obtain, also need revise the compensating error value, specific as follows:
A) errors table is input in the segmentation device of low precision sine and cosine output type encoder; Continue above-mentioned 1 to 4 step; When electric system is rotated angle control, the absolute position value of hanging down each test point of precision sine and cosine output type encoder is worth corresponding modified value addition at errors table with current absolute position;
B) form graph of errors through laser interferometer, obtain error amount again;
C) whether the error amount of each test point of obtaining of determining step b satisfies the accuracy requirement of setting, satisfied then with the errors table that obtains in the above-mentioned steps to get as the errors table that finally hangs down precision sine and cosine output type encoder; Do not satisfy and then return above-mentioned steps 1 from newly hanging down obtaining of precision sine and cosine output type encoder errors table.
Be approximately a line segment (1 qualified scrambler should satisfy this condition) between per two error points; (as shown in Figure 5, the coordinate of two error points of A section is respectively (120 ,-25) and (132 just can to calculate the slope of this line segment according to these two error point horizontal ordinates and ordinate;-17); Slope is 2/3 like this), can calculate the error amount of arbitrfary point between these 2 according to slope then, thereby calculate the error amount in the complete cycle (scrambler rotates a circle).If the limited error amount that just can directly calculate each segmentation value of multiple of segmentation, and it is stored in the errors table; Multiple is bigger when segmenting; The errors table of the error amount of segmentation value is also just huger relatively; For avoiding this situation to take place; Adopt following method simplification error table: the error point coordinate that obtains is stored in the errors table storage module, just can calculate the angle value (horizontal ordinate of current encoder dwell point) that current encoder was rotated apart from zero point, the horizontal ordinate of error point in the horizontal ordinate of current point and the errors table is compared operation according to individual pen count value complete cycle; In the time of between the horizontal ordinate of the horizontal ordinate of current point certain two adjacent error point in errors table; Just confirmed that current point these two adjacent error in errors table put on the formed line segment, the slope of this line segment is calculated by the starting point and the end point coordinate of this line segment, knows the horizontal ordinate of current point again; So can calculate the ordinate of current point, just current error amount.
Revised absolute position value is to add that by the absolute position value current encoder is apart from the description according to the principle of work of segmentation device of the offset of the angle of zero point rotation; What obtain at last in the summation module is the absolute position value (be count complete cycle multiply by current segmentation multiple add current segmentation value) of current encoder operation; Can confirm the angle of scrambler according to individual pen count value complete cycle apart from the rotation at zero point; With 2048 line scramblers is example; The complete number of turns that complete cycle, count value equaled the current operation of scrambler multiply by 2048 adds the individual pen count value of complete cycle, individual pen count value complete cycle and complete cycle count value be plus-minus synchronously.So it is the offset that is added the angle that current encoder was rotated apart from zero point by the absolute position value that the scrambler that can calculate according to the count value of individual pen complete cycle, is confirmed revised absolute position value apart from the angle value of rotation at zero point.
The net result of summation module computing becomes revised absolute position value, carries out repetition error before then and measures step.The segmentation value of high precision sine and cosine output type encoder for example: within a week of scrambler rotation, get several test points, on each test point, get low precision sine and cosine output type encoder and error respectively and be ± 1 ".
Then that two values are poor, obtain low precision sine and cosine output type encoder and be ± 1 with respect to error " the relative error value of high precision sine and cosine output type encoder.
With being approximately a line segment between two test points; Connect at adjacent 2 and obtain the graph of errors that low precision sine and cosine output type encoder rotates a circle, can calculate the relative error value of low precision sine and cosine output type encoder one all arbitrfary points according to graph of errors.Again obtain new errors table, analyze new errors table data then, see and whether will satisfy accuracy requirement; The physical accuracy of supposing low precision encoding device is ± 35 " (curve that records is as shown in Figure 5), the precision that requires to be adapted to are ± 5 ", after through the first-order error compensation; The new graph of errors that records satisfies ± 5 " during the precision of (as shown in Figure 6), compensation behaviour accomplish, after carrying out the first-order error compensation; the new error Qu Jingdu that records is greater than ± 5 "; So just carry out secondary correction work according to new graph of errors, the requirement of precision is satisfied in so cycling up to graph of errors.
The scrambler one all corresponding unique error correction values in optional position in week like this, thus the precision of low precision sine and cosine output type encoder well improved.
The above; Be merely the preferable embodiment of the present invention; But protection scope of the present invention is not limited thereto; Any technician who is familiar with the present technique field is equal to replacement or change according to technical scheme of the present invention and inventive concept thereof in the technical scope that the present invention discloses, all should be encompassed within protection scope of the present invention.