Device redundancy method and device based on PLC device

By introducing a data transmission channel managed by the arbitrator into the PLC device, switching according to the status information of the main PLC device, the problems of complex hardware switching and software delay in the PLC device redundancy method in the prior art are solved, and efficient and effective redundant configuration and exception handling are achieved.

CN120143729APending Publication Date: 2025-06-13SHENZHEN HUICHEN AUTOMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510346700.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-06-13

AI Technical Summary

Technical Problem

In the prior art, the PLC device redundancy method has the problem of complex hardware system switching and large software system delay, making it difficult to efficiently switch backup hardware devices when the main hardware device is abnormal, and it is difficult to effectively implement control functions.

Method used

By establishing an arbitrator-managed data transmission channel between the main PLC device and the redundant PLC device, switching is performed according to the status information of the main PLC device, ensuring that the main PLC device is automatically switched to the redundant PLC device when the main PLC device is abnormal, and switching back to the main device when the main PLC device is restored.

Benefits of technology

It realizes efficient and effective redundant configuration of PLC equipment, improves operation continuity, fault tolerance and timely exception handling, and avoids the needs of complex hardware redundancy and programming.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120143729A_ABST
    Figure CN120143729A_ABST
Patent Text Reader

Abstract

The invention relates to an equipment redundancy method and device based on PLC equipment. The method comprises the following steps: determining main PLC equipment and redundant PLC equipment based on the difference of equipment interfaces connected with the PLC equipment; establishing a data transmission channel between the main PLC equipment and external equipment based on the arbiter, and updating state information of the main PLC equipment after the main PLC equipment receives and processes data based on the data transmission channel; the state information is sent to the redundant PLC device, and if the redundant PLC device detects that the main PLC device is in an abnormal state through the state information, the arbiter disconnects the data transmission channel and establishes a target data transmission channel between the redundant PLC device and the external device; and the arbiter disconnects the target data transmission channel and re-establishes the data transmission channel until the redundant PLC device re-detects that the main PLC device is in the repaired state. By adopting the method, redundancy configuration can be efficiently carried out on the PLC equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of industrial automation, and particularly to a device redundancy method and device based on a PLC device. Background Art

[0002] In the field of industrial automation, by pre-redundantly processing a PLC device, it is ensured that when the PLC device fails, the standby software and hardware system takes over the work.

[0003] However, in related device redundancy methods, on the one hand, device redundancy processing is achieved through a hardware system, that is, the data transmission path needs to be connected in duplicate to the main hardware device and the standby hardware device to realize the switching between the main hardware device and the standby hardware device, making the line connection more complex and it difficult to efficiently switch to the standby hardware device when the main hardware device fails; on the other hand, device redundancy processing is achieved through a software system, that is, the switching between the main logic function and the standby logic function is realized according to complex program design, which has a certain delay and it is difficult to effectively implement the control function when the main device cannot work. Summary of the Invention

[0004] Based on this, in view of the above technical problems, it is necessary to provide a device redundancy method, device, computer device, and computer-readable storage medium based on a PLC device, which are used to improve the operation continuity and fault tolerance of the PLC device by efficiently and effectively performing redundancy configuration on the PLC device.

[0005] In a first aspect, this application provides a device redundancy method based on a PLC device, including: Based on the differences in the device interfaces of the main PLC device and the redundant PLC device connected to each other, determine the identified main PLC device and the identified redundant PLC device among the two PLC devices; Based on the arbiter corresponding to the main PLC device, establish a data transmission channel between the main PLC device and an external device. After the main PLC device receives and processes data based on the data transmission channel, update the status information of the main PLC device; Send the status information of the main PLC device to the redundant PLC device. If the redundant PLC device detects that the main PLC device is in an abnormal state through the status information, the arbiter disconnects the data transmission channel and establishes a target data transmission channel between the redundant PLC device and the external device, so that the redundant PLC device receives and processes data; Until the redundant PLC device detects that the main PLC device is in a repaired state through the state information newly received from the main PLC device, the arbiter disconnects the target data transmission channel and re - establishes the data transmission channel between the main PLC device and the external device.

[0006] In a second aspect, the present application further provides a device redundancy apparatus based on a PLC device, including: An identification module, configured to determine the identified main PLC device and the identified redundant PLC device among the two PLC devices based on the differences in the device interfaces where the main PLC device is connected to the redundant PLC device; A connection module, configured to establish a data transmission channel between the main PLC device and an external device based on the arbiter corresponding to the main PLC device, and update the state information of the main PLC device after the main PLC device receives and processes data through the data transmission channel; A first detection module, configured to send the state information of the main PLC device to the redundant PLC device. If the redundant PLC device detects that the main PLC device is in an abnormal state through the state information, the arbiter disconnects the data transmission channel and establishes a target data transmission channel between the redundant PLC device and the external device, so that the redundant PLC device receives and processes data; A second detection module, configured to until the redundant PLC device detects that the main PLC device is in a repaired state through the state information newly received from the main PLC device, the arbiter disconnects the target data transmission channel and re - establishes the data transmission channel between the main PLC device and the external device.

[0007] In a third aspect, the present application further provides a computer device, including a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the above - mentioned steps are implemented.

[0008] In a fourth aspect, the present application further provides a computer - readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the above - mentioned steps are implemented.

