J. Cent. South Univ. Technol. (2011) 18: 1545-1553
DOI: 10.1007/s11771-011-0871-7
Performance analysis model for real-time Ethernet-based computer numerical control system
WAN Jia-fu(万加富)1, 3, LI Di(李迪)2, TU Yu-qing(涂钰青)2, ZHANG Chun-hua(张春华)2
1. College of Automation Science and Engineering, South China University of Technology,Guangzhou 510640, China;
2. School of Mechanical and Automotive Engineering, South China University of Technology,Guangzhou 510640, China;
3. College of Information and Engineering, Guangdong Jidian Polytechnic University,Guangzhou 510515, China
? Central South University Press and Springer-Verlag Berlin Heidelberg 2011
Abstract: In order to optimize the embedded system implementation for Ethernet-based computer numerical control (CNC) system, it is very necessary to establish the performance analysis model and further adopt the codesign method from the control, communication and computing perspectives. On the basis of analyzing real-time Ethernet, system architecture, time characteristic parameters of control-loop etc, a performance analysis model for real-time Ethernet-based CNC system was proposed, which is able to include the timing effects caused by the implementation platform in the simulation. The key for establishing the model is accomplished by designing the error analysis module and the controller nodes. Under the restraint of CPU resource and communication bandwidth, the experiment with a case study was conducted, and the results show that if the deadline miss ratio of data packets is 0.2%, then the percentage error is 1.105%. The proposed model can be used at several stages of CNC system development.
Key words: computer numerical control (CNC) system; real-time Ethernet; time characteristic parameters; performance analysis model; manufacturing accuracy
Introduction
Embedded systems and networked embedded systems play increasingly important roles in today’s society. Combining embedded control technology with network technology is widely used in computer numerical control (CNC) system. Nowadays, the trend toward distributed motion control and motion networks is driven by a desire to reduce wiring, lower cost, and increase reliability [1]. A typical example of distributed motion control system is Ethernet-based CNC system. Realizing the high performance Ethernet-based CNC system includes several important technologies such as Acc/Dec control, interpolation technology, servo control, contour error and compensation, and embedded system implementation. For this system, the embedded system implementation is a challenge for a designer, and the primary reason is to consider some critical problems collectively, e.g. network resource allocation, CPU scheduling and servo control algolithm.
There are many factors that influence the manufacturing accuracy of Ethernet-based CNC system. However, the interrelated problems concerned with embedded system implementation are considered during establishing performance analysis model, without regard to other factors in this work.
Today, the embedded system implementation for the Ethernet-based CNC system are becoming increasingly complex from the control, communication and computing perspectives. Generally, sampled control theory assumes periodic sampling and negligible or constant input-output latencies. When a controller is implemented as a task in a real-time (RT) operating system executing on a computing platform with small resource margins, this can not be achieved normally. Preemptions from higher priority tasks or interrupt handlers, blockings caused by accesses to mutually exclusive resources, cache misses, etc, lead to jitter in sampling intervals and input-output latencies. Likewise, for the Ethernet-based CNC system, medium access delays, transmission delays, and network interface delays cause variable communication latencies [2]. In these cases, the development trend for designing the Ethernet- based CNC system is the codesign among the control, communication, and computing. For codesign, simulation is a powerful technology that can be used at several stages of system development, which is important to be able to include the timing effects caused by the implementation platform in the simulation. Thus, a performance analysis model for the RT Ethernet-based CNC system is proposed in order to further optimize the embedded system implementation.
2 Related work
For a software-based CNC system, WAN et al [3] built a simulation model for analyzing the embedded system implementation. On the basis of this research, a novel fuzzy feedback scheduling algorithm based on output jitter of key RT tasks was proposed. In Ref.[4], the relationship between time characteristic parameters and CNC system performance was quantified by a performance analysis model. In these studies, Truetime [5] was usually adopted as the simulation tool because a few other tools had been developed that supported co-simulation of RT computing systems and control systems. Moreover, Truetime was the co-simulation facility that made it possible to simulate the latency- related aspects of the network communication in combination with the node computations and the dynamics of the physical environment [2]. Therefore, Truetime was chosen to simulate Ethernet-based CNC system in this work.
In the past, the number of industrial solutions for this application of Ethernet grew rapidly. Different methods for solving the RT problem of the conventional Ethernet were developed, so the largest problem of the use of Ethernet in the field area was solved [6]. In Ref.[7], the ongoing activities in the field of using heterogeneous networks within the automation domain were addressed. In the emerging field of Ethernet-based CNC system, some famous enterprises came up with the representative samples based on RT Ethernet such as EtherCAT, SERCOS-III, and PROFInet [6]. The time synchronization of hierarchical RT networked CNC system based on Ethernet was analyzed in Ref.[8]. Many additional references could be found in Refs.[9-10].
Over the years, a plenty of theory and methodology were well-established in the field of CPU scheduling and network resource allocation [11-13]. Further, some researchers explored an emerging field in terms of control-scheduling codesign, which was motivated by the good quality of control for integrating the feedback control and RT computing from both the control and computer science perspectives [14-15]. Scheduling and communication in the Ethernet-based CNC system led to timing behaviors (delay and jitter) that degraded the overall control performance [16]. From the codesign point of view, in order to optimize the embedded system implementation, it was very necessary to establish a simulation model for the Ethernet-based CNC system.
3 Ethernet-based CNC
3.1 System architecture
In CNC system, architecture means the structure and organization of the control problem. Broadly speaking, there are hierarchical motion control applications where the axes are clustered into 2, 3 or more functional axes, and there are flat applications, where a number of motors must be controlled more or less equally by the central PC. For the Ethernet-based CNC system, the former is usually adopted.
An Ethernet-based CNC system, as shown schematically in Fig.1, is composed of a motion controller with network interface, motors, servo controllers, and a RT Ethernet network. Ethernet-based CNC system requires a network that supports high-speed synchronous transmission of control command and feedback information. To synchronize several axes over a network, a communication cycle time less than 1 ms is needed with a good synchronization accuracy.
Fig.1 Typical Ethernet-based CNC system
3.2 RT Ethernet
Traditional Ethernet is not suitable to meet real time requirements of CNC system. For the Ethernet-based CNC system, the RT requirements are focused on the response time behavior of data packets. Thus, there are three RT classes guaranteeing response time, without considering the class “non-RT” [7]:
1) Class 1: soft RT (scheduling of data traffic on top of UDP/TCP): scalable cycle time, used in factory floor and process automation.
2) Class 2: hard RT (scheduling of data traffic on top of MAC): cycle time 1-10 ms, used for control.
3) Class 3: isochronous RT (with time/clock synchronization and routing with time schedule): cycle time 250 μs-1 ms, used for motion control.
Recently, several RT Ethernets have been proposed as extensions to the industrial Ethernet solutions which are already defined in the communication profile families in IEC 61784-1. These solutions become part of the fieldbus standard. Main RT Ethernet in CNC system is summarized in Table 1.
3.3 Time characteristic parameters for control-loop
During the embedded system implementation, the time characteristic parameters appear in the execution of tasks. If we classify the variety of tasks in terms of function, they can be divided into two types: one is the non-periodic task and the other is the periodic task. A non-periodic task means a task in which the real-time property is not required and the man machine control, interpreter and communication function are typical examples of the non-periodic task. A periodic task is a task for which the real-time property is required and the interpolator and position control tasks are typical examples of periodic tasks. The main task attributes of CNC system are listed in Table 2.
Generally speaking, the time characteristic parameters for control-loop mainly include latency, jitter, sampling period, and lost packet. All the parameters are intimately associated with Ethernet-based CNC system resource and implementation policy. As previously mentioned, the optimum embedded implementation needs the codesign method among the control, communication, and computing in order to improve the certainty of task execution.
The Ethernet-based CNC system with induced time characteristic parameters include three kinds of computer delays, as shown in Fig.2: computational delay in the motion controller; communication delay between the sensor and the motion controller; communication delay between the motion controller and the actuator. The total control delay, for the Ethernet-based CNC system, the time from when a measurement signal is sampled to when it is used in the actuator, equals the sum of these delays:
(1)
Table 1 Main real-time Ethernet for CNC system
Table 2 Main task attributes of CNC system
Fig.2 Ethernet-based CNC system with induced time characteristic parameters
Additionally, the time sequences in such a system are illustrated in Fig.3. Due to the effect of embedded system resource, and communication bandwidth, etc, the measurement signal, from the sensor to the actuator, may be lost or miss the deadline.
Fig.3 Time sequences in Ethernet-based CNC system
3.3.1 Time parameters for controller
Ideally, the control algorithm should be executed with perfect periodicity, and there should be zero delay between the reading of the inputs and the writing of the outputs. This will not be the case in a real implementation, where the execution and scheduling of tasks introduce latencies.
The basic timing parameters of a control task are shown in Fig.4. It is assumed that the control task is released periodically at times given by rk=kT, where T is the sampling interval of the controller. Due to the preemption from other tasks in the system, the actual start of the task may be delayed for some time Ls. This is called the sampling latency of the controller. A dynamic scheduling policy will introduce variations in this interval. The sampling jitter, Js, is quantified by the difference between the maximum and the minimum sampling latencies in all task instances:
(2)
Normally, it can be assumed that the minimum sampling latency of a task is zero, and in this case we have Jitter in the sampling latency will of course also introduce jitter in the sampling interval T. It is obvious that T is only a nominal sampling period. The sampling interval jitter JT is quantified by
(3)
Fig.4 Basic timing parameters of control task
We can see that the sampling interval jitter is upper bounded by
(4)
where Jh is the maximum sampling jitter.
After some computation time and possibly further preemption from other tasks, the controller will actuate the control signal. The delay from the sampling to the actuation is the input-output latency, denoted as Lio. Varying execution times or task scheduling will lead to variations in this interval. The input-output jitter Jio is quantified by
(5)
As already stated in our previous work, the sampling jitter and input-output jitter display varieties of nominal sampling period and task executions, respectively. Additionally, the delay of motion controller is determined by the sampling latency and input-output latency, as shown in Fig.4.
(6)
3.3.2 Communication latencies and lost packets
Communication latencies affect the stability and dynamic characteristic of network, even lead to system instability in extreme cases. Closely associated with communication, latencies are network protocol, node driving mode, etc. Generally, the communication latency, Ldelay, is determined by the following expression:
(7)
where Lpre is the sending process latency, Lwait is the waiting latency, Ltx is the transferring latency, and the Lpost is the receiving process latency. In addition, the large majority of communication latency is the waiting latency, which sometimes affects the system performance. Therefore, network resource allocation by means of packet scheduling in network layer and control task scheduling in application level is of particular importance for Ethernet-based CNC system.
In the networked embedded systems, the lost packets can be broadly split into two basic types: the real lost data and the missed deadline. For the former, the network transmission error is mostly the causation of the lost data. However, the latter shows that the task executions are not finished until the deadline. From the control point of view, the lost packets mean that the actuator cannot get the control input signal during per period, so as to suffer from negative influence on the manufacturing accuracy.
4 Implementation of performance analysis model
4.1 Model framework
The model contains four computer nodes, with each represented by a Truetime kernel block, as shown in Fig.5. The time-driven servo controller nodes sample the process periodically and send the samples over the real-time Ethernet to the motion controller node. The interpolation task in this node calculates the control signal and sends the result to the each servo controller node, where it is subsequently actuated. The simulation also involves an interfering node sending disturbing traffic over the network, and a disturbing high-priority task executing in the controller node.
Fig.5 Model framework of Ethernet-based CNC system
According to the position signal and angle, the result of error analysis indicates the effect of control-loop time characteristic parameters on system performance during embedded system implementation. In addition, the model may be extended to analyze four-axis or six-axis motion control systems by increasing the related modules.
4.2 Module design
The error analysis module and the controller nodes are the keys to the implementation of performance analysis model.
4.2.1 Error analysis module
Assuming that the sampling interval of the simulation model is a constant step, the nearby output positions of the control object are A: pi–1(xi–1, yi–1) and B: pi (xi, yi). Because the nearby time interval is little, the movement from A to B is regarded as an approximately straight line, as shown in Fig.6. At the midpoint C of the straight line AB from Fig.6, we can see that the following error at the position C is the distance from C to E. D is the joint between the extended line of OC and the ideal contour line, and the length of CD approximates that of CE. To simplify the computation, the length of |CD| is regarded as a contour error, and the square of the contour error (|CD|2) is the criterion as the performance assessment for Ethernet-based CNC system. Figure 6 shows that the following expression can be concluded:
(8)
where the length of |OC| is given by
(9)
Fig.6 Contour error for analyzing manufacturing accuracy
4.2.2 Controller nodes
The motion controller node executes the interpolation task and sends the results to each servo controller node. Beyond that, the non-periodic tasks such as man machine interface tasks, together with the interpolation task, compete for CPU resource so that the latencies are inevitably introduced. From the network communication point of view, the data packets are possible to simultaneously transfer over real-time Ethernet, which leads to the communication latencies and even loses the packets.
The program code initializing motion controller in the model is shown as follows:
function controller_init(arg)
ttInitKernel('prioFP') %scheduling policy
data.r=1000; % radius
data.curAng=0;
data.objx = data.r*cos(data.curAng);
data.objy = data.r*sin(data.curAng);
deadline = 0.004;
ttCreateTask('Interpolation_task', deadline,
'Interpolation_code', data); %create interpolation task
period = 0.007;
data = period*arg;
ttCreatePeriodicTask('dummy_task', period,
'dummy_code', data);
prio = 1.0;
data = 'Interpolation_task';
ttCreateHandler('network_handler', 1,
'nwhandler_code', data)
ttAttachNetworkHandler('network_handler')
ttNoSchedule('network_handler');
For the servo controller, the transfer function G(s) of DC servo system is derived from related parameters, as listed in Table 3 [4].
(10)
Table 3 Related parameters for deriving transfer function
During every sampling period, the servo controller nodes send the samples to the motion controller node by means of PROFInet. The motion controller finishes the interpolation algorithm and then sends the results to the each servo controller node, where it is subsequently actuated. According to Fig.3, the time parameters from the sensor to the actuator vary with every sampling period because of resource competition.
The program code initializing servo controller in the model is listed as follows:
function asensor_actuator_init
ttInitKernel('prioFP'); %scheduling policy
ttCreateMailbox('s_xsample',10);
data.ts = 0.004;
% transfer function
sys=tf(250,[1,25,0]);
dsys=c2d(sys,data.ts,'z');
[num,den]=tfdata(dsys,'v');
[data.A data.B data.C data.D]=tf2ss(num,den);
...
%PID parameters
data.kp=8.5;
data.ki=0.38;
data.kd=0.35;
...
data.uChan = 1;
data.count = 0;
data.PIDMode = 1;
period = 0.004; % initial value of servo period
datacount.count = 0;
ttCreatePeriodicTask('asensor_task', period,
'asensor_code',datacount); %create sampling task
deadline = 10.0;
%create servo task
ttCreateTask('aactuator_task', deadline, 'aactuator_
code',data);
prio = 1.0;
data = 'aactuator_task';
ttCreateHandler('network_handler', prio,
'nwhandler_code', data);
ttAttachNetworkHandler('network_handler')
4.3 Simulation model
As shown in Fig.7, the simulation model for analyzing the embedded system implementation is established. Besides the controller nodes, this model also involves an interfering node sending disturbing traffic over the network, and a disturbing high-priority task executing in the controller node. Therefore, the jitter and communication latencies are introduced, and even the data packets are lost in extreme cases.
The outputs of error analysis module, calculated according to Eq.(9), are the current values of contour error and angle which indicate the influence extent of time characteristic parameters on control performance.
5 Case study
The performance analysis model includes the timing effects caused by the implementation platform. However, to simplify the analysis, only the effect of the lost packets on the system performance is considered without regard to the others.
5.1 Simulation parameters
The main tasks and expected periods are listed in Table 4. The interfering node sends disturbing traffic with a controlled signal over the network, so as to compete for the network resource. As mentioned above, the lost packets mean that the data is real lost or misses the deadline, which embodies that the times of position control are less than the times of sampling.
5.2 Performance evaluation
Assume that a circle with a radius of 1 000 mm is machined and the simulation time is 2 s. Accordingly, the times of sampling are obviously 500. According to Table 4, two independent experiments were conducted to compare the mismachining tolerance under different disturbing traffic. In the first experiment, the disturbing traffic was set to be zero, but a controlled signal was sent to the network during the second experiment. The negative effects of the lost packets are observed by calculating the relationship between the deadline miss ratio and manufacturing accuracy under the restraint of CPU resource and communication bandwidth.
Fig.7 Simulation model for analysing embedded system implementation
Table 4 Main tasks and expected periods
The network status is shown in Fig.8, where there exists an obvious difference in network utilization. By comparing Fig.8(a) with Fig.8(b), it can be seen that transporting the disturbing traffic occupies the network resource so as to increase the communication latencies of sending sampling and interpolation result. Figure 9 shows the task executions of the servo controllers. Obviously, the total control delay (i.e. Lt) from the sensor to the actuator varies over a wide range for the second experiment.
By comparing the contour error under different simulation conditions, we can further evaluate the embedded system implementation. Because of the disturbing traffic, the times of position control in the second experiment are 499. Therefore, the deadline miss ratio is 0.2%. The comparison of contour error is given in Fig.10 and Table 5. In the time interval from t=1.4 s to 1.6 s, the negative influence of the lost packets is obvious, as shown in Fig.10. According to Table 5, the maximum of contour error is up to 11.05 and 2.93 mm for two different experiments, which indicates the effect degree of lost packets on manufacturing accuracy.
Fig.8 Network status: (a) Network utilization without disturbing traffic;(b) Network utilization with disturbing traffic
Fig.9 Task executions of servo controller: (a) Task executions without disturbing traffic; (b) Task executions with disturbing traffic
Fig.10 Comparison of contour error: (a) Square of contour error; (b) Circle in different conditions
Table 5 Comparison of contour error
6 Conclusions
1) The system architecture of Ethernet-based CNC system and RT Ethernet used in motion control are introduced. The time characteristic parameters for control-loop, such as jitter, communication latencies and lost packets, are deeply analyzed.
2) On the basis of designing the error analysis module and the controller nodes, the performance analysis model is established.
3) The experiment with a case study is conducted, and the results show the effect of lost packets on manufacturing accuracy, which is used to evaluate the embedded system implementation.
4) The codeisgn for the Ethernet-based CNC system is quite complicated and cannot be realized by traditional design. Further research on this project will take into account of the control, communication and computing perspectives by the aid of the performance analysis model. design method. model ning the error analysis module and controller nodes,
References
[1] LEWIN C. Motion control networks [R]. Massachusetts: Performance Motion Devices Inc, 2007.
[2] ?rzén K E, CERVIN A. Truetime simulation tool for performance analysis of real-time embedded systems [EB/OL]. [2009-12-21].
[3] WAN Jia-fu, LI Di, ZHANG Ping. Key technology of embedded system implementation for software-based CNC system [J]. Chinese Journal of Mechanical Engineering, 2010, 23(2): 217-224.
[4] WAN Jia-fu, LI Di, YAN He-hua, ZHANG Ping. Fuzzy feedback scheduling algorithm based on central processing unit utilization for a software-based computer numerical control system [J]. Journal of Engineering Manufacture, 2010, 24(7): 1133-1143.
[5] CERVIN A, HENRIKSSON D, OHLIN M. Truetime 2.0–reference manual [EB/OL]. [2009-10-15]. http://www. control.lth.se/truetime/.
[6] SCHWAGER J. Real-time Ethernet in industry [EB/OL]. [2008-09-29]. http://www.real-time-ethernet.de/.
[7] NEUMANN P. Communication in industrial automation—What is going on? [J]. Control Engineering Practice, 2007, 15(11): 1332-1347.
[8] ZHANG Xiang-li, TANG Xiao-qi, CHEN Ji-hong. Time synchronization of hierarchical real-time networked CNC system based on Ethernet internet [J]. International Journal of Advanced Manufacturing Technology, 2008, 36(4): 1145-1156.
[9] ZHANG Xiang-li, TANG Xiao-qi, CHEN Ji-hong, WU Tao. Hierarchical real-time networked CNC system based on the transparent mode [J]. International Journal of Advanced Manufacturing Technology, 2007, 34(3): 161-167.
[10] PEREIRA C E, CARRO L. Distributed real-time embedded systems: Recent advances, future trends and their impact on manufacturing plant control [J]. Annual Reviews in Control, 2007, 31(1): 81-92.
[11] WAN Jia-fu, LI Di. Fuzzy feedback scheduling algorithm based on output jitter in resource-constrained embedded systems [C]// 2010 International Conference on Challenges in Environmental Science and Computer Engineering. Wuhan, 2010: 147-152.
[12] SHEN Qing, GUI Wei-hua, YANG Chun-hua, YANG Tie-jun. Application of predictive control scheduling method to real-time periodic control tasks overrun [J]. Journal of Central South University of Technology, 2007, 14(2): 266-270.
[13] LI Zu-xin, WANG Wan-lang, CHENG Xin-min. Optimal band with scheduling for resource-constrained networks [J]. Acta Atuomatica Sinica, 2009, 35(4): 443-448. (in Chinese)
[14] XIA Feng, SUN You-xian. Control-scheduling codesign: A perspective on integrating control and computing [J]. Dynamics of Continuous, Discrete and Impulsive Systems–Series B, 2006, 13(2): 1352-1358.
[15] CERVIN A. Integrated control and real-time scheduling [D]. Lund: Lund Institute of Technology, 2003.
[16] SAMII S, CERVIN A, ELES P, PENG Z. Integrated scheduling and synthesis of control applications on distributed embedded systems [C]// Design, Automation & Test in Europe Conference & Exhibition. Acropolis, 2009: 57-62.
(Edited by YANG Bing)
Foundation item: Projects(50875090, 50905063) supported by the National Natural Science Foundation of China; Project(2009AA04Z111) supported by the National High Technology Research and Development Program of China; Project(20090460769) supported by China Postdoctoral Science Foundation; Project(2011ZM0070) supported by the Fundamental Research Funds for the Central Universities in China; Project (S2011010001155) supported by the Natural Science Foundation of Guangdong Province, China
Received date: 2010-07-27; Accepted date: 2010-12-06
Corresponding author: LI Di, Professor, PhD; Tel: +86-20-87114637; E-mail: itdili@scut.edu.cn