Communication state detection method and device, terminal equipment and storage medium

By performing data verification and error accumulation time determination between the backplane bus and the communication expansion card, the interference and fault problems of multi-level communication interfaces in industrial control systems are solved, thereby improving the stability and maintenance efficiency of the system.

CN121842048APending Publication Date: 2026-04-10SHENZHEN UNIMAT AUTOMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-22
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

The complex environment of industrial sites makes it easy for the analog output signals of programmable logic controllers (PLCs) to malfunction, affecting the stability and reliability of the control system. Existing technologies are unable to effectively handle interference and faults in multi-level communication interfaces.

Method used

By performing initial data verification between the backplane bus and the communication expansion card, and combining different disconnection diagnosis strategies, the system uses data verification and error accumulation time to accurately locate communication faults and avoid misjudgments.

Benefits of technology

It improves the stability and maintenance efficiency of industrial control systems, avoids malfunctions caused by momentary interference or data jitter, and achieves efficient and accurate communication status monitoring.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121842048A_ABST
    Figure CN121842048A_ABST
Patent Text Reader

Abstract

The invention is suitable for the technical field of industrial automation, and provides a communication state detection method and device, terminal equipment and a storage medium, and the method comprises the steps: carrying out the first data verification of a first data frame transmitted between a backboard bus and a plurality of communication expansion cards, and performing first communication verification on the communication state between the backplane bus and the plurality of communication expansion cards. And when the first communication verification error duration accumulatively reaches a first preset time period, determining that the communication state between the backboard bus and the plurality of communication expansion cards is communication failure. And then, when second data verification on second data frames transmitted between the plurality of communication expansion cards and the corresponding input and output expansion cards is passed and the situation that the exchange of the second data frames fails accumulatively reaches a second preset time period, determining that the communication state between the plurality of communication expansion cards and the corresponding input and output expansion cards is communication failure. The error action of the analog output signal of the industrial controller can be avoided.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of industrial automation, and particularly relates to a communication state detection method and device, a terminal device, and a storage medium. BACKGROUND

[0002] In an industrial automation control system, a processor (CPU) of a programmable logic controller (PLC) drives an actuator through an analog output signal to achieve precise control over an industrial process.

[0003] However, the industrial field environment is complex, and there are various electromagnetic interference sources and communication interface faults. These interferences and faults can cause the analog output signal to malfunction, thereby affecting the stability and reliability of the control system. SUMMARY

[0004] The embodiments of the present application provide a communication state detection method, device, terminal device, storage medium, and equipment, which can solve the technical problem that the analog output signal of an industrial controller is prone to malfunction due to the complex industrial field environment and various electromagnetic interference sources and multi-stage communication interface faults.

[0005] In a first aspect, the embodiments of the present application provide a communication state detection method. A processor in an industrial controller establishes a first communication connection between a backplane bus and a plurality of communication expansion cards. Each of the communication expansion cards establishes a second communication connection with a corresponding input / output expansion card. The method comprises the following steps. When a first data frame transmitted between the backplane bus and the plurality of communication expansion cards passes a first data check, a first communication check is performed on a communication state between the backplane bus and the plurality of communication expansion cards. When the first communication check between the backplane bus and the plurality of communication expansion cards is wrong for a first preset time period, it is determined that the communication state between the backplane bus and the plurality of communication expansion cards is communication failure. When it is determined that the communication state between the backplane bus and the plurality of communication expansion cards is communication valid, and when a second data frame transmitted between the plurality of communication expansion cards and the corresponding input / output expansion cards passes a second data check, and when the second data frame exchange between the corresponding input / output expansion card and the communication expansion card fails for a second preset time period, it is determined that the communication state between the plurality of communication expansion cards and the corresponding input / output expansion cards is communication failure.

[0006] In a possible implementation manner of the first aspect, when it is determined that the communication state between the backplane bus and the plurality of communication expansion cards is communication valid, the method comprises the following steps. performing a second data check on second data frames transmitted between the plurality of communication expansion cards and the corresponding input / output expansion cards; in a case where the second data check passes, determining whether second data frame exchange between the corresponding input / output expansion card and the communication expansion card succeeds every third preset time period; in a case where second data frame exchange between the corresponding input / output expansion card and the communication expansion card fails, accumulating a second preset time period, and determining that communication between the plurality of communication expansion cards and the corresponding input / output expansion cards is communication failure; in a case where second data frame exchange between the corresponding input / output expansion card and the communication expansion card succeeds, determining that communication between the plurality of communication expansion cards and the corresponding input / output expansion cards is communication success.

[0007] In a possible implementation of the first aspect, a priority of the first communication check between the backplane bus and the communication expansion card is higher than a priority of the second communication check between the communication expansion card and the input / output expansion card.

[0008] In a possible implementation of the first aspect, in a case where it is determined that communication between the backplane bus and the plurality of communication expansion cards is communication failure, the method comprises: stopping the processor, stopping and initializing processing of the plurality of communication expansion cards, and performing output reset operation and configuration reset operation on the corresponding input / output expansion card.