[0009] The above-mentioned device redundancy method, device, computer device and computer-readable storage medium based on PLC devices first efficiently and accurately identify and distinguish the main PLC device and the redundant PLC device in the two PLC devices based on the differences in the device interfaces connected between the main PLC device and the redundant PLC device; furthermore, based on the detection of the status information of the main PLC device by the redundant PLC device and combined with the coordination and management performance of the arbiter, adaptively construct and disconnect the data transmission channel between the main PLC device and the external device or the target transmission channel between the redundant PLC device and the external device; based on this, according to the independently set and independently operating arbiter, there is no need for complex hardware redundancy, circuit design and program design, and it avoids the problem of ineffective backup when the main PLC device fails, thus realizing efficient and effective redundant configuration of the main PLC device, and improving the operation continuity, fault tolerance and exception handling timeliness of the main PLC device and the redundant PLC device. Description of the Drawings

[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required for use in the description of the embodiments or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0011] Figure 1 It is a schematic flowchart of a device redundancy method based on PLC devices in an embodiment; Figure 2 It is a structural block diagram of a device redundancy device based on PLC devices in an embodiment. Detailed Embodiments

[0012] In order to make the purpose, technical solutions and advantages of the present application more clear, the following further details the present application in conjunction with the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0013] In one embodiment, as Figure 1 shown, a device redundancy method based on PLC devices is provided. In this embodiment, the method is exemplified by being applied to a system including a terminal and a server, and can be implemented through the interaction between the terminal and the server. It can be understood that the method can also be applied to the server and can also be applied to the terminal. In this embodiment, the method is applied to a control system and includes the following steps S101 to step S104.

[0014] Step S101: Based on the differences in the device interfaces of the primary PLC device and the redundant PLC device, identify the identified primary PLC device and the identified redundant PLC device among the two PLC devices.

[0015] Among them, the PLC device (Programmable Logic Controller) represents a digital industrial control device; the control system represents an overall architecture composed of hardware and software, which is used to achieve the automated management and control of industrial devices, technological processes, or other external devices through the PLC device. The control system includes a primary PLC device, a redundant PLC device, and an arbiter.

[0016] Among them, the primary PLC device represents the main control unit in the control system, which is used to process input signals and execute control tasks; the redundant PLC device represents the backup control unit in the control system, which is used to take over the control tasks when the primary PLC device fails to ensure the normal operation of the control system.

[0017] Among them, the arbiter represents a coordination and management unit independent of the primary PLC device and the redundant PLC device, which is used to control and switch the permissions of the primary PLC device and the redundant PLC device to process input signals and execute control tasks respectively.

[0018] Exemplarily, connect the above two PLC devices through the expansion interfaces corresponding to the primary PLC device and the redundant PLC device respectively. Since there are differences in the interface types of the expansion interfaces of different PLC devices, these differences can be used as the basis for identifying and distinguishing the identities of the primary PLC device and the redundant PLC device. For example, connect the left expansion interface of the primary PLC device to the right expansion interface of the redundant PLC device. When the primary PLC device and / or the redundant PCL device is powered on, through the arbiter or other units with detection functions, it is detected that the interface type of the expansion interface applied by a certain PLC device is the left expansion interface or the right expansion interface, so as to accurately distinguish the primary PLC device and the redundant PLC device among the two PLC devices, and respectively identify the distinguished primary PLC device and redundant PLC device to obtain the identified primary PLC device and the identified redundant PLC device.

[0019] Step S102: Based on the arbiter corresponding to the primary PLC device, establish a data transmission channel between the primary PLC device and the external device. After the primary PLC device receives and processes data based on the data transmission channel, update the status information of the primary PLC device.

[0020] Among them, the external device represents an input / output device connected to the control system, which is used to provide the sensing information required by the control system or receive the control signals output by the control system.

[0021] Among them, the status information reflects the operating status of the main PLC device, such as the normal working status, abnormal status, repaired status, etc.; when the main PLC device is in the normal working status, it indicates that the main PLC device is operating normally and can process input signals and execute control tasks; when the main PLC device is in the abnormal status, it indicates that the main PLC device has a fault and cannot process input signals and execute control tasks normally; when the main PLC device is in the repaired status, it indicates that the main PLC device has completed self-check and repair and can resume normal operation.

[0022] Exemplarily, according to the coordination of the arbiter, the internal transmission path of the input signal and output signal of the control system is determined, that is, the arbiter constructs a data transmission channel between the main PLC device and the external device, so as to hand over the authority to process the input signal and execute the control task to the main PLC device, and realize the bidirectional flow of data between the external device and the main PLC device in the control system; the main PLC device receives the data sent by the external device through the data transmission channel, then performs logical operations on the received data to generate a control signal and sends it to the external device through the data transmission channel, and updates the status information of the main PLC device to the real-time status information that can reflect the current operating status of the main PLC device.

[0023] Step S103, send the status information of the main PLC device to the redundant PLC device. If the redundant PLC device detects that the main PLC device is in the abnormal status through the status information, the arbiter disconnects the data transmission channel and establishes a target data transmission channel between the redundant PLC device and the external device, so that the redundant PLC device can receive and process the data.

[0024] Exemplarily, the main PLC device sends the status information of the PLC device to the redundant PLC device. The redundant PLC device analyzes the received status information according to the preset detection logic. If the redundant PLC device detects that the main PLC device is in the abnormal status through the status information, the redundant PLC device notifies the arbiter, and the arbiter re-coordinates and determines the internal transmission path of the input signal and output signal of the control system, that is, the arbiter disconnects the data transmission channel between the main PLC device and the external device, and constructs a target data transmission channel between the redundant PLC device and the external device, so as to hand over the authority to process the input signal and execute the control task to the redundant PLC device, and realize the bidirectional flow of data between the external device and the redundant PLC device in the control system.

