Design of GPC controller based on Linux and s3C2440

Publisher:PositiveEnergyLatest update time:2012-07-31 Source: 单片机与嵌入式系统 Keywords:Linux  s3C2440 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
In recent years, Internet-based network control systems have become a hot topic in the field of measurement and control at home and abroad, and have broad application prospects in the fields of oil exploration and development, steel and chemical industry, etc. The design and development of the controller is the key and core of the entire network control system. In some highly dispersed and harsh control sites, using embedded systems as controller nodes can be more conducive to multi-point distributed integrated control and parallel processing, and achieve better measurement and control effects. However, due to the characteristics of network transmission itself, network delay will inevitably affect the control performance and stability of the network control system. Therefore, this paper proposes a design scheme of GPC (Generalized Predictive Control) controller based on S3C2440A and embedded Linux, which has certain versatility.


1 Controller hardware platform design
The controller node is the center of the embedded networked measurement and control system. In the measurement and control system, the main controller undertakes the two major tasks of control algorithm implementation and data acquisition, which requires the hardware platform of the controller node to have stronger computing power and better network performance. The hardware platform of the controller in this article adopts Samsung's S3C2440, and the peripheral devices mainly include RAM, Flash, etc. The hardware platform structure of the controller is shown in Figure 1.

(1) Introduction to S3C2440 processor
This system uses Samsung's 16/32-bit RISC microprocessor S3C2440AL as the controller core. A major feature of S3C2440AL is that its core processor (CPU) uses a 16/32-bit ARM920T RISC microprocessor. ARM920T implements MMU, AMBA BUS and Harvard cache architecture. The system has rich resources and peripheral interfaces, including power manager, external memory controller, 4-channel DMA, 3-channel UART, 8-way 10-bit ADC and GPIO.
(2) Introduction to peripheral circuits
The controller peripheral circuit is mainly composed of memory circuit module, communication module and JTAG debugging circuit. The memory circuit module uses 2 HY57V561620FTP chips as external SDRAM; 1 SST39VF1601 (2 MB) chip as NOR Flash to store bootloader program; 1 K9F1208 chip (64 MB) as NAND Flash to store operating system and file system. The DM9000 network card chip and the network transformer HR911103A are used in the communication module to realize the design of the Ethernet interface. At the same time, the USB host interface circuit is designed to provide an interface for the next step of WLAN communication. The A/D and D/A interface circuits realize data collection and control signal sending.

[page]

2 Design of controller software platform
2.1 Overall structure of software platform
The software architecture of controller node is shown in Figure 2. The bottom layer is the device driver layer, which is mainly used to initialize the processor and drive various peripheral circuit modules; the second layer is the embedded Linux operating system, which mainly manages the hardware and software resources of the system, the upper layer applications, and operates the bottom layer driver interface; the third layer is the Web server to realize the controller: Browser/Server access control; the fourth layer is the application program, which mainly includes the real-time database, GPC control algorithm and clock synchronization application program.
2.2 Configuration and compilation of bootloader
First, establish the arm-linux-gcc-2.95.3 cross-compilation environment under the Linux of the host machine, decompress vivi.tgz to the corresponding directory of Linux, enter the vivi directory, execute the make menuconfig command to enter the vivi configuration interface, and configure the parameters of vivi. After completing the configuration, compile, and vivi has been generated in the current directory. Vivi can be burned to NAND Flash for operation using H-JTAG.
2.3 Linux transplantation
(1) Compile the Linux kernel
First, establish the arm-linux-gcc-3.4.1 cross-compilation environment under the Linux of the host machine, then decompress Liunx-2.6.13.tgz to a directory in Linux, execute the make menuconfig command to enter the kernel configuration interface, and customize the Linux kernel, including configuring CPU options, network card and sound card drivers, serial ports, and support for the yaffs file system. After completing the customization, save the settings and exit. Then compile the kernel to generate the kernel image file zImage.
(2) Make a yaffs file system
To make a yaffs file system image, you need to use the mkyaffsimage tool program. First, decompress it to the /usr/sbin directory, and then decompress the file system to a directory in Linux. At this time, users can add their own applications or other files to the file system. After adding, use the mkyaffsimage command to get the root.img image file. Finally, you can use H-JTAG to burn the generated image file to NAND Flash for operation.
2.4 Transplantation and construction of Boa server
In the networked measurement and control system, each measurement and control node needs to use a Web browser for monitoring and data interaction. As a data carrier, the Web server can transmit local information and data to the remote client making the request through the network, which is of great significance to the realization of remote networked monitoring. Therefore, the transplantation of Web Server becomes an indispensable task. The advantages of Boa are its open source code, good performance and high reliability. The construction of Web Server in this article is also based on Boa.
First, download the Boa source code boa-0.94.13. tar. gz from the official website, decompress it to a directory of the Linux host, then enter the src directory, execute the ./config command, and generate the Makefile. in file. Since the generated Makefile file is for the X86 platform, in order to generate Boa that can run on ARM, the Makefile file needs to be modified. Find the two lines CC=gcc, CPP=gcc-E and modify them to CC=arm-linux-gcc, CPP=arm-linux-gcc-E; then use the make command to compile. After successful compilation, a Boa executable file that can run on the ARM platform will be generated in the src directory, and then the compiled Boa program will be placed in the /sbin directory.
Before running Boa on the target board, you also need to configure the boa.conf file. The boa.conf file mainly contains the basic boa parameters: Port, the port that the boa server listens on; User, the identity of the client connected to the server; DocumentRoot, the root directory of the HTML file. Users can set it according to their needs. After setting, enter the sbin directory and run Boa directly to start the Web server.


