A method for reading and writing OPC data blocks

By designing event-triggered, periodic reading and writing of OPC data block functional modules and screen configuration modules in the steelmaking production control system, the problem of inconvenient reading and writing of OPC data blocks in the existing technology is solved, and convenient data block operation and maintenance are realized. , reducing cost and complexity.

CN112153089BActive Publication Date: 2024-10-15SHANGHAI MEISHAN IRON & STEEL CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN201910569767.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-06-27
Publication Date
2024-10-15
Estimated Expiration
2039-06-27

AI Technical Summary

Technical Problem

The existing OPC data block reading and writing methods cannot effectively call other application processes in the steelmaking production control system, resulting in inconvenient communication and high maintenance costs.

Method used

A system is designed that includes a system scheduling module, an event-triggered reading OPC data block function module, a periodic reading OPC data block function module, a writing OPC data block function module and a screen configuration module. The reading of OPC data blocks is realized by writing a program in C language. It is written and provides a screen configuration module to facilitate configuration by project engineers and end users.

Benefits of technology

It reduces the workload of project engineering personnel and post-maintenance costs. It is suitable for a variety of operating systems and databases, has a wide range of applications, facilitates post-maintenance for end users, and reduces the complexity of reading and writing OPC data blocks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112153089B_ABST
    Figure CN112153089B_ABST
Patent Text Reader

Abstract

The present invention relates to a method for reading and writing OPC data blocks. The system comprises a system scheduling module, a function module for event-triggered reading of OPC data blocks, a function module for periodic reading of OPC data blocks, a function module for writing OPC data blocks and a screen configuration module. The reading and writing of OPC data blocks are realized by performing corresponding configuration on the screen, which is convenient for application development and later maintenance of project engineering personnel.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method for reading and writing an OPC data block, and belongs to the technical field of automatic control. Background Art

[0002] The control system of steelmaking production includes basic automation system, process control system (PCS system) and production execution system (MES system). The process control system plays a connecting role. First, it reads and stores the performance data of the basic automation system in the production process; second, according to the production plan, manufacturing standards, target requirements, etc. of the MES system, through model calculation, the calculation results are downloaded to the basic automation system to control the action of the PLC and realize the smooth production; third, it communicates with the MES system. In order to ensure the normal operation of the process control system, it is necessary to ensure the communication between the process control system and the basic automation system. The commonly used method for reading and writing OPC data blocks in China is to purchase mature software. For example, most systems of Danieli Company use RSSQL communication software of Rockwell Company in the United States. This software automatically connects the corresponding OPC data block after configuring the OPC address, and realizes event triggering or periodic reading of OPC data blocks through the configuration of database stored procedures or tables, and stores the data in the database or updates the database data through stored procedures. Its defect is that it cannot call other application processes on this basis. Therefore, a new solution is urgently needed to solve the above technical problems. Summary of the invention

[0003] The present invention aims at the problems existing in the prior art and provides a method for reading and writing OPC data blocks, a communication method between a steelmaking process automation system and OPC, and project engineering personnel and terminal users for later maintenance. Through corresponding configuration of the screen, the reading and writing of OPC data blocks are realized, which is convenient for application development and later maintenance of project engineering personnel.

[0004] In order to achieve the above object, the technical solution of the present invention is as follows: a system for reading and writing OPC data blocks, comprising a system scheduling module, a function module for event-triggered reading of OPC data blocks, a function module for periodically reading OPC data blocks, a function module for writing OPC data blocks, and a screen configuration module;

[0005] The system scheduling module is used for scheduling and managing the start and stop of the function module for executing event-triggered reading of OPC data blocks, the function module for periodic reading of OPC data blocks, and the function module for writing OPC data blocks;

[0006] The function module of event-triggered reading of OPC data blocks: used for event-triggered reading of OPC data blocks, including process READ_EVENT_OPC_DATA (used for reading data block data when OPC event occurs) and corresponding auxiliary processes (the so-called event-triggered reading of OPC data blocks, i.e., the occurrence of a certain production event (such as the end time of oxygen blowing of the converter), corresponds to a certain data block in the OPC data block, and the value at this time is True (1) or False (0). When the event occurs, the application needs to read the values ​​of a batch of OPC data blocks);

[0007] The functional module of periodic reading of OPC data blocks is used to read periodic data, including READ_CYC_OPC_DATA (used to read periodic data) and corresponding auxiliary processes (the so-called periodic reading of OPC data blocks means that the application reads the values ​​of a batch of OPC data blocks at a fixed period, such as reading the values ​​of OPC data blocks corresponding to oxygen lance height, oxygen flow, oxygen pressure, total amount of oxygen blowing, etc. at a fixed interval (2-5 seconds) during the oxygen blowing process of the converter);

[0008] The functional module for writing OPC data blocks is used to write OPC data, including WRITE_OPC_DATA (used to write OPC data) and corresponding auxiliary processes (for example, after the converter static model is calculated, the calculated oxygen blowing amount needs to be written to the corresponding OPC data block);

[0009] The screen configuration module is used to configure the relevant information required to read and write OPC on the screen, including an event-triggered OPC data block configuration screen submodule, a periodic OPC data block configuration screen submodule, and a write OPC data block configuration screen submodule.