[0025] Step S104, until the redundant PLC device detects that the main PLC device is in the repaired status through the status information from the main PLC device again, the arbiter disconnects the target data transmission channel and re-establishes the data transmission channel between the main PLC device and the external device.

[0026] Exemplarily, after the main PLC device is converted from an abnormal state to a repaired state, the main PLC device resends the status information to the redundant PLC device. If the redundant PLC device receives the status information from the main PLC device again since the establishment of the target data transmission channel and detects that the main PLC device is in a repaired state through this status information, the redundant PLC device notifies the arbiter, and the arbiter disconnects the target data transmission channel between the redundant PLC device and the external device and reconstructs the data transmission channel between the main PLC device and the external device to reassign the permission to process the input signal and execute the control task to the main PLC device.

[0027] In the above device redundancy method based on PLC devices, first, based on the differences in the device interfaces connected to the main PLC device and the redundant PLC device, the main PLC device and the redundant PLC device are efficiently and accurately identified and distinguished in the two PLC devices; furthermore, based on the detection of the status information of the main PLC device by the redundant PLC device and combined with the coordination and management performance of the arbiter, the data transmission channel between the main PLC device and the external device or the target transmission channel between the redundant PLC device and the external device is adaptively constructed and disconnected; based on this, according to the independently set and independently operating arbiter, there is no need for complex hardware redundancy, circuit design, and program design, and the problem of ineffective backup when the main PLC device fails is avoided, thus realizing efficient and effective redundancy configuration of the main PLC device, and improving the operation continuity, fault tolerance, and exception handling timeliness of the main PLC device and the redundant PLC device.

[0028] In an exemplary embodiment, based on the arbiter corresponding to the main PLC device, establishing the data transmission channel between the main PLC device and the external device includes step S201; if the redundant PLC device detects that the main PLC device is in an abnormal state through the status information, the arbiter disconnects the data transmission channel and establishes the target data transmission channel between the redundant PLC device and the external device, including step S202.

[0029] Step S201, based on the arbiter corresponding to the main PLC device, connects the input point line and the output point line of the main PLC device, and the input point line and the output point line of the expansion module corresponding to the main PLC device to the identified main PLC device respectively to obtain the data transmission channel between the main PLC device and the external device.

[0030] Among them, the input point line represents the signal input channel connecting the external device. The input point line of the main PLC device is used to transfer the data of the external device to the input end of the main PLC device, and the input point line of the expansion module is used to transfer the data of the external device to the input end of the expansion module through the expansion module.

[0031] Among them, the output point circuit represents the signal output channel connecting to external devices. The output point circuit of the main PLC device is used to transmit the control signal generated by the main PLC device according to program operations to external devices. The output point circuit of the expansion module is used to transmit the control signal generated by the main PLC device according to program operations to external devices through the expansion module.

[0032] Among them, the expansion module represents an additional module used to expand the input and output functions of the main PLC device, providing more input terminals and output terminals for the main PLC device to support the connection of more external devices.

[0033] Exemplarily, when the control system is operating normally, after the arbiter identifies and labels the identified main PLC device and the identified redundant PLC device through the differences in the device interfaces where the main PLC device is connected to the redundant PLC device, the arbiter defaults to connecting the input point circuit and output point circuit of the main PLC device, and the input point circuit and output point circuit of the expansion module to the identified main PLC device respectively, thereby constructing a data transmission channel between the main PLC device and external devices; based on this data transmission channel, two-way data transmission between the main PLC device and external devices is realized, or two-way data transmission between the main PLC device and external devices is realized based on the intermediate-set expansion module.

[0034] Step S202, if the redundant PLC device detects that the main PLC device is in an abnormal state through status information, the arbiter receives the warning information from the redundant PLC device and disconnects the data transmission channel based on the warning information, and connects the input point circuit and output point circuit of the main PLC device, and the input point circuit and output point circuit of the expansion module corresponding to the main PLC device to the identified redundant PLC device respectively, to obtain the target data transmission channel between the redundant PLC device and external devices.

[0035] Among them, the warning information represents a notification signal generated when the redundant PLC device detects that the main PLC device is in an abnormal state, and is used to notify the arbiter to switch the permission to process input signals and execute control tasks.

[0036] Exemplarily, when the redundant PLC device detects that the main PLC device is in an abnormal state through the status information from the main PLC device, the redundant PLC device generates a warning message and sends it to the arbiter; after receiving the warning message, the arbiter disconnects the data transmission channel between the main PLC device and the external device, and reassigns the input point circuit and output point circuit of the main PLC device, and the input point circuit and output point circuit of the expansion module to the identified redundant PLC device respectively, so as to construct the target data transmission channel between the redundant PLC device and the external device; based on this target data transmission channel, the two-way data transmission between the redundant PLC device and the external device is realized, or the two-way data transmission between the redundant PLC device and the external device is realized based on the intermediate set expansion module.

[0037] Optionally, after generating the warning message, the redundant PLC device can send the warning message to function modules such as a display screen, a warning light, and a buzzer for display, so as to inform the operator of the abnormality of the main PLC device in a timely manner.

[0038] In this embodiment, by controlling the input point circuit and output point circuit of the main PLC device, and the input point circuit and output point circuit of the expansion module corresponding to the main PLC device to be connected to the identified main PLC device or the identified redundant PLC device, the function of constructing or disconnecting the data transmission channel or the target data transmission channel is adaptively and effectively realized at the level of line-to-line point-to-point connection.

