Master-slave communication method of energy storage controller

By configuring the dial switch on the energy storage controller to set the master-slave identity and modifying the ModbusTcp message structure, the data consistency and control chaos in the coordinated work of multiple nodes is solved, and efficient data synchronization and system stability are achieved.

CN120455270APending Publication Date: 2025-08-08HONGZHENG ENERGY STORAGE (NANJING) DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510799339.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In the multi-node collaborative working scenario, existing energy storage controllers have problems such as weak data consistency, high latency, large resource consumption, and chaotic control. Especially in the edge MCU scenario, there is a lack of simple and efficient master-slave judgment and data synchronization methods.

Method used

By configuring a four-digit dial switch on the energy storage controller to set the master-slave identity and device address, modifying the ModbusTcp message structure, the main energy storage controller broadcasts the declared message regularly and detects network conflicts in real time, ensuring the single master status, and collecting and issuing control instructions.

Benefits of technology

It realizes unified management and control of energy storage systems, improves deployment convenience and reliability, ensures data consistency, reduces the risk of data loss caused by failures, reduces resource consumption, improves control efficiency and availability, and enhances the ability to perceive abnormal states.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120455270A_ABST
    Figure CN120455270A_ABST
Patent Text Reader

Abstract

The invention discloses a master-slave communication method for energy storage controllers, and belongs to the technical field of communication control, and the communication method specifically comprises the following steps: I, configuring the address and the master-slave identity of each energy storage controller, presetting six data acquisition points in each energy storage controller, and configuring an acquisition and forwarding point table; iI, performing customized transformation based on a Modbus Tcp protocol, and regularly broadcasting a declaration message to the whole network every minute by the main energy storage controller in a system operation process; iII, network detection is carried out in real time, if network conflicts exist, a telemetering value is set to be 2, and meanwhile, the main energy storage controller still continues to send a declaration message every minute; complex software configuration is avoided, convenience and reliability of field deployment are improved, data consistency is guaranteed, the risk of data loss caused by master node faults is reduced, delay is reduced, control efficiency is improved, usability is enhanced, resource consumption is reduced, meanwhile, the sensing capacity of abnormal master-slave states is improved, and control chaos caused by conflicts is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication control technology, and in particular to a master-slave communication method for an energy storage controller. Background Art

[0002] In the existing internet, master-slave replication is primarily used in scenarios where multiple nodes collaborate. The main methods used are: 1. Asynchronous replication; 2. Synchronous replication; 3. Log-based replication; 4. Consensus-based replication. However, existing common technical solutions have their own shortcomings. While suitable for cloud-based resource scenarios, these shortcomings are difficult to overcome or replace in edge MCU scenarios. A resource-efficient, simple, and efficient method for master-slave determination and data synchronization is needed. Among them, asynchronous replication is to return success immediately after the master node processes the write operation, and then asynchronously propagate the data changes to the slave nodes, but its disadvantage is weak data consistency, and the failure of the master node may cause data loss; synchronous replication is that the master node must wait for all slave nodes to confirm the success of the write before returning success to the client, but its disadvantage is high latency and reduced availability (any slave node failure will block the master node); log-based replication is that the master node records the operation to the log (such as MySQL's binlog and PostgreSQL's WAL) and the slave node replays the log, but its disadvantage is that log transmission may become a bottleneck; consensus algorithm-based replication is to elect the Leader node, and the log entry must be confirmed by the majority of nodes before it is submitted, but its disadvantage is that the election process consumes resources and the election process is relatively complicated; therefore, it is particularly important to invent a master-slave communication method for energy storage controllers. Summary of the Invention

[0003] The purpose of the present invention is to solve the defects in the prior art and to propose a master-slave communication method for an energy storage controller.

[0004] In order to achieve the above object, the present invention adopts the following technical solutions:

[0005] A master-slave communication method for an energy storage controller, the specific steps of the communication method are as follows:

[0006] Ⅰ. Configure the address and master-slave identity of each energy storage controller, preset 6 data collection points in each energy storage controller, and configure the collection and forwarding point table;

[0007] II. Customized transformation based on the Modbus TCP protocol. During system operation, the main energy storage controller broadcasts a declaration message to the entire network once every minute.

[0008] III. Perform real-time network detection. If a network conflict occurs, set the telemetry value to 2. Meanwhile, the main energy storage controller continues to send declaration messages every minute.

[0009] IV. When the network status returns to normal, the master energy storage controller regularly collects key data from each slave device at preset time intervals and issues control instructions in real time based on the strategy.

[0010] As a further solution of the present invention, the configuration of the collection and forwarding point table in step I is consistent with the Modbus standard protocol.