[0009] In a possible implementation of the first aspect, in a case where it is determined that communication between the backplane bus and the plurality of communication expansion cards is communication success, and communication between the plurality of communication expansion cards and the corresponding input / output expansion cards is communication failure, the method comprises: performing output reset operation on the corresponding input / output expansion card.

[0010] In a possible implementation of the first aspect, in a case where it is determined that communication between the backplane bus and the plurality of communication expansion cards is communication success, and communication between the plurality of communication expansion cards and the corresponding input / output expansion cards is communication failure, the method comprises: if communication between the communication expansion card and the corresponding input / output expansion card returns to normal, immediately resuming output behavior of the corresponding input / output expansion card.

[0011] In a possible implementation of the first aspect, the method comprises: In a case where a cumulative number of times of second data frame exchange failures between the corresponding input / output expansion card and the communication expansion card does not reach the second preset time period, the input / output expansion card will maintain output of a last second data frame.

[0012] In a second aspect, an embodiment of the present application provides a communication state detection device, a processor in an industrial controller establishes a first communication connection between the processor and a plurality of communication expansion cards through a backplane bus, and each of the communication expansion cards establishes a second communication connection with a corresponding input / output expansion card, and the device comprises: A first verification module is configured to perform first data verification on first data frames transmitted between the backplane bus and the plurality of communication expansion cards, and perform first communication verification on a communication state between the backplane bus and the plurality of communication expansion cards in a case where the first data verification passes. A first determination module is configured to determine that the communication state between the backplane bus and the plurality of communication expansion cards is communication failure in a case where a first communication verification error duration between the backplane bus and the plurality of communication expansion cards accumulates to a first preset time period. A second determination module is configured to determine that the communication state between the plurality of communication expansion cards and the corresponding input / output expansion cards is communication failure in a case where it is determined that the communication state between the backplane bus and the plurality of communication expansion cards is communication effective, and a second data verification on second data frames transmitted between the plurality of communication expansion cards and the corresponding input / output expansion cards passes, and a cumulative number of times of second data frame exchange failures between the corresponding input / output expansion card and the communication expansion card reaches a second preset time period.

[0013] In a third aspect, an embodiment of the present application provides a terminal device, which comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the communication state detection method of any one of the above aspects when executing the computer program.

[0014] In a fourth aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executable on a processor to implement the communication state detection method of any one of the above aspects.

[0015] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a terminal device, causes the terminal device to execute the communication state detection method of any one of the above first aspects.

[0016] Compared with the prior art, the embodiment of the present application has the following beneficial effects: The embodiment of the present application provides a communication state detection method, which comprises the following steps: when first data verification passes on a first data frame transmitted between a backplane bus and a plurality of communication expansion cards, first communication verification is performed on a communication state between the backplane bus and the plurality of communication expansion cards. When a first communication verification error duration between the backplane bus and the plurality of communication expansion cards accumulates to a first preset time period, it is determined that the communication state between the backplane bus and the plurality of communication expansion cards is communication invalid. When the communication state between the backplane bus and the plurality of communication expansion cards is determined to be communication valid, and when second data verification passes on a second data frame transmitted between the plurality of communication expansion cards and corresponding input / output expansion cards, and a second data frame exchange failure between the corresponding input / output expansion cards and the communication expansion cards accumulates to a second preset time period, it is determined that the communication state between the plurality of communication expansion cards and the corresponding input / output expansion cards is communication invalid. The method adopts different line break diagnosis strategies between the backplane bus and the communication expansion card and between the communication expansion card and the input / output expansion card, so that accurate positioning of faults is realized. Meanwhile, through the triple verification of data verification, communication verification and error duration judgment, misjudgment of the communication state caused by instantaneous interference or data jitter is avoided, so that the system stability and the maintenance efficiency are improved. BRIEF DESCRIPTION OF DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.

[0018] Figure 1 is a flow diagram of a communication state detection method provided by an embodiment of the present application; Figure 2 is a schematic diagram of a connection structure among a processor, a communication expansion card and an input / output expansion card provided by an embodiment of the present application; Figure 3 is a detection flow diagram of a communication state between a backplane bus and a plurality of communication expansion cards provided by an embodiment of the present application; Figure 4 is a detection flow diagram of a communication state between a communication expansion card and a corresponding input / output expansion card provided by an embodiment of the present application; Figure 5 is a process diagram of communication between a communication expansion card and a corresponding input / output expansion card provided by an embodiment of the present application; Figure 6is a structural schematic diagram of a communication state detection apparatus provided by an embodiment of the present application; Figure 7 is a structural schematic diagram of a terminal device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0019] In the following description, for the purposes of explanation and not limitation, specific details are set forth, such as particular system configurations, techniques, etc., in order to provide a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known methods, devices, circuits, and

[0020] It should be understood that the term "comprises" when used in this specification and the appended claims indicates the presence of the described features, integers, steps, operations, elements, and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.

[0021] It should also be understood that the term "and / or" when used in this specification and the appended claims indicates that the associated listed items can be present one or more of the associated listed items, and that the items are not limited to only one of the associated listed items.