[0039] In an exemplary embodiment, after the main PLC device receives and processes data based on the data transmission channel, the status information of the main PLC device is updated, including step S301 to step S302.

[0040] Step S301, according to the target program loaded into the main PLC device, within each program cycle corresponding to the target program respectively, receive input point information from the external device through the data transmission channel, process the input point information based on the target program to obtain output point information, and transmit the output point information to the external device through the data transmission channel.

[0041] Among them, the target program represents a logic program for implementing a specific control task, which defines the operation rules and behaviors of the main PLC device, and is used to process input point information and generate output point information; the input point information represents the input signal received from the external device through the data transmission channel, and the output point information represents the output signal generated after processing the input point information according to the target program.

[0042] Among them, the program cycle represents the basic time unit for the main PLC device to run the target program. Within each program cycle, the main PLC device completes the reading of input point information, logical operations, and the generation and transmission of output point information. That is, one program cycle can correspond to the complete process from reading input point information to sending output point information.

[0043] Exemplarily, according to the target program loaded into the main PLC device, within each program cycle corresponding to the target program, the main PLC device obtains input point information from external devices through a data transmission channel, such as sensor signals from sensors, switch signals from switch devices, or input signals from other monitoring devices, etc., which can reflect the current operating status of the external devices and the external system composed of external devices; the main PLC device processes the input point information depending on the logical content of the target program, that is, the target program performs logical operations on the input point information according to specific algorithms, rules, or control logics, such as determining whether the sensor signal exceeds the limit, whether the combined state of the switch signals meets the conditions, etc.; after the processing of the input point information is completed, the main PLC device generates corresponding output point information, such as control signals for external devices, alarm trigger signals, or other output signals, which reflects the control intention or response behavior of the main PLC device for external devices or the external system determined according to the input point information and the logical operation results of the target program, and sends the output point information to the corresponding external devices through the data transmission channel.

[0044] Step S302, after the current program cycle ends, update the status information of the main PLC device in the current program cycle according to the execution status of the current program cycle, where the execution status includes the device operating status, program execution status, and input / output status.

[0045] Among them, the execution status of the current program cycle represents the overall operation performance of the main PLC device in the current program cycle, which is used to record and evaluate the comprehensive status of the main PLC device in aspects such as device operation, program operation, and input / output signal processing.

[0046] Among them, the device operating status represents the hardware working condition of the main PLC device, that is, the operating health status of the device, such as whether the power supply, voltage, temperature, CPU load, and storage usage are normal, etc., which reflects whether there are hardware failures or overload problems in the main PLC device.

[0047] Among them, the program execution status represents the execution situation of the target program within one program cycle, such as whether the program runs correctly, whether the logical operations are completed, whether there are exceptions (such as logical errors, loop timeouts), etc., which reflects whether the target program is executed smoothly according to the designed logic.

[0048] Among them, the input / output status indicates the interaction between the main PLC device and external devices within a program cycle. For example, whether the input point information is successfully received, whether the output point information is correctly transmitted, whether data processing has data loss or delay, etc. It reflects whether the communication and data processing between the main PLC device and external devices are smooth.

[0049] Exemplarily, at the end of each program cycle, the main PLC device comprehensively evaluates the execution status in the current program cycle, that is, evaluates the operating status of the main PLC device in the current program cycle based on different evaluation dimensions such as the device operating status, program execution status, and input / output status, and updates the status information of the main PLC device in the current program cycle according to the evaluation results; among them, the status information can represent the evaluation status corresponding to each evaluation dimension (for example, in a normal state or an abnormal state on a certain evaluation dimension), or can represent the comprehensive status corresponding to the overall operating situation of the main PLC device in the current program cycle, such as a normal state (that is, the status of all evaluation dimensions meets the expectations), a warning state (that is, there are minor abnormalities in some evaluation dimensions, but it has little impact on the operation of the control system), and an abnormal state (that is, there are serious problems in some evaluation dimensions, which may cause the main PLC device to operate unstably or interrupt).

[0050] In this embodiment, according to the target program loaded into the main PLC device, in each program cycle corresponding to the target program, the processes of reading input point information, logical operation, and generating and sending output point information are periodically and completely implemented; furthermore, according to the execution status of the main PLC device in the current program cycle, the status information of the main PLC device is updated multi-dimensionally and comprehensively to ensure the reliability of the result of the redundant PLC device detecting the status of the main PLC device based on the received status information.

[0051] In an exemplary embodiment, within each program cycle corresponding to the target program, before receiving the input point information from the data transmission channel and processing the input point information based on the target program to obtain the output point information, the method further includes step S401; after the end of the current program cycle, the method further includes step S402.

[0052] Step S401, the main PLC device copies the target program to the redundant PLC device so that the redundant PLC device synchronously loads the target program.

[0053] Exemplarily, after the main PLC device loads the target program, it generates a complete copy of the target program inside itself, including logical control instructions, operation rules, and the processing logic of input and output signals, etc.; subsequently, through the device interface connecting the main PLC device and the redundant PLC device, the main PLC device transmits the copy of the target program to the redundant PLC device; after receiving the copy of the target program, the redundant PLC device loads the target program inside itself to ensure that the software program configuration of the redundant PLC device is exactly the same as that of the main PLC device.

[0054] Step S402, according to the reading request of the redundant PLC device, the main PLC device sends the input point information and output point information of the current program cycle to the redundant PLC device, so that the redundant PLC device can update the stored input point information and output point information.