[0010] In order to solve the above technical problems, the technology includes the following methods:

[0011] 1. Reading and writing OPC data blocks

[0012] (I) Event triggering reading of OPC data blocks

[0013] In the backend database there are tables:

[0014] T_TRIGGER: used to store events that trigger reading data (see Table 1 for the structure);

[0015] T_TRIGGER_BLOCK: used to store the OPC data block that needs to be read by the trigger (see Table 2 for the structure).

[0016] Table 1 Table T_TRIGGER structure

[0017]

[0018]

[0019] APP_PROG1, APP_PROG2, APP_PROG3, and APP_PROG4 can be designed into multiple applications (only four applications are listed here) according to the requirements of the application, or they can be designed into one application, which includes the functions of multiple applications.

[0020] Table 2 Table T_TRIGGER_BLOCK structure

[0021]

[0022] Write a program (in process form) READ_EVENT_OPC_DATA in C language to read the data block data when the OPC event occurs. The process of event-triggered reading of OPC data blocks is as follows.

[0023] 1. Read the record set in the database T_TRIGGER;

[0024] 2. Transfer the first record of the record set;

[0025] 3. Check whether READ_STATUS is 1. If not, change to 12.

[0026] (When READ_STATUS is 1, the data of the corresponding event is read; otherwise, the data of the corresponding event is read.)

[0027] 4. According to the OPC_BLOCK recorded in the record set, read the data block corresponding to OPC;

[0028] 5. Determine whether the value of the read data block is consistent with the TRIG_TYPE value recorded in the record set (assuming high-bit trigger);

[0029] 6. If not, go to 11;

[0030] 7. If they agree;

[0031] 8. Read the database T_TRIGGER_BLOCK;

[0032] 9. Read the data of the corresponding OPC data block;

[0033] 10. Set the data block value triggered by the event to 0;

[0034] 11. Save the data into the background database, call APP_PROG_SAVEDA, application 1, call application 2, call application 3, call application 4 (a process can also be called here, and its functions include the functions of multiple programs required);

[0035] 12. Determine whether it is the last record of the record set;

[0036] 13. If it is not the last record, read the next record in the record set and go to step 3;

[0037] 14. Delay Δt (depending on the different requirements of different systems, the value is generally between (50ms-500ms)), go to step 1;

[0038] 15. The end.

[0039] (II) Periodically read OPC data block data

[0040] In the backend database there are tables:

[0041] T_CYC: used to store cycle data sets (structure see Table 3);

[0042] T_CYC_BLOCK: used to store OPC data blocks that need to be read cyclically (see Table 4 for the structure).

[0043] Different from reading OPC data block data by event triggering, according to experience, when reading cycle data, the relevant application is not called (if the relevant application needs cycle data for calculation, the corresponding table interface of the database storing cycle data is directly read); if it is necessary to call the application, the corresponding field can also be added to the T_CYC table to call the relevant application.

[0044] Table 3 Table T_CYC structure

[0045]

[0046]

[0047] Table 4 Table T_CYC_BLOCK structure

[0048]

[0049] Write a program (in process form) READ_CYC_OPC_DATA in C language to read cycle data. The process of cyclic reading of OPC data blocks is as follows.

[0050] 1. Read the record set in database T_CYC;

[0051] 2. Transfer the first record of the record set;

[0052] 3. Check whether READ_STATUS is 1. If not, go to step 6.

[0053] 4. Read the data of T_CYC_BLOCK according to the recorded CYC_SEQ_NUM;

[0054] 5. According to the cycle of CYC_TIME, read the data of the corresponding OPC data block once in each cycle time;

[0055] 6. Call the APP_PROG_SAVEDA process to store the data in the background database;

[0056] 7. Determine whether it is the last record of the record set;

[0057] 8. If it is not the last record, read the next record in the record set and go to step 3;

[0058] 9. End.

[0059] (3) Write OPC data block;

[0060] In the backend database there are tables:

[0061] T_WRITE: used to store the data set for writing OPC (structure see Table 5);

[0062] T_WIRITE_BLOCK: used to store the data block that needs to be written to OPC (see Table 6 for the structure);

[0063] T_WIRITE_BLOCK_DATA: used to store data that needs to be written to the OPC data block (structure see Table 7)

[0064] Table 5 Table T_WRITE structure

[0065]

[0066]

[0067] Table 6 Table T_WIRITE_BLOCK structure

[0068]

[0069] Table 7 Table T_WIRITE_BLOCK_DATA structure

[0070]

[0071] Write a program (in process form) WRITE_OPC_DATA in C language to write OPC data. The process of writing OPC data block is as follows.

[0072] 1. Read the database T_WIRITE_BLOCK_DATA and query to obtain the data set that needs to be written to OPC, that is, the record set with DATA_STATUS as 1 and WRITE_STATUS as 1;

[0073] 2. Transfer the first record of the record set;

[0074] 3. Read the data definition of T_WIRITE_BLOCK according to the recorded WRITE_SEQ_NUM and BLOCK_SEQ_NUM;

[0075] 4. According to OPC_BLOCK_TYPE, convert the data into the corresponding data type;

[0076] 5. Write the data to the OPC_BLOCK data block;

[0077] 6. Update the value of the DATA_STATUS field of the record to 0;