[0011] As a further solution of the present invention, the specific steps of configuring the addresses and master-slave identities of each energy storage controller in step I are as follows:

[0012] S1.1: Before each energy storage controller goes online, set the network identity information of each energy storage controller using a reserved four-position DIP switch. The first position on the DIP switch indicates the master-slave status, and the remaining three positions indicate the device address.

[0013] S1.2: When each energy storage controller is powered on, it reads the 4-bit state of the DIP switch through the hardware interface, converts it into a binary value, caches it into a system variable, and parses the master and slave identifiers and device addresses of each energy storage controller.

[0014] S1.3: According to the master-slave status set by the DIP switch, each energy storage controller loads the corresponding functional module.

[0015] As a further solution of the present invention, the specific steps of the customized transformation based on the ModbusTcp protocol described in step I are as follows:

[0016] S2.1: The basic frame structure of the ModbusTcp message is retained, and the first four bytes in the data frame are transformed into a dedicated field. The parsed master-slave identifier and device address are embedded into the transformed dedicated field.

[0017] S2.2: Based on the modified dedicated field, set the declaration message format broadcast by the main energy storage controller.

[0018] As a further solution of the present invention, the basic frame structure of the ModbusTcp message in S2.1 specifically includes a transaction identifier, a protocol identifier, a length field, a unit identifier, a function code and a data field;

[0019] The dedicated fields in S2.1 are specifically the first byte modified to the role identification field, the second byte modified to the device address, the third byte modified to the status field, and the fourth byte modified to the reserved field or extension flag.

[0020] As a further solution of the present invention, the declaration format broadcast by the master energy storage controller in S2.1 specifically includes the device unique ID or SN code, the current device timestamp, the master control status flag, and a reserved field for subsequent protocol upgrades.

[0021] In addition, it should be noted that when the energy storage controller receives a Modbus message with an extended field in the first four bytes, it first reads the first four bytes to identify the sender role and device address, then determines whether the current network status meets the single-master requirement. Then, based on the device identity and function code, it decides whether to continue processing the data field content. If it chooses to continue processing the data field content, special processing logic is triggered based on the status field or other extended fields.

[0022] As a further solution of the present invention, the specific steps of performing real-time network detection in step III are as follows:

[0023] S3.1: The master energy storage controller broadcasts a declaration message through the network every minute and monitors the declaration messages of other energy storage controllers in the network in real time.

[0024] S3.2: If the master energy storage controller receives a message from another energy storage controller within the monitoring period, and the role identification field in the message is master, or if the slave energy storage controller receives confirmation messages from multiple master energy storage controllers within 10 seconds, it means that there are multiple master energy storage controllers in the current network.

[0025] S3.3: When it is determined that there are multiple master energy storage controllers, the local telemetry value is immediately set to 2 to indicate that a master control conflict exists in the current network. During this conflict, the master energy storage controller continues to send declaration messages every minute and perform periodic detection.

[0026] S3.4: When the network status returns to normal, the telemetry values of the master and slave energy storage controllers are set to 0 or 1. When the network of the entire project returns to normal, the master energy storage controller regularly collects key data from the slave energy storage controllers at preset time intervals and issues control instructions in real time according to the strategy.

[0027] As a further solution of the present invention, the declaration message in S3.1 includes information such as the device address, role identification and timestamp, and the declaration message uses a modified ModbusTcp structure, and the message format complies with the interface design specification.

[0028] As a further solution of the present invention, when detecting master control conflicts and determining the source of a message in the network, other devices read the device address field in the message and compare it with their own addresses to determine whether it is the same device or different masters.

[0029] Compared with the prior art, the present invention has the following beneficial effects:

[0030] Before the energy storage controller is deployed, the master-slave identity and device address of each energy storage controller are set through a four-digit dial switch: the first digit is the master-slave identifier, and the last three digits are the address. After the energy storage controller is powered on, the dial status is read and the identity information is parsed, and the corresponding functional module is loaded. On the basis of retaining the basic structure of ModbusTcp, the first four bytes are modified to embed the master-slave identifier and address. The master energy storage controller broadcasts a declaration message every minute and monitors other declaration messages in the network at the same time. If multiple master controllers are detected, the telemetry value is set to 2, indicating that the master controller In the conflict state, the master control still broadcasts regularly for detection. After the network returns to normal, the telemetry value returns to 0 or 1. After the system stabilizes, the master control collects slave device data according to the set period and issues control instructions based on the strategy to achieve unified management and control of the energy storage system. This avoids complex software configuration, improves the convenience and reliability of on-site deployment, ensures data consistency, reduces the risk of data loss caused by master node failure, reduces latency, improves control efficiency, enhances availability, and reduces resource consumption. At the same time, it improves the ability to perceive abnormal master-slave states to avoid control chaos caused by conflicts. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention.