[0055] Among them, the reading request represents a data synchronization request sent by the redundant PLC device to the main PLC device, which is used to obtain the input point information and output point information of the current program cycle from the main PLC device to ensure that the data of the redundant PLC device is consistent with that of the main PLC device.

[0056] Exemplarily, after each program cycle ends, the main PLC device sorts out and stores the input point information and output point information in the current program cycle. At the same time, the redundant PLC device will regularly send a reading request to the main PLC device to obtain the latest input and output point information; after receiving the reading request from the redundant PLC device, the main PLC device sends the input point information and output point information of the current program cycle (i.e., the most recent program cycle) to the redundant PLC device through the device interface connecting the main PLC device and the redundant PLC device; after receiving the input point information and output point information, the redundant PLC device overwrites and updates the input point information and output point information stored in its history to ensure that its data is exactly the same as that of the main PLC device.

[0057] In this embodiment, on the one hand, the target program loaded into the main PLC device is synchronously loaded into the redundant PLC device to ensure that the software program configuration of the redundant PLC device is exactly the same as that of the main PLC device; on the other hand, the input point and output point information of the main PLC device in each program cycle is synchronously updated to the redundant PLC device to ensure that the data of the redundant PLC device is consistent with that of the main PLC device; based on this, based on the fact that the redundant PLC device is consistent with the main PLC device at the program configuration level and data level, it is ensured that when the main PLC device fails, the redundant PLC device can effectively and timely take over the work function, improving the fault tolerance and operation stability of the control system.

[0058] In an exemplary embodiment, after the arbiter disconnects the data transmission channel and establishes a target data transmission channel between the redundant PLC device and the external device, the method further includes steps S501 to S502.

[0059] Step S501: According to the updated input point status of the target data transmission channel, the arbiter sends the target input point information corresponding to the updated input point status to the redundant PLC device, so that the redundant PLC device processes the target input point information according to the target program to obtain target output point information.

[0060] Among them, the updated input point status represents the current status of the input signals related to the external device in the target data transmission channel, which reflects the operating environment or real-time changes of the external device. For example, environmental variables measured by sensors, the opening and closing status of switches, etc.; the input point status is collected and monitored in real time by the arbiter to provide the redundant PLC device with the latest input point information of the external device.

[0061] Exemplarily, after the arbiter establishes the target data transmission channel between the redundant PLC device and the external device, the arbiter monitors and analyzes the latest input point status of the target data transmission channel in real time, that is, the input point status corresponding to the input point line connected to the redundant PLC device, so as to convert the input point status into the target input point information corresponding to the data format that the redundant PLC device can process, and send the target input point information to the redundant PLC device; after receiving the target input point information, the redundant PLC device processes the target input point information according to the pre-loaded target program and the logical rules set in the target program to obtain the target output point information.

[0062] Step S502: The arbiter receives the target output point information from the redundant PLC device, and updates the output point status of the target data transmission channel according to the target output point information to obtain the updated output point status of the target data transmission channel.

[0063] Among them, the updated output point status represents the current status of the output signals related to the external device in the target data transmission channel, which reflects the control signals generated by the redundant PLC device after processing the input point information according to the target program. For example, starting a controller, opening or closing a valve, or triggering an alarm, etc.; the output point status is updated in real time by the arbiter according to the target output point information sent by the redundant PLC device, and is used to control the actions or reactions of the external device.

[0064] Exemplarily, the redundant PLC device sends the generated target output point information to the arbiter. After receiving the target output point information, the arbiter analyzes the target output point information to convert the target output point information into the output point status of the target data transmission channel, such as the output point status corresponding to the output point line accessing the redundant PLC device, and then takes this output point status as the latest output point status. Among them, the process of converting the target output point information into the output point status of the target data transmission channel involves parsing and mapping the target output point information into the status of each specific output point in the target data transmission channel. That is, the target output point information generated by the redundant PLC device is a control signal at the logical layer, and the arbiter needs to convert it into an actual physical signal for communication or driving with external devices to achieve the execution of the signal at the hardware layer.

[0065] In this embodiment, at the level of data reception, the arbiter sends the target input point information corresponding to the updated input point status in the target data transmission channel to the redundant PLC device, so that the redundant PLC device processes the target input point information to obtain the target output point information. At the level of data transmission, the arbiter updates the output point status of the target data transmission channel according to the target output point information from the redundant PLC device. Based on this, the complete consistency between the input point status and the output point status of the target data transmission channel and the logical processing process and processing results of the redundant PLC device is ensured, and the real-time, accuracy, and stability of the data interaction between the redundant PLC device and external devices are ensured.

[0066] In an exemplary embodiment, if the redundant PLC device detects that the main PLC device is in an abnormal state through the status information, before the arbiter disconnects the data transmission channel and establishes the target data transmission channel between the redundant PLC device and the external device, the method further includes one of step S601 to step S602.

[0067] Step S601, if the redundant PLC device detects that the data content corresponding to the status information does not meet the preset data verification condition, it means that the redundant PLC device detects that the main PLC device is in an abnormal state through the status information.

[0068] Among them, the data verification condition represents a set of predefined rules or standards for verifying and judging the status information sent by the main PLC device to determine whether the operation status of the main PLC device is normal.