[0078] 7. Determine whether it is the last record of the record set;

[0079] 8. If it is not the last record, read the next record in the record set and go to step 3;

[0080] 9. Wait for Δt2 (the time is determined according to the specific requirements of the application, generally 50-500ms), and go to step 1;

[0081] 10. End.

[0082] 2. Configuration screen for reading and writing OPC data blocks

[0083] (I) Event trigger read OPC data block configuration screen

[0084] Screen like Figure 1 As shown. Add event button: add the record configuration of the trigger event; Save button: save the configuration of the newly added or modified trigger event; select a row in the event configuration screen for triggering data reading (double-click / right-click), and the corresponding data block information configuration to be read will be displayed in the OPC data block configuration screen; Add data block button: add a new row of information in the OPC data block configuration screen; Save button: save the newly added or modified OPC data block configuration; in the event triggering reading of OPC data block configuration screen, if the read / write status of a certain event is set to 0, all corresponding data blocks will not be read.

[0085] Table 8 Triggering the event configuration screen format for reading data

[0086]

[0087] Table 9 OPC data block configuration screen format

[0088]

[0089]

[0090] (II) Cyclic reading of OPC data block data configuration screen

[0091] Screen like Figure 2 As shown. Add event button: add record configuration of periodic data set; Save button: save the configuration of newly added or modified periodic data set; select a row in the storage periodic data set configuration screen (double-click / right-click), and the corresponding data block information configuration to be read will be displayed in the OPC data block configuration screen; Add data block button: add a new row of information in the OPC data block configuration screen; Save button: save the newly added or modified OPC data block configuration. In the periodic data set configuration screen, if the read / write status of a data set is set to 0, all corresponding data blocks will not be read.

[0092] Table 10 Storage cycle data set configuration screen format

[0093]

[0094] Table 11 OPC data block configuration screen format

[0095]

[0096] (III) Write OPC data block screen configuration

[0097] Screen like Figure 3 As shown. Add Data Set Button: Add record configuration of write data set; Save Button: Save the newly added or modified configuration of write data set; Select a row in the write data set configuration screen (double-click / right-click), and the corresponding data block configuration information to be written will be displayed in the OPC data block configuration screen; Add Data Block Button: Add a new row of information in the OPC data block configuration screen; Save Button: Save the newly added or modified OPC data block configuration. In the write OPC data set configuration screen, if the read / write status of a data set is set to 0, all corresponding data will not be written into the corresponding data block.

[0098] Table 12 Write OPC data set configuration screen format

[0099]

[0100] Table 13 OPC data block configuration screen format

[0101]

[0102] The present invention has been described in detail above in conjunction with specific exemplary embodiments. However, it should be understood that various modifications and variations may be made without departing from the scope of the present invention as defined by the appended claims. The detailed description and the accompanying drawings should be considered only as illustrative and not restrictive, and if there are any such modifications and variations, they will fall within the scope of the present invention described herein. In addition, the background technology is intended to illustrate the current status and significance of the research and development of the present technology and is not intended to limit the present invention or the application field of the present application and the present invention.

[0103] Compared with the prior art, the technical effects of the present invention are as follows:

[0104] Compared with the existing known technologies, the technical solution provided by the present invention has the following significant effects:

[0105] 1. Reduce the workload of project engineers and reduce the cost of subsequent maintenance: Since the reading and writing functions of OPC data blocks are completed by the function modules of event-triggered reading of OPC data blocks, periodic reading of OPC data blocks, and writing of OPC data blocks, the above modules are completed by R&D personnel. For different applications, project engineers only need to configure on the screen configuration module without modifying the code, which reduces the workload of project engineers and the cost of subsequent maintenance;

[0106] 2. Wide application scope: Since the system is developed with C language, it can be applied to multiple operating systems such as Windows, Aix, Linux, etc.; it can be applied to multiple databases such as Oracle, DB2, SqlServer, etc.; the database and the communication process can be in the same system or not; the OPC server and the communication process can be in the same system or not;

[0107] 3. Wide application in various industries: This technology can be used for communication between process control systems and OPC in the metallurgical industry, and can also be applied to multiple industries such as power and chemical industry;

[0108] Convenient for terminal users' later maintenance: After the system is launched, terminal users' later maintenance and maintenance of the communication part only need to be configured on the screen without modifying the program, which facilitates the later maintenance of terminal users. BRIEF DESCRIPTION OF THE DRAWINGS

[0109] Figure 1 This is a module logic relationship diagram of the present invention.

[0110] Figure 2 Event-triggered read OPC data block flow chart

[0111] Figure 3 Cyclic reading of OPC data blocks data flow chart

[0112] Figure 4 Write OPC data block flow chart. DETAILED DESCRIPTION

[0113] In order to deepen the understanding of the present invention, the present embodiment is described in detail below with reference to the accompanying drawings.

[0114] Example 1: See Figure 1 ,

[0115] Take the communication between L2 and L1 of Meishan Steel's first steelmaking converter as an example.

[0116] The L1 of Meishan Steel's No. 1 steelmaking converter uses Siemens S7 400 PLC and industrial Ethernet; the L2 server is a fault-tolerant 5700, using the Windows 2008 Server operating system and Oracle 10g data blocks; the OPC Server and the L2 server are one, that is, Smartic is installed on the L2 server, and OPC-related data blocks are configured on Smartic.