[0032] Figure 1 A flow chart of a master-slave communication method for an energy storage controller proposed by the present invention;

[0033] Figure 2 A communication structure diagram of a master-slave communication method for an energy storage controller proposed by the present invention;

[0034] Figure 3 A schematic diagram of the communication process of a master-slave communication method for an energy storage controller proposed by the present invention;

[0035] Figure 4 This is a master-slave operation framework diagram of the master-slave communication method for energy storage controllers proposed by the present invention. DETAILED DESCRIPTION

[0036] Reference Figure 1-4 , a master-slave communication method for energy storage controller, the specific steps of the communication method are as follows:

[0037] Configure the address and master-slave identity of each energy storage controller, preset 6 data collection points in each energy storage controller, and configure the collection and forwarding point table.

[0038] Specifically, before each energy storage controller goes online, a four-bit DIP switch is reserved to set the network identity information of each energy storage controller. The first bit on the DIP switch indicates the master-slave status, and the remaining three bits indicate the device address. When each energy storage controller is powered on, the four-bit status of the DIP switch is read through the hardware interface, converted into a binary value and cached into a system variable. The master-slave identification and device address of each energy storage controller are then parsed. Based on the master-slave identity set by the DIP switch, each energy storage controller loads the corresponding functional module.

[0039] It should be further explained that the main storage controller loads modules such as data collection management, broadcast announcements, and control; the slave storage controller only loads responsive modules, such as uploading data, receiving instructions, and replying to messages; and the identity of the device will not change dynamically after it is started, and the identity is fixed and determined by the dial setting.

[0040] Specifically, the basic frame structure of the ModbusTcp message is retained, and then the first four bytes in the data frame are transformed into a dedicated field. The parsed master-slave identifier and device address are embedded in the transformed dedicated field. Based on the transformed dedicated field, the declaration message format broadcast by the main energy storage controller is set; when used in non-special broadcast, control and other functional scenarios, standard ModbusTcp function codes are still supported.

[0041] It should be further explained that the configuration of the collection and forwarding point table is consistent with the Modbus standard protocol; the basic frame structure of the ModbusTcp message specifically includes a transaction processing identifier, a protocol identifier, a length field, a unit identifier, a function code, and a data field; the special fields are specifically the first byte modified to the role identification field, the second byte modified to the device address, the third byte modified to the status field, and the fourth byte modified to the reserved field or extension flag.

[0042] It should be further explained that the declaration format broadcast by the master energy storage controller specifically includes the device unique ID or SN code, the current device timestamp, the master control status flag, and a reserved field for subsequent protocol upgrades.

[0043] In addition, it should be noted that when the energy storage controller receives a Modbus message with an extended field in the first four bytes, it first reads the first four bytes to identify the sender role and device address, then determines whether the current network status meets the single-master requirement. Then, based on the device identity and function code, it decides whether to continue processing the data field content. If it chooses to continue processing the data field content, special processing logic is triggered based on the status field or other extended fields.

[0044] Customized based on the ModbusTcp protocol, the main energy storage controller broadcasts a declaration message to the entire network once a minute during system operation.

[0045] Perform real-time network detection. If a network conflict occurs, set the telemetry value to 2. Meanwhile, the main energy storage controller continues to send declaration messages every minute.

[0046] Specifically, the master energy storage controller broadcasts a declaration message through the network every minute and monitors the declaration messages of other energy storage controllers in the network in real time. If the master energy storage controller receives a message from other energy storage controllers within the monitoring period, and the role identification field in the message is master, or the slave energy storage controller receives confirmation messages from multiple master energy storage controllers within 10 seconds, it means that there are multiple master energy storage controllers in the current network. When it is determined that there are multiple master energy storage controllers, the local telemetry value is immediately set to 2 to indicate that there is a master control conflict state in the current network. At the same time, in the conflict state, the master energy storage controller continues to send declaration messages every minute and performs periodic detection. When the network status returns to normal, the telemetry values of the master energy storage controller and the slave energy storage controller are set to 0 or 1. When the network of the entire project returns to normal, the master energy storage controller regularly collects key data from the slave energy storage controllers at preset time intervals and issues control instructions in real time according to the strategy.

[0047] It should be further explained that the declaration message contains information such as the device address, role identifier, and timestamp, and the declaration message uses the modified ModbusTcp structure, and the message format complies with the interface design specifications.

[0048] In addition, it should be noted that when detecting master control conflicts and determining the source of messages in the network, other devices read the device address field in the message and compare it with their own address to determine whether it is the same device or different master devices.

[0049] When the network status returns to normal, the master energy storage controller regularly collects key data from each slave device at preset time intervals and issues control instructions in real time based on the strategy.

