A CANOPEN-based method for recovering from heart rhythm abnormalities

By implementing master station heartbeat error handling tasks and automated node status judgment in the CANopen protocol stack, the problem of slave station heartbeat abnormalities in the CANopen protocol stack was solved, an automated node recovery process was realized, and the system's autonomous recovery capability was improved.

CN119254821BActive Publication Date: 2025-12-02TIANJIN JINHANG COMP TECH RES INST
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411470869.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-21
Publication Date
2025-12-02
Estimated Expiration
2044-10-21

AI Technical Summary

Technical Problem

When faced with bus interference or hardware errors, the CANopen protocol stack can cause abnormal heartbeats from slave stations. Current technology can only provide error status through callback functions, which requires manual handling and lacks an automated error recovery mechanism.

Method used

By implementing the master site heartbeat error handling function, a heartbeat error handling task is created. The getNodeState function is used to determine the node status, and automated node operations are performed according to different statuses, such as querying, configuration, and status transitions. This includes using masterRequestNodeState, SDO operations, etc., to achieve automated node re-bringing.

Benefits of technology

It enables the automatic re-bringing of nodes without human intervention, improving the system's automation capabilities and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119254821B_ABST
    Figure CN119254821B_ABST
Patent Text Reader

Abstract

This invention discloses a method for recovering from heartbeat errors based on CANOPEN. The steps are as follows: S1: Implement the master_heartbeatError function for handling heartbeat errors, and assign its pointer to the heartbeatError pointer under the object dictionary pointer OD; S2: In the master_heartbeatError function, use the rt_thread_create function to create a heartbeat error handling task. After successful task creation, use the rt_thread_startup function to start the task; S3: Use the getNodeState function to obtain the current node state, with the node value nodeId as the parameter. Determine the obtained value and perform different processing based on different return states. This invention, by determining the node state in the standard CANOPEN protocol stack callback function and performing node operations based on the current node state, completes the node re-entry operation without manual intervention.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer control technology and relates to a method for recovering from abnormal heartbeats based on CANOPEN. Background Technology

[0002] CANopen communication is a communication method built on top of the CAN data link layer, and this communication method specifies relevant requirements for the application layer. The CANopen device model includes a communication section, an object dictionary, and an application section. The communication section includes PDO objects, SDO objects, and NMT objects. The object dictionary includes data types, communication objects, and application objects.

[0003] The advantages of the CANOPEN protocol include high efficiency, precise positioning, anti-interference, multi-functionality, ease of configuration, high efficiency in data transmission, flexible configuration and status query functions, open standards, high data security, and secure communication constraints. Summary of the Invention

[0004] (a) Technical problems to be solved

[0005] During the use of the CANopen protocol stack, errors occur when the master station fails to receive the slave station's heartbeat due to bus interference, hardware errors, or other reasons. The CANopen standard protocol stack only provides a callback function, which provides the error status via messages. After an error occurs, it can only be handled manually. This invention provides a CANOPEN heartbeat anomaly recovery method to further process errors.

[0006] (II) Technical Solution

[0007] To address the aforementioned technical problems, this invention provides a CANOPEN-based method for recovering from abnormal heartbeats, comprising the following steps:

[0008] S1: Implement the master_heartbeatError function to handle heartbeat errors, and assign this function pointer to the heartbeatError pointer under the object dictionary pointer OD.

[0009] S2 uses the rt_thread_create task creation function in the master_heartbeatError handler function to create a heartbeat error handling task. After the task is successfully created, the rt_thread_startup function is used to start the heartbeat error handling task.

[0010] S3: Use the getNodeState function to get the current node state. The function parameter is the node value nodeId. Determine the value and perform different processing based on different return states. The processing period is the heartbeat consumption time CONSUMER_HEARTBEAT_TIME.

[0011] Different return states require different handling, including the following five scenarios:

[0012] S31: If the node state value is unknown_state, use the masterRequestNodeState function to query the node state. This function sends a node guardian request command to force the query. The query result is updated in the system state. The next time the getNodeState function is called, the latest state can be obtained.

[0013] S32: If the node status is Disconnected, use the masterRequestNodeState function to query the node status. This function sends a node daemon request command to force the query, and the query result is updated in the system status. The next time the getNodeState function is called, the latest status can be obtained.

[0014] S33: If the node state is Pre_operational, then perform producer heartbeat recovery processing, as follows:

[0015] S33_1 uses the getState function to determine if the main station is in a stopped state; otherwise, it exits the operation. It then checks if the producer heartbeat time (ProducerHeartBeatTime) is not 0 and uses the SetAlarm function to set the timer to ProducerHeartBeatTime. The timer callback function is the heartbeat generation function ProducerHeartbeatAlarm. The setState function then sets the main station state to the operation state (Operational).

[0016] S33_2 sets the node to the started state by calling the masterSendNMTstateChange function of the master station to send the NMT state change.

[0017] S33_3 configures the node, using SDO operations to write data to slave index 0x6040, and to clear data from sub-index 0 if the slave fails. SDO is used to configure the node parameters one by one.

[0018] S34: If the node state is Initialisation, it indicates the power-on process after the node was powered off. Repeat step S3 to continue the judgment.

[0019] S35: If the node state is Operational, repeat step S3 to continue the judgment.

[0020] (III) Beneficial Effects

