Summary of the invention
Purpose of the present invention is a contact measuring apparatus in order to solve existing numerically-controlled machine exactly, measuring workpieces statically, can't combine with digital control system on-line measurement is provided, processing is separated with technology, is finished respectively by different staff, the problem that causes the technological design cycle stretch-out, provide a kind of and have configuration rationally, the automaticity height, cost is lower, be easy to effectively to shorten the numerically controlled lathe intelligence control system and the control method thereof of advantages such as technological design cycle with existing lathe combination.
For achieving the above object, the present invention has adopted following technical scheme: a kind of intelligence control system of numerically controlled lathe, it is made up of numerically controlled lathe, host computer, slave computer, its adopts host computer and the open control system of slave computer composition, is finished by host computer promptly that the extraction of CAD graphical information, cutter path intelligent planning, technological parameter data base optimization, numerical control code generate automatically, the task of machining simulation;
Slave computer is installed on the numerically controlled lathe, carries out on-line measurement, Electric Machine Control, and the processing of workpiece is finished in straight line, circular interpolation computing;
Get in touch by the USB serial communication between host computer and slave computer;
Also have photoelectric detection system on numerically controlled lathe, this photoelectric detection system is connected with slave computer, and can workpiece be positioned and dimensional measurement not contacting under the revolving body workpieces condition, then metrical information is fed back to host computer, realizes online detection.
Described host computer is the PC computing machine, and described slave computer is that model is the dsp chip of TMS320LF2407A, and described USB serial communication is the high speed USB chip that has parallel bus and local DMA transmittability, and its model is PDIUSBD12.
Described photoelectric detection system comprises handle of a knife on the lathe saddle that is installed in numerically controlled lathe for it, and the cutter head that is connected with handle of a knife, and at the photoelectric detector that inboard, cutter head two opposite end has at least one pair of to match, photoelectric detector is connected with slave computer.
Described cutter head is the U type, and photoelectric detector is a pair of laser diode and photodiode, is installed in the relevant position of two parallel relatively end inboards of cutter head respectively.
A kind of intelligence control method of numerically controlled lathe, its step is:
The a host computer extracts the CAD graphical information;
The b slave computer is waited for the numerically controlled lathe initialization order of host computer;
The c host computer sends measuring command by the USB serial communication to slave computer, and obtains the metrical information of feedback; Slave computer starts original dimension and the locating information that measurement function obtains workpiece, and feeds back to host computer;
The d host computer based on the gained metrical information to cutter path carry out intelligent planning, based on intelligent technological data bank select working process parameter, generate numerical control code, machining simulation and numerical control code inspection automatically, the numerical control code that will check sends slave computer to and controls and monitor the slave computer duty;
The e slave computer receives numerical control code, and the control motor is by the numerical control instruction operation, finishes the status information of digital control processing in will processing simultaneously and feeds back to host computer;
After f machined, host computer started measurement function once more, and workpiece size and shape are detected automatically, realized the ACTIVE CONTROL of crudy;
The g slave computer is accepted to start once more after the host computer order measurement function quality states such as the critical size of workpiece and shape is carried out online detection, and the feedback host computer.
Host computer reads the Drawing Interchange File DXF in the CAD drawing in described step a, judges whether to be entity section when reading, and promptly constitutes the coordinate of each entity of profile, if entity section judges that then entity type is straight line, circle or circular arc; If straight line then will extract the starting point and the terminal point coordinate of straight line; If circular arc then will extract the coordinate in the center of circle and the radian value of radius and start, end; Because the order of entity information is the series arrangement when drawing in the DXF file, therefore need sort, and reformulates the profile of part;
In described steps d,, promptly set up the outline description chain of part to be processed to the cutter path intelligent planning; Friendship is asked in skew piecemeal then, carries out topology and checks to eliminate the selfing of skew profile; Adopt parallel merging and equal space line cutting optimization method to get final machining locus at last, generate cutter location file;
Select working process parameter based on intelligent technological data bank, after it contrasts according to the data in processing conditions parameter and the technological data bank, choose reasonable cutting technology parameter and corresponding cutter parameters;
Numerical control code generates automatically, host computer reads in cutter location file line by line, judgement is a technological parameter, or processing entity, if technological parameter is then noted its numerical value, if processing entity then writes down its type, parameters such as starting point and terminal point, according to the call format of used digital control system, write in the numerical control code file;
Machining simulation and numerical control code inspection, it is tested to whole numerical control program correctness, is the inverse process that generates the processing instruction, is about to numerical control program and is converted into graphic file, and it is showed.
In described step c, slave computer control photoelectric detection system carries out the surveying work process and is, at first, numerically-controlled machine starts back tool rest and returns lathe zero point earlier, and make measurement mechanism be in the working position by the tool changing order, be measurement mechanism towards to be processed, promptly set up the position of measurement mechanism in lathe coordinate system this moment; X for workpiece revolution class machining tool workpiece coordinate system is that the centre of gyration overlaps with the lathe coordinate system initial point to initial point usually;
Secondly, determine the position of workpiece coordinate system initial point in lathe coordinate system, it comprises that workpiece coordinate system X is to true origin determining in the lathe coordinate system position, measurement mechanism with knife rest along Z to moving to the most close spindle chuck position, this position control system can be provided with, Z is to stop motion, then knife rest along X to close to workpiece, in this process, because blocking of workpiece, optical signals will inevitably take place at the optical pickup apparatus place has to nothing, the process of growing out of nothing again, and then be converted into voltage from low to high, process from high to low again, be that change in voltage exists one to go up jumping edge and a negative edge, this variation can cause the capture interrupt of slave computer, in this way, system can survey the position of level saltus step place, and the outline position place of workpiece just, the position of level saltus step place, the saltus step of twice level, two coordinate figure X1 that can make that two profiles of system log (SYSLOG) workpiece make progress at lathe coordinate system X and X2, workpiece coordinate system initial point X0=(X1+X2)/2 then, the diameter D=(X2-X1)/2 of workpiece;
Workpiece coordinate system Z is to true origin determining in the lathe coordinate system position, in previous step is rapid, owing to determined X0, then knife rest along X to laser beam emitting device being adjusted to the X0 position, this moment, X was to stopping, then knife rest along Z to moving to its positive dirction, when the measuring position is in the end face of workpiece, the optical signals at optical pickup apparatus place does not have to having, when electric signal changes from high to low, system detects the Z of saltus step place of level to the position, its be workpiece coordinate system Z to true origin in the lathe coordinate system position;
Once more, the mensuration of workpiece size, the mensuration process of workpiece size, the process of setting up of identical workpiece coordinate system can be determined the overall size information of any position workpiece;
At last, after measurement finished, knife rest returned the tool changing point, makes the knife rest transposition by the tool changing order, and the cutter that subsequent processing is used is in the place, working position, carries out normal cut then and gets final product.
In described step e, the slave computer pre-service finishes and calculates its call parameter, optimizes the path according to host computer then and carries out interpolation calculating, calculates interpolation data in real time, and sends into output module, moves with drive motor.
Described interpolation is calculated and is adopted the data sampling interpolation, comprises linear interpolation and circular interpolation method.
The present invention adopts host computer+slave computer (PC+NC) to constitute open architecture, select for use high-speed dsp to finish the slave computer kernel task of real-time as CPU, realize motor control and online detection in real time, and finish the task of non real-time by host computer, extract such as the graphical information in the programming module, realize the mutual of upper and lower machine information by the USB serial communication.A kind of contactless optical electrical measurement of the creationary design of system has realized the automatic foundation of workpiece coordinate system; And, realize that tool dimension compensates automatically by the process dimension to workpiece in the process is carried out online detection; And after process finishing to the automatic detection of workpiece size and shape, realize the ACTIVE CONTROL of crudy; Employing makes full use of the geological information of the AUTOCAD figure of extraction based on the automatic programming system of figure, and in conjunction with the real profile information of obtaining by measurement, plans the turning machining path automatically, realizes automatic programming function.By introducing measuring system, improved precision, production efficiency and the automaticity of numerically controlled lathe, make that based on the machining path planning function of measuring the process operation of numerically controlled lathe is easier simultaneously, it is intelligent that numerically controlled lathe has been had.By enforcement of the present invention, can improve the production efficiency of numerically controlled lathe, promote the level of intelligent and robotization, reduce requirement to operating personnel, help realizing intelligent control.Advantage of the present invention also has, and contactless fast on-line measurement device has easy for installationly, uses flexibly, makes easily, and is with low cost; Metrical information directly feeds back to host computer, by its intelligent planning of realizing the cutter machining path, can reduce the intervention of workman to the numerical control process; Technology and processing are combined, and the intelligence learning function by interactively technological parameter selection or technological data bank can add technological design in the digital control processing process easily, has greatly shortened the technological design cycle; CAD graphical information abstraction function and automatic programming function, exempted the programming of traditional G code, can reduce numerically controlled lathe operating personnel's labor capacity, make numerical control turning processing easier.
Embodiment
The invention will be further described below in conjunction with accompanying drawing and embodiment.
Fig. 1 has provided the composition of control system of the present invention.It has host computer 1, and host computer 1 is a computing machine; Slave computer 2 is the control device on the numerically controlled lathe, and it is the dsp chip of TMS320LF2407A for model; It is to have adopted the high speed USB that has parallel bus and local DMA transmittability that 2 of host computer 1 and slave computers are got in touch it by USB serial communication 3, and its model is PDIUSBD12.Host computer 1 can carry out intelligent planning, the technological parameter data base optimization of extraction, the cutter path of CAD graphical information, the generation and the machining simulation of numerical control code by corresponding software.Operation, Straight Line and Arc interpolation that slave computer 2 is realized on-line measurements by photoelectric detection system 3 and controlled motor compensate the processing capacity of cutter.Total system constitutes open system with host computer 1 and slave computer 2, and photoelectric detection system 3 can arrive host computer 1 with the information online feedback that detects, and carries out intelligent planning by 1 pair of cutter machining path of host computer.
Fig. 2, photoelectric detection system 3 have a handle of a knife 4, and it can be installed on the lathe saddle of numerically controlled lathe, and cutter head 5 is arranged on the handle of a knife 4, and two parallel end inboards of cutter head 5 are the photoelectric detector 6 that a pair of laser diode and photodiode are formed.This photoelectric detection system can move with lathe saddle, finishes the measurement to the bad part of changing a job.Measurement result can be by directly feeding back to host computer 1 after the corresponding processing of circuit.
Fig. 3 is for having provided control flow chart of the present invention.Its course of work is:
A host computer 1 extracts the CAD graphical information, each CAD system all has the data file of oneself, data file divides graph data file, geometric model file and product model file several, DXF is the Graphics Data File of AutoCAD system, ASCII character text with special form, it is easy to by other routine processes, be mainly used in the program of high level language and being connected of AutoCAD system of realizing, or other CAD system and AutoCAD systems exchange graphic file, the DXF file is formed by paired code with the value of associated codes in essence.These codes (being group code) have not only been pointed out the type of related number (class value) thereafter, and class value pairing therewith, by group code and the class value that uses these pairings, the DXF file is organized into the zone, in the DXF file, each group code and each class value all respectively account for delegation, group code is the positive integer of a non-zero, be equivalent to the data type code, the implication of each group code is appointed by the AutoCAD system, the second behavior class value of group, the value that is equivalent to data, the form that adopts depends on the type of the group of group code appointment, group code and class value are represented the implication of data and its value altogether, and each zone all is group code 0 beginning of following character string SECTION thereafter with, then is the character string of group code 2 and expression zone name, each zone all is made up of the group code and the class value of its element of definition, and and then finish in group code 0 this zone of expression of character string ENDSEC thereafter.Analyze the geological information of turning processing parts, the i.e. figure that from CAD software, obtains, can think from DXF read the geological information of part mainly form by straight line and circular arc, for the surface profile section of forming by other curve, requirement according to machining precision, can adopt interpolation algorithm that it is scaled straight line or circular arc, straight line is described, the method of circular arc and screw thread is a lot, data description according to the DXF file, straight line is described with starting point coordinate and terminal point coordinate, circular arc then adopts central coordinate of circle, radius, the circular arc start angle, the circular arc termination point is described, automated programming for the turning processing parts, the part of most critical is exactly to constitute the coordinate of each entity of profile in the DXF file, all entities all illustrate in " ENTITIES " zone, according to LINE in " ENTITIES ", the explanation form of entities such as ARC, can read its inscape, as: starting point, terminal point, the center of circle, start angle, termination point, radius etc., press machine direction and arrange the entity that constitutes profile, as straight line, circular arc, screw thread, supplementary structure, when extracting graphical information, open the dxf file, read in a line item, judge whether to be entity section, if entity section, judge that then entity type is a straight line, circle or circular arc, if straight line, then to extract the starting point and the terminal point coordinate of straight line, if circle then will extract the coordinate and the radius in the center of circle, if circular arc, also need extract initial, the radian value of terminal point, because the order of entity information is the series arrangement when drawing in the dxf file, therefore need sort, and reformulates the profile of part;
B slave computer 2 is waited for the numerically controlled lathe initialization order of host computer 1;
C host computer 1 sends measuring command by USB serial communication 3 to slave computer 2, slave computer 2 obtains original dimension and locating information after by photoelectric detection system workpiece being detected, and send into host computer 1 by the USB serial communication, at first, numerically-controlled machine starts back tool rest and returns lathe zero point earlier, and make measurement mechanism be in the working position by the tool changing order, promptly measurement mechanism is towards to be processed;
Secondly, determine the position of workpiece coordinate system initial point in lathe coordinate system, it comprises that workpiece coordinate system X is to true origin determining in the lathe coordinate system position, measurement mechanism with knife rest along Z to moving to the most close spindle chuck position, this position control system can be provided with, Z is to stop motion, then knife rest along X to close to workpiece, in this process, because blocking of workpiece, optical signals will inevitably take place at the optical pickup apparatus place has to nothing, the process of growing out of nothing again, and then be converted into voltage from low to high, process is from high to low jumped edge and a negative edge on promptly there is one in change in voltage again, and this variation can cause the capture interrupt of slave computer (2), in this way, system can survey the position of level saltus step place, and the outline position place of workpiece just, the position of level saltus step place, the saltus step of twice level, two coordinate figure X1 that can make that two profiles of system log (SYSLOG) workpiece make progress at lathe coordinate system X and X2, then workpiece coordinate system initial point X0=(X1+X2)/2;
Workpiece coordinate system Z is to true origin determining in the lathe coordinate system position, in previous step is rapid, owing to determined X0, then knife rest along X to laser beam emitting device being adjusted to the X0 position, this moment, X was to stopping, then knife rest along Z to moving to its positive dirction, when the measuring position is in the end face of workpiece, the optical signals at optical pickup apparatus place does not have to having, when electric signal changes from high to low, system detects the Z of saltus step place of level to the position, its be workpiece coordinate system Z to true origin in the lathe coordinate system position;
Once more, the mensuration of workpiece size, the mensuration process of workpiece size, the process of setting up of identical workpiece coordinate system can be determined the overall size information of any position workpiece;
At last, after measurement finished, knife rest returned the tool changing point, makes the knife rest transposition by the tool changing order, and the cutter that subsequent processing is used is in the place, working position, carries out normal cut then and gets final product;
D host computer 1 according to gained information to the cutter path intelligent planning, based on intelligent technological data bank select working process parameter, numerical control code generation automatically, machining simulation and numerical control code inspection, the numerical control code that will check sends slave computer 2 to and controls and monitor slave computer 2 duties;
When the establishment nc program, determine technological parameters such as the speed of mainshaft and speed of feed, and the speed of mainshaft is by cutting speed, tool radius is determined, cutting speed is again by tool life, workpiece material, tool type and material and cutting depth, cutting width, factors such as cutter tooth number are determined, these parameters influence each other to each other, concern very complicated, when program is drawn, in order to determine these parameters, the programming personnel need consult the form of large amount of complex, and carry out complicated calculating, not only waste time and energy, and make mistakes easily, therefore set up a convenient and practical technological data bank, its accumulates and has stored the production and the experimental data of a large amount of metal cuttings, can handle by theoretical and empirical mode according to user's requirement, calculate required fast and cutting data that process is optimized, each successful processing instance is stored, when the processing instance of the success of new workpiece processing condition and database storing is similar, just can call original similar machined parameters, suitably modification just can be used as the machined parameters of new workpiece, if cutting effect pretty good can store again, thus abundant cutting database.The cutter parameters database comprises cutter name, cutter number, cutter compensation number, handle of a knife length, handle of a knife width, nose angle length, nose radius, tool orthogonal rake, tool clearance, cutter auxiliary angle, lathe tool type, biased direction etc.Cutting parameter comprises Selection of Cutting, the speed of mainshaft, cutting depth and width etc.At first the processing conditions parameter is passed to the metal cutting data of database input table by the window of interface from automatic programming system, behind the cutting parameter that obtains reasonably optimizing, transfer back in the automatic programming system, realized selecting working process parameter based on intelligent technological data bank;
Combining with digital control turning machining characteristics is set up the outline description chain of part to be processed; Friendship is asked in skew piecemeal, carries out topology and checks to eliminate the selfing of skew profile; Adopt parallel merging and equal space line cutting optimization method to get final machining locus, finish, generate cutter location file the cutter intelligent planning; It disperses surface profile and is a series of straight line and circular arc, set up unified expression way to the piece surface profile, by these straight lines and circular arc are offset the equidistant profile of asking after friendship obtains being offset piecemeal, after the contour surface employing frontier point description with part, just obtained the whole profile boundary chain, its be through just can forming a skew boundary chain that only is made of straight line and circular arc after discrete processes, the skew of parts profile all relative with cutting it operate; In this process, adopted the contour offset algorithm, it was divided into for three steps, (1) skew piecemeal, in order to handle conveniently, we have stipulated an offset direction, each contour segment all needs promptly to be offset towards right outwardly, this direction is the unified offset direction of each contour segment, concerning circular arc, considers its directivity, branch along circle and contrary circle is arranged, and the outside skew of contrary circle is a kind of long trend is a kind of contraction along the outside skew of circle trend that expands; (2) ask friendship piecemeal, in the boundary chain each section profile is after being offset piecemeal, can obtain a new boundary chain, traversal this edge circle chain, with the adjacent profile find intersection of each section profile in the chain with the last period, the starting point of each contour segment and end point values are revised as the intersection value of being asked successively, just obtain a preliminary skew profile.For some the profile of cusp is arranged, do not having intersection point behind the contour offset and between adjacent profile, then need between this, to insert a transition arc; (3) paragraph by paragraph examination, for some depression profiles, less as himself size, in constantly being offset, can progressively shrink, to the selfing that forms profile the most at last, so will check, find that this variation will delete the contour segment of correspondence from boundary chain, use hypomere profile and profile the last period find intersection again then.
Each row in the cutter location file has been represented one section entity, therefore, when handling, only need read in cutter location file line by line, judge it is technological parameter according to identifier, or processing entity, if technological parameter is then noted its numerical value, if processing entity then writes down its type, parameter such as starting point and terminal point according to the call format of used digital control system, is written in the numerical control code file;
Simulation process is actually the inverse process that generates the processing instruction, is about to numerical control program and is converted into graphic file, and it is showed, and the code of checking is sent into slave computer 2; In digital control processing, digital control system is by reading nc program, convert thereof into gating pulse, the processing of workpiece is carried out in the feed motion of rotation of control main shaft of numerical control machine tool and all directions, the correctness of numerical control program, determined process tool can process qualified part safely and effectively, therefore, concerning automated programming, carry out first being processed numerical control program being sent to digital control system, the correctness of check program is an extremely important ring; Along with computer technology, the development of aspect such as computer graphics and cad technique, at present existing many methods can be used for the computing machine checking of job sequence, method commonly used is to adopt the wire frame agent approach to carry out program verification, be used in and show cutter path on the video screen, during actual verification, cutter path can be simulated with the vector between the demonstration cutter location, process for two-dimensional silhouette, when carrying out machining simulation, only need verify cutter path, and do not consider the cutter over-cutting, whole simulation process is actually the inverse process that generates the processing instruction, is about to numerical control program and is converted into graphic file, and it is showed; Correctly reading and discerning of numerical control code file is the prerequisite and the basis of carrying out machining simulation, and this process is almost opposite with the described cutter location file processing procedure of last joint, and its concrete steps are as follows:
1), each continuous instruction initial value of imitating is set;
2), read in delegation's numerical control code file because each row NC file is represented a procedure of processing, promptly represent a processing entity, analyze G code, can draw entity type; Except that the X, the Y that occur for the first time, Z command value presentation-entity starting point coordinate, this type of command value is thereafter all represented its terminal point coordinate, and at this, the continuous command processing method of imitating is identical with the continuous effect command processing method of cutter location file processing procedure,
In processing procedure, if what adopt when program composition is the absolute coordinates programming, what obtain is the absolute coordinates of programming track, if numerical control code adopts relative coordinate to represent when output, then must carry out coordinate transform, since second, every bit a bit converted for basic point in the past, obtain its absolute coordinates, the figure of gained is cutter heart track like this;
E slave computer 2 receives numerical control codes,, finishes the status information of digital control processing in will processing simultaneously and feeds back to host computer 1 by the numerical control instruction operation by program controlled motor; Slave computer 2 adopts relatively interpolation of pointwise, and the running of control step motor makes stepper motor have synchronizing apart from working method, half step pitch working method and 1/4th step pitch working methods, finishes the processing to workpiece.
Wherein for stepper motor, slave computer 2 control CPLD output pulse square waves are input to stepper motor driver, and are for servomotor, identical with stepper motor when controlling with impulse form; Adopt the PCM56U chip when controlling with the analog quantity form; Slave computer 2 has also been transplanted uc/os--II operating system; Adopt data sampling interpolation linear interpolation and circular interpolation mode, the drive motor operation;
After f machined, host computer 1 started measurement function once more, and workpiece size and shape are detected automatically, realized the ACTIVE CONTROL of crudy;
G slave computer 2 is accepted to start once more after host computer 1 order measurement function quality states such as the critical size of workpiece and shape is carried out online detection, and feedback host computer 1, after host computer 1 is optimized, beams back 2 pairs of tool lengths of slave computer and radius and make corresponding compensation, to improve machining precision.