[0022] As used in this specification and the appended claims, the term "if" can be interpreted as meaning "when," or "upon," or "in response to determining," or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [a described condition or event] is detected" can be interpreted to mean "upon determining," or "in response to determining," or "upon detecting [the described condition or event]," or "in response to detecting [the described condition or event]," depending on the context.

[0023] In addition, in the description of the specification and the appended claims, the terms "first," "second," "third," etc. are used only to distinguish descriptions, and cannot be understood as indicating or implying relative importance.

[0024] Reference within the specification of this application to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. The appearances of the phrase "in one embodiment" or "in some embodiments" in various places within specified descriptions in this specification are not necessarily all referring to the same embodiment, however, can mean one or more but not all embodiments. The terms "including," "comprising," "featuring," and variations thereof are meant to encompass the items listed thereafter and equivalents thereof as well as additional items. Unless otherwise noted, the terms "including" and "comprising" are used in an inclusive sense, and should be understood as meaning "including, but not limited to."

[0025] In an industrial automation control system, the processor (CPU) of a programmable logic controller (PLC) drives an actuator through an analog output signal to achieve precise control of an industrial process. However, the industrial field environment is complex, and there are various sources of electromagnetic interference and communication interface failures. These interferences and failures can cause the analog output signal to malfunction, thereby affecting the stability and reliability of the control system.

[0026] Existing technical solutions mainly focus on interference and failure handling of a single interface, and there are still deficiencies in the comprehensive handling of multi-level communication interfaces. Therefore, there is an urgent need for a more perfect handling method to solve this problem. The current mainstream handling method for malfunctions caused by strong interference or communication interface connection problems is to do nothing or reset immediately. After resetting, the device does not power on and does not reconnect.

[0027] To this end, the present application provides a communication state detection method for avoiding malfunctions of industrial controller analog output signals caused by multi-level communication interface interference and failure, to improve the reliability and stability of the control system.

[0028] Please refer to Figure 1 , Figure 1 is a flowchart of a communication state detection method provided by an embodiment of the present application. By way of example and not limitation, the method can be applied to or run in a terminal device. The terminal device can be an industrial controller, and the processor in the industrial controller establishes a first communication connection between the backplane bus and multiple communication expansion cards, and a second communication connection between each communication expansion card and a corresponding input / output expansion card. The method comprises: S11, when the first data frame transmitted between the backplane bus and the multiple communication expansion cards passes the first data check, performing first communication check on the communication state between the backplane bus and the multiple communication expansion cards.

[0029] S12, in a case that the first communication check error duration accumulation between the backplane bus and the plurality of communication expansion cards reaches a first preset time period, it is determined that the communication state between the backplane bus and the plurality of communication expansion cards is communication failure.

[0030] S13, in a case that the communication state between the backplane bus and the plurality of communication expansion cards is determined to be communication valid, and in a case that the second data frame transmitted between the plurality of communication expansion cards and the corresponding input / output expansion card passes the second data check, and the second data frame exchange between the corresponding input / output expansion card and the communication expansion card fails, and the case accumulates to a second preset time period, it is determined that the communication state between the plurality of communication expansion cards and the corresponding input / output expansion card is communication failure.

[0031] It should be noted that the industrial controller is a device for industrial automation control, such as a programmable logic controller (PLC). Generally, the industrial controller can include a processor (CPU), an expansion card (communication expansion card, input / output expansion card), etc. The processor is the core computing unit of the industrial controller, which is responsible for executing programs, processing data, controlling peripherals, etc., and also has basic input / output functions (limited in number). Due to the limited input / output capability of the processor, additional input / output expansion support is provided through the expansion card. Among them, the communication expansion card is a plug-in board that extends the communication capability of the industrial controller, which converts the processor instructions into a specific protocol format and communicates with the input / output expansion card. The input / output expansion card is an interface card that connects external devices (such as sensors, actuators, etc.), which is responsible for inputting and outputting analog signals and digital signals, such as receiving communication data from the communication expansion card and driving external devices, or collecting data feedback from external devices to the communication expansion card.

[0032] As shown in Figure 2 , Figure 2 is a schematic diagram of the connection structure between the processor, the communication expansion card and the input / output expansion card according to an embodiment of the present application. As shown in Figure 2 , the processor, the communication expansion card and the input / output expansion card in the industrial controller are connected according to Figure 2The processor is connected to the plurality of communication expansion cards through the backplane bus, that is, the processor is serially connected to the communication expansion card #0, the communication expansion card #1, the communication expansion card #2,..., the communication expansion card #N, the communication expansion card #0 is connected to the corresponding input / output expansion card #0, the communication expansion card #1 is connected to the corresponding input / output expansion card #1, the communication expansion card #2 is connected to the corresponding input / output expansion card #2, and the communication expansion card #N is connected to the corresponding input / output expansion card #N. The processor represents the upper and lower circuit boards in the processor, that is, the CPU single individual, the expansion card is split into a communication expansion card and an input / output expansion card, and the output part of the analog signal is executed by the input / output expansion card. The processor establishes a first communication connection between the processor and the plurality of communication expansion cards through the backplane bus. The backplane bus refers to a high-speed data bus inside the industrial controller, which is used to connect the processor and the plurality of communication expansion cards to realize data transmission and sharing. The first communication connection is a logical connection established between the processor and the plurality of communication expansion cards. In this embodiment, the first communication connection established between the processor and the plurality of communication expansion cards is a serial connection. A second communication connection is established between one communication expansion card and one corresponding input / output expansion card. Through the second communication connection, communication protocol conversion and data relay can be realized to ensure the flow of data between the external device and the processor.