[0117] The system scheduling module is used for scheduling and managing the start and stop of the function module for executing event-triggered reading of OPC data blocks, the function module for periodic reading of OPC data blocks, and the function module for writing OPC data blocks;

[0118] The function module of event-triggered reading of OPC data blocks: used for event-triggered reading of OPC data blocks, including process READ_EVENT_OPC_DATA (used for reading data block data when OPC event occurs) and corresponding auxiliary processes (the so-called event-triggered reading of OPC data blocks, i.e., the occurrence of a certain production event (such as the end time of oxygen blowing of the converter), corresponds to a certain data block in the OPC data block, and the value at this time is True (1) or False (0). When the event occurs, the application needs to read the values ​​of a batch of OPC data blocks);

[0119] The functional module of periodic reading of OPC data blocks is used to read periodic data, including READ_CYC_OPC_DATA (used to read periodic data) and corresponding auxiliary processes (the so-called periodic reading of OPC data blocks means that the application reads the values ​​of a batch of OPC data blocks at a fixed period, such as reading the values ​​of OPC data blocks corresponding to oxygen lance height, oxygen flow, oxygen pressure, total amount of oxygen blowing, etc. at a fixed interval (2-5 seconds) during the oxygen blowing process of the converter);

[0120] The functional module for writing OPC data blocks is used to write OPC data, including WRITE_OPC_DATA (used to write OPC data) and corresponding auxiliary processes (for example, after the converter static model is calculated, the calculated oxygen blowing amount needs to be written to the corresponding OPC data block);

[0121] The screen configuration module is used to configure the relevant information required to read and write OPC on the screen, including an event-triggered OPC data block configuration screen submodule, a periodic OPC data block configuration screen submodule, and a write OPC data block configuration screen submodule.

[0122] In order to solve the above technical problems, the technology includes the following methods:

[0123] 1. Reading and writing OPC data blocks

[0124] (I) Event triggering reading of OPC data blocks

[0125] In the backend database there are tables:

[0126] T_TRIGGER: used to store events that trigger reading data (see Table 1 for the structure);

[0127] T_TRIGGER_BLOCK: used to store the OPC data block that needs to be read by the trigger (see Table 2 for the structure).

[0128] APP_PROG1, APP_PROG2, APP_PROG3, and APP_PROG4 can be designed into multiple applications (only four applications are listed here) according to the requirements of the application, or they can be designed into one application, which includes the functions of multiple applications.

[0129] Write a program (in process form) READ_EVENT_OPC_DATA in C language to read the data block data when the OPC event occurs. The process of event-triggered reading of OPC data blocks is as follows.

[0130] 1. Read the record set in the database T_TRIGGER;

[0131] 2. Transfer the first record of the record set;

[0132] 3. Check whether READ_STATUS is 1. If not, change to 12.

[0133] (When READ_STATUS is 1, the data of the corresponding event is read; otherwise, the data of the corresponding event is read.)

[0134] 4. According to the OPC_BLOCK recorded in the record set, read the data block corresponding to OPC;

[0135] 5. Determine whether the value of the read data block is consistent with the TRIG_TYPE value recorded in the record set (assuming high-bit trigger);

[0136] 6. If not, go to 11;

[0137] 7. If they agree;

[0138] 8. Read the database T_TRIGGER_BLOCK;

[0139] 9. Read the data of the corresponding OPC data block;

[0140] 10. Set the data block value triggered by the event to 0;

[0141] 11. Save the data into the background database, call APP_PROG_SAVEDA, application 1, call application 2, call application 3, call application 4 (a process can also be called here, and its functions include the functions of multiple programs required);

[0142] 12. Determine whether it is the last record of the record set;

[0143] 13. If it is not the last record, read the next record in the record set and go to step 3;

[0144] 14. Delay Δt (depending on the different requirements of different systems, the value is generally between (50ms-500ms)), go to step 1;

[0145] 15. The end.

[0146] (II) Periodically read OPC data block data

[0147] In the backend database there are tables:

[0148] T_CYC: used to store cycle data sets (structure see Table 3);

[0149] T_CYC_BLOCK: used to store OPC data blocks that need to be read cyclically (see Table 4 for the structure).

[0150] Different from reading OPC data block data by event triggering, according to experience, when reading cycle data, the relevant application is not called (if the relevant application needs cycle data for calculation, the corresponding table interface of the database storing cycle data is directly read); if it is necessary to call the application, the corresponding field can also be added to the T_CYC table to call the relevant application.

[0151] Write a program (in process form) READ_CYC_OPC_DATA in C language to read cycle data. The process of cyclic reading of OPC data blocks is as follows.

[0152] 1. Read the record set in database T_CYC;

[0153] 2. Transfer the first record of the record set;

[0154] 3. Check whether READ_STATUS is 1. If not, go to step 6.

[0155] 4. Read the data of T_CYC_BLOCK according to the recorded CYC_SEQ_NUM;

[0156] 5. According to the cycle of CYC_TIME, read the data of the corresponding OPC data block once in each cycle time;

