introduction
Networked control systems (NCS) refer to control systems in which the intelligent devices, i.e. sensors, controllers and actuators, are distributed in different geographical spaces and form a closed loop through the network. The exchange of data and information between nodes requires the network to be realized. It is a distributed control system that integrates today's advanced network communication technology, computer technology and control technology. Although networked control has been widely used in industrial control, process control and building automation, the theoretical research on networked control systems is quite immature [1]. This paper uses Simulink simulation software, which is widely used in the engineering field, and combines it with the mature embedded microprocessor architecture in the military and civilian fields to develop a networked control simulation system, which provides a useful tool for theoretical research on networked control systems. Since the communication technologies currently used in the industrial control field are self-contained and not open to each other, the newly promulgated IEC61158 fieldbus standard includes 8 different types, and it is almost impossible to make them compatible and interoperable. Therefore, the active adoption of Ethernet technology has become the development trend of industrial networks. At present, Ethernet-based networked control systems have attracted the attention of scholars in the field of automation around the world. In view of this, the simulation system developed in this paper is designed specifically for Ethernet-based networked control.
Since the networked control system is the product of the combination of control technology and network communication technology, its analysis and design are usually carried out from the two perspectives of control and network. From the perspective of network, the communication protocol is generally improved to solve the problems brought to the control system by the network, such as delay, packet loss, disorder, etc., and reduce the impact on the control system; from the perspective of control, the structure of the control system is designed under the existing network structure and protocol, the control algorithm is developed, and the network delay is compensated to ensure the stability of the system. This simulation system is designed from the perspective of control.
This paper establishes a software and hardware structure platform for an embedded networked control simulation system based on Simulink/RTW, using the 32-bit embedded RISC (Reduced Instruction Set Computer) microprocessor structure ARM7TDMI S3C4510B as the CPU core. Combined with the control test example of a brushless DC motor, the specific application of this simulation system is explained.
Networked Control Simulation System
Embedded system platform architecture
This system uses embedded system as hardware platform, and its hardware architecture is shown in Figure 1. The embedded system hardware platform uses Samsung's S3C4510B microprocessor based on ARM7TDMI core as the CPU of the embedded system. S3C4510B 32-bit embedded RISC microcontroller is a low-cost and high-performance microcontroller for Ethernet-based field network control system. It supports 8-bit, 16-bit and 32-bit addressing modes, has 16M×32-bit addressing capability, and can easily build a larger storage space. In order to reduce the cost of the entire system, S3C4510B integrates peripherals and processor cores on a chip, and provides on-chip peripherals mainly including 2-channel UART, 2-channel HDLC, 1-channel MII interface, Ethernet controller, interrupt controller, JTAG interface, PLL clock generator and 2 timers.
The system uses HY29LV160 as FLASH memory, each chip provides 1M×16-bit storage space, two chips in parallel form 1M×32-bit code storage space; HY57V641620 is used as SDRAM memory, each chip provides 4M×16-bit storage space, two chips in parallel form 4M×32-bit code running space, and the relatively large RAM space is conducive to improving system performance and executing more complex control algorithms. The active crystal oscillator provides an external clock signal for S3C4510B, which is used as the operating frequency of the system through the internal phase-locked loop (PLL) circuit. PLL has the functions of frequency amplification and signal purification. Therefore, the system can obtain a higher operating frequency with a lower external clock signal, up to 50MHz.
In addition, the target system has expanded 8-channel 16-bit high-speed A/D and 2-channel 12-bit high-speed D/A to provide control interface for the controlled object. The Ethernet controller is expanded with 100M/10M high-speed Ethernet physical layer transceiver DM9161. The 4×4 keyboard and digital tube display provide on-site debugging means for the system.
ARM7TDMI CPUs do not have MMU, i.e. memory management unit. uClinux can be used as the corresponding operating system. This is a project that fully complies with the GNU/GPL (General Public License) convention and is completely open source. It is a branch of standard Linux, dedicated to CPUs without MMU, and has done a lot of miniaturization work for embedded systems. It has an embedded network protocol and supports multiple file systems. The kernel target file after compilation is about 600KB. [page]
Simulation system software structure
This simulation system provides users with two types of interface modules: network and kernel. The network module is implemented by the system function (S-Function) provided by Simulink for users to develop their own code. The code is written in C language, mainly including UDP/IP and TCP/IP two communication protocol modules, synchronization mechanism module, delay measurement module, control algorithm module and delay compensation module.
The kernel module includes the read module, the write module, and the I/O module for accessing the on-chip peripherals of the system hardware platform and expanding the hardware resources, such as the A/D module, the D/A module, the external interrupt source module, the timer module, etc. In addition to using system functions to complete user space programming, the kernel module also needs to perform kernel space programming in uClinux.
In addition, the simulation system also provides a network monitoring function, so that users who are not at the control site can grasp the operating status of the control system in time. This function is mainly completed by the client and the server, which constitutes the Client/Server mode. The client provides interaction with the user, which is implemented by VC++ and runs on the PC host of the Windows operating system. It mainly implements two functions: control and monitoring. The control function responds to actions from the user, such as modifying remote controller parameters through the network and viewing the real-time values of process variables; the monitoring function displays real-time trend charts of variables for users. The server runs on an embedded system platform and is implemented by ANSI C programming. It mainly processes various command requests from the client and makes corresponding operations, so that the client users can realize various monitoring functions through the network. Using the TCP/IP protocol, the client uses WinSocket and the server uses Socket to realize the communication. The monitoring process is shown in Figure 2.
System Implementation
This system uses Simulink/Real-time Workshop to implement the code part of the simulation system running on the embedded platform.
Simulink is a visual simulation and analysis environment launched by Mathworks for control algorithm design and system dynamic modeling. Its Real-Time Workshop (RTW) toolbox can automatically generate optimized C language code based on the assembled Simulink block diagram, and combine with interface modules related to the target hardware to realize the simulation of the control system described by Simulink, freeing users from the tedious labor of writing code and shortening the program development cycle.
Application development for embedded hardware platforms is different from traditional development. Due to the limited resources of embedded systems, application development generally adopts a master-slave model, that is, the design, compilation and linking of the program are performed on a PC (usually running Linux), and the resulting executable code runs in the embedded system. This process is called cross-compilation.
The main steps to use RTW to generate Simulink block diagrams and run programs on the embedded platform of the simulation system are:
1) Write a general network program that interfaces with Simulink block diagrams;
(2) Install the cross-compilation tool chain arm-elf-gcc on the PC with Matlab installed, including the compiler, linker, binary tools, etc.
(3) Construct the simulation block diagram of the controlled system in Simulink;
(4) Modify the makefile template file integrated in RTW according to the target hardware, add the code written in (1) to the source code list for compilation and linking, and modify the system target file;
(5) Open the corresponding RTW dialog box, select the system target file to be used, and a series of processes such as code generation, compilation, downloading and running on the embedded system will be automatically completed within a few minutes. [page]
Figure 3 describes the overall structure of the simulation system software and the process of implementing embedded applications using Simulink/RTW.
Since Matlab software is usually installed on Windows operating system, in order to ensure the smooth cross-compilation, the software Cygwin is installed to provide a virtual Linux environment under Windows.
Delay characteristic analysis and compensation method
The main reason why the analysis and design of networked control systems are more complex than traditional point-to-point control is network delay. In distributed networked control systems using Ethernet, although the real-time performance of Ethernet transmission has been solved with the development of Fast Ethernet and Switched Ethernet technology, the limited network resources are shared by multiple nodes in the network, so that real-time information in the control system cannot be transmitted in time. In addition, the uncertainty of network delay in packet switching seriously affects the control performance of the system and even causes system instability. Therefore, the networked control simulation platform must first clarify the characteristics of network delay in order to provide simulation of the real network environment.
Delay distribution characteristics
Round trip time, abbreviated as rtt, refers to the time it takes for a small data packet to be sent from the network source node A, reach the destination node B through the network, and then return to A. This paper measures rtt in the wide area network environment accessed by the experimental device in order to analyze the delay distribution characteristics from the measurement data. The measurement uses the delay measurement module of the simulation system. This module adopts the high-precision timing idea proposed by Van Jacobson and is implemented using Simulink system functions.
Figure 4 shows the RTT distribution of the wide area network used in the experimental device when the network is under normal conditions. The measurement was performed 1000 times, with an average of 0.3877s and a mean square error of 0.0106s. From the frequency domain perspective, the power spectrum density obtained is shown in Figure 5. According to the definition of band-limited white noise, that is, the power spectrum density function only takes a constant different from zero within a certain limited frequency range, in order to simplify the theoretical analysis, the measured delay is approximated as low-pass white noise, which can be defined by the definition of low-pass white noise for power spectrum density.
Srinivasagupta also pointed out that it is reasonable to approximate most network delays as white noise.
Compared with systems with larger cutoff frequencies, that is, larger time constants and slower dynamic responses, the impact of network delays of this order of magnitude on the control system may be negligible due to the longer allowed sampling period. However, when the controlled object is a fast response system, the order of magnitude of the network delay is likely to be equal to or even much larger than the sampling period of the control system. At this time, the delay must be compensated to ensure the stability of the control system.
Delay compensation strategy
Due to the uncertainty of delay, in networked control, it is impossible to guarantee that the signal will arrive at the corresponding time within a sampling period. There may be no receipt in the sampling period, that is, empty sampling, or multiple receipts, that is, multiple sampling, or delayed data, that is, delayed sampling. Therefore, the simulation system compensates for the delay of the forward and feedback channels of the networked control system respectively.
The format of information transmission between networks is: timestamp + corresponding data value. Since the simulation system provides a synchronization mechanism module, in order to simplify programming, when sending time information, only the corresponding cycle index value instead of the hard clock value can be sent. Figure 6 describes the network delay compensation strategy adopted by the simulation system. [page]
To be consistent with traditional digital control systems, the controllers, sensors and actuator nodes in the simulation system are all time-driven, that is, the equipment is controlled by a clock and performs operations according to a certain cycle.
Forward path delay compensation
The receiving end of the actuator has a buffer area. The controller node uses a model-based predictive control algorithm to calculate the control signal including the control time domain step at the current moment within one cycle, and sends it to the actuator through the network together with the timestamp information of the sampling moment. When the sampling cycle arrives, the actuator makes corresponding processing according to the received control signal. The specific compensation method is as follows.
The controller uses the generalized predictive control (GPC) as the control algorithm, and the controlled object model uses the controlled autoregressive integral moving average model (CARIMA), which is described by the following discrete difference equation:
d is the time delay of the controlled object, Δ = 1-z-1 represents the difference operator, and ω(t) is a sequence of random variables. The optimal control trajectory is obtained by minimizing the performance index function expressed in equation (5):
Where N1 and N2 represent the minimum and maximum prediction time domain lengths, M is the control time domain length, ρ is the control increment weighting factor, and P=N2-N1 is defined. ) ( ˆy(t+i) is the model prediction output, yr(t+i) is the output reference trajectory, for i=1,2, Λ,N2-N1, there is a Diophantine equation:
polynomials of order max(na.nc-i, nb-i), (i-1), and max(nc-1), (nb-1).
The optimal control law trajectory at time t is:
[page]
In execution cycle l, the actuator should perform the corresponding task according to the received control signal. Due to the existence of network delay, the control signal at the current moment may not arrive. The actuator uses the control signal stored in the buffer area and the timestamp information to use the control signal closest to the current moment to predict the value of the moment, that is,
Feedback channel delay compensation
A predictor with a receiving buffer is added to the feedback channel. The buffer stores the input and output history data and the corresponding timestamp information. The sensor completes the output sampling of the controlled object within a sampling period and transmits the sampling value, control signal and timestamp information through the network. If the predictor does not receive the sampling signal of the corresponding moment sent by the sensor from the network during the sampling period, it will use the buffer data to estimate the sampling signal for the controller to calculate the control signal.
The predictor uses the controlled autoregressive model ARX to predict the sampled signal, and its model prototype is:
To solve the model parameter (10), we can select random signal modules that conform to the delay distribution law to simulate the network environment under Simulink according to the delay distribution characteristics measured experimentally. We can realize the connection between the controller and the actuator, and the sensor and the controller through the TCP/IP module on the forward and feedback channels to form a closed network control system simulation block diagram. We can perform offline simulation, collect a series of input and output data, and use the recursive least squares with gradually disappearing memory (13)-(15) to solve it.
Simulation Example
This section takes a brushless DC motor as an example to verify the effectiveness of using this simulation system to implement networked control experiments. The motor model is open-loop identified using the frequency response method, and the CARIMA model of the controlled object is obtained as follows:
Where y represents the motor speed and u represents the control voltage.
Use Simulink for offline simulation, and use uniformly distributed delay modules to simulate the delay between networks. The ARX model is obtained as follows:
The control algorithm adopts generalized predictive control with a control time domain step size of 7. The modules provided by Simulink and the simulation system are used to form the two parts A and B surrounded by dotted lines in Figure 6. According to the above steps, the block diagram is downloaded to the hardware platforms located in different physical spaces for operation. The data of each node in the control system is set with a fixed step size and simulation stop time in this tab, and the integral solver is selected; click the Real-Time Workshop tab, set the system target file, template binding file, Make command, etc. in this tab, select the xPC Targetgeneration options option in the Category drop-down list, and you can set the buffer size, target object name, etc.
(4) Create and download the target application. After setting the simulation parameters, press Ctrl+B in the Simulink model window to generate C code, compile and link it to generate an executable target application, and automatically download it to the target machine.
(5) Control the target application and signal tracking. After the target application is downloaded, you can start (or stop) the target application by entering +tg (or -tg) in the MATLAB window or start (or stop) in the target machine command line. By adding the xPC Target Scope module to the Simulink model, you can add an oscilloscope to the target machine to display the required signals.
in conclusion
This paper studies the method of designing a semi-physical real-time simulation platform based on MATLAB/xPC. The platform connects flywheels, three-axis turntables, gyroscopes and other physical objects to the real-time simulation system, forming a semi-physical real-time simulation system for satellite attitude control. According to the simulation test results, the experimental results of the real-time simulation system are basically consistent with the Simulink non-real-time mathematical simulation results, and the real-time performance of the system can also meet the requirements. The real-time simulation platform meets the design requirements and is conducive to the research of satellite attitude control.
Previous article:Analysis and Implementation of Embedded DVR Based on MPEG-4
Next article:Research and transplantation of embedded GUI based on ARM LINUX
Recommended ReadingLatest update time:2024-11-16 21:27
- Popular Resources
- Popular amplifiers
- Research on cooperative control and teaming strategy of heterogeneous truck platoons
- Design and implementation of robot teleoperation system based on SimulinkRTW
- Real-time driver monitoring system via modal and viewpoint analysis
- Multi-port and shared memory architecture for high-performance ADAS SoCs
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- The role of magnetic beads and their working principle
- I'm new to PCB, need help, thanks
- Is this true? Most people who buy Apple phones are "invisible poor people"
- As shown in the figure, which type of capacitor filtering wiring is better?
- Power supply tips you must know: A small negligence can ruin EMI performance!
- What is the inverted state of the transistor and what is its function!
- IAP issue when porting from Qinheng CH32F103 to CH32V103
- Playing with Bluetooth chips on a perforated board, where is the antenna? Come and see Qinheng's 10-pin CH9141K
- Common Faults and Solutions for DC-DC Power Modules
- Design of lightning protection circuit for RS-485 in multifunctional electric energy meter