Share this

Design of real-time database for advanced control software system

2026-04-06 07:57:02 · · #1
Preface In recent years, Distributed Control Systems (DCS) have been widely used in the industrial control field both domestically and internationally due to their powerful control functions, reliable safety performance, and good portability. The increasing popularity of DCS provides strong hardware support and guarantee for realizing advanced control, real-time optimization, and other new technologies. Besides improving control performance and increasing economic efficiency, advanced control is also an important way to deeply develop and utilize DCS resources and improve enterprise automation and management levels. The design of advanced control software is generally divided into several modules: model identifier, multivariable predictive controller, robust PID controller (including various intermediate controllers), real-time database, process calculation package, etc., among which the real-time database module is the link and bridge between other modules. Therefore, the quality of the real-time database module design directly affects the success or failure of the advanced control software design. The real-time database is an important component of the advanced control software system and also one of the design challenges. The real-time database is the data processing center of the advanced control software system. When the advanced control system is put into operation, the production status of the industrial site will be reflected in the values ​​of variables in real time, and the instructions issued by the operator in front of the computer must be quickly delivered to the production site. All of this is mediated by the real-time database. Meanwhile, the real-time database also serves as a transaction scheduling center. Data acquisition transactions, graphical display transactions, alarm transactions, historical data storage transactions, etc., are all uniformly allocated by the real-time database, thereby achieving real-time control. 1. Overview of Real-Time Databases Before introducing the concept of a real-time database, let's first introduce data objects. Data defined in advanced control software design differs from traditional data or variables. It not only includes the numerical characteristics of variables but also encapsulates other data-related attributes (such as data status, alarm limits, etc.) and data manipulation methods (such as data storage, alarm processing, etc.) together as a whole, providing services in the form of objects. This data that defines values, attributes, and methods as a unified whole is called a data object. In design, data objects are used to represent real-time data in the system, and object variables replace traditional value variables. The collection of all data objects managed using database technology is called a real-time database. The real-time database provides operations such as managing, refreshing, and querying data objects. Unlike ordinary commercial databases, the main goal of a real-time database is to complete as many transactions as possible within the specified time requirements, rather than fairly allocating the system to ensure that all transactions are executed. It has the following characteristics: 1) Time Constraints: The main characteristic of a real-time database system is the imposition of time constraints on data objects and transactions. Time constraints on data, in addition to the general consistency requirements of the database, specify temporal consistency requirements. In real-time systems, time-constrained data mainly comes from external dynamic data, such as field data collected by sensors and data derived from these data. Therefore, data time constraints can be divided into two categories: absolute data consistency and relative data consistency. Absolute data consistency means that the data in the real-time database should be consistent with external data (also known as environmental data), that is, the data in the database should reflect the state of the external environment in a timely manner. For example, in a chemical process control system, the temperature, pressure, and other information of the tower recorded in the database must be consistent with the actual temperature, pressure, and other parameters of the tower. The violation of this consistency can sometimes lead to catastrophic consequences. In real-time systems, it is often necessary to derive other data from a set of data items, for example, deriving the system's power from the system's current and voltage. In this case, it is often required that the set of data used to derive the new data be as close as possible in time, which forms the concept of relative data consistency in a real-time database system. 2) Transaction Scheduling: In traditional database systems, the goal of transaction scheduling is to improve the system's throughput for transactions. However, real-time database systems require that as many transactions as possible be completed within their time limits. Therefore, real-time transaction scheduling differs from that in traditional database systems. Most real-time transaction scheduling strategies revolve around transaction priority. 3) Real-time Data Storage Management in Real-time Databases: Real-time databases primarily handle the storage and management of all real-time data in the system, providing fast and accurate real-time information for related functions. Therefore, real-time performance is paramount for real-time databases. Considering this, real-time databases should occupy minimal space and reside in memory during system operation to ensure fast database read speeds, flexible access, and easy data sharing between functional modules. Data sharing in real-time databases is achieved through memory-to-file mapping. Non-shared and shared data with low real-time requirements, such as conversion coefficients of sampled values, can be placed in external storage. Therefore, in the design of real-time databases, the conflict between time and storage space must be properly addressed to ensure the real-time performance of advanced control systems. 2. Analysis and Design of Real-Time Databases First, let's analyze the design of real-time databases from a functional perspective. 1) Functional Analysis of the Real-Time Database System: **Field Data Acquisition:** The real-time database provides interfaces to typical data sources, reading and writing field values ​​from communication device registers and sending them to an allocated memory buffer. **Preprocessing Mechanism:** Raw data can be directly processed within the real-time database, such as data transformation. **Rolling Storage Mechanism:** Data objects in the real-time database are stored in memory as linked lists, thus the database capacity is relatively fixed. When new data is generated, the field value attributes of the data objects are automatically updated. **Automatic Update Mechanism:** When the field value attributes of data objects in the real-time database change, a thread is automatically started to update the data displayed on the screen. If storage is required, it is stored in an Access database for real-time monitoring. **Triggering and Timing Mechanisms:** Rich triggering and timing mechanisms are provided for various data processing, advanced control, and optimization algorithms to ensure data real-time performance, validity, and consistency. **Compensation Mechanism:** When continuous operation cannot be guaranteed (e.g., during system backup), a corresponding compensation mechanism is required to ensure data is not lost. **Data Retrieval Mechanism:** Data objects in the real-time database can be retrieved in a manner similar to relational databases to obtain the required data object attributes or operations. 1) Dynamic Summarization Mechanism: The real-time database provides dynamic summarization functions for alarm status, operation events, and other information. 2) Real-time Database Transaction Scheduling Analysis: After the advanced control software system is put into operation, it needs to simultaneously perform DCS data acquisition, data processing, graphical display refresh, historical data storage, emergency event alarms, or over-limit alarms, etc. All these transactions must be processed in parallel. If the waiting time is too long, it cannot meet the real-time requirements. This requires us to implement parallel programming on a machine with only one CPU. This means allocating the CPU time to each event according to a certain priority criterion, processing a specific event periodically without letting any event take too long. Under 32-bit Windows 98 or Windows NT 4.0, this parallel programming is implemented using multi-threaded programming techniques to schedule transactions in real time. 3) Real-time Database Design: Using object-oriented programming (OOP) design techniques, the real-time database is defined as a class. As shown in Figure 2, the interface functions defined in the real-time database class, which are related to various graphics display modules and historical data storage modules, are divided into several modules for explanation: Real-time Database Initialization Module: This module mainly creates various data objects based on the data required by advanced control, using linked lists as the storage method, and establishes an object name index corresponding to each data object to improve the access speed of data objects. It also establishes an Access historical database. Basic Operation Module: Provides basic operations for data objects, such as obtaining other attributes of data objects by name or ID, or obtaining the ID of data objects by name, etc. Read/Write Data Operation Module: Provides read/write data operations for data objects, writing the current value stored in the data buffer to the current value attribute of the data object in the real-time database, and reading the current value in the data object. 3. Communication Equipment Read/Write Operation Module: Manages communication equipment, reads the current working status of the equipment, and performs operations on specified equipment. Window Operation Module: Reads the name of the user window, performs operations on the specified user window, and reads the current status of the user window. Alarm Operation Module: Stores alarm information and reads the alarm limit values ​​of data objects. Storage Operation Module: Stores the data to be stored in the Access database. 3. Implementation of Real-Time Database Definition of Data Object Classes in Real-Time Database: Data objects are divided into three types: analog quantity, digital quantity, and string. The following focuses on the definition of the analog quantity class and provides some VC++ code. The definitions of other classes are similar and will not be introduced here. //Class definition for analog quantities: class AnalogType : public CObject { public: AnalogType(); virtual ~AnalogType(); private: //Basic attribute operation parameters CString ObjectName; //Object name float ObjectInivalue; //Initial value float ObjectMinvalue; //Minimum value float ObjectMaxvalue; //Maximum value CString ObjectUnit; //Object's unit of measurement int ObjectPointN; //Decimal places //Save operation parameters BOOL IsSave; //Whether to save int SaveTime; //Save time //Alarm operation parameters BOOL IsAlarm //Whether to alarm int AlarmPriority; //Priority float LowLowvalue; //Low low alarm float Lowvalue; //Low alarm float HeighHeighvalue; //High high alarm float Heighvalue; //High alarm float LowDevvalue; //Low deviation alarm value float HeighDevvalue; //High deviation alarm value int FieldvalueInt; //Real-time integer value of the field float FieldvalueFloat; //Real-time analog value of the field //Define data operation public: // Defines the input interface for the attribute, providing initialization operations. void SetObjectName(CString name) {ObjectName = name; } void SetObjectInivalue(float inivalue) {ObjectInivalue = inivalue; } void SetObjectMinvalue(float minvalue) {ObjectMinvalue = minvalue; } void SetObjectMaxvalue(float maxvalue) {ObjectMaxvalue = maxvalue; } void SetObjectUnit(CString unit) {ObjectUnit = unit; } …… // Defines the output interface, providing basic data operations and save/alarm operations. CString GetObjectName() { return ObjectName; } float GetObjectInivalue() { return ObjectInivalue; } float GetObjectMinvalue() { return ObjectMinvalue; } float GetObjectMaxvalue() { return ObjectMaxvalue; } CString GetObjectUnit() { return ObjectUnit; } …… // Real-time value operation void SetFieldvalue(float valuefield) {Fieldvalue = valuefield; } float GetFieldvalue() { return Fieldvalue; } }; The design of the real-time database class, declared in VC++ header file as follows: class RealDB : public CObject { private : AnalogType *TemAnalog; SwitchType *TemSwitch; POSITION temposition; int DataNum; private: // Create Access historical database and table BOOL CreateNewTable(); BOOL CreateHistoryAlarmDB(); BOOL CreateHistoryObjectTable(); public: CDaoTableDef *m_newtable; CDatabase m_dataobject; CObList m_listdata; // Linked list of data objects CString IndexTag[200]; // Define the maximum number of data objects 200 int AnalogSwitchSign; // Define the split position of analog and switch type // Operation public: RealDB(); virtual ~RealDB(); BOOL CreateDataObject(); // Create a data object // Basic operations of the data object BOOL GetProFromName(CString Name, int Type, float InitV, CString Unit, float MaxV, float MinV, int PointN); BOOL GetProFromID(int id, CString Name, int Type, float InitV, CString Unit, float MaxV, float MinV, int PointN); int GetIDFromDataName(CString dataname); // Get the ID number by the tag name CString GetDataNameFromID(int id); // Get the name of the data object by the ID int GetDataType(CString Name); int GetAlmDataName(CString name[200]); // Collection of alarm data objects int GetSaveDataName(CString alarmname[200]); // Collection of data objects // Read and write operations of the field value of the data object BOOL GetvalueFromName(CString name, float value); // Get the field value by tag name BOOL SetvalueFromName(CString name, float value); // Write the field value to the data object by tag name BOOL GetvalueFromID(int id, float value); // Get the field value by ID number BOOL SetvalueFromID(int id, float value); // Write the field value by ID number BOOL GetvalueArrayFromID(int Num, int id[], float value[]); // Read the field value of the data object in groups BOOL SetvalueArrayFromID(int Num, int id[], float value[]); // Write the field value of the data object in groups... }; 4 Conclusion Real-time database design is an important and difficult part of advanced control software design. This paper discusses the implementation method of real-time database modules through an overview and analysis of real-time databases, and provides some code for defining classes in an object-oriented programming manner. Real-time database systems are complex, and due to space limitations, this paper does not provide detailed explanations of each aspect. The real-time database I developed can be connected to advanced control software that has already been developed. It has been successfully tested in the laboratory, and some other work (such as a real-time database management system and a real-time database interface) is also underway.
Read next

Discussion on the Integration and Upgrading of DCS Control Systems

1. Process Status and Automation System Background of Nantong Acetate Fiber Co., Ltd. Nantong Acetate Fiber Co., Ltd. (h...

Articles 2026-02-22
CATDOLL Maria Hard Silicone Head

CATDOLL Maria Hard Silicone Head

Articles
2026-02-22
CATDOLL 135CM Laura

CATDOLL 135CM Laura

Articles
2026-02-22
CATDOLL 128CM Dolly Silicone Doll

CATDOLL 128CM Dolly Silicone Doll

Articles
2026-02-22