The PC machine enters the field of numerical control, which greatly enriches the hardware and software resources of the numerical control system, and is beneficial to realize the bus-type, modular and open CNC system, which has a high performance-price ratio. With the development and popularization of Windows system, the development of CNC system under WindowB CE has become the consensus of the majority of CNC counterparts. In recent years, many domestic manufacturers have developed several Windows-based control systems. Domestic control systems have their own advantages, but from the perspective of the development of CNC systems, there are still many areas for improvement.

And other new operating systems. Software development ideas and technology are backward, always at or below the level of structured programming. Did not make full use of new theory and technology of object-oriented.

Secondly, there are irregular designs in the design of CNC system software, and the reliability and maintainability are poor. There is no open and modular software design method.

The system software introduced in this paper uses Windows multi-threading mechanism and interrupt mechanism to solve the real-time multi-tasking of CNC software. Using the new theory and technology of object-oriented, adopts an open and modular software design method to make the software have Open. The system software can perform interpolation, servo control and NC program preparation at the same time, which can better meet the requirements of the numerical control system, and has formed a product with good application effect.

The overall design of 2CNC software is to make the CNC software have obvious open CNC features, so that the CNC software is easy to assemble, expand and maintain. We adopt the engineering design method and develop a set of Windows 32-bit CNC software using object-oriented technology. Software design follows the principles of modularity, hierarchy, and dynamic configuration.

Open control systems should employ a layered architecture. Layering enables the layers to be isolated, and the layers communicate with each other through standard interfaces to achieve portability and available third-party software, and only replace the corresponding layers. The first vertical level of the system is the interface layer, which completes the monitoring and management of the system: input, I/O processing, display, diagnosis and monitoring. This interface layer consists of an interface and various callback functions. The function of the callback function is to complete the event-driven operation of the controls on the interface. The callback operation of the callback function, managed by the operating system.

The second vertical level of the system is the functional unit layer, including the decoding class, the tool compensation class, the interpolation dynamic connection library, and the motion controller class. The decoding layer interprets the NC instructions into the internal data format of the CNC system. The tool compensation layer performs tool compensation. Interpolation dynamic link library completes data interpolation, generates processing data, speed processing, auxiliary function device control D motion controller class completes position servo control D decoding class, knife complement class is composed of multiple software chips. The call operation of this functional unit layer is placed in the callback function.

The third vertical level of the system is the support layer, including the motion controller card, the device driver of the motion controller, the I/O card, the operating system, and the PC. The motion controller card mainly performs the task of position servo. The motion controller's device driver completes direct manipulation of the motion control card and I/O card. The architecture of this system is as shown.

In the software of the numerical control system, a front-back type structure is adopted. The foreground program interrupts the program in real time and completes all real-time functions (interpolation dynamic link library, motion controller class, device driver), mainly interpolation function. The main functions of the background program are the preparation function and scheduling management before interpolation (including interface, I user input I decoding class, knife compensation class). Specifically, it is a numerical control program input, decoding, tool compensation, display and scheduling management functions between the above tasks. The daemon structure is a multi-threaded structure that performs multitasking. During the running process, the foreground program (interrupt service program) is continuously inserted to complete the part processing tasks. The task of position servo is mainly done by the motion controller. After the machining program is decoded by the computer, tool compensation, and speed processing, the interpolation command data of the tool center is obtained. The computer stores these imputed instruction data and other instruction data in a buffer in a fixed format. Each time an interrupt occurs, the computer performs the corresponding processing based on these instruction data. If there is an interpolation command, the interpolation data is calculated in real time and a buffer is sent, and the motion controller controls the motor action of the corresponding axis based on the data. When one frame of instruction data in the computer is read, the new interpolation instruction data is automatically calculated in the interpolation gap, and the buffer is filled.

Document editing surface for the surface of the knife / alcohol set 1 surface system setting surface manual 撅 更 更 ip ip ip ip 自动 自动 自动 自动 自动 自动 自动 自动 自动 自动 自动 自动 自动 自动 自动 自动 自动 自动 自动 自动 自动 自动 自动 自动 I I I I I I I I I I I I I 3 Implementation Method 3.1 Multi-task real-time control strategy of the software system The CNC system is a dedicated multi-tasking computer system.

In its control software, it incorporates many advanced technologies in software technology, the most prominent of which is multi-task parallel processing and real-time processing. The CNC device is usually used as an independent process control unit in industrial automation production process. Software must complete both management and control functions. The management part of the system, including input, I/O processing, display, and diagnosis. The control part of the system, including decoding, tool compensation, speed processing, interpolation, position control. During the actual operation of the CNC device, several of the multiple tasks are to be performed simultaneously.

In the actual application process of industrial automation, CNC software must have real-time in order to meet the production requirements.

In order to make our CNC software have the ability of parallel processing and real-time processing, we adopt the multi-threaded model of Windows95 and the control strategy of the interrupt mechanism.