[0033] The first data check and the second data check can be understood as verifying the integrity and correctness of the data frame (such as cyclic redundancy CRC check) to ensure that the data is not tampered with or damaged during transmission. In this embodiment, the first data check and the second data check can adopt a CRC check mode, such as a CRC32 check mode (i.e., a 32-bit cyclic redundancy check algorithm that generates a 32-bit check code) for the first data check and a CRC8 check mode (i.e., an 8-bit cyclic redundancy check algorithm that generates an 8-bit check code) for the second data check.

[0034] The first communication check and the second communication check can be understood as verifying the state of the communication connection to determine whether the communication link is active or has a fault. The first communication check verifies the state of the first communication connection established between the backplane bus and the plurality of communication expansion cards. The second communication check verifies the state of the second communication connection established between the plurality of communication expansion cards and the corresponding input / output expansion cards.

[0035] The first preset time period and the second preset time period are pre-set cumulative error duration thresholds. By setting the first preset time period and the second preset time period, it can be avoided that the communication failure is misjudged due to instantaneous interference, and the detection robustness is improved. In this embodiment, the first preset time period can be 500 ms, and the second preset time period can be 3 s. The specific values of the first preset time period and the second preset time period are not limited.

[0036] In some examples, the detection process of the communication state in the industrial controller is specifically: First, as shown in Figure 3 , Figure 3 is an embodiment of the present application provides a detection process diagram about the communication state between the backplane bus and the plurality of communication expansion cards. The processor performs first data verification (such as CRC32 verification) on the first data frame transmitted between the backplane bus and the plurality of communication expansion cards. If the first data verification is passed, the first communication verification (such as sending a heartbeat packet and waiting for a response, etc.) is further performed to verify whether the first communication connection is active. Among them, the first data frame is a data packet transmitted in the first communication connection, and the first data frame contains control instructions, state feedback or device data.

[0037] If the error duration of the first communication verification accumulates to reach the first preset time period (such as the accumulated verification error duration reaches 500ms), it is determined that the first communication connection has a fault, that is, the communication state between the backplane bus and the plurality of communication expansion cards is communication failure. Through this method, false positives caused by transient interference can be avoided, and the detection accuracy can be improved by accumulating the error duration.

[0038] It should be noted that in the case of passing the first data verification, the first data frame can be parsed every fourth preset time period to determine whether an update has occurred. If the parsed data is updated, the updated data is output; if the parsed data is not updated, the data is not updated. At the same time, in the case of not passing the first data verification, the data is not updated.

[0039] Then, as shown in Figure 4 , Figure 4 is an embodiment of the present application provides a detection process diagram about the communication state between the communication expansion card and the corresponding input and output expansion card. Figure 4 In the case of passing the first communication verification or the error duration of the first communication verification not accumulating to reach the first preset time period, it is determined that the communication state between the backplane bus and the plurality of communication expansion cards is communication effective, at this time, the second data frame transmitted between the plurality of communication expansion cards and the input and output expansion card is subjected to second data verification (such as CRC8 verification). Among them, the second data frame is a data packet transmitted in the second communication connection, and the second data frame contains control instructions, state feedback or device data.

[0040] In the case that the second data verification passes, it is checked whether the data exchange failure between the communication expansion card and the corresponding input / output expansion card occurs within a second preset time period (such as 3s continuously). Only the passing data verification and correct format of the second data frame can cause the update, that is, the data exchange between the communication expansion card and the corresponding input / output expansion card is successful. If the time length of the data exchange failure occurrence accumulates to the second preset time period, it is determined that the second communication connection has a fault, that is, the communication state between the communication expansion card and the corresponding input / output expansion card is communication failure.

[0041] It should be understood that the precise positioning of the fault is realized by adopting different disconnection diagnosis strategies between the backplane bus and the communication expansion card and between the communication expansion card and the input / output expansion card. Meanwhile, the three verification of the data verification, the communication verification, and the error accumulation time length judgment is adopted to avoid the misjudgment of the communication state caused by the instantaneous interference or the data jitter, so as to avoid the error action of the industrial controller analog output signal, and then the efficient and precise communication state monitoring can be realized, and the system stability and the maintenance efficiency are improved.

[0042] In a possible implementation, in the case that it is determined that the communication state between the backplane bus and the plurality of communication expansion cards is communication valid, the method comprises: The second data frame transmitted between the plurality of communication expansion cards and the corresponding input / output expansion cards is subjected to second data verification.

[0043] In the case that the second data verification passes, it is checked whether the data exchange failure between the communication expansion card and the corresponding input / output expansion card occurs within a second preset time period (such as 3s continuously). Only the passing data verification and correct format of the second data frame can cause the update, that is, the data exchange between the communication expansion card and the corresponding input / output expansion card is successful. If the time length of the data exchange failure occurrence accumulates to the second preset time period, it is determined that the second communication connection has a fault, that is, the communication state between the communication expansion card and the corresponding input / output expansion card is communication failure.