[0157] 6. Call the APP_PROG_SAVEDA process to store the data in the background database;

[0158] 7. Determine whether it is the last record of the record set;

[0159] 8. If it is not the last record, read the next record in the record set and go to step 3;

[0160] 9. End.

[0161] (III) Writing OPC data blocks

[0162] In the backend database there are tables:

[0163] T_WRITE: used to store the data set for writing OPC (structure see Table 5);

[0164] T_WIRITE_BLOCK: used to store the data block that needs to be written to OPC (see Table 6 for the structure);

[0165] T_WIRITE_BLOCK_DATA: used to store data that needs to be written to the OPC data block (structure see Table 7)

[0166] Write a program (in process form) WRITE_OPC_DATA in C language to write OPC data. The process of writing OPC data block is as follows.

[0167] 1. Read the database T_WIRITE_BLOCK_DATA and query to obtain the data set that needs to be written to OPC, that is, the record set with DATA_STATUS as 1 and WRITE_STATUS as 1;

[0168] 2. Transfer the first record of the record set;

[0169] 3. Read the data definition of T_WIRITE_BLOCK according to the recorded WRITE_SEQ_NUM and BLOCK_SEQ_NUM;

[0170] 4. According to OPC_BLOCK_TYPE, convert the data into the corresponding data type;

[0171] 5. Write the data to the OPC_BLOCK data block;

[0172] 6. Update the value of the DATA_STATUS field of the record to 0;

[0173] 7. Determine whether it is the last record of the record set;

[0174] 8. If it is not the last record, read the next record in the record set and go to step 3;

[0175] 9. Wait for Δt2 (the time is determined according to the specific requirements of the application, generally 50-500ms), and go to step 1;

[0176] 10. End.

[0177] 2. Configuration screen for reading and writing OPC data blocks

[0178] (I) Event trigger read OPC data block configuration screen

[0179] Screen like Figure 1 As shown. Add event button: add the record configuration of the trigger event; Save button: save the configuration of the newly added or modified trigger event; select a row in the event configuration screen for triggering data reading (double-click / right-click), and the corresponding data block information configuration to be read will be displayed in the OPC data block configuration screen; Add data block button: add a new row of information in the OPC data block configuration screen; Save button: save the newly added or modified OPC data block configuration; in the event triggering reading of OPC data block configuration screen, if the read / write status of a certain event is set to 0, all corresponding data blocks will not be read.

[0180] (II) Periodic reading of OPC data block data configuration screen

[0181] Screen like Figure 2 As shown. Add event button: add record configuration of periodic data set; Save button: save the configuration of newly added or modified periodic data set; select a row in the storage periodic data set configuration screen (double-click / right-click), and the corresponding data block information configuration to be read will be displayed in the OPC data block configuration screen; Add data block button: add a new row of information in the OPC data block configuration screen; Save button: save the newly added or modified OPC data block configuration. In the periodic data set configuration screen, if the read / write status of a data set is set to 0, all corresponding data blocks will not be read.

[0182] (III) Write OPC data block screen configuration

[0183] Screen like Figure 3As shown. Add Data Set Button: Add record configuration of write data set; Save Button: Save the newly added or modified configuration of write data set; Select a row in the write data set configuration screen (double-click / right-click), and the corresponding data block configuration information to be written will be displayed in the OPC data block configuration screen; Add Data Block Button: Add a new row of information in the OPC data block configuration screen; Save Button: Save the newly added or modified OPC data block configuration. In the write OPC data set configuration screen, if the read / write status of a data set is set to 0, all corresponding data will not be written into the corresponding data block.

[0184] The present invention has been described in detail above in conjunction with specific exemplary embodiments. However, it should be understood that various modifications and variations may be made without departing from the scope of the present invention as defined by the appended claims. The detailed description and the accompanying drawings should be considered only as illustrative and not restrictive, and if there are any such modifications and variations, they will fall within the scope of the present invention described herein. In addition, the background technology is intended to illustrate the current status and significance of the research and development of the present technology and is not intended to limit the present invention or the application field of the present application and the present invention.

[0185] Example 2

[0186] Take the communication between L2 and L1 of Meishan Iron and Steel's No. 2 Steelmaking Converter as an example.

[0187] The L1 of Meishan Steel's No. 2 Steelmaking Converter adopts Siemens S7 400PLC and industrial Ethernet; the L2 server is the fault-tolerant server ftServer 6100, which adopts the LinuxRedhat 5.5 operating system and the data block is DB2 10.5; the OPC Server is HP DL 580, which adopts the Windows 2008 Server operating system, and the two machines are hot standby for each other.

[0188] The system scheduling module is used for scheduling and managing the start and stop of the function module for executing event-triggered reading of OPC data blocks, the function module for periodic reading of OPC data blocks, and the function module for writing OPC data blocks;

[0189] The function module of event-triggered reading of OPC data blocks: used for event-triggered reading of OPC data blocks, including process READ_EVENT_OPC_DATA (used for reading data block data when OPC event occurs) and corresponding auxiliary processes (the so-called event-triggered reading of OPC data blocks, i.e., the occurrence of a certain production event (such as the end time of oxygen blowing of the converter), corresponds to a certain data block in the OPC data block, and the value at this time is True (1) or False (0). When the event occurs, the application needs to read the values ​​of a batch of OPC data blocks);