[0050] The working principle of the master-slave communication method of the energy storage controller is as follows: before the energy storage controller is deployed, the master-slave identity and device address of each energy storage controller are set through a four-digit dial switch: the first digit is the master-slave identifier, and the last three digits are the address. After the energy storage controller is powered on, it reads the dial status and parses the identity information, loads the corresponding functional module, and on the basis of retaining the basic structure of ModbusTcp, the first four bytes are modified to embed the master-slave identifier and address. The master energy storage controller broadcasts a declaration message every minute and monitors other declaration messages in the network at the same time. If multiple master controllers are detected, the telemetry value is set to 2, indicating a master control conflict. In the conflict state, the master controller still broadcasts regularly for detection. After the network returns to normal, the telemetry value returns to 0 or 1. After the system is stable, the master controller collects slave device data according to the set period and issues control instructions according to the strategy.

[0051] The above is a detailed description of an embodiment of the present invention. However, the content described is only a preferred embodiment of the present invention and should not be considered to limit the scope of the present invention. All equivalent changes and improvements made within the scope of the present invention should still fall within the scope of the patent coverage of the present invention.

Claims

1. A master-slave communication method for an energy storage controller, characterized in that: The specific steps of this communication method are as follows: Ⅰ. Configure the address and master-slave identity of each energy storage controller, preset 6 data collection points in each energy storage controller, and configure the collection and forwarding point table; II. Customized transformation based on the Modbus TCP protocol. During system operation, the main energy storage controller broadcasts a declaration message to the entire network once every minute. III. Perform real-time network detection. If a network conflict occurs, set the telemetry value to 2. Meanwhile, the main energy storage controller continues to send declaration messages every minute. IV. When the network status returns to normal, the master energy storage controller regularly collects key data from each slave device at preset time intervals and issues control instructions in real time based on the strategy.

2. A master-slave communication method for energy storage controller according to claim 1, characterized in that: The specific steps for configuring the addresses and master-slave identities of each energy storage controller in Step I are as follows: S1.1: Before each energy storage controller goes online, set the network identity information of each energy storage controller by reserving a four-position DIP switch. The first position on the DIP switch indicates the master-slave status, and the remaining three positions indicate the device address. S1.2: When each energy storage controller is powered on, it reads the 4-bit state of the DIP switch through the hardware interface, converts it into a binary value, caches it into a system variable, and parses the master and slave identifiers and device addresses of each energy storage controller. S1.3: According to the master-slave status set by the DIP switch, each energy storage controller loads the corresponding functional module.

3. A master-slave communication method for energy storage controller according to claim 2, characterized in that: The specific steps for customized transformation based on the ModbusTcp protocol described in Step I are as follows: S2.1: The basic frame structure of the ModbusTcp message is retained, and the first four bytes in the data frame are transformed into a dedicated field. The parsed master-slave identifier and device address are embedded into the transformed dedicated field. S2.2: Based on the modified dedicated field, set the declaration message format broadcast by the main energy storage controller.

4. The energy storage controller master-slave communication method according to claim 3, characterized in that: The basic frame structure of the ModbusTcp message described in S2.1 specifically includes a transaction identifier, a protocol identifier, a length field, a unit identifier, a function code, and a data field; The dedicated fields in S2.1 are specifically the first byte modified to the role identification field, the second byte modified to the device address, the third byte modified to the status field, and the fourth byte modified to the reserved field or extension flag.

5. The energy storage controller master-slave communication method according to claim 3, characterized in that: The specific steps for performing real-time network detection in step III are as follows: S3.1: The master energy storage controller broadcasts a declaration message through the network every minute and monitors the declaration messages of other energy storage controllers in the network in real time. S3.2: If the master energy storage controller receives a message from another energy storage controller within the monitoring period, and the role identification field in the message is master, or if the slave energy storage controller receives confirmation messages from multiple master energy storage controllers within 10 seconds, it means that there are multiple master energy storage controllers in the current network. S3.3: When it is determined that there are multiple master energy storage controllers, the local telemetry value is immediately set to 2 to indicate that a master control conflict exists in the current network. During this conflict, the master energy storage controller continues to send declaration messages every minute and perform periodic detection. S3.4: When the network status returns to normal, the telemetry values of the master and slave energy storage controllers are set to 0 or 1. When the network of the entire project returns to normal, the master energy storage controller regularly collects key data from the slave energy storage controllers at preset time intervals and issues control instructions in real time according to the strategy.

6. The energy storage controller master-slave communication method according to claim 5, characterized in that: The declaration message described in S3.1 contains information such as the device address, role identifier, and timestamp, and the declaration message uses the modified ModbusTcp structure. The message format complies with the interface design specifications.