[0044] In the case that the second data frame exchange between the corresponding input / output expansion card and the communication expansion card fails and the time length accumulates to the second preset time period, it is determined that the communication state between the plurality of communication expansion cards and the corresponding input / output expansion cards is communication failure.

[0045] In the case that the second data frame exchange between the corresponding input / output expansion card and the communication expansion card is successful, it is determined that the communication state between the plurality of communication expansion cards and the corresponding input / output expansion cards is communication valid.

[0046] In some examples, in the case that it is determined that the communication state between the backplane bus and the plurality of communication expansion cards is communication failure, the communication connection failure processing of the processor and the communication expansion card is directly performed, and it is not necessary to judge the communication state between the communication expansion card and the input / output expansion card.

[0047] In the case that the communication state between the backplane bus and the plurality of communication expansion cards is determined to be communication valid, the communication state between the plurality of communication expansion cards and the corresponding input / output expansion cards is then determined. In this case, first, the second data frame transmitted between the plurality of communication expansion cards and the corresponding input / output expansion cards needs to be subjected to second data verification to ensure the integrity of the second data frame, so as to avoid misjudgment in the subsequent steps due to data errors, and to filter out data damage caused by transmission interference or hardware failure.

[0048] Then, in the case that the second data verification is passed, whether the second data frame transmitted between the corresponding input / output expansion card and the communication expansion card is exchanged successfully is determined every third preset time period. The third preset time period is a preset periodic detection interval time, such as detection once every 50 ms. Through periodic detection of data updates, the real-time performance and system load can be balanced, excessive resources can be avoided due to frequent detection, and the working state of the input / output expansion card can be monitored in real time, so as to avoid misjudgment of communication invalidity due to no data update (for example, the data may not change when the device is in a stationary state).

[0049] If the second data frame exchange between the corresponding input / output expansion card and the communication expansion card fails for a time period accumulated to a second preset time period (such as no data update for 3 s continuously), it can be determined that the communication state between the communication expansion card and the corresponding input / output expansion card is communication invalid. Through the accumulated time threshold, the instantaneous stagnation (such as temporary data change) and the continuous failure (such as card failure, power failure) can be distinguished, so as to improve the detection accuracy and avoid false positives. At this time, the communication expansion card and the corresponding input / output expansion card with communication invalidity can be quickly located and processed after the communication connection is invalid; and the communication expansion card and the corresponding input / output expansion card with communication validity can continue to run.

[0050] If the second data frame exchange between the corresponding input / output expansion card and the communication expansion card is successful every third preset time period, it can be determined that the communication state between the communication expansion card and the corresponding input / output expansion card is communication valid, the communication link is normal, and the system can continue to run.

[0051] It should be understood that by determining that the first communication connection is communication valid but the input / output expansion card does not update data within a preset time period, the second communication connection or the device can be quickly located to have a fault problem, so as to accurately locate the fault and reduce false positives.

[0052] In one possible implementation, the priority of the first communication verification between the backplane bus and the communication expansion card is higher than the priority of the second communication verification between the communication expansion card and the input / output expansion card.

[0053] That is, the first communication check between the backplane bus and the communication expansion card needs to be checked first, and only when the first communication check is passed, the second communication check between the communication expansion card and the input / output expansion card will be continued. Moreover, the bus communication needs to be guaranteed first to ensure that the control command is issued in time, and in the case of communication failure between the communication expansion card and the input / output expansion card, a short delay can be tolerated.

[0054] In a possible implementation, in a case where it is determined that the communication state between the backplane bus and the plurality of communication expansion cards is communication failure, the method comprises: stopping the processor, stopping and initializing the plurality of communication expansion cards, and performing output reset operation and configuration reset operation on the corresponding input / output expansion card.

[0055] In some examples, as Figure 3 In a case where it is determined that the communication state between the backplane bus and the plurality of communication expansion cards is communication failure, that is, when it is determined that there is a disconnection (including a physical interface disconnection) between the backplane bus and the plurality of communication expansion cards or the error duration accumulates to the first preset time period, the processor will be in a stopped state to avoid sending invalid instructions by the processor when the bus fails. In addition, the failed communication expansion card will be stopped and initialized to clear the potential mispositioning state and prepare for reconnection. At this time, the failed communication expansion card can also flash a diagnostic light to quickly locate the failed communication expansion card for the operator, and the diagnostic data can be queried by the upper computer. Meanwhile, the input / output expansion card corresponding to the failed communication expansion card will perform output reset operation and configuration reset operation. By performing output reset operation on the input / output expansion card, all output signals are set to a safe value to avoid residual dangerous actions of the device. At the same time, by performing configuration reset operation, the configuration is restored to the default parameters to prevent subsequent communication abnormalities caused by incorrect configuration.