[0069] Exemplarily, first, the redundant PLC device extracts the field contents in the status information, such as the device operation status, program execution status, input / output status, and heartbeat signal of the main PLC device; furthermore, the redundant PLC device compares these field contents with preset data verification conditions, such as checking whether the heartbeat signal conforms to the expected time interval, whether the input / output point status is within a reasonable range, and whether the program execution status shows normal operation. If it is detected that any one of these fields does not meet the preset data verification conditions, such as a delayed or missing heartbeat signal, an abnormal input point status, or a failed program execution, the redundant PLC device determines that the status information of the main PLC device does not meet the expectation, thereby confirming that the main PLC device is in an abnormal state.

[0070] Step S602, if the redundant PLC device does not receive the status information from the main PLC device within a preset number of consecutive program cycles, it means that the redundant PLC device detects that the main PLC device is in an abnormal state through the status information.

[0071] Exemplarily, first, the status signal represents heartbeat packet information. A communication cycle and an allowed maximum number of losses are preset for the transmission of the heartbeat packet information, where one communication cycle corresponds to one program cycle of the target program; the redundant PLC checks whether it receives the heartbeat packet information of the main PLC device in each communication cycle. If not, it records it as one loss; when the consecutive number of losses reaches or exceeds the preset value, the redundant PLC device officially determines that the main PLC device is in an abnormal state; for example, if the communication cycle is 10 milliseconds and the allowed number of losses set by the redundant PLC is 3 times, when the heartbeat packet information of the main PLC device is not received within 30 consecutive milliseconds, the redundant PLC device determines that the main PLC device is in an abnormal state.

[0072] Exemplarily, after the main PLC device is repaired, it sends normal heartbeat packet information to the redundant PLC device in each communication cycle; after the redundant PLC device receives the normal heartbeat packet information, it records it as one reception. When the consecutive number of receptions reaches or exceeds the preset value, the redundant PLC device determines that the main PLC device is in a repaired state.

[0073] In this embodiment, on the one hand, the status information of the main PLC device is verified through data verification conditions, so as to quickly detect the abnormal state of the main PLC device in the dimension of field verification; on the other hand, by detecting the transmission situation of the status information of the main PLC device in multiple consecutive program cycles, the abnormal state of the main PLC device is effectively detected, fully considering the short interruptions or occasional delays in the communication process, and by allowing limited loss of status information, false judgment caused by a single anomaly is avoided.

[0074] In an exemplary embodiment, until the redundant PLC device detects that the master PLC device is in a repaired state by re-obtaining the status information from the master PLC device, after the arbiter disconnects the target data transmission channel and re-establishes the data transmission channel between the master PLC device and the external device, the method further includes steps S701 to S702.

[0075] Step S701, within the historical period from when the data transmission channel is disconnected to when the target data transmission channel is disconnected, the master PLC device obtains the historical data received and processed by the redundant PLC device during the historical period, and obtains the master PLC device with the recovered data based on the historical data.

[0076] Among them, the historical data represents all the data sets related to the operation of the control system received and processed by the redundant PLC device during the period when the master PLC device fails and loses control authority, including the input point information received by the redundant PLC device, the output point information generated and sent by the redundant PLC device, the device operation status, program execution status, and input / output status and other operation status data during the operation of the redundant PLC device.

[0077] Exemplarily, the master PLC device in the repaired state sends a data synchronization request to the redundant PLC device. The redundant PLC device packs and organizes the input point information, processed output point information, and operation status data received during the failure of the master PLC device into historical data based on the data synchronization request, and transmits it to the master PLC device. After receiving these historical data, the master PLC device integrates the historical data into its own status information to ensure that the master PLC device has a complete and accurate record of all information in the control system, and eliminates the problem of data loss caused by the failure.

[0078] Optionally, the master PLC device in the abnormal state can detect its own hardware or software problems based on the built-in self-check and repair mechanism to repair its own failure; the master PLC device in the abnormal state can also read the device operation data recorded by the redundant PLC device in the initial stage of the failure to accurately locate the cause of the failure and perform targeted repair.

[0079] Step S702, the master PLC device with the recovered data generates an exception report information, and the exception report information includes the failure time, failure type, failure cause, and device operation data.

[0080] Among them, the exception report information represents a detailed record file generated by the master PLC device after the failure recovery according to the operation records and analysis results during the failure, and is used to reflect the occurrence, processing, and recovery process of the failure.

[0081] Exemplarily, first, the main PLC device extracts the fault time according to its own operation log to mark the time points when the fault occurs and is recovered; furthermore, the main PLC device analyzes the hardware state and software state during the fault to identify the fault type, such as communication interruption, module fault, or logic execution error, etc.; furthermore, the main PLC device further analyzes the original data and combines the historical data provided by the redundant PLC device to find the specific fault cause, such as device abnormality caused by power fluctuation, loss of sensor input signal, or program logic error, etc.; in addition, the main PLC device also organizes the device operation data such as input point information, output point information, and operation status data before the fault occurs, after the fault ends, or during the fault occurrence into a part of the exception report; the generated exception report information is stored in the operation logs of the main PLC device and the redundant PLC device and can be transmitted to the upper management system or maintenance personnel through the system interface for further fault analysis and system optimization. Further, the generation process of the exception report information can be jointly implemented by the main PLC device and the redundant PLC device, that is, the main PLC device and the redundant PLC device respectively generate corresponding exception report information based on their own existing data, and then integrate different exception report information to comprehensively obtain the exception report information corresponding to this exception event.