[0190] The functional module of periodic reading of OPC data blocks is used to read periodic data, including READ_CYC_OPC_DATA (used to read periodic data) and corresponding auxiliary processes (the so-called periodic reading of OPC data blocks means that the application reads the values ​​of a batch of OPC data blocks at a fixed period, such as reading the values ​​of OPC data blocks corresponding to oxygen lance height, oxygen flow, oxygen pressure, total amount of oxygen blowing, etc. at a fixed interval (2-5 seconds) during the oxygen blowing process of the converter);

[0191] The functional module for writing OPC data blocks is used to write OPC data, including WRITE_OPC_DATA (used to write OPC data) and corresponding auxiliary processes (for example, after the converter static model is calculated, the calculated oxygen blowing amount needs to be written to the corresponding OPC data block);

[0192] The screen configuration module is used to configure the relevant information required to read and write OPC on the screen, including an event-triggered OPC data block configuration screen submodule, a periodic OPC data block configuration screen submodule, and a write OPC data block configuration screen submodule.

[0193] In order to solve the above technical problems, the technology includes the following methods:

[0194] 1. Reading and writing OPC data blocks

[0195] (I) Event triggering reading of OPC data blocks

[0196] In the backend database there are tables:

[0197] T_TRIGGER: used to store events that trigger reading data (see Table 1 for the structure);

[0198] T_TRIGGER_BLOCK: used to store the OPC data block that needs to be read by the trigger (see Table 2 for the structure).

[0199] APP_PROG1, APP_PROG2, APP_PROG3, and APP_PROG4 can be designed into multiple applications (only four applications are listed here) according to the requirements of the application, or they can be designed into one application, which includes the functions of multiple applications.

[0200] Write a program (in process form) READ_EVENT_OPC_DATA in C language to read the data block data when the OPC event occurs. The process of event-triggered reading of OPC data blocks is as follows.

[0201] 1. Read the record set in the database T_TRIGGER;

[0202] 2. Transfer the first record of the record set;

[0203] 3. Check whether READ_STATUS is 1. If not, change to 12.

[0204] (When READ_STATUS is 1, the data of the corresponding event is read; otherwise, the data of the corresponding event is read.)

[0205] 4. According to the OPC_BLOCK recorded in the record set, read the data block corresponding to OPC;

[0206] 5. Determine whether the value of the read data block is consistent with the TRIG_TYPE value recorded in the record set (assuming high-bit trigger);

[0207] 6. If not, go to 11;

[0208] 7. If they agree;

[0209] 8. Read the database T_TRIGGER_BLOCK;

[0210] 9. Read the data of the corresponding OPC data block;

[0211] 10. Set the data block value triggered by the event to 0;

[0212] 11. Save the data into the background database, call APP_PROG_SAVEDA, application 1, call application 2, call application 3, call application 4 (a process can also be called here, and its functions include the functions of multiple programs required);

[0213] 12. Determine whether it is the last record of the record set;

[0214] 13. If it is not the last record, read the next record in the record set and go to step 3;

[0215] 14. Delay Δt (depending on the different requirements of different systems, the value is generally between (50ms-500ms)), go to step 1;

[0216] 15. The end.

[0217] (II) Periodically read OPC data block data

[0218] In the backend database there are tables:

[0219] T_CYC: used to store cycle data sets (structure see Table 3);

[0220] T_CYC_BLOCK: used to store OPC data blocks that need to be read cyclically (see Table 4 for the structure).

[0221] Different from reading OPC data block data by event triggering, according to experience, when reading cycle data, the relevant application is not called (if the relevant application needs cycle data for calculation, the corresponding table interface of the database storing cycle data is directly read); if it is necessary to call the application, the corresponding field can also be added to the T_CYC table to call the relevant application.

[0222] Write a program (in process form) READ_CYC_OPC_DATA in C language to read cycle data. The process of cyclic reading of OPC data blocks is as follows.

[0223] 1. Read the record set in database T_CYC;

[0224] 2. Transfer the first record of the record set;

[0225] 3. Check whether READ_STATUS is 1. If not, go to step 6.

[0226] 4. Read the data of T_CYC_BLOCK according to the recorded CYC_SEQ_NUM;

[0227] 5. According to the cycle of CYC_TIME, read the data of the corresponding OPC data block once in each cycle time;

[0228] 6. Call the APP_PROG_SAVEDA process to store the data in the background database;

[0229] 7. Determine whether it is the last record of the record set;

[0230] 8. If it is not the last record, read the next record in the record set and go to step 3;

[0231] 9. End.

[0232] (III) Writing OPC data blocks

[0233] In the backend database there are tables:

[0234] T_WRITE: used to store the data set for writing OPC (structure see Table 5);

[0235] T_WIRITE_BLOCK: used to store the data block that needs to be written to OPC (see Table 6 for the structure);

[0236] T_WIRITE_BLOCK_DATA: used to store data that needs to be written to the OPC data block (structure see Table 7)

[0237] Write a program (in process form) WRITE_OPC_DATA in C language to write OPC data. The process of writing OPC data block is as follows.

