introduction
The gate system is an important part of water resource dispatching. At present, most of them are operated manually and partially electrically, and there are few reports on truly intelligent gate control. This paper adopts embedded technology based on the Linux operating system to realize local/remote automatic monitoring of water conservancy project gates, which integrates video monitoring and real-time monitoring of water level, gate position, reservoir capacity, flow and other parameters.
Linux and Embedded Systems
An embedded system is a special-purpose computer system that is application-centric, based on computer technology, and whose software and hardware can be tailored to meet the strict requirements of actual applications on functions, reliability, cost, volume, power consumption, etc. It is oriented to specific applications, has high reliability and a long market life cycle. As the functions of embedded systems become more and more complex and hardware conditions become better and better, choosing a suitable embedded operating system has become a key issue in system development.
Currently, there are two main methods for developing embedded systems: one is to rely on the development platform and components provided by existing commercial software, such as VxWorks, uC/OS, Windows CE, QNX, etc., which have mature technology, powerful functions, and provide a large number of available function call interfaces, which greatly shortens the product development cycle, but the price is not cheap; the other is to develop based on free software Linux, customize it according to the needs of your own system, and do not have to pay extra fees for obtaining a license, which can greatly reduce the development cost.
Linux is a multi-task and multi-process embedded operating system based on the Unix core, supporting a wide range of computer hardware. Developers can modify and customize the operating system according to their own needs. It has a large number of open application codes available, and Linux has C, C++, and Object C compilers GCC that can support up to 11 operating platforms. It is powerful and has an execution efficiency 20% to 30% higher than that of general compilers. Among Linux-based embedded operating systems, there are many improved varieties that cater to the embedded/real-time market, including RTLinux (real-time Linux), μcLinux (Linux for non-MMU memory management unit processors), Montavista Linux (Linux distribution for ARM, MIPS, PPC), ARM2Linux (Linux on ARM), etc. In view of the fact that the current gate intelligent monitoring system does not have high requirements for real-time operation, we chose Red Hat 9.0 based on the Linux2.4.22 kernel as the development environment in this application.
Linux Customization
Kernel Configuration
Since the storage space of embedded systems is limited, Linux must be customized if it is to be used in embedded systems, that is, unnecessary modules in the kernel, such as peripheral support modules such as SCSI and Floppy, must be cut.
(1) Clear the setting environment make mrproper
(2) Set configuration make config
(3) Compile the kernel and modules: make dep ; make clean ; make bzImage ; make modules
The compiled kernel files are /usr/src/linux/arch/i386/boot/bzImage and /usr/src/linux/System.map
Production system electronic disk
In a standard Linux environment, mount the electronic disk to / RamDisk and create a boot and start program on the electronic disk.
(1) Modify the lilo.conf file so that the system boots directly from the electronic disk.
(2) Create a kernel file system ext2: mke2f s - i 8192 - m 0/ dev/ ram 50, and under the / RamDisk directory, create the directory files necessary for running the system: bin dev etc lib mnt proc sbin tmp usr var, as well as the necessary files under each directory, especially the library files required by the application.
(3) Put the kernel file into RamDisk: # dd if = bzImage of = / dev/ ram bs = 1k. And load the root system file: # dd if = /tmp/ ram-image. gz of = / dev/ fd0 bs = 1k seek = kernel data block number. Among them, ram-image. gzJ is the compressed root system file, and the kernel data block number is the kernel size.
Quick start and startup screen
Since the system is developed based on Rad Hat 910, the startup process is relatively long. It takes more than 30 seconds from the time the system is powered on until the system console displays "login:". Through testing, a lot of time is spent on hardware initialization when the kernel starts. For example, Linux needs to detect a total of 20 IDE interfaces (including master and slave disks). By modifying the definition value of MAX-HWIFS in the Linux source code from 10 to 1, the time for Linux to detect the IDE interface can be reduced to shorten the system startup time. The real way to speed up the startup time is to rewrite the startup scripts such as rc. sysinit and rc so that the system only performs the necessary hardware module initialization work and services to achieve the purpose.
During quick startup, only the user-defined interface needs to be displayed. The original data in Linuxlogo.h can be replaced by 1pcx or 1tif format image data with 256 colors and 640X480 pixels, and a small amount of modification can be made to the driver/ video/ fbcon. c source code. The macro definition LOGO-H 80 is changed to 640, LOGO-W 80 is changed to 480, and the corresponding functions are modified.
Abnormal shutdown
In the process of using the system, in order to facilitate users, it should support abnormal shutdown, that is, to avoid possible problems when the power is directly cut off. The ext2 file system is usually used, which is a non-logging file system. When the system restarts, it will take a lot of time to check the file system, and sometimes even produce fatal errors, forcing users to manually use the fsck command to check the file system.
The use of the general log file ext3 system will ensure the reliability of data recovery through log records. The system will not require a file system check when restarting, and the running speed and stability are good. Upgrade the original ext2 file system to ext3: tune2fs - j / dev/hda6, and change the file system type of the partition from ext2 to ext3 in the / etc / fstab file. Since the use of the ext3 log file system does not require frequent file system checks (fsck), it is necessary to use the tune2fs - i 0 - c 0 / dev/hda6 command to turn off the file system check, which also achieves the purpose of reducing the system startup time.
Gate intelligent monitoring system composition
System structure and function
The gate intelligent monitoring system consists of the control cabinet in the central control room, the on-site gate opening and closing machine, the front-end video monitoring point, the on-site water level and gate position monitoring points and related auxiliary equipment. The system structure is shown in Figure 1. The monitoring system is based on the Linux-based embedded system and realizes the following functions:
(1) Intelligent control of gate raising, lowering and stopping operations, as well as alarm and emergency flood discharge;
(2) 8-channel digital MPEG24 compressed streaming video, remotely monitoring water conditions, gate status and operation through video images;
(3) Real-time water data monitoring, automatic measurement and reporting of water level, flow and water volume, providing a basis for flood control and water volume scheduling;
(4) Historical data statistics, generate corresponding process lines and reports.
Hardware Implementation
The control cabinet in the central control room is required to have video monitoring and data curve display functions, using CRT monitors, with passive backplanes, half-length CPU boards using PCI6870, CPUs using Intel's PIII Celeron 1.2GHzMHz, memory of 256MB, Ethernet interface of 10MHz RTL-8139A, and four-channel video acquisition cards for Phituo DVS4816AVC. The CPU board is connected to the sampling module and output module through the PC104 bus, and the electronic disk uses 64MFlashDisk.
Software Implementation
The system software consists of two parts, namely the embedded operating system and the application program (structure as shown in Figure 2). The basic embedded operating system includes:
(1) Bootloader (initializes the processor, initializes necessary devices, downloads the system image, and initializes the operating system);
(2) Embedded Linux kernel (including memory management, process management, inter-process communication, etc., as well as other configurable hardware drivers, TCP/IP network stack);
(3) Root file system.
Summary and Outlook
The application of embedded Linux in gate intelligent monitoring system has positive significance in reducing costs and improving reliability and stability.
In this system, the ext3 file system is used. In order to further improve the reliability of the system, the log file system JFFS or JFFS2 designed specifically for Flash memory can also be used in the future. Since JFFS2 uses a new storage method, supports loss balancing, and has a power-off protection function, it can quickly recover after a file crash. Therefore, the JFFS2 file system is more suitable for embedded systems that use flash as a storage device.
Previous article:FPGA Implementation of VGA Graphics Controller
Next article:Design of IPv6 Composite Firewall Based on Linux
- Popular Resources
- Popular amplifiers
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- 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
- [CH563L Review] Part 2 Based on uCos, using FIFO algorithm to implement UART queue
- [National Technology N32 MCU Development Package] --N32G032 Series
- [Today at 10:00 live broadcast] Deep digging into NXP LPC55S69: a new generation of secure and low-power MCU based on ARM Cortex-M33 core
- Playing with Zynq Serial 46——[ex65] Image Laplace Edge Extraction of MT9V034 Camera
- Reading and writing 8-bit data in C2000 series
- [ESP32-Audio-Kit Audio Development Board Review] First Look at the Anxinke Audio Development Board
- How to test the third generation semiconductors? Advanced skills are ready! Collect energy to win prizes! The event has begun~
- Programming example of MSP430 controlling digital tube
- Learn about C2000 32-bit microcontrollers
- Migrate ssh service to EK200-zlib-openssl-openssh