Share this

Design of a Control System Platform Based on an Embedded Operating System

2026-04-06 05:46:07 · · #1
Abstract: With the rapid development of computer and microelectronics technology, embedded systems, as an important field of computer applications, have penetrated into all aspects of society. This paper discusses the design and implementation of embedded system software, aiming to create a complete embedded control system software platform. This platform organically combines embedded real-time operating systems, embedded configuration software, and soft PLCs to provide a complete operating environment for embedded control systems. Keywords: Software platform, Embedded, Control system 1 Introduction In recent years, embedded systems have been increasingly widely used in the field of industrial control. With the development of embedded control systems, embedded control systems will, to a certain extent, replace existing industrial PC control systems and are widely used in fields such as micro TDCS (Distributed Control System), fieldbus systems, PLC control systems, and intelligent instruments. Due to its strong cost advantage and flexibility compared to large TDCS systems, its application areas are further expanding. This paper establishes a complete embedded control system software platform, which is built on embedded hardware systems and includes embedded real-time operating systems, soft PLC systems, and embedded configuration software. The platform consists of two parts: the operating environment and the development environment. Using the development environment, users can easily configure and perform secondary development, focusing their development efforts on specific control system applications. Complex and tedious software tasks, such as system software architecture design, real-time performance assurance, and general control system software like network communication and control algorithms, are handled by the platform. 2. Overall Platform Framework The embedded control system platform is centered on an embedded real-time operating system and includes a hardware platform, hardware drivers, a graphics library runtime environment, real-time database management and communication, a human-machine interface, a soft PLC, network communication, and user applications. The overall framework of the embedded control system platform is shown in Figure 1. [align=center] Figure 1 Overall Framework of Embedded Control System Software Platform[/align] As shown in Figure 1, the embedded control system software platform mainly includes the following parts: (1) Embedded hardware platform (2) Embedded real-time operating system (3) Hardware driver (4) Graphics library and runtime environment (5) Real-time database management and communication (6) Human-machine interface (7) Soft PLC (8) Network communication (9) User application 3 Implementation of the main modules of the embedded control system software platform The embedded control system software platform is a very complex system. As can be seen from the overall framework diagram, the platform includes many modules such as real-time operating system, real-time database management and communication, graphics library and runtime environment, and human-machine interface. This chapter focuses on the implementation of the embedded real-time operating system, real-time database management and communication and other modules. 3.1 Embedded Linux Real-Time Operating System Linux is a powerful, open-source, and free operating system that can run on multiple platforms. It is entirely feasible to develop an open, standard, efficient and inexpensive real-time operating system based on Linux. The embedded control system software platform introduced in this paper adopts the embedded Linux real-time operating system and uses a dual-kernel RTAI solution. RTAI's implementation scheme is similar to RT-Linux, a dual-kernel system that utilizes the Linux kernel while adding a real-time kernel, with both kernels working together. RTAI leverages Linux's kernel module mechanism to complete real-time tasks and provide real-time services. Modules are part of the kernel but are not compiled into it. Modules are compiled into a set of object files, which can be inserted into or removed from the running kernel as needed. The main modules implemented in RTAI include the RTAI core module, the RTAI scheduler module, the RTAI FIFO module, the RTAI shared memory module, and the LXRT module. 3.1.1 Implementation of the RTAI-based Linux Real-Time Operating System Our process for implementing the RTAI-based Linux real-time operating system is as follows: Based on standard Linux, we apply the RTAI real-time patch package, configure it appropriately according to specific hardware conditions and operating environment requirements, and then trim and compile the kernel into a real-time-enabled kernel. 3.1.2 Application Development Based on RTAI-Linux When writing applications based on RTAI-Linux, the applications are divided into real-time tasks and non-real-time tasks according to the specific requirements of the real-time system. Real-time tasks are real-time modules that run in kernel mode as loadable modules in the Linux kernel. Generally, the `init_module()` function is defined, which is called when the `insmod` command loads a module. This function typically performs initialization work and starts the real-time task. Similarly, the `cleanup_module()` function needs to be defined, which is called when the `rmmod` command unloads a module. This function typically performs resource release work. The design of real-time tasks should be as simple as possible, containing only processing modules with strong real-time requirements, such as real-time data acquisition and external device control. Non-real-time tasks are ordinary Linux processes that run in user mode, performing tasks with low real-time requirements, such as data processing and graphics display. Real-time tasks (RTAI kernel mode) cannot directly call system calls; they must communicate with non-real-time tasks (Linux processes) through specific methods. They can communicate through shared memory and FIFO methods. The structure diagram of the RTAI application is shown in Figure 2. [align=center] Figure 2 RTAI Application Structure Diagram[/align] 3.2 Real-time Database Management and Communication The real-time database of this system manages global I/O data. Data is acquired through hardware drivers and stored in a real-time database. Simultaneously, upper-layer software retrieves data from the real-time database. 3.2.1 Data Structure Design Like other general databases, a real-time database contains a set of objects and their structure. Since there is currently no unified data model for real-time databases, the data structures of databases developed by different vendors vary significantly. In this system's real-time database, a basic data object is "data," which contains several pieces of information, such as data name, data type, data location, and data length. Considering data access efficiency, at the beginning of program execution, a buffer is allocated in memory. This buffer only stores data; if the buffer size is insufficient (i.e., there is too much data), the buffer size can be automatically expanded. When storing real-time data in the buffer, we adopt the following approach: if the data is not bit-type, since the data length is always an integer multiple of bytes, it is stored in bytes in the buffer. The length of the data is calculated in bytes. If the data is bit-type, it is stored in the buffer. The length of this data is calculated in bits. Then, another piece of real-time data is stored. If the data is not bit-type, it is stored starting from the next byte, meaning the original bit-type data occupies one byte. If the data is bit-type, its storage position is determined by its length. There are two cases: if the lengths of the two bit-type data are no more than 8 bits, the bit-type data is stored immediately after the previous bit-type data; if the lengths of the two bit-type data are more than 8 bits, it is stored starting from the next byte, meaning the original bit-type data occupies one byte. 3.2.2 Data Access Design For convenient access, all real-time data is organized into a linked list. The node type of the linked list is the rtdb_data_t structure mentioned above. When a piece of data is added to the real-time buffer, the data storage location, length, and other information are automatically calculated, and a node is added to the real-time database linked list. In this way, retrieving real-time data is very flexible and convenient. If the name of the real-time data is known, the data can be obtained by traversing the linked list. If the storage location and length of the data are known, the data can be obtained directly from the buffer using the interface provided by the real-time database, without having to traverse the linked list. Traversing the linked list takes some time, which is not suitable for this system with high real-time requirements. Therefore, this system often uses the latter method to access data. The linked list structure of the real-time database is shown in Figure 3. [align=center] Figure 3 Real-time database linked list structure[/align] 3.3 Human-Machine Interface Software The human-machine interface module is an important part of this system, providing an interaction platform between the user and the underlying control. 3.3.1 Human-Machine Interface Database Human-machine interface data refers to data related to the interface, including global I/O data and memory data. I/O data refers to variables that need to be exchanged between the system and other applications (including I/O service programs), similar to global I/O data in the real-time database. Memory variables are variables that are only needed within the system, such as intermediate variables in the calculation process. For ease of access, we use linked lists to organize the HMI data, forming two linked lists: the I/O data list and the memory data list. The HMI database is also populated based on the XML configuration file hmidb.xml, which comes from the development environment. 3.2.2 Interface Elements Elements are the basic elements that make up the screen, including basic elements such as lines, rectangles, and ellipses, as well as composite elements such as oil tanks and valves, which are composed of basic elements. This system provides a large number of elements, and the drawing of these elements will call platform functions under specific systems, such as Linux and Windows CE systems. That is, for users, this layer is the same regardless of which system they use. Describing the HMI requires an XML configuration file, such as hmiwidget.xml, which is generated by the user when designing the interface in the development environment. The system also supports element changes, i.e., dynamic attributes, and event responses. Therefore, HMI elements also have dynamic attributes and event attributes. When parsing the hmiwidget.xml configuration file, these attributes are analyzed and linked together. During system initialization, MiniGUI operates in two modes: Server and Client. This depends primarily on the value of the global variable `mgServer`. `TRUE` indicates a server-side application, while `FALSE` indicates a client-side application. Renaming the MiniGUI application to `mginit` makes it a server-side application. If the MiniGUI application is run as a client, the server-side program `mginit` provided by MiniGUI must be run first. [align=center] Figure 4: MiniGUI Application Flow[/align] Author's Innovation: The embedded control system software platform discussed in this paper is a complex and large system, with each component having a highly complex internal structure and implementation. I have conducted extensive research on this topic, proposing a system design framework. Currently, the implemented components include: an embedded Linux real-time operating system, real-time database management and communication, a graphics library and runtime environment, etc., achieving excellent results. References: [1] Zhu Wenkai, Wang Weihua, Ding Han, et al. Open PLC based on embedded PC[J]. Mechanical and Electronic, 2003(3):3-7 [2] Li Jia. Development of embedded remote monitoring system[J]. Automation Instrument, 2002, 4 23(4):5-7 [3] Xu Wenbo, Zhang Xingye, Ou Aihui. Analysis and research on real-time operating system based on RTAI-Linux[J]. Shandong Electronics, 2003(2):21-23 [4] Chen Wei, Zhou Ruixiang, Li Zhuotao. Research on software platform of distributed manufacturing resource integration system[J]. Microcomputer Information, 2006, 5-1: 309-311 Author Introduction: He Huimin (1967.3-), male, Han nationality, from Yongnian, Hebei, associate professor, mainly engaged in teaching and research on computer architecture and embedded systems.
Read next

CATDOLL 108CM Victoria (TPE Body with Soft Silicone Head)

Height: 108cm Weight: 14.5kg Shoulder Width: 26cm Bust/Waist/Hip: 51/47/59cm Oral Depth: 3-5cm Vaginal Depth: 3-13cm An...

Articles 2026-02-22