[0238] 1. Read the database T_WIRITE_BLOCK_DATA and query to obtain the data set that needs to be written to OPC, that is, the record set with DATA_STATUS as 1 and WRITE_STATUS as 1;

[0239] 2. Transfer the first record of the record set;

[0240] 3. Read the data definition of T_WIRITE_BLOCK according to the recorded WRITE_SEQ_NUM and BLOCK_SEQ_NUM;

[0241] 4. According to OPC_BLOCK_TYPE, convert the data into the corresponding data type;

[0242] 5. Write the data to the OPC_BLOCK data block;

[0243] 6. Update the value of the DATA_STATUS field of the record to 0;

[0244] 7. Determine whether it is the last record of the record set;

[0245] 8. If it is not the last record, read the next record in the record set and go to step 3;

[0246] 9. Wait for Δt2 (the time is determined according to the specific requirements of the application, generally 50-500ms), and go to step 1;

[0247] 10. End.

[0248] 2. Configuration screen for reading and writing OPC data blocks

[0249] (I) Event trigger read OPC data block configuration screen

[0250] Screen like Figure 1 As shown. Add event button: add the record configuration of the trigger event; Save button: save the configuration of the newly added or modified trigger event; select a row in the event configuration screen for triggering data reading (double-click / right-click), and the corresponding data block information configuration to be read will be displayed in the OPC data block configuration screen; Add data block button: add a new row of information in the OPC data block configuration screen; Save button: save the newly added or modified OPC data block configuration; in the event triggering reading of OPC data block configuration screen, if the read / write status of a certain event is set to 0, all corresponding data blocks will not be read.

[0251] (II) Cyclic reading of OPC data block data configuration screen

[0252] Screen like Figure 2As shown. Add event button: add record configuration of periodic data set; Save button: save the configuration of newly added or modified periodic data set; select a row in the storage periodic data set configuration screen (double-click / right-click), and the corresponding data block information configuration to be read will be displayed in the OPC data block configuration screen; Add data block button: add a new row of information in the OPC data block configuration screen; Save button: save the newly added or modified OPC data block configuration. In the periodic data set configuration screen, if the read / write status of a data set is set to 0, all corresponding data blocks will not be read.

[0253] (III) Write OPC data block screen configuration

[0254] Screen like Figure 3 As shown. Add Data Set Button: Add record configuration of write data set; Save Button: Save the newly added or modified configuration of write data set; Select a row in the write data set configuration screen (double-click / right-click), and the corresponding data block configuration information to be written will be displayed in the OPC data block configuration screen; Add Data Block Button: Add a new row of information in the OPC data block configuration screen; Save Button: Save the newly added or modified OPC data block configuration. In the write OPC data set configuration screen, if the read / write status of a data set is set to 0, all corresponding data will not be written into the corresponding data block.

[0255] It should be noted that the above embodiments are not intended to limit the protection scope of the present invention, and equivalent changes or substitutions made on the basis of the above technical solutions all fall within the protection scope of the claims of the present invention.

Claims