[0082] In this embodiment, on the one hand, by synchronizing the historical data of the redundant PLC device, the main PLC device can completely restore the device operation data during the fault after the fault is repaired, ensuring that the main PLC device seamlessly takes over the corresponding control authority from the redundant PLC device, guaranteeing the operation continuity and status consistency; on the other hand, by generating detailed exception report information, it provides comprehensive data support for the analysis, diagnosis, and maintenance of the fault, helps to quickly locate the root cause of the problem and optimize the system design, and improves the reliability and maintainability of the control system.

[0083] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are displayed in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, there is no strict order limit for the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.

[0084] Based on the same inventive concept, an embodiment of the present application further provides a device redundancy device based on a PLC device for implementing the device redundancy method based on a PLC device involved above. The solution provided by this device for solving problems is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the device redundancy device based on a PLC device provided below can refer to the limitations on the device redundancy method based on a PLC device in the above text, and will not be repeated here.

[0085] In an exemplary embodiment, as Figure 2 shown, a device redundancy device based on a PLC device is provided, including: an identification module 201, a connection module 202, a first detection module 203, and a second detection module 204, where: The identification module 201 is configured to determine the identified main PLC device and the identified redundant PLC device among the two PLC devices based on the differences in the device interfaces where the main PLC device is connected to the redundant PLC device; The connection module 202 is configured to establish a data transmission channel between the main PLC device and an external device based on the arbiter corresponding to the main PLC device. After the main PLC device receives and processes data based on the data transmission channel, update the status information of the main PLC device; The first detection module 203 is configured to send the status information of the main PLC device to the redundant PLC device. If the redundant PLC device detects that the main PLC device is in an abnormal state through the status information, the arbiter disconnects the data transmission channel and establishes a target data transmission channel between the redundant PLC device and the external device, so that the redundant PLC device receives and processes data; The second detection module 204 is configured to until the redundant PLC device detects that the main PLC device is in a repaired state through the status information from the main PLC device again, the arbiter disconnects the target data transmission channel and re - establishes the data transmission channel between the main PLC device and the external device.

[0086] In an exemplary embodiment, the connection module 202 is further configured to: based on the arbiter corresponding to the main PLC device, connect the input point line and the output point line of the main PLC device, and the input point line and the output point line of the expansion module corresponding to the main PLC device to the identified main PLC device respectively, to obtain a data transmission channel between the main PLC device and external devices; the first detection module 203 is further configured to: if the redundant PLC device detects that the main PLC device is in an abnormal state through status information, the arbiter receives a warning message from the redundant PLC device and disconnects the data transmission channel based on the warning message, and connects the input point line and the output point line of the main PLC device, and the input point line and the output point line of the expansion module corresponding to the main PLC device to the identified redundant PLC device respectively, to obtain a target data transmission channel between the redundant PLC device and external devices.

[0087] In an exemplary embodiment, the connection module 202 is further configured to: according to the target program loaded into the main PLC device, within each program cycle corresponding to the target program respectively, receive input point information from external devices through the data transmission channel, process the input point information based on the target program to obtain output point information, and transmit the output point information to external devices through the data transmission channel; after the current program cycle ends, update the status information of the main PLC device in the current program cycle according to the execution status of the current program cycle, and the execution status includes the device operation status, the program execution status, and the input / output status.

[0088] In an exemplary embodiment, the connection module 202 is further configured to: the main PLC device copies the target program to the redundant PLC device, so that the redundant PLC device synchronously loads the target program; according to the read request of the redundant PLC device, the main PLC device sends the input point information and the output point information of the current program cycle to the redundant PLC device, so that the redundant PLC device updates the stored input point information and output point information.

[0089] In an exemplary embodiment, the connection module 202 is further configured to: according to the updated input point status of the target data transmission channel, the arbiter sends the target input point information corresponding to the updated input point status to the redundant PLC device, so that the redundant PLC device processes the target input point information according to the target program to obtain target output point information; the arbiter receives the target output point information from the redundant PLC device, and updates the output point status of the target data transmission channel according to the target output point information, to obtain the updated output point status of the target data transmission channel.

[0090] In an exemplary embodiment, the first detection module 203 is further configured to: if the redundant PLC device detects that the data content corresponding to the status information does not meet the preset data verification condition, it indicates that the redundant PLC device detects that the main PLC device is in an abnormal state through the status information; if the redundant PLC device does not receive the status information from the main PLC device within a preset number of consecutive program cycles, it indicates that the redundant PLC device detects that the main PLC device is in an abnormal state through the status information.

[0091] In an exemplary embodiment, the device further includes a recovery module, which is configured to: within the historical period corresponding to the disconnection of the data transmission channel to the disconnection of the target data transmission channel, the main PLC device obtains the historical data received and processed by the redundant PLC device within the historical period, and obtains the main PLC device with the recovered data according to the historical data; the main PLC device with the recovered data generates an exception report information, and the exception report information includes the failure time, failure type, failure cause, and device operation data.

[0092] Each module in the above device redundancy device based on PLC devices can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor in the computer device in hardware form or independent of the processor, or stored in the memory in the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules.

[0093] In an exemplary embodiment, a computer device is provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in any of the above embodiments are implemented.

[0094] In an embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in any of the above embodiments are implemented.

[0095] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logic devices, data processing logics based on quantum computing, etc., without limitation.

[0096] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.

[0097] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation on the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims

1. A device redundancy method based on PLC equipment, characterized in that: The method comprises: Based on the difference of the device interface connected to the main PLC device and the redundant PLC device, determining the identified main PLC device and the identified redundant PLC device in the two PLC devices; Based on the arbitrator corresponding to the main PLC device, a data transmission channel between the main PLC device and an external device is established, and after the main PLC device receives and processes data based on the data transmission channel, the status information of the main PLC device is updated; Sending the status information of the main PLC device to the redundant PLC device, if the redundant PLC device detects that the main PLC device is in an abnormal state through the status information, the arbitrator disconnects the data transmission channel and establishes a target data transmission channel between the redundant PLC device and the external device, so that the redundant PLC device receives and processes data; Until the redundant PLC device detects that the main PLC device is in a repaired state by re-receiving status information from the main PLC device, the arbitrator disconnects the target data transmission channel and re-establishes the data transmission channel between the main PLC device and the external device.

2. The method according to claim 1, characterized in that The establishing of a data transmission channel between the main PLC device and an external device based on the arbitrator corresponding to the main PLC device includes: Based on the arbitrator corresponding to the main PLC device, the input point circuit and the output point circuit of the main PLC device and the input point circuit and the output point circuit of the expansion module corresponding to the main PLC device are respectively connected to the identified main PLC device to obtain a data transmission channel between the main PLC device and the external device; If the redundant PLC device detects through the status information that the main PLC device is in an abnormal state, the arbitrator disconnects the data transmission channel and establishes a target data transmission channel between the redundant PLC device and the external device, including: If the redundant PLC device detects that the main PLC device is in an abnormal state through the status information, the arbitrator receives the warning information from the redundant PLC device and disconnects the data transmission channel based on the warning information, and connects the input point line and the output point line of the main PLC device and the input point line and the output point line of the expansion module corresponding to the main PLC device to the identified redundant PLC device, so as to obtain the target data transmission channel between the redundant PLC device and the external device.

3. The method according to claim 1, characterized in that After the master PLC device receives and processes the data based on the data transmission channel, updating the status information of the master PLC device includes: According to the target program loaded into the main PLC device, in each program cycle respectively corresponding to the target program, input point information is received from the external device through the data transmission channel, the input point information is processed based on the target program to obtain output point information, and the output point information is transmitted to the external device through the data transmission channel; After the current program cycle ends, the status information of the main PLC device in the current program cycle is updated according to the execution status of the current program cycle, and the execution status includes the device operation status, program execution status and input and output status.

4. The method according to claim 3, characterized in that In each program cycle corresponding to the target program, before receiving input point information from the data transmission channel and processing the input point information based on the target program to obtain output point information, the method further includes: The main PLC device copies the target program to the redundant PLC device, so that the redundant PLC device synchronously loads the target program; After the current program cycle ends, it also includes: According to the read request of the redundant PLC device, the main PLC device sends the input point information and output point information of the current program cycle to the redundant PLC device, so that the redundant PLC device updates the stored input point information and output point information.

5. The method according to claim 4, characterized in that After the arbitrator disconnects the data transmission channel and establishes a target data transmission channel between the redundant PLC device and the external device, the method further includes: According to the updated input point state of the target data transmission channel, the arbitrator sends the target input point information corresponding to the updated input point state to the redundant PLC device, so that the redundant PLC device processes the target input point information according to the target program to obtain the target output point information; The arbitrator receives target output point information from the redundant PLC device, updates the output point status of the target data transmission channel according to the target output point information, and obtains the updated output point status of the target data transmission channel.

6. The method according to claim 1, characterized in that If the redundant PLC device detects that the main PLC device is in an abnormal state through the status information, the arbitrator disconnects the data transmission channel and establishes a target data transmission channel between the redundant PLC device and the external device, and further includes one of the following two steps: If the redundant PLC device detects that the data content corresponding to the status information does not meet the preset data verification condition, it means that the redundant PLC device detects that the main PLC device is in an abnormal state through the status information; If the redundant PLC device does not receive the status information from the main PLC device within a preset number of consecutive program cycles, it means that the redundant PLC device detects that the main PLC device is in an abnormal state through the status information.

7. The method according to claim 1, characterized in that The method further includes: until the redundant PLC device detects that the main PLC device is in a repaired state through the status information from the main PLC device, and then the arbitrator disconnects the target data transmission channel and re-establishes the data transmission channel between the main PLC device and the external device. During the historical period corresponding to the disconnection of the data transmission channel to the disconnection of the target data transmission channel, the main PLC device obtains the historical data received and processed by the redundant PLC device during the historical period, and obtains the main PLC device with restored data according to the historical data; The master PLC device whose data has been restored generates abnormal report information, and the abnormal report information includes fault time, fault type, fault cause and equipment operation data.

8. A device redundancy device based on a PLC device, characterized in that: The device comprises: An identification module, used for determining an identified main PLC device and an identified redundant PLC device in two PLC devices based on a difference in device interfaces connected to the main PLC device and the redundant PLC device; A communication module, configured to establish a data transmission channel between the main PLC device and an external device based on an arbitrator corresponding to the main PLC device, and to update the status information of the main PLC device after the main PLC device receives and processes data based on the data transmission channel; A first detection module is used to send the status information of the main PLC device to the redundant PLC device. If the redundant PLC device detects that the main PLC device is in an abnormal state through the status information, the arbitrator disconnects the data transmission channel and establishes a target data transmission channel between the redundant PLC device and the external device, so that the redundant PLC device receives and processes data; The second detection module is used for the arbitrator to disconnect the target data transmission channel and re-establish the data transmission channel between the main PLC device and the external device until the redundant PLC device detects that the main PLC device is in a repaired state through the status information from the main PLC device again.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.