Summary of the invention
Weak points such as, poor stability low at the digital control system control performance that exists in the prior art and communication efficiency are low, the technical problem to be solved in the present invention provide a kind of implementation method of the digital control system networking architecture based on high controlled, high stability of having of high-grade, digitally controlled machine tools technical indicator and open cnc technology national standard and high communication efficiency.
For solving the problems of the technologies described above, the technical solution used in the present invention is:
The implementation method of a kind of digital control system networking of the present invention architecture may further comprise the steps:
The man-machine interface controller is separated from numerical control machine, run in the Industrial PC Computer, task controller, motion controller and PLC run in the numerical control machine;
On Industrial PC Computer, realize the real time data processing of man-machine interface controller by soft real-time mechanism;
On numerical control machine, realize the real time data processing of server and task controller, and adopt between task controller and the motion controller and mix interaction models and communicate by soft real-time mechanism;
Connect Industrial PC Computer and numerical control machine by real-time ethernet.
Described man-machine interface controller runs in the Industrial PC Computer as un-real time job, serves as the mutual platform of user and digital control system; Task controller runs in the numerical control machine as un-real time job, is responsible for the action of coordinates user instruction and system's key-course; Motion controller and PLC run in the numerical control machine as real-time task, finish motion control and logic control.
Realize that by soft real-time mechanism the real time data processing of man-machine interface controller, server and task controller may further comprise the steps:
The un-real time job initialization;
The real-time period task initialization;
Soft/hard real-time switches, and task enters kernel state;
Enter the major cycle cycle, the Core Feature of executing the task, real-time processing data;
Periodic duty finishes, and returns user's attitude;
Task discharges resource.
Described is on ethernet hardware by real-time ethernet connection Industrial PC Computer and numerical control machine, by real-time ethernet hard real-time network protocol stack and tdma, and the real time data between transmission Industrial PC Computer and the numerical control machine, it comprises following process:
Transmitting terminal is encapsulated into message in the UDP message, calls the real-time sockets interface of real-time ethernet, in the sending time slots of transmitting terminal, according to the real-time control system configuration file, message is sent to numerical control machine in real time;
The server listening port, the real-time sockets interface that calls real-time ethernet receives the UDP message in real time, according to the real-time control system configuration file, message extraction is come out to put into local buffer, continues listening port;
Receiving end reads message and processing according to the real-time control system configuration file from local buffer.
Described digital control system networking architecture adopts bus topolopy, by revising the real-time control system configuration file, and the replacement network structure, the corresponding correspondence between the change node is realized between Industrial PC Computer and the numerical control machine one to one or one-to-many is communicated by letter.
Adopt between the task controller that moves on the described numerical control machine and the motion controller and mix interaction models and communicate, promptly use shared buffer storage interactive messages, use pipeline to transmit the status signal of shared buffer, and task controller and motion controller only could obtain the visit to shared buffer after receiving the signal of pipeline.
The communication process that mixes interaction models comprises:
After transmitting terminal write shared buffer with message, the pipeline that provides by the hard real-time multiple task operating system sent signal to receiving end, informed that the information updating of its shared buffer finishes;
After receiving end is received the signal of pipeline, from shared buffer, read message, message read the back that finishes by pipeline to the transmitting terminal return signal, inform that message in its shared buffer has read to finish.
The present invention has following beneficial effect and advantage:
1. alleviate processor pressure, improve the digital control system control performance.In the inventive method, man-machine interface controller and other controller degrees of coupling are low and resource consumption is big, with its isolated operation in Industrial PC Computer, not only can make full use of the PC resource, take processor alone, can also pass through standard ICP/IP protocol access the Internet, by WLAN agreement wireless connections portable terminal, be convenient to realize remote monitoring, fault detect, functions such as remote maintenance, avoided simultaneously with numerical control machine in real-time is required harsh controller competitive resource, guarantee the timely response of real-time task, thereby effectively alleviated processor pressure, improved the digital control system control performance.
2. guarantee real time of data transmission between the cross-platform module.The inventive method is introduced network in digital control system, bring the problem of propagation delay time, adopt real-time ethernet RTnet to connect man-machine interface controller and task controller, on ethernet hardware, by hard real-time network protocol stack and tdma with determinacy mode transmitting real-time data, effectively alleviate data packet collisions and network congestion, reduced network transfer delay, thereby guaranteed the real-time of data interaction between the cross-platform module.
3. improve the speed of user task data processing.The inventive method adopts soft real-time mechanism (LXRT; Linux Real Time); interrupt in user's space executed in real time task by simple software; improve the priority of user task; and provide memory protect to it; thereby avoided user task to wait as long for, improved the speed of user task data processing.
4. improve the performance and the system stability of data interaction between the local module.The inventive method adopts mixes interaction models, by pipeline realize to the shared buffer access synchronously, can give full play to the advantage of shared buffer direct read internal memory, can utilize the polling operation in the event driven characteristic minimizing of the pipeline communicating pair handshake procedure again, reduce the memory access time jitter, thereby improved data interaction performance and system stability between the local module.
Embodiment
As shown in Figure 1, the cnc system software building-block of logic of using for the inventive method.
Running software among this figure is in hard real-time multiple task operating system (RTAI, Real TimeApplication Interface for Linux) on the platform, adopt real-time control system (RCS, Real-timeControl System) stratification Reference Model Design also realizes based on the RCS storehouse, can be divided into three levels, four functional modules.Three levels are respectively: graphical user interface layer, task scheduling layer, system's key-course.Four functional modules are man-machine interfacial level controller, task controller, motion controller, programmable logic controller (PLC) (PLC, Programmable Logic Controller), finish following function respectively:
1. man-machine interface controller
Running on user's space as un-real time job, is the mutual platform of user and digital control system.Operating personnel can realize all operations to digital control system on user interface, comprising: input, editor, demonstration and the management of nc program and PLC program; With described program or start power on, operation such as automatic/hand mode switch is corresponding becomes the interface control order to send to numerical control machine; The display system running status.
2. task controller
Running on user's space as un-real time job, is the hinge of total system, mainly is responsible for the action of coordinates user instruction and system's key-course.At first, receive operation and execution immediately that man-machine interfacial level controller sends, then, explain that the part program of " G code and M code " establishment is the RCS control command, the execution function that calls the corresponding command sends it to motion controller or PLC, the action of coordinated movement of various economic factors controller and PLC.Obtain current machining state from motion controller and PLC at last, be packaged into the RCS status message, send to the man-machine interface controller after the processing and show.In addition, task controller is also finished the initial work to system and lathe, to the functions such as conversion and control of operator scheme such as automatic, manual.
3. motion controller
Motion controller is the core of digital control system, mainly finishes the motion control to axle, comprises the shaft position sampling, calculates functions such as track value, interpolation and servocontrol, and then drive the servosystem operation.In addition, also comprise some compensating modules in the motion controller, nonlinear characteristic is carried out linear-apporximation and made compensation, for example backlash Compensation of Half and bi-directional axial compensation.Because the motion control controller is strict to travelling speed and sequential, so motion controller runs between the RTAI real-time empty as real-time task.
4.PLC
Run between the RTAI real-time empty, mainly be responsible for the I/O control that control and three subsystems of auxiliary control (for example suddenly stop, lubricate) were controlled, cooled off to main shaft.The digital information and the fine coordination of switching value information of numerically-controlled machine are got up, drive the I/O equipment operation.
According to the rule of RCS configuration file, realize information interaction between above-mentioned four functional modules by intermediary message language (NML, Neutral Message Language) passage mechanism and shared buffer that RCS provides.The software configuration of this modularization, stratification makes digital control system in open type be easy to expansion, can satisfy the difference control requirement of all kinds of lathe hardware.Standardized user interface, unified user interface had both made things convenient for the maintenance of system, made things convenient for the user to realize requirement soft to system, that hardware exchanges again.
As shown in Figure 2, the digital control system communications platform synoptic diagram of using for the inventive method.
The digital control system communications platform is directly connected to the overall performance of digital control system for information interoperability between functional module and between field apparatus provides the basis.The information interoperability is meant the data interaction between digital control system self functional part between functional module, and it is mutual to be divided into the mutual and cross-platform intermodule of local intermodule.The information interoperability is meant by field bus technique and realizes the communication between the control system and relevant functional equipment such as servo, I/O, network analyzer in the control scene between field apparatus.The inventive method mainly is at the information interoperability between the digital control system functional module.
The implementation method of digital control system networking architecture of the present invention may further comprise the steps:
The man-machine interface controller is separated from numerical control machine, run in the Industrial PC Computer, task controller, motion controller and PLC run in the numerical control machine;
On Industrial PC Computer, realize the real time data processing of man-machine interface controller by soft real-time mechanism;
On numerical control machine, realize the real time data processing of server and task controller, and adopt between task controller and the motion controller and mix interaction models and communicate by soft real-time mechanism;
Connect Industrial PC Computer and numerical control machine by real-time ethernet (RTnet).
Described man-machine interface controller runs in the Industrial PC Computer as un-real time job, serves as the mutual platform of user and digital control system; Task controller runs in the numerical control machine as un-real time job, is responsible for the action of coordinates user instruction and system's key-course; Motion controller and PLC run in the numerical control machine as real-time task, finish motion control and logic control.
Described digital control system networking architecture adopts bus topolopy, by revising the real-time control system configuration file, and the replacement network structure, the corresponding correspondence between the change node is realized between Industrial PC Computer and the numerical control machine one to one or one-to-many is communicated by letter.
As shown in Figure 3, be digital control system networking architectural schematic in the inventive method.
RTnet network using bus topolopy among this figure comprises limited a plurality of node, wherein has a plurality of Industrial PC Computer and a plurality of numerical control machine.The man-machine interface controller independent operating of low coupling high flow rate in Industrial PC Computer wherein, other controllers, promptly task controller, motion controller and PLC run on wherein in the numerical control machine.Industrial PC Computer can be passed through standard ICP/IP protocol access the Internet, by portable terminals such as WLAN agreement wireless connections mobile phone, individual palm PC, portable computers, is convenient to realize functions such as remote monitoring, fault detect, remote maintenance.Based on standard ethernet hardware, the Real-time UDP/IP protocol transmission real time data bag (as: command messages, status message, error message etc.) that uses RTnet to provide between Industrial PC Computer and the numerical control machine uses Tunneled ICP/IP protocol transmission non-real-time data bag.
Said process just is located at man-machine interface controller and other controllers respectively on Industrial PC Computer and the numerical control machine, digital control system after this separation can be taked one to one, the mode of operation of one-to-many, promptly a personal-machine interfacial level controller can connect any one or more numerical control machine among the RTnet, only need to revise the rule of communication in the RCS configuration file, the network structure of can resetting, corresponding correspondence between the change node, the flexible configuration of realization network.
As shown in Figure 4, be digital control system Principle of Communication figure in the inventive method.
Networked architecture in the inventive method is based on that the network communicating function of RCS communications platform realizes, its core technology is a NML passage mechanism.Wherein, the NML server is used for remote channel communication, and the RCS configuration file is used to write down the message communicating rule between each module and each buffer zone.
Because real-time requires the highest motion controller to operate on the numerical control machine, therefore on numerical control machine, enable server and create passage, as: command channel, stator channel, mistake passage etc., open up buffer zone simultaneously.Task controller can the direct read local buffer.Long-range man-machine interfacial level controller connects the server of corresponding numerical control machine node in the RTnet network according to the rule of configuration file, and the dereference buffer zone comes and information such as task controller interactive command, state, mistake with this.Server generation carries out encoding and decoding for the man-machine interface controller to the message in the buffer zone, realizes the remote access to buffer zone, can avoid the influence of telecommunication to local intermodule communication.Run on the transformation of man-machine interface controller, NML server and the task controller (be un-real time job, also can be described as user task) of user's space, as soft real-time task real-time processing data by soft real-time mechanism.Adopt between improved task controller and the motion controller and mix interaction models and communicate by letter.
Based on Fig. 4 principle, described real time data processing by soft real-time mechanism realization man-machine interface controller, server and task controller as shown in Figure 5, is the soft real time implementation process flow diagram of un-real time job in the inventive method, may further comprise the steps:
The un-real time job initialization;
The real-time period task initialization;
Soft/hard real-time switches, and task enters kernel state;
Enter the major cycle cycle, the Core Feature of executing the task, real-time processing data;
Periodic duty finishes, and returns user's attitude;
Task discharges resource.
Un-real time job comprises man-machine interface controller, NML server and task controller.
The first step, the un-real time job initialization is provided with basic configuration parameter and operational factor;
In second step, the function that uses LXRT to provide is initialized as the real-time period task with un-real time job, and locking task memory headroom prevents to be displaced internal memory, creates real-time proxy task at kernel spacing, and it is cyclic pattern that the timer pattern is set, and starts timer;
The 3rd step, realize that by soft interruption soft/hard real-time switches, task enters kernel state, and the start-up time and the Cycle Length of real-time task is set;
The 4th step entered the major cycle cycle, the Core Feature of executing the task, and real-time processing data after this subtask is finished, is initiatively abandoned CPU, waits for scheduling next time, and loop cycle is carried out;
In the 5th step, after periodic duty is finished, return user's attitude;
The 6th step, delete real-time proxy task, the timeing closing device unlocks and the clean-up task space, discharges resource.
Based on Fig. 4 principle, described real-time ethernet RTnet connects Industrial PC Computer and numerical control machine, is on ethernet hardware, by RTnet hard real-time network protocol stack and tdma, real time data between transmission Industrial PC Computer and the numerical control machine, it comprises following process:
Transmitting terminal is encapsulated into message in the UDP message, calls the real-time sockets interface of real-time ethernet RTnet, in the sending time slots of transmitting terminal, according to the real-time control system configuration file, message is sent to numerical control machine in real time;
The server listening port, the real-time sockets interface that calls real-time ethernet RTnet receives the UDP message in real time, according to the real-time control system configuration file, message extraction is come out to put into local buffer, continues listening port;
Receiving end reads message and processing according to the real-time control system configuration file from local buffer.
Shown in Fig. 6 A, 6B and 6C, be respectively that man-machine interface controller message process of transmitting synoptic diagram, server message receiving course synoptic diagram and task controller message read the process synoptic diagram in the inventive method.Each module is used in the process of NML tunneling traffic, according to configuration file, if the buffer flag of visit be long-range (RTMOTE) or this as server, then need to call the web socket interface.The real-time sockets interface that the inventive method uses RTnet to provide is replaced RCS standard sockets interface, finishes telecommunication.Be example with the command messages among the figure, each module is described in detail.
As shown in Figure 6A, be man-machine interface controller message process of transmitting synoptic diagram in the inventive method.
The first step, initialization is connected with the command channel, creates passage object and UDPMEM object, is used for the storage and the transmission of UDP bag;
Second step, call real-time ethernet RTnet interface, create Datagram Socket, the socket attribute is set, registered port numbers, the remote acknowledgement buffer zone, call server is replied;
The 3rd step was encapsulated into command messages in the UDP message, called real-time ethernet RTnet interface, in the sending time slots of Industrial PC Computer, according to the RCS configuration file, command message was sent to numerical control machine in real time;
In the 4th step, nullify port.
Shown in Fig. 6 B, be server message receiving course synoptic diagram in the inventive method.
The first step, initialization is connected with the command channel, creates the passage object, bind command buffer zone, and the match condition of each module and command buffer in the inquiry RCS configuration file;
Second step, call real-time ethernet RTnet interface, create Datagram Socket, the socket attribute is set, registered port numbers;
In the 3rd step, listening port calls real-time ethernet RTnet interface, real-time receiving remote command message, and, from message, extract command messages according to the RCS configuration file, put into the local command buffer zone;
In the 4th step, nullify port.
Shown in Fig. 6 C, for task controller message in the inventive method reads the process synoptic diagram.
The first step is created passage, opens up command buffer;
Second step is after waiting for server is put into command buffer with the long-range command messages that receives, according to the RCS configuration file, directly from command buffer reading order message.
As shown in Figure 7, be networked digital control system cross-platform interchange synoptic diagram in the inventive method.
Be example with the command messages among this figure, describe the cross-platform workflow of networked digital control system in detail.Wherein, the man-machine interface controller runs on the Industrial PC Computer as transmitting terminal, carries out write order message.Server, task controller run on the numerical control machine as receiving end, carry out remote agent write order message and read command message.1. be the execution in step sequence number 9. extremely among the figure.Each module is described as follows respectively:
1. man-machine interface controller
1. step is stated and being connected of command channel;
2. step locks the task memory headroom, and initialization real-time period task also is provided with scheduling strategy, opens the cyclic pattern timer, and unit is nanosecond;
3. step switches to kernel spacing by soft interruption, enters the hard real-time state, and task start time and Cycle Length are set;
4. step enters the major cycle cycle, carries out man-machine interfacial level controller core missions, and real-time processing data is created real-time socket and registered port, according to RCS configuration file remote write data, command messages is sent to remote port in real time;
5. step judges whether task finishes, if finish, then changes step 9.; Otherwise change step 4., continue loop cycle and handle, until task termination;
9. step returns user's space, enters soft real-time status, timeing closing device and socket, clean-up task.
2. server
1. step is stated and being connected of command channel;
2. step locks the task memory headroom, and the initialization real-time task also is provided with scheduling strategy;
3. step switches to kernel spacing by soft interruption, enters the hard real-time state, and the task start time is set, and changes step 6.;
6. step starts the NML server, creates real-time socket, registration and listening port, wait for real-time receiving remote data, according to the RCS configuration file, the command messages of receiving write corresponding command buffer in real time after, continue listening port, finish, change step 9. until server task;
9. step returns user's space, enters soft real-time status, stops the NML server.
3. task controller
1. step creates the command channel, opens up command buffer;
2. step locks the task memory headroom, and initialization real-time period task also is provided with scheduling strategy, opens the cyclic pattern timer, and unit is nanosecond;
3. step switches to kernel spacing by soft interruption, enters the hard real-time state, and task start time and Cycle Length are set, and changes step 7..
7. step enters the major cycle cycle, the controller core task of executing the task, and according to the RCS configuration file, reading order message and processing in real time from command buffer;
8. step judges whether task finishes, if finish, then changes step 9.; Otherwise, change step 7., continue loop cycle and handle, until task termination;
9. step returns user's space, enters soft real-time status, timeing closing device and socket, clean-up task.
Based on Fig. 4 principle, in the inventive method, adopt between the task controller that moves on the numerical control machine and the motion controller and mix interaction models and communicate, promptly use shared buffer storage interactive messages, use pipeline to transmit the status signal of shared buffer, and task controller and motion controller only could obtain the visit to shared buffer after receiving the signal of pipeline.
The communication process that mixes interaction models comprises:
After transmitting terminal write shared buffer with message, the pipeline that provides by hard real-time multiple task operating system RTAI sent signal to receiving end, informed that the information updating of its shared buffer finishes;
After receiving end is received the signal of pipeline, from shared buffer, read message, message read the back that finishes by pipeline to the transmitting terminal return signal, inform that message in its shared buffer has read to finish.
As shown in Figure 8, for mixing the interaction models synoptic diagram in the inventive method.
Adopt shared buffer interactive command, state, error message among the figure between task controller and the motion controller, use pipeline to transmit the status signal of shared buffer.
With the command messages is example, and the communication process between task controller and the motion controller is as follows:
1. data send: task controller sends a signal by pipeline to motion controller with command messages write command buffer zone, informs that message is updated in its command buffer, transfers the access right to command buffer simultaneously.
2. Data Receiving: motion controller is received the signal of pipeline, acquisition is to the access right of command buffer, from command buffer reading order message, read the back that finishes and reply a signal to task controller by pipeline, inform that the data in its command buffer are read, task controller regains access right after receiving this signal.
RTAI is that pipeline is created the call back function handle, and when this pipeline during by read/write, call back function is called automatically by system.Therefore, communicating pair only just removes the read/write shared buffer after receiving signal, and other carry out the core code of oneself constantly, do not need the user mode of poll check shared buffer, possess event driven characteristic.
Real-time and stability are the key factors of decision digital control system overall performance, also are the performances that the inventive method is paid close attention to.
The test environment of the inventive method: the Industrial PC Computer hardware platform is 2.2GHz x86CPU, the 1Gb internal memory; The numerical control machine hardware platform is 800MHz x86CPU, the 512Mb internal memory; Operating system is RedHat Linux 9.0, kernel version 2 .6.19, RTAI version 3 .7; RTnet version 0.9.11; Network interface card is Realtek RTL 8139.
As shown in Figure 9, be networked digital control system telecommunication time-delay analysis figure in the inventive method.With the example that is transmitted as of 1Kb command messages, the real-time of test the inventive method.Among the figure communication delay is divided into T
Hmi, T
TaskAnd T
Tran, represent man-machine interfacial level controller data processing time delay, task controller data processing time delay and RTnet propagation delay time respectively.
The data processing time delay is defined as the transmission time of data between task buffer zone and local network interface card static memory.The data processing time delay of man-machine interface controller and task controller contrasts with the digital control system of not using LXRT mechanism in test the inventive method.
Experimental result, the T of the inventive method
HmiAverage out to 27.4 μ s, T
TaskAverage out to 28.1 μ s are less than the digital control system of not using LXRT mechanism.The result shows that the inventive method is used LXRT mechanism, has improved the user task data processing speed, effectively reduces the data processing time delay.
Network analysis instrument Wireshark sniffer is used in experiment, and at specific IP main frame, each intercepted data packet is apart from the time interval between the last time intercepted data packet, by computational grid data packet transmission frequency indirectly testing network transfer delay T in the record network
Tran
Shown in Figure 10 A and 10B, be respectively the time interval figure of Ethernet and RTnet packet in the inventive method.Show 100 groups of test datas among the figure, wherein, in order to identify measured value clearly, the The data logarithmic plot that Ethernet measures.Because the RTnet packet sends frequent, per 200 bag time intervals of record of Wireshark.
Experimental result, the shake of the Ethernet data packet transmission time interval is very big, and sniffer on average just can be caught a packet every 2.44 seconds.And the packet of RTnet transmits steadily, significantly space jitter can not occur, and packet is littler at interval, every transmitting a packet 490 nanoseconds.The result shows, compares with Ethernet, and RTnet has effectively been alleviated data packet collisions, has reduced the propagation delay time T of cross-platform intermodule
Tran
Though the inventive method has been introduced network factors, but it separates the man-machine interface controller, and employing soft real-time mechanism of LXRT and RTnet real-time ethernet technology, effectively alleviated the pressure of uniprocessor, the real-time and the real time of data transmission of data processing have been guaranteed preferably, and then improved the control performance of entire system, have an enormous advantage with respect to traditional digital control system.
Shown in Figure 11 A and 11B, be respectively and adopt shared buffer model and the memory access time delay figure that mixes interaction models in the inventive method.Experiment is example with the command messages, the time of message write command buffer zone between logger task controller and the motion controller.
Experimental result, mixing the average write time of interaction models is 20.742 μ s, is lower than 24.209 μ s of shared buffer model, and the time jitter of mixing interaction models is littler.The result shows, compares with shared buffer models, adopts between task controller and motion controller and mixes interaction models, and local intermodule communication time delay is littler, and the stability of system better.