A distributed controller database download structure and method based on double buffer
By adopting a double buffer-based database download structure and method in the distributed control system, the problem of complex database download operations in the prior art is solved, and the effect of simplifying the download operations, reducing storage consumption and supporting online downloads is achieved.
Patent Information
- Application Number
- CN202010939543.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2020-08-24
- Filing Date
- 2020-09-08
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2040-09-08
AI Technical Summary
The existing distributed control system database has complex download operations, strict execution conditions, long download operations, poor stability, and does not support online modification and downloading of databases.
The distributed controller database download structure and method based on double buffers are adopted. The control layer and application layer switch are connected through the core switch. The engineer station compiles the database files and downloads them to the process control station, and uses the double buffer design to support online download operations.
It simplifies database download operations, reduces the consumption of controller storage resources, supports online downloads, and improves the stability and flexibility of the system.
Smart Images

Figure CN111948998B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of distributed control, and in particular to a distributed controller database download structure and method based on double buffers. Background Art
[0002] Distributed control system is also called distributed control system (DCS). It is a new control system developed by integrating computer technology, network technology, communication technology and control technology. The system adopts a combination of decentralized control and centralized management and has a hierarchical architecture. At present, distributed control systems have been widely used in modern automation control systems such as petrochemical, electric power, metallurgy, production line automation and intelligent buildings, meeting the requirements of large-scale industrial production and increasingly complex process control.
[0003] The hardware of the distributed control system can be functionally divided into two parts: distributed controller and I / O card. The distributed controller, referred to as the controller, is the core component of the distributed control system and the brain of the entire control system. It collects data from the input channels of various input cards in real time, stores the data in the database of the distributed controller, and then writes the output data points into the database and the output channels corresponding to the output cards after each cycle operation according to the set cycle operation control algorithm. I / O cards, also called input and output cards, are the interface between the distributed controller and external devices or systems, providing input and output of distributed controller database data points. According to the data type, it can be divided into two types: analog cards and digital cards; according to the input and output direction of the signal, it can be divided into three types: input cards, output cards, and input and output cards.
[0004] With the continuous improvement of the automation level of modern large-scale industrial production and the increasingly complex process control requirements, the control strategies of distributed control systems are becoming more and more complex. In order to improve the control quality of the control system and adapt to new control process requirements, it is often necessary to modify the database configuration in the controller online, such as adding, deleting and modifying the data points of the database. The database of the controller is the key to the correct operation of the controller control algorithm. Online modification of the database must ensure that it will not affect the ongoing production and control. If the production is interrupted due to the modification of the database, and the unplanned change of the data point value causes a production accident, the loss will be immeasurable. Therefore, a perfect database download structure and method is an important technology for distributed control systems.
[0005] At present, the downloading operation of distributed control system database is complicated, the execution conditions are strict, the downloading operation is time-consuming, the stability is poor, and some even do not support online modification and downloading of database. On this basis, a distributed controller database downloading structure and method based on double buffer is proposed. Summary of the invention
[0006] The purpose of the present invention is to provide a distributed controller database download structure and method based on double buffers, which solves the defects of the existing distributed control system database download operations being complicated, requiring stringent execution conditions, consuming a long time for download operations, and having poor stability.
[0007] In order to achieve the above object, the technical solution adopted by the present invention is:
[0008] The present invention provides a distributed controller database download structure based on double buffers, including a core switch, wherein the core switch is respectively connected to a control layer access switch and an application layer access switch, the control layer access switch is connected to at least one process control station; the application layer access switch is connected to at least one engineer station; wherein the engineer station is used to compile a production database file, and download the generated database file to the process control station through the application layer access switch.
[0009] Preferably, the process control station includes a controller, which is respectively connected to a network module, a storage module and a non-volatile memory; wherein the network module is used to realize data exchange between the controller and the engineer station; the storage module is the memory of the controller; and the non-volatile memory is a persistent FLASH memory used to support the operation of the controller.
[0010] Preferably, the storage module is divided into six functional areas from the low address space L to the high address space H, the first functional area is the reserved area; the second functional area is the application area; the third functional area is the data exchange area; the fourth functional area is the first database area; the fifth functional area is the second database area; and the sixth functional area is the error handling and reporting area.
[0011] Preferably, the core switch is respectively connected to a control layer access switch and an application layer access switch via Ethernet.
[0012] Preferably, the control layer access switch is connected to the process control station via Ethernet; and the application layer access switch is connected to the engineer station via Ethernet.
[0013] A distributed controller database download method based on double buffers, based on the distributed controller database download structure based on double buffers, comprises the following steps:
[0014] Step 1, customize the parameters in the process control station, wherein the download flag is set to Flag1, when Flag1=0, it means that the controller is in the initial state, and the database initial download is executed; when Flag1=1, it means that the controller is in the online running state, and the database online download is executed;
[0015] Set the switch flag to Flag2. When Flag2=0, it means that the database switch operation does not need to be performed. When Flag2=1, it means that the database switch operation needs to be performed.
[0016] Step 2: Initialize and power on the process control station, then partition the process control station and assign the core switch a value of 0. After completion, the process control station sends the download flag Flag1 to the engineer station at the set broadcast cycle.
[0017] Step 3, the engineering station receives the download flag Flag1 in real time and determines the value of Flag1, and then the engineering station sends the compiled database file to the process control station;
[0018] Step 4: The process control station loads the database file through a download operation, thereby establishing a real-time database for the operation of the process control station.
[0019] Preferably, in step 1, the parameters in the process control station are customized, and the specific method is:
[0020] Three pointers are customized in the data exchange area, namely P1, P2 and Pa, where P1 points to the first database area, P2 points to the second database area, and Pa represents the current working database file storage area, pointing to P1 or P2.
[0021] Preferably, in step 4, the download operation includes initial download and online download, wherein, when Flag1=0, the download operation is initial download; when Flag1=1, the download operation is online download.
[0022] Preferably, in step 4, the specific method of initial downloading is:
[0023] The controller writes the received database file into the first database area and the second database area respectively, and writes the database files in byte order starting from the starting addresses of the first database area and the second database area respectively, and then assigns a value of 1 to Pa, indicating that the currently active database is the first database area, and assigns a value of 1 to Flag1, indicating that the initial download is completed;
[0024] The specific method of online installation is:
[0025] Determine the value of Pa:
[0026] When Pa=1, it indicates that the currently working database is the first database area, and the controller writes the received database file into the second database area;
[0027] Then, when the database file is written, the engineer station sends a command to the controller to set the switch flag Flag2 to 1; after the controller completes the calculation task of each calculation cycle, it determines the value of the switch flag Flag2. When Flag2=1, it means switching, and the controller sets Pa=2, indicating that the controller will automatically use the second database area for calculation in the next calculation cycle; when Flag2=0, it means no switching, and the controller continues to use the first database area for calculation in the next calculation cycle;
[0028] When Pa=2, it means that the second database area is currently working, and the industrial controller writes the received database file to the first database area; then, when the database file is written, the engineer station sends a command to the controller and assigns the switching flag Flag2 to 1; when Flag2=1, it means switching, and the controller executes the switching operation; the controller assigns Pa=1, indicating that the controller will automatically use the first database area for calculation in the next operation cycle; when Flag2=0, it means no switching, and the controller continues to use the second database area for calculation in the next operation cycle.
[0029] Compared with the prior art, the present invention has the following beneficial effects:
[0030] The invention provides a distributed controller database download structure based on double buffers. The system has a simple connection structure and is convenient to install and construct. The system has flexible configuration, and process control stations and engineer stations can be added and deleted at any time as needed.
[0031] The present invention provides a distributed controller database download method based on double buffers. The database file compiled by the engineer station has a compact structure and occupies a small storage space, which significantly reduces the consumption of controller storage resources. At the same time, a double buffer design is adopted to well support the online database download operation. The initial download and online download use a unified file format, making the online database download operation of the control system simple and feasible. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 It is a schematic diagram of the download structure of a distributed controller database based on double buffers;
[0033] Figure 2 It is the internal partition map of the storage module;
[0034] Figure 3 It is an engineering application and deployment structure diagram. DETAILED DESCRIPTION
[0035] The present invention will be further described in detail below in conjunction with the accompanying drawings.
[0036] like Figure 1 , Figure 3 As shown, a distributed controller database download structure based on double buffers provided by the present invention includes a core switch S1, and the core switch S1 is respectively connected to a control layer access switch S2 and an application layer access switch S3 through Ethernet.
[0037] The control layer access switch S2 is connected to a process control station DPU via Ethernet; the application layer access switch S3 is connected to at least one engineer station E via Ethernet.
[0038] The process control station comprises a controller CU, and the controller CU is respectively connected to a network module N, a storage module M and a non-volatile memory Q via a data bus.
[0039] Specifically: the network module N is connected to the control layer through an Ethernet cable and accesses the switch S2, which serves as a bridge for data exchange between the controller CU and the engineer station E1;
[0040] The storage module M is the memory of the controller DPU. All data and applications are stored on the storage module M. The storage module M exchanges data with the controller in both directions through an 8-bit data bus.
[0041] The non-volatile memory Q is used to support the persistent FLASH memory of the controller operation, and performs bidirectional data exchange with the controller CU through the data bus.
[0042] like Figure 2 As shown, the size of the storage module M in the present structure is at least 128 megabytes, specifically: the storage module M is divided into six functional areas from the low address space L to the high address space H, the first functional area is the reserved area RE, whose size is 4 megabytes; the second functional area is the application area AP, whose size is 20 megabytes; the third functional area is the data exchange area DE; its size is 80 megabytes; the fourth functional area is the first database area DB1, whose size is 8 megabytes; the fifth functional area is the second database area DB2, whose size is 8 megabytes; the sixth functional area is the error handling and reporting area ER, whose size is variable, and the remaining space of the storage module M is all divided into the ER area.
[0043] The controller CU is connected to a communication baseboard BCM, and the communication baseboard BCM is respectively connected to an analog quantity input card component, an analog quantity output card component, a digital quantity input card component and a digital quantity output card component.
[0044] The three-level network topology of Ethernet is formed by the application layer switch S3, the control layer switch S2 and the core switch S1. The two engineering stations are engineering station 1 and engineering station 2.
[0045] The detailed configuration information is described as follows:
[0046] The network address of the controller is 192.168.1.1, and the addresses of the two engineering stations are 192.168.1.101 and 192.168.1.102 respectively.
[0047] The card address of the analog input card is 3, the card address of the analog output card is 4, the card address of the digital input card is 5, and the card address of the digital output card is 6.
[0048] The controller and the card communicate through the communication baseboard BCM.
[0049] The communication address of the controller is 1. According to the project configuration, you can compile and generate the database file at the engineer station E1 or the engineer station E2, and then perform the initial download or online download to download the database file to the controller of the process control station through the network connection for operation.
[0050] like Figure 3 As shown, the present invention provides a method for downloading a distributed controller database based on a double buffer, comprising the following steps:
[0051] Step 1: Customize the parameters in the controller DPU:
[0052] In the data exchange area DE, three pointers P1, P2 and Pa are defined, where P1 points to DB1, P2 points to DB2, and Pa indicates the current working database file storage area, pointing to P1 or P2;
[0053] Define the download flag as Flag1. When Flag1=0, it means the controller is in the initial state; when Flag1=1, it means the controller is in the online running state.
[0054] The switch flag is defined as Flag2. When Flag2=0, it indicates that the database switch operation does not need to be performed; when Flag2=1, it indicates that the database switch operation needs to be performed.
[0055] Step 2: After the controller DPU is initialized and powered on, the storage space of the storage module M is partitioned, and the pointers P1 and P2 point to DB1 and DB2 respectively. The core switch S1 is assigned a value of 0. After completion, the controller DPU sends the download flag Flag1 to the engineering station E1 via Ethernet at the set broadcast cycle;
[0056] Step 3: Use the controller download operation to send the database file compiled by the engineer station E1 to the controller DPU. The controller download operation is divided into initial download and online download.
[0057] Specifically:
[0058] Database file definition: Database file refers to the description file of the control system database written by the user at the engineer station according to the requirements of the control process. The file is compiled and generated at the engineer station and provided to the controller for use.
[0059] The controller loads the file during initialization or online downloading, and then initializes and defines the data points of the control system according to the file to establish a real-time database for the controller operation.
[0060] The database file is a binary file that records and describes in detail the composition and configuration information of the process station, including the configuration information of IO cards, the configuration information of card channels, the configuration information of analog points (4-byte floating point numbers), and the configuration information of digital points (1-byte integers, which have only two states: 0 and 1).
[0061] The database file is compiled and generated by the engineering station E1, and its structural model is shown in Table 1:
[0062] Using binary representation, the file data is a binary stream; the method and byte order of the database file compiled by the engineering station E1 are as follows:
[0063] S1, the first field is the file header of the database file, the field length is 1 byte, and the value is 0x55 (0x represents hexadecimal);
[0064] S2, the second field records the length of the database file data area, the field length is 4 bytes, the length of the data area starts from the unit number field and ends at the file end field, excluding the file end field, and the unit of measurement for the data area length is bytes;
[0065] S3, the third field records the unit number where the process station is located, and the field length is 1 byte;
[0066] S4, the fourth field records the process station number, the field length is 1 byte, and the supported 256 process stations are numbered 1, 2, ..., 256 respectively;
[0067] S5, the fifth field records the communication box type, with a length of 1 byte; for example, when it is equal to 0, it means that the communication box type is BCM01. The fifth byte describes the total number of cards configured in the process station. Cards can be divided into three types according to the data input and output direction: input cards, output cards, and input and output cards. Cards contain data channels, each data channel corresponds to a data point, and cards can be divided into analog cards and digital cards according to the type of data points;
[0068] S6, the sixth field is the card information area, which is cyclical with the card as the unit, first writing the information of the first card, then writing the information of the second card, and so on until the information of the last card is written.
[0069] The card information area includes a card description area, an analog data area, and a digital data area; the card description area includes four fields, the first field is the index number, which is 4 bytes long and uniquely represents the card; the second field is the card type, which is 1 byte long and is an enumerated type value indicating the type of the card; the third field is the card address, which is 1 byte long and contains the physical address of the card, through which the card communicates with the controller; the fourth field is the broadcast cycle, which is 1 byte long and records the cycle in which the card sends data to the controller, in milliseconds. If it is an output card, the value is changed to 0.
[0070] Next, describe the data points under the card, and write them in the order of analog data area first and digital data area later; then write the total number of analog points of the card. If the card has no analog points, it will be 0.
[0071] When the number of analog points is greater than 1, the analog data area is generated in the following order: 4-byte index number, 30-byte point name, 30-byte point description, 4-byte physical range upper limit, 4-byte physical range lower limit, 4-byte exception report dead zone, 4-byte exception report maximum interval, 4-byte alarm upper limit 1, 4-byte alarm lower limit 1, 4-byte alarm upper limit 2, 4-byte alarm lower limit 2, 4-byte alarm upper limit 3, 4-byte alarm lower limit 3, 1-byte whether to enable or not, 0 means not enabled, 1 means enabled.
[0072] Next, write the total number of digital points of the card. When the total number of digital points is greater than 1, generate the digital data area in the following order: 4-byte index number, 30-byte point name, 30-byte point description, 4-byte maximum interval time for exception report, 1-byte alarm definition (1 means enabling the alarm, 0 means disabling the alarm), and 1-byte whether the byte is enabled or not.
[0073] According to the above format, write the information of the second card and the third card in sequence until all the card information is written.
[0074] S7, the last field is the end of the file, the field length is 1 byte, and the value is 0xAA (0x represents hexadecimal).
[0075] Table 1 Database file structure and composition
[0076]
[0077]
[0078]
[0079] Step 4: The engineer station receives the download flag Flag1 broadcast from the controller in real time and determines the value of Flag1. When Flag1=0, it indicates that the initial download needs to be executed. When Flag1=1, it indicates that the database online download needs to be executed.
[0080] When it is the initial download,
[0081] Under the initial downloading condition, the engineer station downloads the database file to the controller via Ethernet, and the controller writes the file to DB1 and DB2 at the same time, starting from the starting address of DB1 and DB2, and writes the database files in byte order, and then assigns 1 to Pa (Pa=1), indicating that the currently active database is DB1, and assigns 1 to Flag1, indicating that the initial downloading is completed. After the assignment is completed, the application performs operations according to the database pointed to by Pa.
[0082] (2) Download online
[0083] The value of Pa needs to be determined for offline installation:
[0084] When Pa=1, it means that the current working database is DB1. The engineer station transmits the compiled database file to the controller via Ethernet. After receiving the database file, the controller writes the database file to DB2. After writing, the engineer station sends a command to the controller to assign the switch flag Flag2 to 1. After the controller completes the calculation task of each calculation cycle, it determines whether to switch the database and judges the switch flag Flag2. When Flag2=1, it means switching, and the controller performs the assignment operation: Pa=2; in the next calculation cycle, the controller will automatically use the database DB2 for calculation. When Flag2=0, it means no switching, and the controller continues to use the database DB1 for calculation in the next calculation cycle.
[0085] When Pa=2, it means that the current working database is DB2. The engineer station transmits the compiled database file to the controller via Ethernet. After receiving the database file, the controller writes the database file to DB1. After the calculation task is completed in each calculation cycle, the controller determines whether to switch the database, and determines the switching flag Flag2. When Flag2=1, it means switching. The controller performs the switching operation. Pa=1, switches to database DB1. In the next calculation cycle, the controller will automatically use database DB2 for calculation. When Flag2=0, it means no switching.
[0086] Compared with the prior art, the present invention has the following advantages:
[0087] 1. The system has a simple connection structure and is easy to install and construct.
[0088] 2. The system configuration is flexible, and controllers and engineer stations can be added and deleted at any time as needed.
[0089] 3. The database file structure is compact and occupies little storage space, which significantly reduces the consumption of controller storage resources.
[0090] 4. The use of binary makes the database file generation speed fast, the controller parses the configuration file and compares the file at a high speed, and the online download takes less time, ensuring that the control system can run continuously and reliably.
[0091] 5. The double buffer design is adopted to support the online downloading operation of the database. The initial downloading and online downloading use the same file format, making the online downloading operation of the control system database simple and feasible.
Claims
1. A distributed controller database download method based on double buffer, characterized in that: A distributed controller database download structure based on double buffers includes a core switch (S1), the core switch (S1) is connected to a control layer access switch (S2) and an application layer access switch (S3), the control layer access switch (S2) is connected to a process control station; the application layer access switch (S3) is connected to at least one engineer station; wherein the engineer station is used to compile a production database file, and download the generated database file to the process control station through the application layer access switch (S3); The following steps are involved: Step 1, customize the parameters in the process control station, wherein the download flag is set to Flag1, when Flag1=0, it means that the controller is in the initial state, and the database initial download is executed; when Flag1=1, it means that the controller is in the online running state, and the database online download is executed; Set the switch flag to Flag2. When Flag2=0, it means that the database switch operation does not need to be performed. When Flag2=1, it means that the database switch operation needs to be performed. Step 2, initialize and power on the process control station, then partition the process control station and assign the core switch (S1) to 0. After completion, the process control station sends the download flag Flag1 to the engineer station at the set broadcast cycle; Step 3, the engineering station receives the download flag Flag1 in real time and determines the value of Flag1, and then the engineering station sends the compiled database file to the process control station; Step 4, the process control station loads the database file through a download operation, thereby establishing a real-time database for the operation of the process control station; In step 4, the download operation includes initial download and online download, wherein, when Flag1=0, the download operation is initial download; when Flag1=1, the download operation is online download; The specific method of initial download is: The controller writes the received database files into the first database area (DB1) and the second database area (DB2) respectively, and writes the database files in byte order starting from the starting addresses of the first database area (DB1) and the second database area (DB2), and then assigns a value of 1 to Pa, indicating that the currently active database is the first database area (DB1), and assigns a value of 1 to Flag1, indicating that the initial download is completed; The specific method of online installation is: Determine the value of Pa: When Pa=1, it indicates that the currently working database is the first database area (DB1), and the controller writes the received database file into the second database area (DB2); Then, when the database file is written, the engineer station sends a command to the controller to set the switch flag Flag2 to 1; after the controller completes the calculation task of each calculation cycle, it determines the value of the switch flag Flag2. When Flag2=1, it means switching, and the controller sets Pa=2, indicating that the controller will automatically use the second database area (DB2) for calculation in the next calculation cycle; when Flag2=0, it means no switching, and the controller continues to use the first database area (DB1) for calculation in the next calculation cycle; When Pa=2, it indicates that the second database area (DB2) is currently working, and the industrial controller writes the received database file into the first database area (DB1); then, when the database file is written, the engineer station sends a command to the controller, assigning the switching flag Flag2 a value of 1; when Flag2=1, it indicates switching, and the controller executes the switching operation; the controller assigns Pa=1, indicating that the controller will automatically use the first database area (DB1) for calculation in the next operation cycle; when Flag2=0, it indicates no switching, and the controller continues to use the second database area (DB2) for calculation in the next operation cycle.
2. A distributed controller database download method based on double buffer according to claim 1, characterized in that: In step 1, customize the parameters in the process control station by: Three pointers are defined in the data exchange area (DE), namely P1, P2 and Pa, where P1 points to the first database area (DB1), P2 points to the second database area (DB2), and Pa represents the current working database file storage area, pointing to P1 or P2.
3. A distributed controller database download method based on double buffer according to claim 1, characterized in that: A process control station comprises a controller (CU), and the controller (CU) is respectively connected with a network module (N), a storage module (M) and a non-volatile memory (Q); wherein the network module (N) is used to realize data exchange between the controller and an engineer station; the storage module (M) is the memory of the controller (CU); and the non-volatile memory (Q) is a persistent FLASH memory used to support the operation of the controller.
4. A distributed controller database download method based on double buffer according to claim 3, characterized in that: The storage module (M) is divided into six functional areas from the low address space L to the high address space H. The first functional area is the reserved area (RE); the second functional area is the application area (AP); the third functional area is the data exchange area (DE); the fourth functional area is the first database area (DB1); the fifth functional area is the second database area (DB2); and the sixth functional area is the error handling and reporting area (ER).
5. A distributed controller database download method based on double buffer according to claim 1, characterized in that: The core switch (S1) is respectively connected to a control layer access switch (S2) and an application layer access switch (S3) via Ethernet.
6. A distributed controller database download method based on double buffer according to claim 1, characterized in that: The control layer access switch (S2) is connected to the process control station via Ethernet; the application layer access switch (S3) is connected to the engineer station via Ethernet.
Citation Information
Patent Citations
Controller initial downloading and installation and on-line downloading and installation system structure and method thereof
CN106054849A
Distributed controller database downloading structure based on double buffer areas
CN212391726U