Research on Scheduling of Network Control Systems Based on CAN Bus
2026-04-06 06:20:23··#1
Abstract: Network control is a new field formed by the integration of computer technology, communication technology, and control technology. Network scheduling has a significant impact on the performance of network control systems. This paper introduces the schedulability analysis method and basic scheduling algorithm of the network, and then proposes an improved hybrid scheduling algorithm (MTS). A simulation platform for a network control system based on the CAN bus is built using the TrueTime toolbox. Through simulation experiments comparing the impact of the improved MTS algorithm on the motor network control system, the effectiveness of the algorithm is demonstrated. The performance of the improved network control system is greatly improved, the overshoot is significantly reduced, and the settling time is shortened. Keywords: CAN bus; scheduling; network control 1 Introduction Network control system (NCS), also known as a networked control system, is a control system implemented in a network environment. For network control systems, due to the large number of information sources in the system, information transmission requires time-sharing of network communication lines. However, the network's carrying capacity and communication bandwidth are limited, inevitably resulting in time delays during information transmission. These delays may be fixed, time-varying, or even random. From a control perspective, such delays make system analysis and design more complex. There are two approaches to solving network latency problems: one is to fully consider the impact of network latency when designing control algorithms, which is a controller design problem; the other is to design the controller without considering latency, relying on improved scheduling algorithms to ensure the real-time nature of information transmission and ensure the stability and performance of the control system, which belongs to the information scheduling problem. This paper takes the CAN bus as the research object. After analyzing network schedulability and scheduling algorithms, an improved hybrid scheduling algorithm (MTS) is proposed. The network control system is simulated using the TrueTime network control toolbox, and the impact of the scheduling algorithm on the control system performance is analyzed, achieving satisfactory results. 2 Scheduling Algorithm Traditional computer control theory assumes that the output of the object is sampled at equal intervals, that is, periodically sampled at time kT[sub]m[/sub], where T[sub]m[/sub] is the sampling period. This assumption can yield a linear time-invariant data sampling system and greatly simplify the analysis of system stability and other performance characteristics. However, due to the existence of network transmission latency and its uncertainties, equal interval sampling cannot necessarily be guaranteed in NCS. For NCS, one of the main requirements is the time limit, that is, the information must be successfully transmitted within a limited time and the time characteristics of the information transmission must meet the real-time requirements of the system. Network scheduling mainly focuses on how often a node can transmit information and the priority of the transmitted information. The process of judging whether the network transmission meets the main requirements and the guarantee of transmission is called schedulability analysis. 2.1 Scheduling analysis The worst response time of information, that is, the longest waiting time, is an important parameter for whether it is schedulable. It is defined as the longest time required from when the information enters the transmission queue of the sending node to when it is correctly received by the target node. For any information S[sub]m[/sub], its longest waiting time R[sub]m[/sub] is: (1) Where J[sub]m[/sub] is the disturbance time of information S[sub]m[/sub], that is, the earliest and latest time difference when the information is queued; I[sub]m[/sub] is the waiting delay time of information S[sub]m[/sub]; C[sub]m[/sub] is the transmission time of information S[sub]m[/sub]. To ensure the real-time transmission of CAN bus information, a message entering the transmission queue must be sent before the next message arrives. If the message is not sent in time, it will be overwritten by the next message. Therefore, the transmission of information must satisfy (2) where D[sub]m[/sub] is the information deadline, representing the maximum allowed time from the generation of the message to its correct reception. If each message satisfies this condition, we say that the network is schedulable. The purpose of selecting the network scheduling algorithm is to ensure the schedulability of the network. 2.2 Basic Scheduling Algorithm The CAN bus uses identifiers in the data frame to represent the source and priority of the information. Identifiers can be set statically or dynamically, that is, static or dynamic information priorities can be achieved using identifiers. Among the real-time scheduling algorithms that satisfy schedulability, the priority-driven real-time scheduling algorithm is currently commonly used. It can be divided into static priority scheduling algorithm and dynamic priority scheduling algorithm. In the static priority scheduling algorithm, the priority of task scheduling remains fixed during the scheduling process, such as the fixed priority scheduling algorithm (FP) and the monotonic rate algorithm (RM). RM allocates the priority of information according to the period of the information. The smaller the period of the information, the higher the priority. In the dynamic priority scheduling algorithm, the priority of task scheduling changes dynamically with the execution time or deadline of each control task. The task priority is not only related to the task itself, but also to other tasks in the system, such as the earliest deadline first algorithm (EDF) and the deadline monotonic algorithm (DM). DM allocates the priority of information according to the deadline of the information. The smaller the deadline of the information, the higher the priority. 2.3 Proposal of improved hybrid scheduling algorithm Based on the high utilization of dynamic priority scheduling, the literature [6] proposed to assign identification numbers to information according to the absolute deadline of the task and designed a hybrid scheduling algorithm (MTS). The MTS algorithm is a compromise algorithm between the static priority scheduling algorithm and the dynamic priority scheduling algorithm. The core idea of the MTS algorithm is to encode the absolute deadline of the information into the identifier, make full use of the identifier of the information to reflect the change of the deadline of the information, use the EDF algorithm for high priority information, and use the FP algorithm for low priority information. Since each information in the CAN bus must have a unique identifier, MTS divides the identifier into three fields: priority field, deadline field, and node field, so that the identifier reflects the change of the deadline and ensures uniqueness. In a typical system, since the deadline changes with the clock, the content of all information deadline fields should be updated in a timely manner and synchronized with the clock. To solve the above problem, the MTS algorithm adopts a distributed clock synchronization algorithm and divides the time into several intervals, and encodes the content of the deadline field according to the time interval in which the deadline is located. However, for a multiprocessor network control system composed of multiple motors, due to the increase in the number of processors and the increase in the number of nodes that need to use the network to transmit information within a sampling period, the delay increases, and the general MTS algorithm is not applicable. In order to improve the real-time performance of the network control system, the MTS algorithm is improved here. Let the original sampling period be T[sub]m[/sub], let (3) where N is a natural number greater than 1, and sampling is performed with a period of T[sub]N[/sub], but only one sampled data is sent through the network in every n samplings. Let time be the sampling time in a sampling period starting from t[sub]0[/sub], and the data sampled at any sampling time is successfully sent, then no more sampling will be performed at time. After such improvements, network latency still exists, but the information deadline D[sub]m[/sub] is greatly reduced. If the waiting time for information transmission exceeds the deadline, the data will be discarded, and data will be re-acquired and sent, thereby improving the real-time performance of the network control system. Since a maximum of N samples are taken in one cycle, the processing speed of the processor needs to be increased accordingly. The significant increase in the speed of single-chip microprocessors and the emergence of digital signal processors have solved this problem. 3 Simulation of Network Control Systems Based on CAN Bus The TrueTime toolbox is a Matlab-based network control simulation toolbox developed by scholars such as Dan Henriksson and Anton Cervin. It provides a good research tool for the study of network control systems. 3.1 Construction of Network Control System Simulation Platform Using the TrueTime toolbox, a multiprocessor network control simulation system in which one computer controls four DC motors through a CAN bus is constructed. The impact of the scheduling algorithm on the control performance is analyzed. The simulation principle diagram is shown in Figure 1. [align=center] Figure 1 Simulation Schematic Diagram of Network Control System[/align][/align] The controlled DC motor is represented by the following transfer function: (4) The purpose of introducing an integral element in a common PID digital controller is mainly to eliminate steady-state error and improve accuracy. However, when the motor starts or stops, it will cause integral accumulation of PID calculation, which will eventually cause a large overshoot of the system, or even cause system oscillation. Therefore, in practical applications, it is advisable to use the integral separation PID control algorithm. Suppose that the PD algorithm is used when the absolute value of the deviation is not less than a certain set value (the deviation is relatively large), that is, where y(k) is the output value of the current cycle, y(k-1) is the output value of the previous cycle, r(k) and u(k) are the given value and the output value of the controller, respectively, T[sub]d[/sub]=0.035s, K=1.5, ε=0.1, the sampling period of the sensor is defined as T[sub]m[/sub]=10ms, and the time delay generated by data calculation, sensor data acquisition and actuator action is 0.1ms. When the absolute value of the deviation is less than the set value ε (the deviation is relatively small), the PID algorithm is adopted, that is, an integral element is added to the PD algorithm: where the integral time constant T[sub]i[/sub] = 0.15, I(k), I(k-1) are the integral components of the current period and the previous period, respectively. The control effect of the network control system before and after the introduction of the integral separation PID control algorithm is shown in Figure 2. [align=center] Figure 2 Effect of integral separation PID control algorithm[/align] As can be seen from the figure, the overshoot exceeds 45% when using the general PID control algorithm, while the overshoot does not exceed 5% when using the integral separation PID control algorithm. The integral separation PID control algorithm greatly improves the dynamic performance of the control system. 3.2 Simulation Results Based on the established network control system simulation platform, the network control system is simulated to study the impact of network scheduling on the performance of the control system. The baud rate of the CAN bus is set to 250Kbps and the packet loss rate is 0. The general hybrid scheduling algorithm (MTS) is used for simulation, and the simulation results are shown in Figure 3. Figure 3(a) shows the square wave response of the four control subsystems, and Figure 3(b) shows the network scheduling status of the first three sampling periods as seen from the network scheduling window. [align=center] Figure 3 Simulation results when applying the hybrid scheduling algorithm[/align] As shown in Figure 3(a), due to the large network delay, the dynamic response of two of the control subsystems is poor, with overshoot exceeding 14% and settling time exceeding 0.2s. In the network scheduling status diagram in Figure 3(b), the vertical axis represents the node number. According to the CAN protocol, nodes with smaller node numbers have higher priority, with controller node 1 having the highest priority and sensor node 9 having the lowest priority. The network waiting delays of nodes 7 and 9 are both large (exceeding 2ms), which is the reason for the poor dynamic performance of two of the control subsystems. As the number of network nodes increases, the dynamic performance of the control subsystem containing the lowest priority node will become even worse. Simulation was performed using the improved hybrid scheduling algorithm proposed in this paper, modifying only the scheduling algorithm while keeping other conditions unchanged. The responses of the four control subsystems and the network scheduling status when a square wave input is taken are shown in Figure 4. [align=center]Figure 4 Simulation results when applying the improved hybrid scheduling algorithm[/align] As shown in Figure 4(a), when the improved hybrid scheduling algorithm is used to simulate the network control system, the overshoot does not exceed 5%, the settling time does not exceed 0.13s, and there is no steady-state error. Figure 4(b) shows the network status of the network scheduling window, indicating that network conflicts still occur, but the network delay is small. The information transmission time of nodes 7 and 9 is the same as that of the MTS algorithm, but the first two sampled data are discarded due to the long delay, and only the third sampled data is successfully transmitted. Even with the addition of more nodes, the network transmission waiting delay of the sensor nodes does not exceed 1ms, which is much smaller than that of the general MTS algorithm. 4 Conclusion The innovation of this paper: This paper proposes an improved hybrid scheduling algorithm, which reduces the network control delay without changing the actual sampling period. A simulation platform for a multi-node network control system based on CAN bus is established, and the simulation results prove the effectiveness of the algorithm in information scheduling. The information scheduling algorithm of a network control system has a significant impact on the system's real-time performance. Designing a suitable scheduling algorithm can limit network transmission delay to a certain range. This paper only improves the network scheduling algorithm under specific conditions. Further research is needed on a general information scheduling algorithm suitable for various conditions. References [1] Martion Andersson, Dan Henriksson, Anton Cervin. TrueTime 1.3—Reference Manual, Jun 2005 [2] Deng Zhusha et al. Research on reliable scheduling based on CAN real-time application. Chengdu: Computer Application, 2006 (3) [3] Tao Yonghua. New PID control and its application. Beijing: Machinery Industry Press, 2005.1 [4] Tindell K, Burns A. Analysis of Hard Real-time Communication. Real-Time System, 1995.9 [5] Walsh GC, Ye H. Scheduling of Networked Control Systems[J]. IEEE Control System, 2001, 21 (1): 57-65 [6] Zuberi KM, Shin K G. Design and implementation of efficient message scheduling for controller area network. IEEE Transactions on Computers. 2000, 49 (2): 182-188. [7] Wu Chunxue, Yu Zhenwei. Data Transmission Packet Loss and Control Methods in NCS. Beijing: Microcomputer Information, 2005, 10X