[0056] It should be noted that once the determination that the communication state between the backplane bus and the plurality of communication expansion cards is communication failure occurs, the error will not be restored in the case where the processor is not re-powered, and the failed communication expansion card and the corresponding input / output expansion card will always display an error and be in a stopped state until the operator eliminates the problem and re-powers to restore.

[0057] If the timeout behavior caused by the error code due to interference does not exceed the first preset time period, the processor will record and count the error, and the operator can perform logical programming or observation by reading the error to ensure the safety of the entire system.

[0058] In a possible implementation, in a case where the communication state between the backplane bus and the plurality of communication expansion cards is determined to be communication valid, and the communication state between the plurality of communication expansion cards and the corresponding input / output expansion card is determined to be communication invalid, the method comprises: performing an output reset operation on the corresponding input / output expansion card.

[0059] In some examples, as Figure 4 indicated in the description, if the communication state between the backplane bus and the plurality of communication expansion cards is communication valid, but the communication state between part of the communication expansion cards and the corresponding input / output expansion card is communication invalid, the corresponding input / output expansion card performs an output reset operation, that is, stops outputting analog signals and resets to 0, but the configuration of the corresponding input / output expansion card will not be reset and will be refreshed after the communication is recovered. If the communication state between the communication expansion card and the corresponding input / output expansion card is recovered to normal, the output behavior of the corresponding input / output expansion card is immediately recovered. That is, the corresponding input / output expansion card immediately resumes the running state and immediately outputs analog signals.

[0060] In a possible implementation, the method comprises: In a case where the cumulative time of the second data frame exchange failure between the corresponding input / output expansion card and the communication expansion card does not reach the second preset time period, the input / output expansion card will maintain the output of the last second data frame.

[0061] For the communication invalidity caused by the communication expansion card and the corresponding input / output expansion card, if the cumulative time of the second data frame exchange failure between the corresponding input / output expansion card and the communication expansion card does not reach the second preset time period (for example, does not exceed 3 seconds), the analog signal output by the corresponding input / output expansion card will maintain the output value of the last correct data, that is, the last second data frame. At this time, the output value of the last correct data is maintained for 3 seconds, and the analog signal output is stopped after 3 seconds. However, at any time point, if the communication expansion card and the corresponding input / output expansion card resume communication, the analog signal output behavior is immediately recovered, avoiding misjudgment caused by interference.

[0062] It should be understood that, on the basis of optimizing the misoperation problem caused by interference and physical connection problems, the embodiments are intended to distinguish the different offline diagnosis strategies for the processor and the plurality of serially connected communication expansion cards and input / output expansion cards, further refine the possible causes of communication offline, and screen the severity level of offline through these verification methods. A tolerant strategy is adopted for slight problems (for example, second communication connection invalidity), and a strict strategy is adopted for serious problems (for example, first communication connection invalidity), thereby improving the safety and stability of multi-level communication applications.

[0063] It should be noted that, as Figure 5 indicated in the description,Figure 5 is a process diagram provided by an embodiment of the application for communication between the communication expansion card and the corresponding input / output expansion card. Figure 5 In the process, S21, the transceiving buffer is defined, that is, the buffer area for data receiving and sending is initialized. S22, the status register header 0x5A is filled. The header of the status register is filled with a specific identification value 0x5A, which is used to identify the beginning of the status data. S23, the status register is copied to the buffer. The value of the current status register is copied to the predefined transceiving buffer. S24, the data register byte sequence is exchanged and copied to the buffer. The byte sequence of the data in the data register is adjusted (such as the conversion between big-endian and little-endian), and then the processed data is copied to the buffer. S25, the null bytes are filled. That is, the necessary null bytes are filled in the buffer to meet the requirements of the data format or protocol. The above steps are packet assembly and construction of the sending data. Then, S26, the CRC is calculated, that is, the cyclic redundancy check calculation is performed on the data in the buffer, that is, the CRC8 value of the sending data is calculated, and the CRC8 value is placed at the end of the sending data. S27, the SPI exchanges data between the communication expansion card and the input / output expansion card. That is, the communication expansion card exchanges data with the corresponding input / output expansion card through the serial peripheral interface SPI, such as sending data to the communication expansion card and receiving response data from the communication expansion card. S28, the received data check is calculated. The data received through the SPI is checked, that is, the check value of the response data is checked to verify the correctness of the data. S29, the frame header is checked whether it is equal to 0x5A, and the checksum is calculated. The frame header of the response data is checked whether it is 0x5A, if the frame header does not match, S30, the bus disconnection judgment is set and the AO is set to be opened or disconnected, that is, the check fails, the timer is checked whether it is overdue, and if it is overdue, the output is cleared. If the frame header matches, the checksum is calculated to further verify the data, the verification is successful, the normal output is set, and the timer is set, S31, the configuration update flag is checked to determine whether there is a configuration update requirement. If S32, the configuration does not need to be updated, the flag is decremented, and the bus connection is set and the AO is set to the open state again. If S33, the configuration needs to be updated, the control register is updated. S34, the control register CB1 is checked whether it is equal to 0x01. That is, the specific bit CB1 of the control register is checked whether it is set to 0x01. If CB1 is not equal to 0x01, S35, the configuration register is reset and the configuration parsing is performed again. If CB1 is equal to 0x01, S36, the configuration register is updated. S37, the byte sequence is restored (exchanged), and the AO output buffer is updated. That is, the byte sequence of the data is adjusted, and the AO (analog output) buffer is updated. S38, the bus connection is established, and the AO is set to the open state to ensure that the system can normally output the analog signal.

[0064] It should be understood that the size of the serial number of each step in the above embodiment does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the application.

[0065] A communication state detection method corresponding to the above embodiment, Figure 6 The structure diagram of the communication state detection device provided by an embodiment of the application is shown, and only the parts related to the embodiments of the application are shown for ease of illustration.

[0066] Referring to Figure 6 In the communication state detection device 4 of the embodiment, the processor in the industrial controller establishes a first communication connection between the backplane bus and the plurality of communication expansion cards, and each communication expansion card establishes a second communication connection with the corresponding input / output expansion card, comprising: The first verification module 41 is configured to, in the case that the first data verification passes on the first data frame transmitted between the backplane bus and the plurality of communication expansion cards, perform first communication verification on the communication state between the backplane bus and the plurality of communication expansion cards.

[0067] The first determination module 42 is configured to, in the case that the first communication verification error duration between the backplane bus and the plurality of communication expansion cards accumulates to a first preset time period, determine that the communication state between the backplane bus and the plurality of communication expansion cards is communication failure.

[0068] The second determination module 43 is configured to, in the case that the communication state between the backplane bus and the plurality of communication expansion cards is determined to be communication effective, and in the case that the second data verification passes on the second data frame transmitted between the plurality of communication expansion cards and the corresponding input / output expansion cards, and the second data frame exchange between the corresponding input / output expansion card and the communication expansion card fails, accumulates to a second preset time period, determine that the communication state between the plurality of communication expansion cards and the corresponding input / output expansion card is communication failure.

[0069] Further, the communication state detection device 4 comprises: The second data verification module is configured to perform second data verification on the second data frame transmitted between the plurality of communication expansion cards and the corresponding input / output expansion card.

[0070] The second update judgment module is configured to, in the case that the second data verification passes, judge whether the input / output expansion card updates the second data frame every third preset time period.

[0071] The second communication invalidity determination submodule is configured to determine that the communication state between the plurality of communication expansion cards and the corresponding input / output expansion card is communication invalidity in a case where the second data frame exchange between the corresponding input / output expansion card and the communication expansion card fails for a second preset time period.

[0072] The second communication validity determination submodule is configured to determine that the communication state between the plurality of communication expansion cards and the corresponding input / output expansion card is communication validity in a case where the second data frame exchange between the corresponding input / output expansion card and the communication expansion card succeeds.

[0073] Further, the priority of the first communication verification between the backplane bus and the communication expansion card is higher than the priority of the second communication verification between the communication expansion card and the input / output expansion card.

[0074] Further, the communication state detection apparatus 4 comprises: The first invalidity processing module is configured to shut down the processor, shut down and initialize the plurality of communication expansion cards, and perform output reset operation and configuration reset operation on the corresponding input / output expansion card.

[0075] Further, the communication state detection apparatus 4 comprises: The second invalidity processing module is configured to perform output reset operation on the corresponding input / output expansion card.

[0076] Further, the communication state detection apparatus 4 comprises: The first recovery processing module is configured to immediately restore the output behavior of the corresponding input / output expansion card if the communication state between the communication expansion card and the corresponding input / output expansion card is restored to normal.

[0077] Further, the communication state detection apparatus 4 comprises: The data output processing module is configured to maintain the output of the last second data frame by the input / output expansion card in a case where the second data frame exchange between the corresponding input / output expansion card and the communication expansion card fails for less than a second preset time period.

[0078] It should be noted that the information interaction and execution process between the modules in the communication state detection apparatus 4 described above are based on the same concept as the method embodiments of the present application, and the specific functions and technical effects brought by the modules can be referred to the method embodiments part, which will not be described here.

[0079] The present application also provides a terminal device, as shown in Figure 7 The present application also provides a terminal device, as shown in Figure 7 The present application also provides a terminal device, as shown in Figure 7The terminal device 5 of this embodiment includes a memory 51, a processor 52, and a computer program stored in the memory 51 and executable on the processor 52, and the processor 52 implements the steps in any of the communication state detection method embodiments described above when executing the computer program.

[0080] The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the steps in the various method embodiments described above.

[0081] The computer program product, when executed on the mobile terminal, causes the mobile terminal to implement the steps in the various method embodiments described above.

[0082] The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the present application implements all or part of the processes in the above-mentioned embodiment methods, which can be completed by a computer program instructing related hardware. The computer program can be stored in a computer readable storage medium, and the computer program, when executed by a processor, can implement the steps in the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or some intermediate forms. The computer readable medium at least includes any entity or device capable of carrying the computer program code to the photographing device / terminal device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium. For example, U disk, mobile hard disk, magnetic disk or optical disk, etc.

