Theory and Design of CNC Systems Part 12 ppt

35 368 1
Theory and Design of CNC Systems Part 12 ppt

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

10.3 Design of Soft-NC System 373 the requester retrieves the data generated by the requested service, an acknowledge- ment signal is transmitted to the receiver, and the process of accessing the shared memory is terminated. In general, this method is used for safe sending of long data such as program files, system parameters, and PLC programs to the NCK/PLC modules from the MMI module. For example, in the case of file transfer between MMI and NCK, NCK sends MMI a request asking to send a part program to MMI and then MMI transmits the program file to NCK via the shared memory. Write Answer Acknowledge Read Answer Request Acknowledge Recognize Interpret Request Fig. 10.12 Request/Answer method The typical data structure of shared memory for communicating data in Operation Mode can be realized as shown in Fig. 10.13. 10.3.5.1 Inter-task Communication in NCK Data exchange between IPR, IPO, and POS tasks in the NCK module can be designed by using shared memory, as shown in Fig. 10.14. A General Communication Area is the area in shared memory where states, po- sitions, and control flags are exchanged between the IRP task and the IPO task. Emergency Stop, Axis Position, Error Handling Diagnosis, Debug Information, and Watchdog Information are transmitted via the General Communication Area. A Block Record Buffer is also defined, and is the area used for transmitting data about NC blocks to the IPO task, the IPR can only write the data to it, the IPO can only read data from it. It is defined as an area of shared memory and has a ring buffer 374 10 Design of PC-NC and Open CNC 0 1 2 10 - 11 Free hold Stop Operation Active G-Code No. (Group 1) Active G-Code No. (Group 2) Active Block No. SMDB11 NCK → MMI (Operation status) Byte (or Offset) Bit 7 6 5 4 3210 Fig. 10.13 Typical data structure of shared memory IPR - IPO communication area POS - IPO communication area IPR task POS task IPO task General communication Block record buffer Fig. 10.14 Data exchange in NCK module structure. Interpolation Type, Start and End Position, Corrections, Axis components, Path Parameters, Path Velocity, Dwell time, and Spindle Information are stored in the Block Record Buffer. The POS-IPO communication area is the area for exchanging data between the IPO task and the POS task. It is defined in shared memory and Command Axis Po- sition, Spindle Output, Machine Position, Emergency Stop, Watchdog Information, and Error Message are exchanged via it. 10.3.5.2 Communication Between NCK and MMI Where the MMI and NCK/PLC modules operate on a single OS and single CPU, communication between MMI and NCK can be designed easily. However, in the case 10.3 Design of Soft-NC System 375 of a CNC system where the MMI and NCK modules operate on individual CPUs, a bus interface and high-speed serial interface can be used for communication between modules. This configuration has a more complex communication mechanism than Soft-NC. Not only should the communication speed necessary for meeting the real- time requirements be considered but also reliability, communication distance, cost, extensibility, and robustness. The Open System Interface (OSI) seven layers shown in Fig. 10.15 has been typ- ically used as the layer architecture for communication software. However, the OSI seven-layer method is not appropriate in industry because it may not meet real-time requirements. So, to realize the high-speed communication between MMI and NCK, simplified layers are used based on three layers from among the seven layers of OSI. Field buses such as BACNET and PROFIBUS have been developed based on the simplified layers. Application Presentation Session Transport Network Data Link Physical OSI 7 Layers Application Data Link Physical Simplified Layers Deleted layers for real-time application More Efficient, Faster Response, Lower overhead Fig. 10.15 Comparison between OSI 7 and Simplified Layers architectures The communication software layer architecture to which the above 3-layer archi- tecture is applied is shown in Fig. 10.16. It consists of a Hardware Driver for acti- vating the Ethernet Controller and an Interface Level Driver for providing network services and interface with application software. On the side of NCK, the commu- nication task is designed as application software based on real-time OS. The com- munication task of MMI is designed as application software based on Windows 95. Therefore, on the side of MMI, the communication task can be designed easily by 376 10 Design of PC-NC and Open CNC using an Ethernet driver for PC and Windows OS. However, in the case of NCK, the communication task can be developed only when a real-time OS supports Ethernet. Fig. 10.16 Software layer for communication between MMI and NCK To manage the communication data efficiently, it is necessary to define the data block for assembling the related data in shared memory. Having defined the block for communication data of MMI, as for the block for NCK, it is possible to develop easily application software for each module. 10.4 Motion Control System Programming Example In this section, the example of system programming for implementing a motion con- trol system in a real-time environment based on the NCK module detailed in Chap- ter 6 will be described. As the development environment of the motion control sys- tem, PC hardware with INTEL processor, Windows NT, and RTX (VentureCom) were considered. The Acc/Dec-Control-Before-Interpolation-type NCK, which was implemented in this section, consists of the Rough Interpolation task, the Acc/Dec control task, the Fine Interpolation task and Position Control tasks. As mentioned above, it is necessary not only to implement all tasks but also to execute them successfully for realization of NCK. For this, various API functions and techniques provided by RTX were used for system programming. This section shows only one example of de- signing NCK based on RTX and the system programming of NCK will be described based on the implemented code. 10.4 Motion Control System Programming Example 377 10.4.1 Design of System Architecture The implemented ADCAI-type NCK, as shown in Fig. 10.17, is composed of main function, timer handlers for the tasks of NCK, event server and handler for handling the instruction from MMI, and ring buffers for transmitting the data between tasks. Timer handler Event server Event handler Main Ring TimerG Rough IPO timer Acc/Dec timer Fine IPO timer POS timer Rough IPO Acc/Dec Fine IPO POS Emergency_Stop event Cycle_Start functionCycle_Start event Feed_Override event Emergency_Stop Feed_Override Interrupt Fig. 10.17 Sample architecture of ADCAI-type NCK The main function is the function that is called first when the NCK boots up and performs the following steps: 1. To initialize internal variables required for execution of NCK. 2. To create the timer and timer’s handler for each task. 3. To create the event server for handling the instruction from MMI. 4. To create ring buffers for transmitting data between tasks. The timer handler is used for tasks that are iteratively activated every specified time. The event handler is used for handling aperiodic events. Because the rough and fine interpolation tasks, Acc/Dec control task, and position control task are performed periodically, as shown in Fig. 10.17, they were realized using a timer. MMI instructions, such as cycle start, emergency stop, and feed over- ride, were realized by an event handler. (Note, because the emergency stop is a very urgent instruction, it is realized by unique hardware interrupt. This example is only to show how to implement motion control.) 378 10 Design of PC-NC and Open CNC 10.4.2 Creating Tasks An individual timer for each task is created. This timer activates iteratively particular handler functions every specified time. The following shows how to use the timer for creating the Acc/Dec control task using RTX API. // *********************************************************** // // Description: Create Timer, set start time and period // // *********************************************************** // hAccDec = RtCreateTimer( NULL, // Security - NULL is none 0, // stack size - 0 is use default. DoAccDec, // Timer handler NULL, // NULL context P ACCDEC, // priority CLOCK 2); // RTX HAL Timer RtSetTimer(hAccDec, &Start time4, &RTPeriod); As the function RtCreateTimer() shown in the above code is for generating a timer, it receives data about security option, the size of stack, the name of the timer handler, priority, and the reference time as arguments. “DoAccDec”, the third argu- ment, is the name of the timer handler function. And P ACCDEC, the fifth argument, gives the priority of timer handler. It was mentioned that the latency time is the key performance index of RTOS in Chapter 9. The average latency time of RTX is within some tens of μ s(RTX version 4.3 and P-III 866MHz). The maximum latency time does not exceed several μ s. This means that the timer provided by RTX can be used to implement a task whose sampling time is 1 ms. Actually, regardless of the assigned priority, there is the non-interrupted job that hinders real-time tasks. In the case of RTX, access (reading/writing) to the hard-disk driver belongs in this non-interruptedjob category. Therefore, to guarantee the real-time property, it is essential to find a non- interrupted job and avoid executing it together with real-time tasks. 10.4.3 Task Synchronization In order to synchronize the execution of tasks, the start time and the sampling time of each task must be properly decided. The result of the rough interpolation task is used as the input to the acc/dec control task. Further, the result of the acc/dec control task is used as input to the fine interpolation task. The result of the fine interpolation task is used as the input to the position control task. Therefore, the rough interpolation task, acc/dec control task, fine interpolation task, and position control task must be started in that order. This can be represented by Eq. 10.1. In Eq. 10.1, TS RIPO , TS ACCDEC , TS FIPO ,andTS POS mean the start times of the rough 10.4 Motion Control System Programming Example 379 interpolation task, acc/dec control task, fine interpolation task, and position control task, respectively. Moreover, A ¡ B denotes that task A starts before task B. TS RIPO < TS ACCDEC < TS FIPO < TS POS (10.1) The implemented NCK can perform continuous mode machining. In order to implement continuous mode machining, the Acc/Dec control task requires the in- terpolation result from two previous blocks. Therefore, the start time of the rough interpolation task and the Acc/Dec control task can be represented as in Eq. 10.2: TS RIPO + 2∗P RIPO < TS ACCDEC (10.2) where, P RIPO means the sampling time (cyclic time) of the rough interpolation task. The fine interpolation task and the position control task were separately imple- mented. Once the fine interpolation task has been performed, the position control task is executed eight times. (The sampling times of the fine interpolation task and the position control task are set to 16 ms and 2 ms, respectively.) According to the description, above, the relationship between the sampling time and the start times of tasks is represented by Eq. 10.3: TS FIPO < TS POS < TS FIPO + P POS (10.3) The relationship shown in Eq. 10.3 is because data transmission from the fine in- terpolation task to the position control task is done by shared memory instead of a ring buffer. In general, the ring buffer is used when the difference between the speed of producing data and the speed of consuming it is not constant. In the NCK mod- ule, the data transition between the Acc/Dec control task and the fine interpolation task is a good example of the use of the ring buffer. Whenever the Acc/Dec control task is carried out once, the Acc/Dec profile for one block is generated. However, the fine interpolation task consumes one profile segment corresponding to one sam- pling time. A single execution of the Acc/Dec control task generates data that the fine interpolation task can consume during several tens or several hundred time pe- riods. Because the data consumption speed of the position control task and the data production speed of the fine interpolation task are equal and fast data access speed is needed, shared memory was used. Because the usage of shared memory instead of the ring buffer makes the execution speed of the task predictable, the usage of shared memory has a positive influence on the reliability of the implemented NCK module. After the position control task consumes the whole result from the fine inter- polation task, the fine interpolation task interpolates the path segment (precisely speaking, the velocity profile) corresponding to the next sampling time. According to Eqs. 10.1, 10.2, and 10.3, the start time of tasks is specified as follows: // ********************************************************** // // Description: Set start time and period for each timer // // ********************************************************** // // Set reference time. RtGetClockTime(CLOCK 2, &Start time); 380 10 Design of PC-NC and Open CNC // Start rough IPO after 20 milliseconds. Start time1.QuadPart = Start time.QuadPart + 200000; // Start ACC/DEC after 54 milliseconds. Start time4.QuadPart = Start time.QuadPart + 200000 + 160000 + 160000 + 20000; // Start fine IPO after 62 milliseconds. Start time3.QuadPart = Start time.QuadPart + 540000 + 80000; // Start POS after 79 milliseconds. Start time2.QuadPart = Start time.QuadPart + 630000 + 160000; // Set repeat for each timer. RTPeriod.QuadPart = 160000; // 16 msec POSPeriod.QuadPart = 20000; // 2 msec // Create rough timer and start. hRIPO = RtCreateTimer( NULL, // Security - NULL is none 0, // stack size - 0 is use default. DoRIPO, // Timer handler NULL, // NULL context P RIPO, // priority CLOCK 2); // RTX HAL Timer RtSetTimer(hRIPO, &Start time1, &RTPeriod); In the above example, RtGetClockTime() is the function to get the current time and the time from RtGetClockTime() is used as the reference time (the reference time is saved in the variable Start time.). The start time for each task is decided on by adding a particular time to the reference time. For example, the rough interpolation task starts after 20 ms from the reference time. The position control task starts after 79 ms from the reference time. 20 ms is the allowance time spent to set variables and create the timer for the rough interpolation task. The Acc/Dec control task starts after the rough interpolation task has been executed twice and the allowance time, 2 ms, has passed. As mentioned above, in RTX the timer is generated by RtCreateTimer() and the timer is set by RtSetTimer(). RtSetTimer() gets the timer’s handler, the start time of the timer and the frequency of the timer are given as arguments. hRIPO, the first argument, denotes the handler of the rough interpolation task’s timer and Start time1, the second argument, means the start time of the timer. RTPeriod, the third argument, gives the sampling time of the timer. The above was applied to the NCK implemented in this book. Depending on the programming environment and algorithms, the description above varies. 10.4 Motion Control System Programming Example 381 10.4.4 Task Priority Priority is applied not only to a timer’s handler but also to an event handler. Equa- tion 10.4 denotes the priorities of tasks. In Eq. 10.4, PR RIPO , PR ACCDEC , PR FIPO ,and PR POS denote the priorities of the rough interpolation task, the Acc/Dec control task, the fine interpolation task, and the position control task, respectively. PR ES means the priority of the event for the emergency stop instruction. PR MMI denotes the pri- ority of the event for other instructions from the MMI except for the emergency stop instruction. In Eq. 10.4, A < B denotes that the priority of task A is lower than that of task B. And A <= B denotes that the priority of task A is less than or equal to that of task B. PR MMI < PR RIPO <= PR ACCDEC < PR FIPO < PR POS < PR ES (10.4) 10.4.5 Inter-Task Communication A ring buffer and a shared memory are used for communication between tasks in the NCK module. The following is the data structure for the ring buffer between the interpretation task and the rough interpolation task and the function to access the buffer. In general, when the memory size is not enough, a ring buffer is used and, by using the ring buffer, the usage of memory can be restricted. In particular, because of the difference between the speed of producing data from the Acc/Dec control task and the speed of consuming data by the fine interpolation task, memory may be used excessively. Excessive usage of the memory may reduce the performance of system. To overcome this problem, each task checks the number of items stored in the buffer. If as many items exist as the specified number, the task does not work. Using this method, the number of items does not exceed the specified size and the following code works like aringbuffer. // *********************************************************** // // Description: Ring buffer structure and handling function // // *********************************************************** // // Ring buffer structure for communication between IPR and rough IPO typedef struct CRingIRTag { int nGCode; // IPO type 0 : G00, 1 : G01, 2 : G02 Vector Start; // Start position (mm) Vector End; // End position (mm) Vector Cen; // Center of circular IPO (mm) float dRadius; // Radius of circular IPO (mm) float dFeed; // Feedrate (mm/min) float dSpindle; // Spindle speed (RPM) short int nSpindleDir; // CW: 1, CCW: 2, Stop: 0 382 10 Design of PC-NC and Open CNC int nStatus; // block status 0: start, 1: end int nControlMode; // EXACTSTOPMODE // /BLOCKOVERRAPMODE int nBlockNumber; // Index number of block int nWorkingstepID; // Working step ID BOOL IsProgramEnd; // TRUE: end of block, FALSE: under machining struct CRingIRTag* next; } CRingIR; // Head and tail of buffer typedef struct CIRListTag { CRingIR* head; CRingIR* tail; }CIRList; // ********************************************************** // // Description: Add item at tail of buffer // // ********************************************************** // void CIRList AddTail(CIRList* list, CRingIR* item) { item− >next = NULL; if(list− >tail == NULL) { list− >head = item; list− >tail = item; } else { list− >tail−>next = item; list− >tail = item; } } // ********************************************************** // // Description: Delete item structure at head of ring buffer // // ********************************************************** // BOOL CIRList RemoveHead(CIRList* list) { CRingIR* temp; if(list− >head == NULL) return TRUE; if(list− >head == list− >tail) { free(list-¿head); list− >head = list− >tail = NULL; return TRUE; } else { temp = list− >head; list− >head = list− >head−>next; [...]... their CNC equipment is the same A CNC system has limitations on communication with PC and FA controllers In addition, the options provided by CNC makers depend on the CNC makers and are expensive To solve these problems, standardization and openness are required 10.5 Open -CNC Systems 391 of CNC system exists for one kind of machine and it cannot exchange hardware, software, and data with other CNC systems. .. portability and interchangeability 10.5.2.2 Classification of an Open System The openness of a CNC system should include the openness not only of stand-alone units but also FA systems Therefore, besides the development of special-purpose 392 10 Design of PC-NC and Open CNC systems by modularization of system components and standardization of platforms and interfaces between modules, it is necessary to make... openness of PC technology However, now, despite low price, openness, and many developers of PC-NC, the lack of reliability and openness to application S/W has made it impossible to implement perfectly open systems 10.5.1 Closed-type CNC Systems For better understanding of Open -CNC systems, a conventional CNC system, the Closed CNC system contrasted with the Open -CNC system will be addressed In terms of functionality,... 11 .12 In addition, Part 11 also defines elements such as approach retract strategy at the beginning or end of the operation, milling machine functions for milling, and milling technology for milling 11.4.4 Part 12: Process Data for Turning Part 12 defines the technology-specific data elements needed as process data for turning The relationship between Part 10 and Part 12 is similar to that of Part 10 and. .. does it not provide flexibility to adapt the CNC system to a variety of machines and a variety of purposes In addition, since in the closed architecture the scalability of the function and the standard interface for exchanging the data with other systems are not provided, only one kind 390 10 Design of PC-NC and Open CNC Table 10.7 Requirements for closed CNC systems Item Reconfigurability Extensibility... handler, first, the event handler should be taken and the status of the event object should be changed RtOpenEvent() plays the role of opening the handler of a particular event and receives as arguments the access method to the event object and whether the returned handler can be inherited In addition, it also receives the name of an event object as argument After taking and using the event object handler,... function for creating a thread and it receives the thread handler function and the initial status of the thread as arguments StartHandler, the third argument, denotes the name of the handler function and the fifth argument, CREATE SUSPENDED, means that as soon as the thread is created, the handler 386 10 Design of PC-NC and Open CNC function is suspended The priority of the generated thread is specified... functionality, a CNC system consists of the NCK function, which executes the interpretation of a part program, interpolation, acceleration and deceleration control, position control, and compensation algorithm, the MMI function, 388 10 Design of PC-NC and Open CNC which provides the interface to enable a user to operate a machine, edit a part program, communicate with external systems, and watch the status of the... or modify a part of hardware or software without knowledge of the interface and dependency of each module In contrast, Type 3 10.6 Summary 393 Open MMI Partially Open CNC Fully CNC Open MMI NCK Fig 10.20 Open CNC System classification CNC systems can modify or replace modules independently owing to the full open architecture 10.6 Summary PC-NC, being the alternative for replacing a closed and expensive... 11.1 ISO Current status of Parts in the ISO 14649 (December, 2007) ISO 14649 Title of documents Edition Part 1 Overview & fundamental principles 1 Part 10 General process data 1 Part 11 Process data for milling 1 Part 12 Process data for turning 1 Part 13 Process data for wire-EDM 2 Part 14 Process data for sink-EDM 2 Part 15 Contour cutting 2 Part 16 Process data for inspection 2 Part 17 Process Data . only of stand-alone units but also FA systems. Therefore, besides the development of special-purpose 392 10 Design of PC-NC and Open CNC systems by modularization of system components and standardization. required. 10.5 Open -CNC Systems 391 of CNC system exists for one kind of machine and it cannot exchange hardware, software, and data with other CNC systems. Since monitoring of processes and the control. architecture of closed CNC systems could not meet the user’s re- quirements and improvement of CNC systems was possible, not by MTB (Machine Tool Builders) but CNC makers. The limited resources of CNC

Ngày đăng: 11/08/2014, 20:21

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan