Data reading method, data writing method, and security control system

By introducing data consistency voting processing into the safety control system, the problem of inconsistent data reading and writing across multiple control channels of the controller was solved, thereby improving the accuracy of data reading and writing and the availability of the system.

CN115437576BActive Publication Date: 2026-04-14SUPCON TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-24
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Inconsistent data reading and writing across multiple control channels in a safety control system, particularly due to asynchronous read/write commands causing inconsistencies in channel values ​​and write failures or delays, can lead to incorrect voting results.

Method used

Within each control cycle, the communication module performs data consistency voting on the operation variable data from multiple control channels of the controller, and stores the data in the buffer when the vote passes. It responds to the read and write commands from the host computer to provide data feedback. At the same time, it performs data integrity verification and voting processing when writing data to ensure data consistency.

Benefits of technology

It effectively solves the problem of inconsistent data reading and writing across multiple control channels in a safety control system, improves the accuracy of data reading and writing and the availability of the system, and reduces the communication overhead between the HMI software and the controller.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115437576B_ABST
    Figure CN115437576B_ABST
Patent Text Reader

Abstract

The application discloses a data reading method, a data writing method and a safety control system. The data reading method comprises the following steps: receiving a plurality of groups of first operation variable data sent by a plurality of control channels and performing consistency voting, storing the first operation variable data to a cache area of a communication module when the voting is passed, and querying target operation variable data from the cache area and feeding back to an upper computer in response to a read command of the upper computer; the data writing method comprises the following steps: copying second operation variable data into a plurality of copies in response to a write command of the upper computer, sending the second operation variable data to a plurality of control channels, copying the write command into a plurality of copies by each control channel, saving one copy and sending other copies to other control channels, performing consistency voting on the saved write command and the write command sent by other control channels, and writing or discarding the second operation variable data based on the voting result. The application solves the technical problem that the data read and written by a plurality of control channels of a controller in a safety control system is inconsistent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of security control technology, and more specifically, to a data reading method, a data writing method, and a security control system. Background Technology

[0002] Safety instrumented systems are a type of safety control system widely used in industries such as petrochemicals and chemicals. They are mainly used for alarm and shutdown control. When abnormal conditions occur during normal production in a factory, the safety instrumented system will activate alarm or shutdown operations to prevent the conditions from deteriorating further and to ensure the safety of personnel and equipment.

[0003] In related technologies, safety control system controllers often employ a 1oo2D or 2oo3D voting architecture. These controllers contain multiple identical control channels, each capable of independently performing control functions. Safety outputs are achieved through voting between these channels. However, because the controller uses a real-time operating system with stringent response time requirements, timeouts are not permitted, making voting difficult for large-scale operational variables. Furthermore, when external devices read the controller's operational variables, the asynchronous nature of read commands may lead to inconsistencies in values ​​across channels, resulting in display anomalies. Similarly, when external devices write to the controller's operational variables, asynchronous write commands may cause write failures or delays in certain channels, leading to inconsistencies in program execution across control channels.

[0004] There is currently no effective solution to the above problems. Summary of the Invention

[0005] This application provides a data reading method, a data writing method, and a security control system to at least solve the technical problem of inconsistent data reading and writing across multiple control channels of a controller in a security control system.

[0006] According to one aspect of the embodiments of this application, a data reading method is provided, applied to a communication module in a safety control system, comprising: receiving a first number of sets of first operational variable data sent from a first number of control channels in a controller in each control cycle; performing a data consistency vote on the first number of sets of first operational variable data, and storing the first operational variable data in a first buffer in the communication module when the vote passes; and, in response to a read command sent by a host computer for reading target operational variable data, querying the target operational variable data from all the first operational variable data stored in the first buffer, and feeding back the target operational variable data to the host computer.

[0007] Optionally, before performing data consistency voting on the first number of first operational variable data, the status information of the first number of control channels is obtained; if a fault control channel exists, the first operational variable data sent by the fault control channel is prohibited from participating in the data consistency voting.

[0008] Optionally, if the result of the data consistency vote is unsuccessful in a second consecutive number of control cycles, a first alarm message is issued. The first alarm message is used to indicate that the data of the operation variables in the first number of control channels are inconsistent.

[0009] According to another aspect of the embodiments of this application, a data writing method is also provided, applied to a communication module in a safety control system, comprising: responding to a write command sent by a host computer, copying the write command into a first number of copies, and sending the first number of copies of the write command to a first number of control channels in a controller, wherein the write command includes second operational variable data to be written; each control channel is used to copy the received write command into a first number of copies, save one copy of the write command, and send the other copies of the write command to other control channels in the controller, perform a data consistency vote on the write command saved by itself and the write commands sent by other control channels, write or discard the second operational variable data based on the voting result, and feed back the write result to the communication module; receiving the first number of write results fed back by the first number of control channels, and feeding back the first number of write results to the host computer.

[0010] Optionally, before copying the write command to the first number of copies, the data integrity of the second operation variable in the write command is verified; if the verification passes, the write command is copied to the first number of copies; if the verification fails, a second alarm message is issued to indicate that the data of the second operation variable is incomplete and needs to be rewritten.

[0011] Optionally, before copying the write command into the first number of copies, the status information of the first number of control channels is obtained; if a faulty control channel exists, the write command to be copied is prohibited from being sent to the faulty control channel.

[0012] Optionally, each control channel copies the received write command into a first number of copies, stores one copy of the write command in the second buffer of the control channel, generates a voting command corresponding to the write command, and inserts the voting command into the voting command queue; the other copies of the write command are sent to other control channels in the controller, and the voting command is also sent to other control channels in the controller; when receiving write commands and voting commands from other control channels, the voting command sent by the other control channels is inserted into the voting command queue, and the write commands sent by the other control channels are stored in the second buffer; within each control cycle, the voting command queue is checked to see if it meets the preset requirements, and when the voting command queue meets the preset requirements, data consistency voting is performed on multiple write commands in the second buffer.

[0013] Optionally, the second operational variable data includes at least one of the following: the address of the second operational variable, the data content, the data length, the corresponding human-machine interface software type, and the feature code information; each control channel generates a unique identifier information corresponding to the write command based on the second operational variable data in the received write command, and uses the unique identifier information as the voting command.

[0014] Optionally, each voting command has a preset valid time period; within each control cycle, each control channel checks the number and status of voting commands in the voting command queue, and when there are a first number of voting commands in the voting command queue and all of the first number of voting commands are within the valid time period, data consistency voting is performed on the first number of write commands in the second buffer.

[0015] Optionally, for each control channel, when the number of write commands with consistent data is not less than a first preset threshold, the vote is confirmed to pass, the second operational variable data is written into the operational variable data area in the controller, and the first write result of successful writing is fed back to the communication module; when the number of write commands with consistent data is less than the preset threshold, the vote is confirmed to fail, the second operational variable data is discarded, and the second write result of failed writing is fed back to the communication module.

[0016] Optionally, if the number of received second write results is not less than the second preset threshold, a write command is resent to the control channel corresponding to the second write result.

[0017] According to another aspect of the embodiments of this application, a safety control system is also provided, including: a host computer, a communication module, and a controller, wherein the host computer is configured to send a read command to the communication module for reading target operational variable data; receive target operational variable data fed back by the communication module; the communication module is configured to receive a first number of sets of first operational variable data sent from a first number of control channels in the controller in each control cycle; perform data consistency voting on the first number of sets of first operational variable data, and store the first operational variable data in a first buffer in the communication module when the voting passes; and, in response to the read command sent by the host computer for reading target operational variable data, query the target operational variable data from all the first operational variable data stored in the first buffer, and feed the target operational variable data back to the host computer; the controller includes a first number of control channels, wherein each control channel is configured to send first operational variable data to the communication module in each control cycle.

[0018] According to another aspect of the embodiments of this application, a security control system is also provided, including: a host computer, a communication module, and a controller, wherein the host computer is configured to send a write command for writing second operational variable data to the communication module; and receive write results fed back by the communication module; the communication module is configured to, in response to the write command, copy the write command into a first number of copies, and send the first number of copies of the write command to a first number of control channels in the controller respectively, receive a first number of write results fed back by the first number of control channels, and feed back the first number of write results to the host computer; the controller includes a first number of control channels, wherein each control channel is configured to copy the received write command into a first number of copies, save one copy of the write command, and send the other copies of the write command to other control channels in the controller respectively, perform data consistency voting on the write command saved by itself and the write commands sent by other control channels, write or discard the second operational variable data based on the voting result, and feed back the write result to the communication module.

[0019] According to another aspect of the embodiments of this application, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored program, wherein the device where the non-volatile storage medium is located executes the above-described data reading method or data writing method by running the program.

[0020] According to another aspect of the embodiments of this application, an electronic device is also provided, the electronic device including: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the above-described data reading method or data writing method through the computer program.

[0021] In this embodiment, the communication module receives multiple sets of first operational variable data from multiple control channels in the controller during each control cycle, and performs data consistency voting on the multiple sets of first operational variable data. When the voting passes, the first operational variable data is stored in the first buffer in the communication module. Then, in response to a read command sent by the host computer to read the target operational variable data, the communication module queries the target operational variable data from all the first operational variable data stored in the first buffer and feeds the target operational variable data back to the host computer. At the same time, in response to a write command sent by the host computer to write second operational variable data, the communication module can copy the write command into a first number of copies and send the first number of copies of the write command to multiple control channels in the controller. Each control channel copies the received write command into a first number of copies, saves one copy of the write command, and sends the other copies of the write command to other control channels in the controller. It performs data consistency voting on the write command it saves and the write commands sent by other control channels, writes or discards the second operational variable data based on the voting result, and feeds back the write result to the communication module. The communication module receives the first number of write results fed back by the first number of control channels and feeds back the first number of write results to the host computer. By introducing a data consistency voting process during the read and write process, the technical problem of inconsistent read and write data across multiple control channels of the controller in the safety control system is effectively solved. Attached Figure Description

[0022] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0023] Figure 1 This is a schematic diagram of an optional safety control system according to an embodiment of this application;

[0024] Figure 2 This is a flowchart illustrating an optional data reading method according to an embodiment of this application;

[0025] Figure 3 This is a flowchart illustrating an optional data writing method according to an embodiment of this application. Detailed Implementation

[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0027] It should be noted that the terms "first," "second," etc., used in the specification, claims, and drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0028] Example 1

[0029] In safety control systems of related technologies, when external devices read the controller's operational variables, multiple control channels need to be read simultaneously each time. Due to the asynchronous nature of the read commands, inconsistencies often arise between channel values, leading to display anomalies. Similarly, when external devices write to the controller's operational variables, the asynchronous nature of the write commands may result in write failures or delays on certain channels. This can cause inconsistencies in program execution between control channels, ultimately leading to incorrect voting results. Conventional redundant control systems resolve data inconsistencies by copying data from the working controller using a backup controller. However, the redundant control channels of a safety control system require independence from each other, making this method unsuitable.

[0030] To address the aforementioned problems, embodiments of this application provide a security control system capable of more efficiently and accurately reading and writing manipulated variables, such as... Figure 1 As shown, the safety control system includes at least: a host computer 10, a communication module 11, and a controller 12, wherein:

[0031] The host computer 10 can be a terminal device such as a computer, which usually runs HMI (Human Machine Interface) software and is used to interact with the controller 12 through the communication module 11.

[0032] The communication module 11 is the bridge between the host computer 10 and the controller 12, and it typically includes a first buffer for storing mirrored data of the operation variables.

[0033] The controller 12 includes multiple control channels 12 (a to n), and the multiple control channels 12 (a to n) can also interact to achieve consistent voting on the operation variable data.

[0034] The following section uses the reading process of manipulated variables in a safety control system as an example to explain the functions of each module.

[0035] The host computer is used to send read commands to the communication module to read the target operation variable data; and to receive the target operation variable data fed back by the communication module.

[0036] The communication module is used to receive a first number of sets of first operational variable data sent from a first number of control channels in the controller during each control cycle; to perform data consistency voting on the first number of sets of first operational variable data, and to store the first operational variable data in a first buffer in the communication module when the vote passes; and to query the target operational variable data from all the first operational variable data stored in the first buffer in response to a read command sent by the host computer for reading the target operational variable data, and to feed back the target operational variable data to the host computer.

[0037] The controller includes a first number (n) control channels, wherein each control channel is used to send first operational variable data to the communication module in each control cycle.

[0038] The first operational variable data includes at least one of the following: the address of the first operational variable, the data content, the data length, the corresponding HMI software type, and the feature code information.

[0039] To ensure the consistency of the read operation variable data, the communication module needs to first perform a data consistency vote on the first number of groups of first operation variable data sent by the first number of control channels. When the vote passes, it is confirmed that the first operation variable data of each control channel is consistent. At this time, the communication module can store the first operation variable data in the first buffer area to facilitate the subsequent reading of the corresponding operation variable data by the host computer.

[0040] Optionally, before performing data consistency voting on the first number of first operational variable data, the communication module can also obtain the status information of the first number of control channels; if there is a fault control channel, the first operational variable data sent by the fault control channel is prohibited from participating in the data consistency voting to avoid interference from erroneous data.

[0041] Optionally, if the data consistency voting results are all unsuccessful within a second consecutive number of control cycles, a first alarm message is issued. This first alarm message indicates inconsistency in the operational variable data within a first number of control channels. The second number can be set by the user according to their needs, such as 3; no specific limitation is made here. This alarm mechanism helps users promptly identify problems.

[0042] When a user reads the target operational variable data of the controller through the HMI software on the host computer, the HMI software sends a read command to the communication module. The communication module then queries the target operational variable data from the first buffer and sends the data back to the HMI software. In this way, the HMI software only needs to query once each time it reads the controller's operational variable data, reducing the communication overhead between the HMI software and the controller.

[0043] As an optional implementation, the safety control system with the above structure can also implement write operations on the manipulated variables, wherein the specific functions implemented by each module are as follows:

[0044] The host computer is used to send write commands to the communication module for writing data to the second operation variable; and to receive the write results from the communication module.

[0045] The communication module is used to respond to a write command, copy the write command into a first number of copies, send the first number of copies of the write command to a first number of control channels in the controller, receive the first number of write results fed back from the first number of control channels, and feed back the first number of write results to the host computer.

[0046] The controller includes a first number (n) control channels, wherein each control channel is used to copy the received write command into a first number of copies, save one copy of the write command, and send the other copies of the write command to other control channels in the controller, perform a data consistency vote on the write command saved by itself and the write commands sent by other control channels, write or discard the second operation variable data based on the voting result, and feed back the write result to the communication module.

[0047] The second operational variable data includes at least one of the following: the address of the second operational variable, the data content, the data length, the corresponding HMI software type, and the feature code information.

[0048] Optionally, before copying the write command into the first number of copies, the communication module can first perform data integrity verification on the second operation variable data in the write command, such as performing CRC (Cyclic Redundancy Check); if the verification passes, the write command is copied into the first number of copies; if the verification fails, a second alarm message is issued to indicate that the second operation variable data is incomplete and needs to be rewritten.

[0049] Optionally, before copying the write command into the first number of copies, the communication module can also obtain the status information of the first number of control channels; if there is a faulty control channel, the write command to be copied is prohibited from being sent to the faulty control channel to avoid interference to other normal control channels caused by the subsequent data sent by the faulty control channel.

[0050] After the communication module sends the first number of write commands to the first number of control channels, as an optional implementation, each control channel copies the received write command into the first number of copies, stores one copy of the write command in the second buffer of the control channel, generates a voting command corresponding to the write command, and inserts the voting command into the voting command queue; then, it sends the other write commands to other control channels in the controller, and sends the voting command to other control channels in the controller; when receiving write commands and voting commands from other control channels, it inserts the voting command sent by other control channels into the voting command queue, and stores the write commands sent by other control channels in the second buffer; in each control cycle, it checks whether the voting command queue meets the preset requirements, and when the voting command queue meets the preset requirements, it performs data consistency voting on multiple write commands in the second buffer.

[0051] To address the issues of duplicate data packets and interference from similar commands, thereby improving system availability, this application embodiment adds a unique confirmation method for voting commands in the following way: Each control channel generates a unique identifier corresponding to the write command based on the second operation variable data in the received write command, and uses this unique identifier as the voting command. For example, the address, data length, HMI software type, and feature code information of the second operation variable are converted into hexadecimal, with each type occupying 4 bytes, and arranged sequentially to obtain the unique identifier.

[0052] Optionally, to address data packet delay and loss issues and improve system availability, a valid time period can be preset for each voting command, such as 2 seconds. Within each control cycle, each control channel checks the number and status of voting commands in the voting command queue. When there are a first number of voting commands in the queue, and all of these commands are within their valid time periods (meaning the control channel has received write and voting commands from all other control channels, and all voting commands have not timed out), the control channel can then perform data consistency voting on the first number of write commands in the second buffer.

[0053] Optionally, during data consistency voting, for each control channel, if the number of write commands indicating data consistency is not less than a first preset threshold, the vote is confirmed as passed. At this point, the second operational variable data can be written to the operational variable data area in the controller, and a first write result indicating successful writing is sent back to the communication module. If the number of write commands indicating data consistency is less than the preset threshold, the vote is confirmed as failed, the second operational variable data is discarded, and a second write result indicating writing failure is sent back to the communication module. The first preset threshold can be adaptively adjusted by the user according to the number of control channels; no specific limitation is made here. Voting can resolve data packet errors and prevent the controller from receiving erroneous data.

[0054] Optionally, the communication module can also resend the write command to the control channel corresponding to the second write result if the number of received failed second write results is not less than a second preset threshold. The second preset threshold can also be adaptively adjusted by the user based on the number of control channels; no specific limitation is made here. Resending write commands can solve the problem of data packet loss and improve system availability.

[0055] In this embodiment, the communication module receives multiple sets of first operational variable data from multiple control channels in the controller during each control cycle, and performs data consistency voting on the multiple sets of first operational variable data. When the voting passes, the first operational variable data is stored in the first buffer in the communication module. Then, in response to a read command sent by the host computer to read the target operational variable data, the communication module queries the target operational variable data from all the first operational variable data stored in the first buffer and feeds the target operational variable data back to the host computer. At the same time, in response to a write command sent by the host computer to write second operational variable data, the communication module can copy the write command into a first number of copies and send the first number of copies of the write command to multiple control channels in the controller. Each control channel copies the received write command into a first number of copies, saves one copy of the write command, and sends the other copies of the write command to other control channels in the controller. It performs data consistency voting on the write command it saves and the write commands sent by other control channels, writes or discards the second operational variable data based on the voting result, and feeds back the write result to the communication module. The communication module receives the first number of write results fed back by the first number of control channels and feeds back the first number of write results to the host computer. By introducing a data consistency voting process during the read and write process, the technical problem of inconsistent read and write data across multiple control channels of the controller in the safety control system is effectively solved.

[0056] Example 2

[0057] Based on the security control system provided in Embodiment 1, this application provides a data reading method executed by a communication module. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than that shown here.

[0058] Figure 2 This is a flowchart illustrating an optional data reading method according to an embodiment of this application, such as... Figure 2 As shown, the method includes at least steps S202-S206, wherein:

[0059] Step S202: In each control cycle, receive a first number of sets of first operational variable data sent from a first number of control channels in the controller.

[0060] The controller includes a first number of control channels. Each control channel sends its first operational variable data to the communication module in each control cycle. The first operational variable data includes at least one of the following: the address of the first operational variable, the data content, the data length, the corresponding HMI software type, and the feature code information.

[0061] Step S204: Perform a data consistency vote on the first operational variable data of the first quantity group, and when the vote passes, store the first operational variable data in the first buffer area of ​​the communication module.

[0062] To ensure the consistency of the read operation variable data, the communication module needs to first perform a data consistency vote on the first number of first operation variable data. When the vote passes, it is confirmed that the first operation variable data of each control channel is consistent. At this time, the communication module can store the first operation variable data in the first buffer area to facilitate the subsequent reading of the corresponding operation variable data by the host computer.

[0063] As an optional implementation, before performing data consistency voting on the first number of first operational variable data, the communication module can also obtain the status information of the first number of control channels; if there is a fault control channel, the first operational variable data sent by the fault control channel is prohibited from participating in the data consistency voting to avoid interference from erroneous data.

[0064] Optionally, if the data consistency voting results are all unsuccessful within a second consecutive number of control cycles, a first alarm message is issued. This first alarm message indicates inconsistency in the operational variable data within a first number of control channels. The second number can be set by the user according to their needs, such as 3; no specific limitation is made here. This alarm mechanism helps users promptly identify problems.

[0065] Step S206: In response to the read command sent by the host computer for reading the target operation variable data, query the target operation variable data from all the first operation variable data stored in the first buffer, and feed the target operation variable data back to the host computer.

[0066] When a user reads the target operational variable data of the controller through the HMI software on the host computer, the HMI software sends a read command to the communication module. The communication module then queries the target operational variable data from the first buffer and sends the data back to the HMI software. In this way, the HMI software only needs to query once each time it reads the controller's operational variable data, reducing the communication overhead between the HMI software and the controller.

[0067] In this embodiment, the communication module receives multiple sets of first operational variable data from multiple control channels in the controller during each control cycle, and performs data consistency voting on the multiple sets of first operational variable data. When the vote passes, the first operational variable data is stored in the first buffer in the communication module. Then, in response to a read command sent by the host computer to read the target operational variable data, the target operational variable data is queried from all the first operational variable data stored in the first buffer, and the target operational variable data is fed back to the host computer. By introducing a data consistency voting process during the read process, the technical problem of inconsistent data read and write operations among multiple control channels of the controller in the safety control system is effectively solved.

[0068] Example 3

[0069] Based on the security control system provided in Embodiment 1, this application embodiment also provides a data writing method executed by a communication module. It should be noted that the steps shown in the flowchart in the accompanying drawings can also be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0070] Figure 3 This is a flowchart illustrating an optional data writing method according to an embodiment of this application, as shown below. Figure 3 As shown, the method includes at least steps S302-S304, wherein:

[0071] Step S302: In response to the write command sent by the host computer, the write command is copied into a first number of copies, and the first number of copies of the write command are sent to a first number of control channels in the controller respectively. The write command includes the second operation variable data to be written. Each control channel is used to copy the received write command into a first number of copies, save one copy of the write command, and send the other copies of the write command to other control channels in the controller respectively. It performs a data consistency vote on the write command it saves and the write commands sent by other control channels, writes or discards the second operation variable data based on the voting result, and feeds back the write result to the communication module.

[0072] The second operational variable data includes at least one of the following: the address of the second operational variable, the data content, the data length, the corresponding HMI software type, and the feature code information.

[0073] As an optional implementation, before copying the write command into the first number of copies, the communication module can first perform data integrity verification on the second operation variable data in the write command, such as performing CRC (Cyclic Redundancy Check); if the verification passes, the write command is copied into the first number of copies; if the verification fails, a second alarm message is issued, which is used to indicate that the second operation variable data is incomplete and needs to be rewritten.

[0074] Optionally, before copying the write command into the first number of copies, the communication module can also obtain the status information of the first number of control channels; if there is a faulty control channel, the write command to be copied is prohibited from being sent to the faulty control channel to avoid interference to other normal control channels caused by the subsequent data sent by the faulty control channel.

[0075] After the communication module sends the first number of write commands to the first number of control channels, as an optional implementation, each control channel copies the received write command into the first number of copies, stores one copy of the write command in the second buffer of the control channel, generates a voting command corresponding to the write command, and inserts the voting command into the voting command queue; then, it sends the other write commands to other control channels in the controller, and sends the voting command to other control channels in the controller; when receiving write commands and voting commands from other control channels, it inserts the voting command sent by other control channels into the voting command queue, and stores the write commands sent by other control channels in the second buffer; in each control cycle, it checks whether the voting command queue meets the preset requirements, and when the voting command queue meets the preset requirements, it performs data consistency voting on multiple write commands in the second buffer.

[0076] To address the issues of duplicate data packets and interference from similar commands, thereby improving system availability, this application embodiment adds a unique confirmation method for voting commands in the following way: Each control channel generates a unique identifier corresponding to the write command based on the second operation variable data in the received write command, and uses this unique identifier as the voting command. For example, the address, data length, HMI software type, and feature code information of the second operation variable are converted into hexadecimal, with each type occupying 4 bytes, and arranged sequentially to obtain the unique identifier.

[0077] Optionally, to address data packet delay and loss issues and improve system availability, a valid time period can be preset for each voting command, such as 2 seconds. Within each control cycle, each control channel checks the number and status of voting commands in the voting command queue. When there are a first number of voting commands in the queue, and all of these commands are within their valid time periods (meaning the control channel has received write and voting commands from all other control channels, and all voting commands have not timed out), the control channel can then perform data consistency voting on the first number of write commands in the second buffer.

[0078] Optionally, during data consistency voting, for each control channel, if the number of write commands indicating data consistency is not less than a first preset threshold, the vote is confirmed as passed. At this point, the second operational variable data can be written to the operational variable data area in the controller, and a first write result indicating successful writing is sent back to the communication module. If the number of write commands indicating data consistency is less than the preset threshold, the vote is confirmed as failed, the second operational variable data is discarded, and a second write result indicating writing failure is sent back to the communication module. The first preset threshold can be adaptively adjusted by the user according to the number of control channels; no specific limitation is made here. Voting can resolve data packet errors and prevent the controller from receiving erroneous data.

[0079] Step S304: Receive the first number of write results fed back from the first number of control channels, and feed back the first number of write results to the host computer.

[0080] Optionally, the communication module can also resend the write command to the control channel corresponding to the second write result if the number of received failed second write results is not less than a second preset threshold. The second preset threshold can also be adaptively adjusted by the user based on the number of control channels; no specific limitation is made here. Resending write commands can solve the problem of data packet loss and improve system availability.

[0081] In this embodiment, the communication module, in response to a write command sent by the host computer to write the second operational variable data, copies the write command into a first number of copies and sends these first number of copies to multiple control channels in the controller. Each control channel copies the received write command into the first number of copies, saves one copy, and sends the other copies to other control channels in the controller. It then performs a data consistency vote on the saved write command and the write commands sent by other control channels, writes or discards the second operational variable data based on the vote result, and feeds back the write result to the communication module. The communication module receives the first number of write results from the first number of control channels and feeds them back to the host computer. By introducing a data consistency voting process during the write operation, the technical problem of inconsistent data reading and writing among multiple control channels in the safety control system is effectively solved.

[0082] Example 4

[0083] According to an embodiment of this application, a non-volatile storage medium is also provided, which includes a stored program, wherein the device where the non-volatile storage medium is located executes the data reading method in embodiment 2 or the data writing method in embodiment 3 by running the program.

[0084] According to an embodiment of this application, a processor is also provided for running a program, wherein the program executes the data reading method in embodiment 2 or the data writing method in embodiment 3 during runtime.

[0085] According to an embodiment of this application, an electronic device is also provided, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the data reading method in embodiment 2 or the data writing method in embodiment 3 through the computer program.

[0086] Optionally, the program executes the following steps during runtime: within each control cycle, it receives a first number of sets of first operational variable data sent from a first number of control channels in the controller; it performs a data consistency vote on the first number of sets of first operational variable data, and when the vote passes, it stores the first operational variable data in a first buffer in the communication module; in response to a read command sent by the host computer for reading target operational variable data, it queries the target operational variable data from all the first operational variable data stored in the first buffer, and feeds back the target operational variable data to the host computer.

[0087] Optionally, the program executes the following steps during runtime: In response to a write command sent by the host computer, the write command is copied into a first number of copies, and the first number of copies of the write command are sent to a first number of control channels in the controller, wherein the write command includes the second operation variable data to be written; each control channel is used to copy the received write command into a first number of copies, save one copy of the write command, and send the other copies of the write command to other control channels in the controller, perform a data consistency vote on the write command saved by itself and the write commands sent by other control channels, write or discard the second operation variable data based on the voting result, and feed back the write result to the communication module; receive the first number of write results fed back by the first number of control channels, and feed back the first number of write results to the host computer.

[0088] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.

[0089] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0090] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between units or modules may be electrical or other forms.

[0091] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0092] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0093] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.

[0094] The above are merely preferred embodiments of this application. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A data reading method, applied to a communication module in a safety control system, characterized in that, include: Within each control cycle, receive a first number of sets of first operational variable data sent from a first number of control channels in the controller; A data consistency vote is performed on the first operational variable data of the first quantity group, and when the vote passes, the first operational variable data is stored in the first buffer in the communication module. The data consistency vote is used to determine whether the first operational variable data of the first quantity group is consistent. In response to a read command sent by the host computer for reading target operation variable data, the target operation variable data is queried from all the first operation variable data stored in the first buffer, and the target operation variable data is fed back to the host computer.

2. The method according to claim 1, characterized in that, Before performing data consistency voting on the first operational variable data of the first quantity group, the method further includes: Obtain the status information of the first number of control channels; If a fault control channel exists, the first operational variable data sent by the fault control channel is prohibited from participating in the data consistency voting.

3. The method according to claim 1, characterized in that, The method further includes: If the data consistency voting results are all unsuccessful within a second consecutive number of control cycles, a first alarm message is issued. The first alarm message is used to indicate that the operation variable data in the first number of control channels are inconsistent.

4. A data writing method, applied to a communication module in a security control system, characterized in that, include: In response to a write command sent by the host computer, the write command is copied into a first number of copies, and the first number of copies of the write command are sent to a first number of control channels in the controller. The write command includes second operation variable data to be written. Each control channel is used to copy the received write command into a first number of copies, save one copy of the write command, and send the other copies of the write command to other control channels in the controller. It performs a data consistency vote on the write command it saves and the write commands sent by other control channels, writes or discards the second operation variable data based on the voting result, and feeds back the write result to the communication module. The data consistency vote is used to determine whether the second operation variable data in multiple write commands are consistent. Receive the first number of write results fed back from the first number of control channels, and feed back the first number of write results to the host computer.

5. The method according to claim 4, characterized in that, Before copying the write command into a first number of copies, the method further includes: Perform data integrity verification on the second operation variable data in the write command; If the verification passes, the write command will be copied to the first number of copies; If the verification fails, a second alarm message is issued, which indicates that the data of the second operation variable is incomplete and needs to be rewritten.

6. The method according to claim 4, characterized in that, Before copying the write command into a first number of copies, the method further includes: Obtain the status information of the first number of control channels; If a fault control channel exists, write commands for copying should not be sent to that fault control channel.