[0083] In the above embodiments, the description of each embodiment has its own focus, and the parts not described or recorded in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0084] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in connection with the embodiments disclosed herein can be realized in electronic hardware, or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0085] In the embodiments provided by the present application, it should be understood that the disclosed apparatus / network device and method can be implemented in other manners. For example, the embodiments of the apparatus / network device described above are merely illustrative. For example, the division of the modules or units is merely logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between the units can be indirect couplings or communication connections through some interfaces, devices or units, and can be electrical, mechanical or in other forms.

[0086] The units described as separated components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e., can be located in one place or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purposes of the embodiments of the present application.

[0087] The above embodiments are merely used to describe the technical solutions of the present application, but not to limit the present application; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: the technical solutions recorded in the foregoing embodiments can still be modified, or some technical features can be replaced by equivalent replacements; and these modifications or replacements do not make the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A communication state detection method characterized by comprising: A processor in an industrial controller establishes a first communication connection between the processor and a plurality of communication expansion cards via a backplane bus, and each of the communication expansion cards establishes a second communication connection with a corresponding input / output expansion card, and the method comprises: performing a first data check on first data frames transmitted between the backplane bus and the plurality of communication expansion cards; when a first communication check error between the backplane bus and the plurality of communication expansion cards is accumulated for a first preset time period, determining that the communication state between the backplane bus and the plurality of communication expansion cards is communication failure; when it is determined that the communication state between the backplane bus and the plurality of communication expansion cards is communication valid, and when a second data check on second data frames transmitted between the plurality of communication expansion cards and the corresponding input / output expansion cards is passed, and the second data frame exchange between the corresponding input / output expansion card and the communication expansion card fails, and the case is accumulated for a second preset time period, determining that the communication state between the plurality of communication expansion cards and the corresponding input / output expansion cards is communication failure.

2. The communication state detection method according to claim 1, wherein when it is determined that the communication state between the backplane bus and the plurality of communication expansion cards is communication valid, the method comprises: performing a second data check on second data frames transmitted between the plurality of communication expansion cards and the corresponding input / output expansion cards; when the second data check is passed, determining whether the second data frame exchange between the corresponding input / output expansion card and the communication expansion card is successful every third preset time period; when the second data frame exchange between the corresponding input / output expansion card and the communication expansion card fails, and the case is accumulated for the second preset time period, determining that the communication state between the plurality of communication expansion cards and the corresponding input / output expansion cards is communication failure; when the second data frame exchange between the corresponding input / output expansion card and the communication expansion card is successful, determining that the communication state between the plurality of communication expansion cards and the corresponding input / output expansion cards is communication valid.

3. The communication state detection method according to claim 2, wherein The priority of the first communication check between the backplane bus and the communication expansion card is higher than the priority of the second communication check between the communication expansion card and the input / output expansion card.

4. The communication state detection method according to claim 3, wherein when it is determined that the communication state between the backplane bus and the plurality of communication expansion cards is communication failure, the method comprises: stopping the processor, stopping the plurality of communication expansion cards and initializing the process, and performing output reset operation and configuration reset operation on the corresponding input / output expansion card.

5. The communication state detection method according to claim 3, wherein when it is determined that the communication state between the backplane bus and the plurality of communication expansion cards is communication valid, and it is determined that the communication state between the plurality of communication expansion cards and the corresponding input / output expansion cards is communication failure, the method comprises: performing output reset operation on the corresponding input / output expansion card.

6. The communication state detection method according to claim 4, wherein In a case that the communication state between the backplane bus and the plurality of communication expansion cards is determined to be communication valid, and the communication state between the plurality of communication expansion cards and the corresponding input / output expansion cards is determined to be communication invalid, the method comprises: If the communication state between the communication expansion card and the corresponding input / output expansion card is restored to normal, the output behavior of the corresponding input / output expansion card is immediately resumed.

7. The communication state detection method of claim 2, wherein The method comprises: In a case that the second data frame exchange between the corresponding input / output expansion card and the communication expansion card fails, and the cumulative time of the second preset time period is not reached, the input / output expansion card will maintain the output of the last second data frame.

8. A communication state detection apparatus characterized by comprising: A processor in an industrial controller establishes a first communication connection between the backplane bus and a plurality of communication expansion cards, and a second communication connection between each of the communication expansion cards and a corresponding input / output expansion card, and the device comprises: A first verification module is configured to perform first data verification on a first data frame transmitted between the backplane bus and the plurality of communication expansion cards, and perform first communication verification on the communication state between the backplane bus and the plurality of communication expansion cards; A first determination module is configured to determine that the communication state between the backplane bus and the plurality of communication expansion cards is communication invalid when the cumulative time of the first communication verification error reaches a first preset time period; A second determination module is configured to determine that the communication state between the plurality of communication expansion cards and the corresponding input / output expansion cards is communication invalid when the communication state between the backplane bus and the plurality of communication expansion cards is determined to be communication valid, and the second data frame transmitted between the plurality of communication expansion cards and the corresponding input / output expansion cards is determined to pass the second data verification, and the cumulative time of the second preset time period is reached in a case that the second data frame exchange between the corresponding input / output expansion card and the communication expansion card fails.

9. A terminal device, comprising: The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method of any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the method of any one of claims 1 to 7.