3 Design and implementation of GPC algorithm
The generalized predictive control algorithm was proposed by Clarke et al. in 1987. This algorithm retains the multi-step prediction optimization strategy in DMC, MAC and other algorithms, and draws on the ideas of model prediction, minimum variance control and online identification in minimum variance self-correcting control. Therefore, it has low requirements on model accuracy and strong robustness to objects with variable time delay. It has been widely used and valued in recent years. This paper adopts the GPC algorithm to solve the delay problem.

[page]

3.1 GPC algorithm
In GPC, the controlled autoregressive integrated moving average model (CARIMA) used in minimum variance control is used to describe the controlled object, that is where z-1 is the backshift operator, which represents the corresponding quantity of one sampling period backward; A(z-1), B(z-1), C(z-1) are polynomials of the backshift operator z-1. y(k) is the system output, and u(k) is the control output. ξ(t) is a white noise sequence with a mean of 0 and a variance of 0, which represents the influence of a type of random noise. △ is a difference operator, and △=1-z-1. Generally, let C(z-1)=1. For the convenience of research, without affecting the research of the system algorithm, let the system be a SISO system. The control increment weighting parameter is introduced into the objective function of the GPC algorithm to enhance the robustness of the system. Its objective function is Wherein, E is the mathematical expectation; ω(k+i) is the input reference trajectory, N1 and N2 are the initial and final values ​​of the optimization time domain, NU is the control time domain, and λ(j) is the weighted coefficient of the control increment greater than zero. The generalized predictive control algorithm problem is ultimately reduced to: by recursively solving the Diophanfine equation, the optimal control increment △U is obtained to minimize the objective function. 3.2 MatIab simulation and target code generation RTW is a code automatic generation tool provided by Matlab, which can automatically generate code for different targets from Simulink models. Currently, Matlab/RTW can generate code that runs on devices such as PC and ARM, as well as executable files that run on systems such as Windows and Linux. Using RTW to automatically generate code allows engineers to focus on system design and implementation, reduce programming workload, and speed up product development. The simulation and debugging of the GPC algorithm is implemented in the Matlab7.0 environment, using the MPC toolbox, and compiling corresponding programs. Since the M language in Matlab cannot be directly transplanted to the embedded controller, the system model must be built with Simulink first, and then the C code for the ARM platform is automatically generated using Real-Time Workshop. The experimental steps for automatically generating code using RTW are as follows: ① Use Matlab's M language to write the GPC algorithm program. After the simulation passes, encapsulate it into a Simulink simulation block diagram and establish the GPC control system model Model.mdl. ② In the Simulink window, select the Simulink|Configuration Parameters option to set the solvet option, Data Import/Export, etc. ③ Select the Generate code only checkbox and click build to automatically generate the code. ④ Integrate the underlying driver function, user-defined function and automatically generated GPC program, and compile to generate the target file. As can be seen from Figure 3, in a binary system with random disturbances, the overshoot and adjustment time of the controller based on the GPC algorithm are relatively small, and the rise time is fast, showing good dynamic performance and robustness. This is inseparable from the characteristics of multi-step prediction and rolling optimization of the GPC algorithm.