[0021] The above-mentioned technical solution provides a CANOPEN heartbeat anomaly recovery method that determines the node status in the standard CANOPEN protocol stack callback function and performs node operations based on the current node status, thus completing the node re-online operation without the need for manual intervention. Attached Figure Description

[0022] Figure 1 This is a flowchart of the CANOPEN-based heartbeat abnormality recovery method of the present invention. Detailed Implementation

[0023] To make the objectives, contents, and advantages of the present invention clearer, the specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples.

[0024] Reference Figure 1 As shown, the CANOPEN-based heartbeat abnormality recovery method in this embodiment includes the following steps:

[0025] S1: Implement the master_heartbeatError function to handle heartbeat errors, and assign this function pointer to the heartbeatError pointer under the object dictionary pointer OD.

[0026] S2 uses the rt_thread_create task creation function in the master_heartbeatError handler function to create a heartbeat error handling task. After the task is successfully created, the rt_thread_startup function is used to start the heartbeat error handling task.

[0027] S3: Use the getNodeState function to get the current node state. The function parameter is the node value nodeId. Determine the value and perform different processing based on different return states. The processing period is the heartbeat consumption time CONSUMER_HEARTBEAT_TIME.

[0028] Different return states require different handling, including the following five scenarios:

[0029] S31: If the node state value is unknown_state, use the masterRequestNodeState function to query the node state. This function sends a node guardian request command to force the query. The query result is updated in the system state. The next time the getNodeState function is called, the latest state can be obtained.

[0030] S32: If the node status is Disconnected, use the masterRequestNodeState function to query the node status. This function sends a node daemon request command to force the query, and the query result is updated in the system status. The next time the getNodeState function is called, the latest status can be obtained.

[0031] S33: If the node state is Pre_operational, then perform producer heartbeat recovery processing, as follows:

[0032] S33_1 uses the getState function to determine if the main station is in a stopped state; otherwise, it exits the operation. It then checks if the producer heartbeat time (ProducerHeartBeatTime) is not 0 and uses the SetAlarm function to set the timer to ProducerHeartBeatTime. The timer callback function is the heartbeat generation function ProducerHeartbeatAlarm. The setState function then sets the main station state to the operation state (Operational).

[0033] S33_2 sets the node to the started state by calling the masterSendNMTstateChange function of the master station to send the NMT state change.

[0034] S33_3 configures the node, using SDO operations to write data to slave index 0x6040, and to clear data from sub-index 0 if the slave fails. SDO is used to configure the node parameters one by one.

[0035] S34: If the node state is Initialisation, it indicates the power-on process after the node was powered off. Repeat step S3 to continue the judgment.

[0036] S35: If the node state is Operational, repeat step S3 to continue the judgment.

[0037] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for recovering from abnormal heartbeats based on CANOPEN, characterized in that, Includes the following steps: S1: Implement the master_heartbeatError function to handle heartbeat errors, and assign this function pointer to the heartbeatError pointer under the object dictionary pointer OD; S2 uses the rt_thread_create task creation function in the master_heartbeatError handler function to create a heartbeat error handling task. After the task is successfully created, the rt_thread_startup function is used to start the heartbeat error handling task. S3: Use the getNodeState function to get the current node state. The function parameter is the node value nodeId. Determine the value obtained and perform different processing based on different return states. In step S3, if the node state is Pre_operational, then the producer heartbeat recovery process is performed. In step S3, the process of restoring the producer's heartbeat is as follows: S33_1 uses the getState function to determine if the main station status is stopped; otherwise, it exits the operation. It then checks if the producer heartbeat time ProducerHeartBeatTime is not set to 0, and uses the SetAlarm function to set the timer to ProducerHeartBeatTime. The timer callback function is the heartbeat generation function ProducerHeartbeatAlarm. Finally, it uses the setState function to set the main station status to Operational. S33_2 sets the node to the started state by calling the masterSendNMTstateChange function sent by the master station to send the NMT state change. S33_3 configures the node, writes data to slave index 0x6040 via SDO operation, writes data to sub-index 0 at 0x80, clears the slave failure, and uses SDO to configure the node parameters one by one.

2. The CANOPEN-based heartbeat abnormality recovery method as described in claim 1, characterized in that, In step S3, the processing cycle is the heartbeat consumption time CONSUMER_HEARTBEAT_TIME.

3. The CANOPEN-based heartbeat abnormality recovery method as described in claim 2, characterized in that, In step S3, if the node state value is an unknown state (Unknown_state), the masterRequestNodeState function is used to query the node state. This function sends a node guardian request command to force the query, and the query result is updated in the system state. The next time the getNodeState function is called, the latest state is obtained.

4. The CANOPEN-based heartbeat abnormality recovery method as described in claim 2, characterized in that, In step S3, if the node status is Disconnected, the masterRequestNodeState function is used to query the node status. This function sends a node guardian request command to force the query, and the query result is updated in the system status. The getNodeState function is called next time to get the latest status.

5. The CANOPEN-based heartbeat abnormality recovery method as described in claim 2, characterized in that, In step S3, if the node state is Initialisation, it indicates that the node is in the power-on process after being powered off. Step S3 is repeated to continue the judgment.

6. The CANOPEN-based heartbeat abnormality recovery method as described in claim 2, characterized in that, In step S3, if the node state is Operational, then step S3 is repeated to continue the judgment.

Citation Information

Patent Citations

  • Train network data transmission method, system and device based on CANopen protocol

    CN109104349A

  • A CANopen mast and slave station reliability control method and an overall manager thereof

    CN109245979A