1. A method for reading and writing OPC data blocks, characterized in that: The method is as follows: Step 1: Read and write OPC data blocks; (1) Event triggering to read OPC data blocks; (2) Periodically read OPC data blocks; (3) Write OPC data block; Step 2: Configure OPC data block; (1) Configure event trigger to read OPC data block; (2) Configure periodic reading of OPC data blocks; (III) Configure the screen for writing OPC data blocks; The (1) event triggers the reading of OPC data blocks, as follows: In the backend database there are tables: T_TRIGGER: used to store events that trigger reading data; T_TRIGGER_BLOCK: used to store the OPC data block that needs to be read by the trigger; Application APP_PROG1: indicates the triggered application or process; Application APP_PROG2: indicates the triggered application or process; Application APP_PROG3: indicates the triggered application or process; Application APP_PROG4; indicates the triggered application or process; The process of event-triggered reading of OPC data blocks is as follows: (1) Read the record set in the database T_TRIGGER; (2) Transfer the first record of the record set; (3) Determine whether READ_STATUS is 1. If READ_STATUS is 1, read the data of the corresponding event. If READ_STATUS is not 1, go to (9); (4) Read the data block corresponding to OPC according to the OPC_BLOCK recorded in the record set; (5) Determine whether the value of the read data block is consistent with the TRIG_TYPE value recorded in the record set. If not, go to (7). If consistent, read the database T_TRIGGER_BLOCK. (6) Read the data of the corresponding OPC data block; (7) Set the data block value triggered by the event to 0; (8) Store the data in the background database, call APP_PROG_SAVEDA, call application APP_PROG1, call application APP_PROG2, call application APP_PROG3, call application APP_PROG4; (9) Determine whether it is the last record of the record set. If it is not the last record, read the next record of the record set and go to step (3); (10) Delay Δt and go to step (1); (11) End; The step (ii) periodically reads the OPC data blocks, specifically as follows: In the backend database there are tables: T_CYC: used to store periodic data sets; T_CYC_BLOCK: used to store OPC data blocks that need to be read cyclically; When the OPC data block needs to be called during the periodic reading, a corresponding field is added to the table T_CYC to call the relevant application. READ_CYC_OPC_DATA, used to read cycle data; The process of periodically reading OPC data blocks is as follows: (1) Read the record set in database T_CYC; (2) Transfer the first record of the record set; (3) Determine whether READ_STATUS is 1. If not, go to (6); (4) Read the data of T_CYC_BLOCK according to the recorded CYC_SEQ_NUM; (5) According to the cycle period of CYC_TIME, the data of the corresponding OPC data block is read once in each cycle time; (6) Call the APP_PROG_SAVEDA process to store the data in the background database; (7) Determine whether it is the last record of the record set; (8) If it is not the last record, read the next record in the record set and go to step (3); The step (iii) of writing the OPC data block is as follows: In the backend database there are tables: T_WRITE: used to store data sets for writing OPC; T_WIRITE_BLOCK: used to store the data block that needs to be written to OPC; T_WIRITE_BLOCK_DATA: used to store data that needs to be written to the OPC data block; WRITE_OPC_DATA, used to write OPC data; The process of writing OPC data blocks is as follows: (1) Read the database T_WIRITE_BLOCK_DATA and query the data set that needs to be written to OPC. That is, the record set with DATA_STATUS being 1 and WRITE_STATUS being 1; (2) Transfer the first record of the record set; (3) Read the data definition of T_WIRITE_BLOCK according to the recorded WRITE_SEQ_NUM and BLOCK_SEQ_NUM; (4) According to OPC_BLOCK_TYPE, convert the data into the corresponding data type; (5) Write the data into the OPC_BLOCK data block; (6) Update the value of the DATA_STATUS field of the record to 0; (7) Determine whether it is the last record of the record set; (8) If it is not the last record, read the next record in the record set and go to step (3); (9) Wait for Δt2 and go to step (1); (10) End; The (1) configuration event triggers the reading of OPC data blocks, specifically as follows: Click the Add Event button: add the recording configuration of the trigger event; Click the Save button: save the configuration of the newly added or modified trigger events; Click to select a row in the event configuration screen that triggers data reading, and the corresponding data block information configuration that needs to be read will be displayed in the OPC data block configuration screen; Click the Add Data Block button: add a new row of information to the OPC data block configuration screen; Click the Save button: save the newly added or modified OPC data block configuration. In the event-triggered read OPC data block configuration screen, if the read / write status of an event is set to 0, all corresponding data blocks will not be read. The (ii) configuration period reads the OPC data block, specifically as follows: Click the Add Event button: add the record configuration of the periodic data set; Click the Save button: save the configuration of the newly added or modified periodic data set; Select a row in the storage period data set configuration screen, and the corresponding data block information configuration to be read will be displayed in the OPC data block configuration screen; Click the Add Data Block button: add a new row of information to the OPC data block configuration screen; Click the Save button: save the newly added or modified OPC data block configuration. In the periodic data set configuration screen, if the read / write status of a data set is set to 0, all corresponding data blocks will not be read. The (iii) configuration of writing OPC data blocks is as follows: Click the Add Dataset button: add the record configuration for writing the dataset; Click the Save button to save the newly added or modified configuration of the write data set; Click to select a row in the Write Data Set Configuration screen, and the corresponding data block configuration information to be written will be displayed in the OPC Data Block Configuration screen; Click the Add Data Block button: add a new row of information to the OPC data block configuration screen; Click the Save button: save the newly added or modified OPC data block configuration. In the Write OPC data set configuration screen, if the read / write status of a data set is set to 0, all corresponding data will not be written into the corresponding data block.

2. A system for reading and writing OPC data blocks, characterized in that: For implementing the method of reading and writing OPC data blocks as claimed in claim 1, the system comprises a system scheduling module, a function module for event-triggered reading of OPC data blocks, a function module for periodic reading of OPC data blocks, a function module for writing OPC data blocks, and a screen configuration module; System scheduling module: used to start and stop scheduling management of function modules for event-triggered reading of OPC data blocks, periodic reading of OPC data blocks, and writing of OPC data blocks; Function module for event-triggered reading of OPC data blocks: used for event-triggered reading of OPC data blocks, including process READ_EVENT_OPC_DATA and corresponding auxiliary processes. Event-triggered reading of OPC data blocks refers to the occurrence of an event corresponding to a certain data block in the OPC data block. When the event occurs, the application needs to read the values ​​of a batch of OPC data blocks; Function module for periodic reading of OPC data blocks: used to read periodic data, including READ_CYC_OPC_DATA and corresponding auxiliary processes, where periodic reading of OPC data blocks refers to the application program reading a batch of OPC data block values ​​at a fixed period; Function module for writing OPC data blocks: used to write OPC data, including WRITE_OPC_DATA and corresponding auxiliary processes; Screen configuration module: used to configure the relevant information that needs to read and write OPC on the screen, including the event-triggered read OPC data block configuration screen submodule, the periodic read OPC data block configuration screen submodule, and the write OPC data block configuration screen submodule.

Citation Information

Patent Citations

  • Method and system for processing mass data

    CN101119278A

  • Object linking and embedding for process control (OPC)-based general interface system and its control method

    CN102520687A

  • Method and device for reading and writing PLC variables through SQL database

    CN107885782A

  • PLC onsite data acquisition and monitoring module and method based on OPC protocol

    CN108469790A

  • Knitting machinery data gateway based on OPC UA and control method thereof

    CN109194528A