7. The method according to claim 4, characterized in that, The received write command is copied into a first set of copies. One copy of the write command is saved, and the other copies are sent to other control channels in the controller. Data consistency voting is performed on the saved write command and the write commands sent by other control channels, including: Each control channel copies the received write command into a first number of copies, stores one copy of the write command in the second buffer of the control channel, generates a voting command corresponding to the write command, and inserts the voting command into the voting command queue. The other write commands are sent to the other control channels in the controller, and the voting command is sent to the other control channels in the controller. Upon receiving write commands and voting commands from other control channels, the voting commands sent by the other control channels are inserted into the voting command queue, and the write commands sent by the other control channels are stored in the second buffer. Within each control cycle, the voting command queue is checked to see if it meets the preset requirements. If the voting command queue meets the preset requirements, a data consistency vote is performed on multiple write commands in the second buffer.

8. The method according to claim 7, characterized in that, The second operational variable data includes at least one of the following: the address of the second operational variable, the data content, the data length, the corresponding human-machine interface software type, and the feature code information; Generating a voting command corresponding to the write command includes: each control channel generating unique identification information corresponding to the write command based on the second operation variable data in the received write command, and using the unique identification information as the voting command.

9. The method according to claim 7, characterized in that, Each of the aforementioned voting orders has a preset valid time period; Within each control cycle, the voting command queue is checked to see if it meets preset requirements. When the voting command queue meets the preset requirements, data consistency voting is performed on multiple write commands in the second buffer. This includes: within each control cycle, each control channel checks the number and status of voting commands in the voting command queue. When there are a first number of voting commands in the voting command queue and all of the first number of voting commands are within the valid time period, data consistency voting is performed on the first number of write commands in the second buffer.

10. The method according to claim 7, characterized in that, The second operational variable data is written or discarded based on the voting result, and the writing result is fed back to the communication module, including: For each control channel, when the number of write commands with consistent data is not less than a first preset threshold, the vote is confirmed to pass, the second operation variable data is written into the operation variable data area in the controller, and the first write result of successful writing is fed back to the communication module. When the number of write commands with consistent data is less than the preset threshold, the confirmation vote fails, the second operation variable data is discarded, and the second write result of write failure is fed back to the communication module.

11. The method according to claim 10, characterized in that, After receiving the first number of write results fed back from the first number of control channels, the method further includes: When the number of received second write results is not less than the second preset threshold, the write command is resent to the control channel corresponding to the second write result.

12. A safety control system, characterized in that, include: The host computer, communication module, and controller are included. The host computer is used to send a read command to the communication module for reading the target operation variable data; and to receive the target operation variable data fed back by the communication module. The communication module is configured to receive, in each control cycle, a first number of sets of first operational variable data sent from a first number of control channels in the controller; perform data consistency voting on the first number of sets of first operational variable data, and when the voting passes, store the first operational variable data in a first buffer in the communication module, wherein the data consistency voting is used to determine whether the first number of sets of first operational variable data are consistent; and, in response to a read command sent by the host computer for reading target operational variable data, query the target operational variable data from all the first operational variable data stored in the first buffer, and feed the target operational variable data back to the host computer. The controller includes a first number of control channels, wherein each control channel is used to send the first operation variable data to the communication module in each control cycle.

13. A safety control system, characterized in that, include: The host computer, communication module, and controller are included. The host computer is used to send a write command to the communication module for writing data of the second operation variable; and to receive the write result fed back by the communication module. The communication module is configured to respond to the write command by copying the write command into a first number of copies, sending the first number of copies of the write command to a first number of control channels in the controller, receiving a first number of write results from the first number of control channels, and feeding back the first number of write results to the host computer. The controller includes a first number of control channels, wherein each control channel is used to copy a received write command into a first number of copies, save one copy of the write command, and send the other copies of the write command to other control channels in the controller, perform data consistency voting on the write command saved by itself and the write commands sent by other control channels, write or discard the second operation variable data based on the voting result, and feed back the writing result to the communication module, wherein the data consistency voting is used to determine whether the second operation variable data in multiple write commands are consistent.

14. A non-volatile storage medium, characterized in that, The non-volatile storage medium includes a stored program, wherein the device containing the non-volatile storage medium executes the data reading method according to any one of claims 1 to 3 or the data writing method according to any one of claims 4 to 11 by running the program.

15. An electronic device, characterized in that, include: A memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute, via the computer program, the data reading method of any one of claims 1 to 3 or the data writing method of any one of claims 4 to 11.

Citation Information

Patent Citations

  • System and method for processing input / output requests

    CN113782071A

  • Data writing, consistency checking and reading method and device

    CN114556283A