In order to enable the CNC system software to process multitasking in parallel in the Windows environment, multi-threading is used to implement multi-tasking control. Thread is the main feature of the 32-bit operating system. It supports the preemptive multitasking mechanism and is the basic scheduling unit of the operating system. We can place each management and control module in a separate thread to achieve parallel processing of the CNC software system. In our CNC software, the main control thread (monitoring and interface thread), display/panel operation thread and automatic processing thread are established. The preset time slice of the display/panel operation thread is 50ms. The automatic processing thread is started and eliminated by the main thread. By establishing these three threads, the coordinated operation of the entire system can be achieved.

The main control thread mainly completes monitoring and interface management, function control, system management, etc., and is responsible for starting and eliminating automatic processing threads in real time. The display/panel operation thread is eliminated when the system exits. The main control thread is queued by Windows messages to implement its operation flow.

The user input (the program starts p: NC initializes a system main menu interface and the event loops 3 does not stop the thread) to achieve a real-time task. Since interrupts can occur at any time, and are not limited to applications running on the device, the interrupt service routine must be in a fixed code segment. In the large frame EMS memory configuration, there is only one type of code that can be used to perform such interrupt service at any time. This type of code is the code in a fixed code snippet of a dynamic link library (DLL). Therefore, you must use a DLL to implement the interrupt. In our system, hardware interrupts are implemented using DLLs and are reliable.

In our software, in the automatic processing thread, the interrupt mechanism is used for real-time control. The automatic processing thread mainly completes opening NC files, syntax checking, decoding, tool compensation, interpolation, and generating processing data. Among these functions, the interpolation must be done in real time and thus implemented using an interrupt service routine. The opening of the automatic processing thread is completed in the callback function. The control flow of the automatic processing thread can be seen in the interrupt service program control flow. See the automatic processing thread. Because the dynamic link library can be loaded and unloaded flexibly by the application according to the needs, the occupied system resources will be reduced accordingly, so the interpolation interrupt service program is compiled. Connected to form as a dynamic link library.

Because object-oriented software development technology combines functional abstraction and data abstraction, it better realizes software scalability, polymorphism, and makes software easy to modify. We use the object-oriented method to model the numerical control software, and describe and implement it in three levels: system, control unit and basic class, which makes the CNC software assembleable and easy to expand.

The basic class is the result of fine-grained decomposition of the numerical control system function and is the smallest unit that constitutes an open system. The basic classes form the class system of object-oriented NC software. A basic class with a standardized interface is called a software chip.

A control unit is a software entity that consists of a series of functionally related basic classes that perform certain functions. Control units can be nested.

The system is a type of CNC system software consisting of a series of control units.

In our CNC software development class, there are motion controller classes, decoding classes, and tool compensation classes. They all perform position servo function, decode function, and tool compensation function as function units. The decoding class and the tool complement class are more complicated and are composed of multiple software chips.

3.3 Multi-buffer technology Motion controller class, decoding class, tool-compensation class and dynamic link library are relatively independent functional units. They have a large amount of data exchange with each other, so multi-buffer is used to realize data exchange.

In order to coordinate the operation between threads and tasks, the modules are relatively independent, and multiple data buffers are created in the software. The specific implementation method is: allocating memory for multiple buffers, establishing read and write to the current buffer. The pointer constitutes a circular multi-buffer; a flag is set for each block of memory as a basis for judging the operation of each buffer; each time a buffer is read, a read flag is set for the buffer, and the current read pointer moves forward. A buffer; each write a buffer, set the write flag to the buffer, the current write pointer moves forward a buffer; for the buffer whose current operation is not finished, set the operation flag to prohibit other operations.

In this way, the operation that must be completed in a single interpolation cycle in the system is "homogenized" in multiple interpolation cycles, effectively utilizing the calculation time of the CPU and improving the working efficiency of the system.

3.4 Interface Implementation The interface of the technology measurement and control software not only has Windows-like control functions, but also must have some real-world controls, such as electric meter display 7TC, knob and so on. Therefore, the system interface is designed using LabWindows/CVI tools. It is very convenient to design the interface in a C language when using LabWindows/CVI. The interface designed by this tool includes a header file (.h) and an interface file (.uir). In it, provide a callback function for the interface control. The application can implement the required functionality in the callback function. In this system, the display/panel operation thread acts as a callback function for the interface's timer control. Windows periodically calls the timer control's callback function according to the time set by the timer.

4 Conclusion The multi-threading model and the interrupt mechanism combine the control strategy and hierarchical architecture. Using object-oriented technology, multi-buffer technology and interface implementation technology, the real-time multi-task control requirements of the numerical control system are successfully realized in the Windows environment. Better software scalability, polymorphism, refactoring, and easy to modify software. This design method has been applied to the CNC software we developed and has achieved good results.

(Finish)

Fat Tire Electric Motorcycle

Electric Offroad Motorcycle,Fat Tire Electric Motorcycle,High Speed Electric Motorcycle,Fat Tire Mountain Electric Motorcycle

Wuxi Jiangyin Xufeng Electric Bicycle Co., Ltd. , https://www.relxrides.com