The construction and application of the most popul

2022-10-23
  • Detail

Construction and application of real Linux system for numerical control equipment

with the rapid development and wide application of embedded system, embedded Linux is more and more respected by developers because of its powerful performance and openness. The establishment of embedded Linux Consortium (ELC) established by Cai, IBM and other companies and organizations marks that embedded Linux has moved towards the standardization stage. Now, various embedded systems based on Linux have been used in all walks of life. Based on the advantages of completely open source code and good performance comparable to commercial operating systems, people have carried out a lot of research and Discussion on the open CNC system based on embedded real-time Linux platform. Some international organizations and research institutions have made some substantial breakthroughs and progress in using embedded Linux to build medium and high-end CNC [6]

system construction methods and strategies

at present, as the largest open source project in the world, Linux technology has achieved rapid development and is widely used in desktop applications, massive computing, consumer electronics and industrial control products. Because of its very important practical value, the construction of micro Linux system has always been regarded as a research hotspot in the embedded field, and some research results have been achieved, such as floppy disk Linux project, tiny Linux system with flash card and so on [1]

based on the needs of actual system development, and on the basis of drawing lessons from some excellent open source projects in the world, the author of this paper gives a complete set of schemes and strategies for building a special real-time numerical control system platform (real time numerical control system platform -rcn is used to support the bearing of the sample and the indenter applying the load, both of which adopt hardened steel CP)

the two main objectives of building the real-time CNC system platform are: to achieve the purpose of verifying the application program interface, develop a set of software that can realize the functions of all CNC modules; Establish a media platform and carry out secondary development on this basis, which can easily realize the real-time control of machine tools, robots, coordinate measuring machines and other automatic equipment [2]

based on the characteristics of rcncp as a control system software platform, the author focuses on two aspects: real-time kernel reduction and construction, and Linux system integration

real time kernel reduction and construction

considering the openness of source code and the rapid development of real-time Linux system, the author adopts realtime-linux as the underlying platform of rcncp control system. Specifically applicable to rtlinux-3.1 and Linux core 2.4.16

the specific implementation steps are as follows:

obtain the required source code files:

Linux core

RTLinux source code

patch_ rtl-2.4.16、patch_ Rtlinux-3.1 patch file

extract the source code and patch it

tar zxvf/tmp/

tar zxvf/tmp/

patch p1root (hd2,0)

filesystem type is Ext2fs, partition type 0x83

grub>setup (HD2)

checking if "/boot/grub/stage1" exists yes

Checking if“/boot/grub/stage2”exists... yes

Checking if“/boot/grub/e2fs_stage1_5”exists... no

Install/boot/grub/stage1(hd2)/boot/grub/stage2/boot/grub/nf... succeeded Done.

grub>quit

in this way, the grub boot program is successfully installed on the CF card, and the CF card has become an independent starting medium

file system establishment

as an important part of the support for embedded Linux system, the author uses busybox, a small tool to complete this function. The implementation method is also very simple:

tar zxf

cd busybox-0.60.5; make; Make install

then install busybox on compact flash:

cp-r install/*/mnt/flash

after installation, you can use busybox to provide system support

specific application

considering the application characteristics of the system software in the NC equipment industry, based on the idea of distributed control, on the basis of the built real-time Linux system, using the component design method, the whole control system software can be divided into four parts according to its function classification: GUI (graphical user interfaces), human-machine interface, motion controller (MOT) The system workflow diagram of the input/output controller discrete i/o controller (IO) and task assignor task executor (task) is shown in Figure 1

Figure 1 rcncp numerical control system software work flow chart

the working principles of these parts are introduced below:

GUI (graphical user interfaces)

as a direct interface between the system and users caused by the special structure of numerical control, the human-machine interface must accurately reflect the current state of the numerical control device, such as the position of each coordinate axis, acceleration and deceleration setting, programmable IO address, etc. At the same time, it must be able to respond to users' requests in time and reach the specified target location, which puts forward higher requirements for the preparation of GUI programs

motion controller

motion controller MOT is the most important part of CNC system. It undertakes four main real-time tasks:

sampling the position of the controlled axis, sampling from the input port if it is a servo motor, and accumulating the current position of the motor with a counter if it is a stepping motor

calculate the next point on the trajectory

interpolate between the current point and the next track point

calculate the control output of the motor. For the servo system, the output is based on the PID adjustment algorithm. For the stepping motor, due to the open-loop, the control pulse output depends on whether the difference between the specified position and the cumulative position is greater than one step

it also realizes many other control functions, including the interface of programmable software travel limit, hard travel limit and reset switch, servo PID compensation supporting ff0, FF1 and FF2 feedforward, the setting of maximum follow-up error, selectable feed speed and acceleration, three independent feed modes of each axis (continuous, incremental and absolute), mixed sequential movement of linear and ordinary arcs, Programmable forward and reverse motion calculation, etc

mot is written in C, so it has good portability. The setting of system parameters is similar to that of INI configuration file under windows, which is read during program startup and operation. In the configuration file, you can set most software and hardware parameters, such as the number of axes, the type of axes, the axis unit and its proportion to the feedback device unit, the gain size, and the operation cycle of adjusting compensation and trajectory calculation. The complex kinematics algorithm can be written and connected in C according to the specified function interface, replacing the default kinematics algorithm of XYZ Cartesian coordinates

the hardware interface code that interacts with the hardware can also be rewritten conveniently with the provided API to drive different hardware devices without changing other parts

i/o controller

I/O controller is written in C + + and R equipment is used to protect CS library regularly. It is based on an inherited from NML_ Module is the hierarchy of the basic class, and all its communications use NML. Considering the low compatibility of the output controller, it is usually impossible to customize the IO system functions through the INI configuration file. An API written in C language is designed between the input and output controller and the hardware. It can easily drive different hardware to communicate with the company without rewriting the core code

task (task controller)

task controller is the core part of the whole system. Task controllers are similar to input and output controllers, both using RCS library and ml_ MODULE。 It accepts g and M series mechanical codes from GUI or other external programs, interprets them into standard commands, and sends commands to two controllers in sequential logic. Fig. 1 shows a workflow diagram. Figure 2 shows the system operation interface

Figure 2 RCNC system operation interface

conclusion

with the rapid development of the information industry, the post PC era has arrived in advance. In the foreseeable future, embedded Linux will be widely used in various fields. On the basis of studying the current embedded Linux system, the author also puts forward a new real-time system architecture, which is applied to the development of practical NC equipment. It has made a useful exploration in the field of embedded Linux, which is of great research value. (end)

Copyright © 2011 JIN SHI