Abstract: This paper designs a safety system that can work normally in harsh environments in response to the frequent accidents in the mining industry. First, the related concepts and software and hardware environment of embedded systems are introduced, and the embedded system requirements and Windows CE embedded operating system selection of coal mine monitoring terminals are explained; then, the related concepts and software and hardware environment of embedded databases are introduced.
Based on the embedded database requirements and characteristics of monitoring terminals, this paper studies in detail the key technical characteristics of Berkeley DB database and its applicability in coal mine monitoring systems, and introduces the basic concepts and basic API function operations of Berkeley DB database.
introduction
Embedded databases are not only very different from traditional databases in terms of functional concepts and system characteristics, but also in their application methods. Embedded databases are not sold directly to users, but are provided to device manufacturers or application developers so that they can be directly generated in embedded systems and applications. Embedded databases have broad application prospects in many fields, such as handheld computing and mobile computing, smart devices, and this article provides a good application.
1 System Requirements Analysis
Embedded system software development work such as front-end data collection, monitoring, and transmission. In order to meet the large amount of processing requirements of the front-end embedded monitoring system for storage, query, and display of real-time underground data, a database management system must be installed. However, the traditional database management system is obviously not suitable for embedded mine monitoring systems due to its large resource usage and low data management efficiency. Therefore, exploring a database system suitable for embedded monitoring terminals in the harsh environment of mines has become the key to the progress of this article.
Embedded database management system is a type of embedded application software that has emerged with the development of embedded applications. It has become an important branch of database technology research and is widely used in mobile computing platforms (such as HPC, PDA), home information environments (such as set-top boxes and digital TVs), communication computing platforms, automotive electronics platforms, e-commerce platforms (such as smart card applications) and other fields.
In order to solve these problems, the application of embedded system in coal mine monitoring system is proposed. The small size, high reliability, low power consumption and low cost of embedded system technology meet the strict requirements of the equipment of the mine monitoring system and the adaptability to the harsh production environment on site. The monitoring terminal transplants the embedded database management system to meet the main functional requirements of the traditional coal mine safety monitoring system:
1. Data communication function requirements.
2. Real-time query and display requirements.
3. User login management requirements.
2 Overall system design
The core of the embedded mine safety system is data processing. The monitoring terminal collects analog signals from various sensors in the mine (such as gas concentration, carbon monoxide concentration, wind speed, temperature, humidity, dust, pressure, etc.) and switch signals from field equipment control equipment (such as fan start and stop status, etc.) in real time to achieve real-time data display, real-time/historical curve display, query and report printing, sound and light alarm, manual/automatic control, and network communication. The realization of all these functions is based on data management. The embedded database system can effectively organize and manage various types of data in the coal mine, so as to achieve the design requirements of real-time query and control functions of the mine monitoring system. Figure 1 is a typical structure diagram of a mine safety system using an embedded database:
The system uses Windows CE embedded operating system and Berkeley DB embedded database as the development platform for the terminal application of the mine well monitoring system; it uses the existing mine safety monitoring system as the data source, collects on-site safety production data in real time through file sharing, and processes and sends the data.
3. Implementation of main functional modules of the system
3.1 Data Acquisition Module
The data acquisition module realizes the reading of real-time data from the coal mine data source sensor and is designed into a certain format of data structure for database and application operation. This system uses the existing mine safety system (MSUS) as the data source. The safety system organizes the sensor data according to the file format specified by the protocol and stores it in the specified local disk path.
1. Device installation information file (dev.xml)
The sensor device file is divided into a data header and a data body. The data header format is as follows:
2. Real-time data file (rtdata.xml)
The real-time data file is divided into a data header and a data body. The data header format is as follows:
The data body format is specified as follows:
The data status is represented by bits to indicate the data status (defined in binary and converted to integers when used), and its text correspondence is as follows:
[page]
Data acquisition program design
The data acquisition module program uses the ReadFile.h and ReadFile.cpp files, so this article designs the CReadFile class, which encapsulates all data acquisition operations for the dev.xml and rtdata.xml exchange files. According to the structure of the dev.xml and rtdata.xml exchange files, as well as the considerations of database storage operations, the program designs the DEVDATA and REALDATA structures for each sensor, which are used to save the data information of the dev.xml and rtdata.xml files respectively. The DEVDATA structure is shown below:
typedef struct devdata
{ TCHAR m_str_devSubstation[MAXLENGTH]; //Substation
TCHAR m_str_devID[MAXID]; //Sensor number
TCHAR m_str_devPlace[MAXLENGTH]; //Installation location
TCHAR m str_devName[MAX]; //Detection category
TCHAR m str_devType[MAX]; //Sensor type
TCHAR m str_devUnit[MAX]; //unit
float m_data_up; //Upper limit of range
float mes_data_down; //lower limit of range
float m_alarrn_up; //Alarm upper limit
float m_alarm_down; //Alarm lower limit
float m_power_off; //power-off value
float m_power_on; //power-on value
}DEVDATA;
The REALDATA structure is as follows:
typedef struct realdata
{TCHAR m_str_devID[MAXID]; //Sensor number
float m_data; //sensor value
TCHAR m_str_dataStatus[MAXSTATUS]; //Data status
}REALDATA;
The CReadFile class uses the CPtrList linked list data structure to manage all sensor information of the exchange file. The data nodes are DEVDATA and REALDATA structures.
3.2 Data Storage Module
The sensor device upload time is used as the key, and the device installation information encapsulated in the DEVDATA structure and the real-time data information encapsulated in the REALDATA structure constitute the data of the database, thus forming two sets of Key to Data pairs. Therefore, this solution will form two tables, which are stored in two database files. The sensor device installation information and real-time data information are stored in two database files separately. The device file storage operation is performed only when the device installation information changes, which greatly reduces the disk space occupied by the database file.
Berkeley DB uses Key/Data to distinguish data in the database. Key/Data pairs are the basis for BerkeleyDB to manage the database. The Key/Data pairs composed of these two constitute a basic structural unit in the database, and the entire database is actually composed of many such structural units. In other words, calling the database interface is actually providing the corresponding keyword, and using the keyword to find the data to be operated.
If a group of related Key/Data pairs is also regarded as a table, then each database is only allowed to store one table. Therefore, generally one type of Key/Data pair constitutes a database file. The database storage code design is mainly divided into the device installation information (key/data pair is the device upload time/DEVDATA structure) storage code design and real-time data information (key/data pair is the device upload time/REALDATA structure) storage code design. Berkeley DB manages the database in files. Since the device installation information is only stored in the database when the data changes, and the interval period is long, the author designed the dev.db file to implement the storage management of the installation information; since the update cycle of real-time data information is short, the database storage operation is frequent, and data is collected and updated every day, the author designed the real-time database file in units of daily dates. The system will obtain the date of the day and use it as the file name to form a database file for database operations. For example, if the date of the day is February 8, 2007, then the database file name is 2007-02-08.db.
[page]
The storage codes of equipment installation information and real-time data information have certain similarities. The author takes the storage code of real-time data information as an example to illustrate the design process. The program flow is as follows:
Figure 2 Equipment installation information database storage program flow
3.3 Data Query Module
The design of the real-time/historical data query module mainly involves the design of GetDevKey, DataQueryByRealTime and DataQuery functions.
1. DataQueryByRealTime function design
If the device installation information has not changed during the query time period entered by the user, the GetDevKey function will directly return FALSE. The program will then call the DataQueryByRealTime function to query the real-time database file. The device installation information is directly obtained from the m-devList structure list. The function design includes the following:
① Based on the query date input by the user, a real-time database file such as 2007-02-09.db is generated and the real-time database is opened.
② Build a cursor, use the get method, use the query time as the key, and the flag label as DB_ SET_ RANGE to locate the first record of multiple records in the database file.
③ Traverse the database file with multiple records of the same kev, and display the REALDATA structure whose sensor ID number in data is equal to the user input ID number and the corresponding m devList linked list node DEVDATA structure in the list box control (CC1istCtrl).
2. DataQuery function design
If the installation information corresponding to the device query time has changed relative to the current time period, the GetDevKey function will return the correct device installation information query time devKey, which may be different from the sensor query time entered by the user; the program will then call the DataQuery function and pass the correct device query time devKey, the sensor real-time data query time realKey entered by the user, the sensor ID number strDevID, and the real-time database file name strRealDbName to the DataQuery function as formal parameters. The function design includes the following:
①Open the device database dev.db file and open the real-time database file according to the parameter strRealDbName.
② Build a cursor, use the get method, use devKey and realKey as the database key, and the flag tag is DB_ SET_ RANGE. The cursor is positioned to the first record of the device database file and the real-time database file.
③ Traverse multiple records with the same key in the database file. If the sensor ID number in the data recorded in the device database file (DEVDATA structure) is equal to the sensor ID number in the data recorded in the real-time database file (REALDATA structure), the two data information will be displayed in the list box control (CC1istCtrl).
4. Conclusion
The innovation of this paper: Analyze the functional requirements of the embedded coal mine monitoring system, develop and design a mine safety system based on Berkeley DB database and Windows CE, realize window login, data acquisition, system interface, database storage, real-time/historical data query, real-time curve display and other functional modules, and deeply discuss and study the system's data acquisition method, database KEY/DATA pair storage scheme and real-time/historical sensor data database query strategy. In actual production, it works stably and has fast query speed, achieving the expected design goals.
Previous article:Application of ZigBee Technology in Gun Positioning System
Next article:Design of security system for unattended substation
Recommended ReadingLatest update time:2024-11-16 22:35
- Popular Resources
- Popular amplifiers
- Siemens PLC from Beginner to Mastery with Color Illustrations (Yang Rui)
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Operational Amplifier Practical Reference Handbook (Edited by Liu Changsheng, Zhao Mingying, Liu Xu, etc.)
- A Complete Illustrated Guide to Operational Amplifier Applications (Written by Wang Zhenhong)
- Mir T527 series core board, high-performance vehicle video surveillance, departmental standard all-in-one solution
- Akamai Expands Control Over Media Platforms with New Video Workflow Capabilities
- Tsinghua Unigroup launches the world's first open architecture security chip E450R, which has obtained the National Security Level 2 Certification
- Pickering exhibits a variety of modular signal switches and simulation solutions at the Defense Electronics Show
- Parker Hannifin Launches Service Master COMPACT Measuring Device for Field Monitoring and Diagnostics
- Connection and distance: A new trend in security cameras - Wi-Fi HaLow brings longer transmission distance and lower power consumption
- Smartway made a strong appearance at the 2023 CPSE Expo with a number of blockbuster products
- Dual-wheel drive, Intellifusion launches 12TOPS edge vision SoC
- Toyota receives Japanese administrative guidance due to information leakage case involving 2.41 million pieces of user data
- 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
- Excellent "Internet of Things" (IoT) video recommendation, it explains it very thoroughly!
- Design of TPS53355 ripple injection circuit
- How to realize serial communication between DSP and PC
- DIY GPS Tracker
- Why does the main function of C/C++ return 0?
- Please help me find out if there is any problem with this WM8978 circuit
- MSP430 seems unable to enter interrupt, no output can be observed
- How do capacitors and inductors store energy?
- Raspberry Pi (I) Using Python language to flash GPIO pins
- About CC2640 off-chip OAD problem handling