Conclusion
This paper successfully built a software and hardware platform for networked controller nodes, and through the Matlab/RTW semi-physical simulation method, realized the rapid transplantation of the GPC algorithm and compensated for network delay. The measurement and control platform has a wide range of applications and is suitable for Ethernet-based embedded Web controllers to meet remote real-time control requirements, and has certain application prospects.

Keywords:Linux  s3C2440 Reference address:Design of GPC controller based on Linux and s3C2440

Previous article:Research on driving RGB TFT LCD screen with S3C2440A
Next article:Design of Embedded Navigation System Based on S3C2440A and Win CE

Recommended ReadingLatest update time:2024-11-16 21:50

Locate the error code line according to linux Oops
I have been debugging the serial port of atmel at91sam9x25 these days, and it always causes Oops. The Oops content is as follows: Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = c0004000 *pgd=00000000 Internal error: Oops: 17 last sysfs file: /sys/devices/virtual/misc/at91fl
[Microcontroller]
Locate the error code line according to linux Oops
With the help of Intel Thread Director technology, the performance of Linux users running Windows virtual machines increases by 14%
According to news on February 5, last October, Microsoft released a guide to encourage Windows users to try Linux through WSL, which was somewhat surprising. And if you are a Linux user who wants to try a Windows virtual machine on a Linux host and happens to be using a 12th generation or higher Intel processor, there
[Embedded]
Design of solar tracking system based on ARM S3C2440
Based on the principle of computer vision, an embedded image processing platform is built with an ARM microcontroller as the core to achieve real-time tracking of the sun. The system uses a CMOS image sensor to collect solar images, calculates the solar angle through a microcontroller, and controls the turntable throu
[Microcontroller]
Design of solar tracking system based on ARM S3C2440
Configuration of s3c2440.jflash project (download boot to norflash using jlink)
Configuration of J-Flash ARM. Generally speaking, you can find some *.jflash configuration files in file– open project, and just load them, but I didn't find any suitable for S3C2440. So I built a MINI2440.jflash and configured it manually: J-Link Settings 1. Open J-Flash ARM and go to the menu: Options– Project s
[Microcontroller]
Configuration of s3c2440.jflash project (download boot to norflash using jlink)
Control the export function of Linux dynamic link library
In Linux, we can control the export function by -fvisibility=default|internal|hidden|protected. In the GCC help document -fvisibility=default|internal|hidden|protected parameter, there is a description: a superior solution made possible by this option to marking things hidden when the default is public is to make th
[Microcontroller]
Linux 5.19 has added support for Intel's 13th-generation Core Raptor Lake-P graphics drivers
       IT Home reported on April 17 that the Linux 5.19 kernel has added multiple feature supports recently, one of which is the Raptor Lake-S graphics driver support in the kernel PCI ID part. Now, Raptor Lake-P support is also here.   Similar to Intel's Alder Lake-P series and previous models, the next-generation Ra
[Mobile phone portable]
Linux 5.19 has added support for Intel's 13th-generation Core Raptor Lake-P graphics drivers
Access control monitoring system software design based on ARM9 and Linux
Access control, also known as access control system, is a digital management system for managing people's access. At present, with the development of industrial automation and people's increasing demand for applications, access control monitoring systems have been increasingly used, but traditional access control mo
[Microcontroller]
Access control monitoring system software design based on ARM9 and Linux
arm assembler S3C2440
The microcontroller source program is as follows: pWTCON EQU 0x53000000 ; Watchdog timer port address pLOCKTIME EQU 0x4c000000 ; Lock time count value register address pCLKDIVN EQU 0x4c000014 ;Clock control register address pUPLLCON        EQU        0x4c000008                                ; pMPLLCON         EQU 
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号