A low-voltage interconnection system software detection and active-standby switching method
By establishing a shared memory area and heartbeat message mechanism in the low-voltage interconnect system, the problem of the smart terminal being unable to detect the operating status of the main terminal in real time was solved, and the stable switching of the main and backup nodes and system data synchronization were realized, ensuring the stable operation of the system and the efficiency of data synchronization.
Patent Information
- Application Number
- CN202511454802.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-13
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2045-10-13
AI Technical Summary
In low-voltage interconnected systems, smart terminals cannot detect the operating status of the main terminal and whether the software is online in real time. This causes the system to enter a disconnected state when the control micro-application goes offline or the terminal fails, and thus cannot operate normally.
In a low-voltage interconnected system, each distribution area is equipped with a distribution area intelligent terminal, which establishes a shared memory area to store system operation status data. The status of the primary and backup nodes is determined through heartbeat messages, and the primary and backup nodes are selected to run according to preset priorities. The primary node collects data and stores it in the shared memory area, while the backup node receives and saves the changed data. Data synchronization is performed using TCP point-to-point transmission and UDP broadcast methods.
It enables real-time monitoring of the low-voltage interconnection system software, ensuring stable system operation during primary/standby switchover, and provides stable and unique multi-zone panoramic data for the upper-level platform, thereby improving the stability and operational optimization capabilities of the flexible interconnection system.
Smart Images

Figure CN120915651B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of low-voltage AC / DC hybrid power distribution and communication technology, and in particular to a method for software detection and master / slave switching in a low-voltage interconnected system. Background Technology
[0002] Low-voltage interconnection systems connect multiple AC distribution areas via flexible interconnection devices to achieve interconnection and mutual power supply between areas with complementary temporal and spatial load characteristics. This effectively improves the utilization rate of power distribution resources and reduces the cost of capacity expansion and deployment. Based on a cloud-edge-device collaborative control architecture, the system's energy management and coordinated control strategies are often deployed on the intelligent converged terminal of one distribution area. This terminal acts as the system's brain, enabling system control functions such as starting and stopping connected devices and power regulation. However, the intelligent terminals and devices in other distribution areas cannot know the current operating status of this "brain" or whether the software is online. When the control micro-application (APP) goes offline or the terminal itself malfunctions, the system enters a disconnected state and cannot operate normally. Therefore, to ensure stable and reliable system operation, it is necessary to monitor the operation of the main terminal and the built-in software APP in real time, and to provide a switching scheme for the system software when the "brain" malfunctions. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a method for software detection and primary / backup switching of low-voltage interconnection systems, which can detect the operation status of low-voltage interconnection system software in real time, while ensuring the stable operation of the system during primary / backup switching.
[0004] The technical solution adopted by this invention to solve its technical problem is: to provide a software detection and primary / backup switching method for a low-voltage interconnection system, wherein the low-voltage interconnection system includes multiple low-voltage distribution areas, each low-voltage distribution area is provided with a distribution area intelligent terminal, one distribution area intelligent terminal operates as a primary node, and the other distribution area intelligent terminals operate as backup nodes, the method is applied to each distribution area intelligent terminal, and includes the following steps:
[0005] A shared memory area is established to store system operating status data, which includes process running data of host nodes and operating status data of all low-voltage distribution areas in the low-voltage interconnection system.
[0006] Send heartbeat messages at set time intervals, and listen to the heartbeat messages of other smart terminals in the same area to determine the operating status of the primary and backup nodes;
[0007] Based on the current operating status of the primary and backup nodes and the preset node priority order, select whether to run the local machine as the primary node or as the backup node.
[0008] When running as the master node, it collects the system operating status data, stores it in the shared memory area, and sends the changed data to the standby node;
[0009] When running as a standby node, it receives the changed data sent by the master node and saves it to the shared memory area.
[0010] Furthermore, prior to the step of sending heartbeat messages at set time intervals, the method further includes:
[0011] Search host nodes;
[0012] If a master node exists, the local machine will be run as a standby node, and the system running status data will be obtained from the master node to initialize the shared memory area;
[0013] If no host node exists, the local machine will be run as the host node, and the system running status data will be obtained from the local machine configuration to initialize the shared memory area.
[0014] Furthermore, the acquisition of the system operating status data from the host node is performed using TCP point-to-point transmission; the heartbeat message and the change data are sent using UDP broadcast.
[0015] Furthermore, the shared memory area includes a record sequence number area, a record identifier area, a domain segment description area, and a data area, and is retrieved using a primary key value according to a relational database retrieval method. The primary key value includes views, objects, records, and domains.
[0016] Furthermore, initializing the shared memory area includes:
[0017] The acquired system operating status data is stored one by one into the shared memory area in the order of the view, the object, and the record;
[0018] Initialize the record, the record identifier area, and the field.
[0019] Furthermore, when the changed data is sent, it is achieved by sending the corresponding primary key value and domain segment data according to the domain segment description area used to identify the system operating status data that each view needs to synchronize.
[0020] Furthermore, the process execution data is collected through the following methods:
[0021] Obtain the running status data of each core process, and restart the core processes that have no records or are abnormal;
[0022] Obtain the running status data of each thread within the core process, and restart any abnormal threads;
[0023] The running status data of each core process and its thread after the restart is obtained as the process running data.
[0024] Furthermore, the abnormal thread is determined by the following method:
[0025] The thread that timed out during check-in within the core process is selected as the target thread.
[0026] The target thread that is running abnormally is marked based on the service process status, and the target thread that is marked twice is designated as the abnormal thread.
[0027] Furthermore, the changed data is sent using UDP broadcast.
[0028] Furthermore, the heartbeat message is sent using UDP broadcast.
[0029] Furthermore, when operating as a standby node, the process also includes collecting the operating status data of the local low-voltage distribution area and caching it in a non-shared memory area.
[0030] Furthermore, the step of selecting whether to run the local machine as a master node or a standby node based on the operating status of the master and standby nodes and a preset priority order includes:
[0031] Based on the current operating status of the primary and backup nodes, determine the faulty and non-faulty nodes of the low-voltage interconnection system;
[0032] When the master node fails and the local machine is the highest priority non-failed node, the local machine will be selected to run as the master node; otherwise, the local machine will be selected to run as the standby node.
[0033] Beneficial effects
[0034] By adopting the above-mentioned technical solution, this invention has the following advantages and positive effects compared with the prior art: This invention establishes a shared memory area for storing system operating status data, enabling the host node to collect system operating status data and synchronously update it to the shared memory area of the standby node. This ensures that all primary and standby nodes maintain the same time-section data at all times, thereby providing stable and unique multi-region panoramic data to the upper-layer platform (cloud master station). This invention identifies faulty nodes by having all nodes send heartbeat messages at set time intervals. Then, when a host node fails, a non-faulty node is elected as the new host node based on priority. Combined with the shared memory area mechanism that maintains the same time-section data at all times, this achieves normal switching of standby functions in the event of host failure, thus ensuring that the energy management function of the multi-region interconnected system is always online. Furthermore, seamless switching of data synchronization between primary and standby nodes effectively improves the stability and optimized operation capabilities of the flexible interconnected system. This invention constructs a data area including a record sequence number area, a record identifier area, a domain segment description area, and a data area, and retrieves the data using primary key values according to relational database retrieval methods. This allows the host node to quickly retrieve the changed data that should be sent, improving data synchronization efficiency. Attached Figure Description
[0035] Figure 1 This is a flowchart of an embodiment of the present invention;
[0036] Figure 2 This is a schematic diagram of a typical three-area flexible interconnection system according to an embodiment of the present invention;
[0037] Figure 3 This is a schematic diagram of the communication architecture according to an embodiment of the present invention;
[0038] Figure 4 This is a schematic diagram of the software deployment and interaction form within the intelligent terminal of the central area in the flexible interconnection system according to an embodiment of the present invention;
[0039] Figure 5 This is a flowchart of the system detection module execution according to an embodiment of the present invention;
[0040] Figure 6 This is a flowchart of the system detection module initialization process according to an embodiment of the present invention;
[0041] Figure 7 This is a schematic diagram of the real-time data block storage, retrieval and synchronization method according to an embodiment of the present invention;
[0042] Figure 8 This is a schematic diagram of the application layer interaction message format during the implementation of the embodiments of the present invention;
[0043] Figure 9 This is a schematic diagram of the standby machine initialization and interaction process in the presence of the host machine according to an embodiment of the present invention;
[0044] Figure 10 This is a schematic diagram of the standby machine initialization and interaction process when the host machine is present in an embodiment of the present invention. Detailed Implementation
[0045] The present invention will be further illustrated below with reference to specific embodiments. It should be understood that these embodiments are for illustrative purposes only and are not intended to limit the scope of the invention. Furthermore, it should be understood that after reading the teachings of this invention, those skilled in the art can make various alterations or modifications to the invention, and these equivalent forms also fall within the scope defined by the appended claims.
[0046] This invention relates to a method for software testing and master / standby switching in a low-voltage interconnected system. The low-voltage interconnected system includes multiple low-voltage distribution areas, each equipped with a smart terminal. The smart terminal integrates intelligent components within the power system, directly connecting to primary equipment such as switches and disconnectors via cables, and communicating with secondary equipment such as protection and monitoring systems via optical fiber to achieve equipment status monitoring, switch signal processing, and automated control functions. Its hardware includes components such as switch modules and temperature / resistance output modules, and on-site equipment verification can be performed using a comprehensive intelligent terminal input verification device. In this embodiment, one smart terminal is configured as the master node, while the others operate as standby nodes.
[0047] This method is executed by the smart terminal in the distribution area, such as... Figure 1 As shown, it includes the following steps:
[0048] Establish a shared memory area to store system operating status data; the system operating status data may include process running data of host nodes and operating status data of all low-voltage distribution areas in the low-voltage interconnection system;
[0049] Send heartbeat messages at set time intervals, and listen for heartbeat messages from other smart terminals in other areas to determine the operating status of the primary and backup nodes.
[0050] Based on the current operating status of the primary and backup nodes and the preset node priority order, select whether to run this machine as the primary node or the backup node;
[0051] When running as the master node, it collects system operating status data, stores it in the shared memory area, and sends the changed data to the standby node;
[0052] When running as a standby node, it receives changed data sent by the master node and saves it to the shared memory area.
[0053] In some preferred embodiments, an initialization step is included before sending the heartbeat message, specifically including:
[0054] Search host nodes;
[0055] If a master node exists, the local machine will be run as a standby node, and system running status data will be obtained from the master node to initialize the shared memory area;
[0056] If no host node exists, the local machine will be run as the host node, and the system running status data will be obtained from the local machine configuration to initialize the shared memory area.
[0057] In practical implementation, a dedicated management and control software for the low-voltage interconnected system can be deployed in the intelligent terminals of 1 to N transformer substations (N not greater than 16). This software includes four parts: global parameters and real-time data blocks, system detection, data acquisition and forwarding services, and energy management.
[0058] The global parameter and real-time data block is a data storage area that includes basic configuration information of N stations, real-time running data, system status, process status and other data. It has the function of global data uniqueness and can be quickly accessed by other business functions (software APP) within the terminal.
[0059] System detection includes functions such as global parameter and real-time data block management, process management, data synchronization, network detection, and primary / backup switching. It is used for the diagnosis and maintenance of business functions (software APP), the diagnosis and maintenance of system connection status, receiving data updates, and system operation probe management.
[0060] The data acquisition and forwarding service includes two functions: data acquisition and data forwarding.
[0061] Energy management includes setting system operating parameters, calculating real-time system data, and outputting strategies such as flexible interconnection of multiple power stations, source-grid-load-storage coordination, and load sharing.
[0062] The global parameters and real-time data blocks are shared memory segments created by the system detection within the system. Their contents are maintained and managed by the system detection, including reading and writing. Other intelligent terminal business functions (software APP) within the interconnected system can quickly access them.
[0063] The system detection section may include process management methods, including:
[0064] 1) Establish a core detection process information table to record core process running system parameters, such as process ID, number of handles, number of threads, CPU utilization, memory usage, and other key parameters, for early warning and prompting; restart processes that exit abnormally;
[0065] 2) Establish runtime probes for core processes to prevent process deadlocks and infinite loops; restart processes with abnormal probes.
[0066] The system detection section may also include data synchronization methods, including:
[0067] 1) Upon initial startup or restart, the device actively seeks out a running host and establishes a TCP connection to quickly synchronize all data to the local machine;
[0068] 2) When a business function (software APP) needs to update global parameters and some data within the real-time data block, it uses UDP broadcast to notify the system to detect and perform local data updates.
[0069] The system detection section may also include network detection and primary / backup failover methods, including:
[0070] A heartbeat timeout detection mechanism is established. All transformer nodes send heartbeat signals via UDP at certain intervals, and the status of each transformer node on the network is recorded in real time. If the heartbeat fails multiple times in a row (e.g., at level 10), the fault status of the transformer node on the network is recorded.
[0071] The system detection section may also include primary / standby switchover methods, including:
[0072] Establish a priority order for the nodes in the distribution area. When a node with higher priority is running normally as the master, other nodes are set as backups.
[0073] When a high-priority standby machine detects a primary machine failure, it is promoted to primary machine.
[0074] After the original host is restored, the system's failover mechanism automatically restores the original host as the primary host, and the others become backup hosts.
[0075] More specifically, for a short period of time (milliseconds) before the primary and backup machines switch over, all backup machines maintain the same time-section data as the primary machine. When a backup machine is promoted to primary machine, it starts the key energy management related service functions.
[0076] The data collection and forwarding service includes:
[0077] 1) Data acquisition service, which realizes the establishment and protection of acquisition channels, communication protocol matching, code parsing, data processing, and data updating; the acquired data includes process data (referring to the data monitored by each running host process, including process status, resource usage, etc., which is equivalent to the self-monitoring data of software operation) and the operating data of other physical devices (such as the voltage, current, power, etc. of the interconnected devices). All of these data are placed in the shared area.
[0078] 2) Data forwarding service, which enables the establishment and maintenance of forwarding channels, communication protocol matching, data encapsulation and transmission.
[0079] A channel for data collection or forwarding services can be established on the host machine first. If the channel conditions permit, a backup channel can be established on the standby machine for the same data collection or forwarding service. The data collection service of the backup channel will be executed normally, the collected data will be cached, and the data will not be updated to the real-time data block.
[0080] When performing data synchronization, the following methods can be used at the application layer of the flexible DC-DC interconnect system to exchange messages:
[0081] In short messages and emergency messages, fixed-frame short messages are used, and UDP multicast is employed for rapid synchronization.
[0082] During data initialization and large-scale data synchronization, variable frame length messages are used, employing a point-to-point TCP reliable connection communication method.
[0083] When initializing data in a shared memory block, the record sequence number area (INDEX), record identifier area (FAT), and field segment description area (FIELD) are established synchronously; the retrieval key is established, including view (VIEW), object (OBJ), record (INDEX), and field (FIELD); the synchronization process is performed as needed based on the key and the changed data segment.
[0084] by Figure 2 Taking the typical topology of three transformer substations as an example, the diagram includes a typical low-voltage distribution substation, low-voltage flexible interconnection devices, distributed photovoltaic systems, energy storage devices, charging piles, a 750V DC bus, and DC-type sources, loads, and storage. Each substation is equipped with a smart terminal, which acts as the substation's "brain," providing data acquisition services to lower levels and data forwarding services to higher levels. The system deploys dedicated flexible interconnection management software (APP) on the smart terminals in each substation to communicate with and regulate the flexible loads connected to the substation, such as flexible interconnection devices, energy storage, and charging piles, thereby achieving source-grid-load-storage coordination between substations. The software detection and master-slave switching method in Example 1 enables real-time data synchronization between multiple substation smart terminals, thereby achieving real-time detection of the operating status of multiple integrated terminals and their software. Simultaneously, it provides stable and unique multi-substation panoramic data to the upper-level platform (distribution automation master station, cloud master station, etc.), and ensures that the energy management function of the multi-substation interconnection system remains online at all times through master-slave switching. The seamless switching technology for multi-channel data acquisition effectively improves the stability and optimized operation capabilities of the flexible interconnection system.
[0085] like Figure 3 The communication diagram shows that the data acquisition service is used to collect data from devices including but not limited to flexible interconnected devices, energy storage devices, and charging piles; the uplink forwarding service includes providing operating data of equipment in the distribution area to cloud platform systems (such as dispatch automation systems or power distribution automation systems), IoT management platforms, and other cloud platforms, while receiving parameter configuration and control commands issued by the cloud master station.
[0086] Figure 4 This invention demonstrates the software deployment and interaction methods within the intelligent terminals of a low-voltage interconnected system. It proposes a software architecture for intelligent terminals in low-voltage interconnected systems, including an energy management module, a global parameter and real-time data block, a system detection module, and a data acquisition and forwarding service module. The energy management module is used to achieve power allocation and adjustment for coordinated interaction between power sources, grids, loads, and storage in each low-voltage interconnected system, and to output system energy management strategies. The global parameter and real-time data module is used to maintain basic information configuration, real-time operating data, system status, and process status data for the low-voltage interconnected system. The system detection module is used for the diagnosis and maintenance of business functions (software APP), the diagnosis and maintenance of system connection status, receiving data updates, and managing system operation probes, including global parameter and real-time data module management, process management, data synchronization, network detection, and primary / backup switching functions. The data acquisition and forwarding service module is used for data acquisition and forwarding services for both north-south and upstream communication.
[0087] During system operation, the dedicated management and control software for the low-voltage interconnected system running at a transformer substation node (transformer substation smart terminal) includes processes such as system detection, data acquisition and forwarding services, and an energy management APP. Among these, system detection is initiated first, establishing a shared memory area for global parameters and real-time data blocks. The main process of system detection is as follows: Figure 5 As shown. First, the network node status is determined based on the heartbeat timeout detection mechanism, and the current host is set according to the network node status. Then, the heartbeat is broadcast again. The running status of the core processes in the system is traversed and recorded. For core processes that have no records in the system or are abnormal, the processes are restarted. The thread running probes of each core process are traversed. Threads that time out are considered abnormal. Combined with multi-dimensional health checks such as CPU and memory, the service process status is determined, and processes marked as abnormal twice are restarted. When the system is the host, according to the needs of other business functions (software APP), corresponding data processing is performed at key time nodes such as whole seconds, whole minutes, whole hours, days, months, and years. For example, statistical accumulation, signal restoration, remote control and adjustment timeout, etc., the changed data is synchronously broadcast to other backup nodes.
[0088] Subsequently, before the system detection module executes its main process, it must complete initialization. If system detection is not fully initialized, other processes will enter a waiting state until system initialization is complete. The system detection initialization process is as follows: Figure 6As shown, first, a shared memory area, namely the global parameter and real-time data block, is established. Then, the online host in this configuration system is searched. If the host exists, the running data is copied from the host to the local machine. If it does not exist, the global parameter and real-time data block is initialized from the local machine's configuration. The real-time data processing thread is started to update the global parameter and real-time data block with the received broadcast data. The TCP listening thread is started to receive connection requests and data requests from the backup machine when acting as the master. When the initialization is completed, the initialization is marked as successful.
[0089] Subsequently, a method for real-time data block storage, retrieval, and synchronization in flexible DC-DC interconnection systems is proposed, aiming to resolve the contradiction between data integrity storage and rapid real-time data sharing among multiple data zones. For example... Figure 7 As shown, in terms of storage, different views are designed and stored in files and memory according to the different meanings of data representation. Each view contains file parameter data and real-time data. File storage uses a relational database approach, while memory storage blocks include record sequence number area (INDEX), record identifier area (FAT), field description area (FIELD), and data area (DATA). For retrieval, data in files is retrieved using a relational database retrieval method, while memory data is retrieved quickly using a self-built retrieval key. The key content includes view (VIEW), object (OBJECT), record (INDEX), and field (FIELD), allowing for quick retrieval of relevant field data from memory. Regarding synchronization, during initialization, full data synchronization is used, synchronizing all data in memory, including file parameter data and real-time data. For data update synchronization, only the real-time data portion is synchronized based on the record specified by the key. The methods for storing, retrieving, and synchronizing memory data are as follows:
[0090] 1) During the initialization process, the shared memory block is formatted, and the data is stored in the shared memory area one by one according to the order of view, object, and record, based on the read file or the full data synchronized from other machines. At the same time, the INDEX, FAT, and FIELD information are initialized.
[0091] 2) During system operation, data is quickly located and retrieved by searching the key; the addition and deletion of records are marked by the bit flags in the FAT.
[0092] 3) During the synchronization process, based on the domain segment information that each view needs to synchronize (identified as the real-time data domain in FIELD), only the KEY and real-time data domain segment data are sent during the synchronization communication.
[0093] The proposed application layer interaction message format for this system is as follows: Figure 8 As shown, it includes a fixed-length message header and a variable-length data area. The message header includes a synchronization header, source, destination, total length, command code, record count, and record length.
[0094] The initialization process and normal interaction process of the standby machine when the primary machine is present are as follows: Figure 9 As shown, after the standby machine starts up, it prioritizes sending fixed-frame command messages (EnCmd_query_master) via UDP broadcast. Upon receiving a response from the master (fixed-frame EnCmd_query_master_respone), it actively establishes a TCP connection with the master and receives the master's full data mirror transmission messages (variable-frame EnCmd_rt_insert). During normal interaction, both the master and standby machines periodically send heartbeat messages (fixed-frame EnCmd_iamalive) for other nodes to determine the network status. All changes in data during the master's operation are sent via UDP broadcast, with a message length not exceeding 1500 bytes. Transmitted commands include remote signaling changes (EnCmd_trans_yx), telemetry changes (EnCmd_trans_yc), remote control commands (EnCmd_trans_yk), and parameter changes (EnCmd_trans_para).
[0095] Taking the three-area low-voltage interconnection system as an example, the energy management software and monitoring software of the low-voltage flexible DC interconnection are deployed on the smart terminals in area 1, area 2 and area 3 respectively. At any given moment, there is only one smart terminal (network node) as the host of the low-voltage flexible DC interconnection software system, and the other two smart terminals serve as hot standby machines.
[0096] The host computer is determined according to the system initialization process in the above-mentioned invention. The host computer is determined by the startup order and pre-set priority. Unless the host computer malfunctions, it will always operate in its current state. Figure 10 For example, smart terminal 2 serves as the system host, while smart terminals 1 and 3 serve as system backups. According to the technical solution of this invention, smart terminals 1, 2, and 3 are each equipped with several components of low-voltage flexible DC interconnection software, including global parameters and real-time data blocks, system detection, data acquisition and forwarding services, and energy management.
[0097] Global parameters and real-time data blocks remain consistent across the three smart terminals in the distribution area. In this embodiment, the memory data storage view includes: network node view, channel view, device object view, remote signaling view, telemetry view, remote control view, remote adjustment view, system parameter view, model view, etc.
[0098] The network node view records information about several network nodes configured in this system, which is used to implement primary / standby machine switching;
[0099] The channel view records the configuration and operational information related to the acquisition channel and forwarding channel;
[0100] The device object view records device information, such as interconnected devices, energy storage PCS, photovoltaic inverters, etc.
[0101] The remote signaling view, telemetry view, remote control view, and remote adjustment view record the relevant four-remote information of each device; the system parameter view records the system configuration parameters and operating parameters.
[0102] The model view records the device model description information.
[0103] Taking the example of Smart Terminal 2 operating as the host, with Smart Terminal 1 and Smart Terminal 3 in hot standby mode. The system detection, data acquisition and forwarding services, and energy management functions running in Smart Terminal 2 only operate on the host, and must implement all control and power scheduling functions. Smart Terminal 2 collects operating data and process data from various physical devices in Zone 1, Zone 2, and Zone 3 to form system operating status data. Smart Terminal 1 and Smart Terminal 3, as hot standby, except for the system detection functions that enable mutual monitoring between network nodes and the function of acquiring AC sampling data for their respective zones, are in a running and waiting state until they are promoted to host.
[0104] A preferred embodiment 1 of this implementation relates to a three-zone low-voltage interconnection system, including zone 1, zone 2, and zone 3, with corresponding smart terminals A, B, and C, respectively. The preset node priority is: terminal B > terminal A > terminal C, where terminal B is the primary terminal, and terminals A and C are backup terminals. The heartbeat message sending interval is set to 5 seconds.
[0105] The intelligent terminals in each distribution area of the system implement software detection and primary / backup switching through the following methods:
[0106] Each smart terminal in a distribution area establishes a shared memory area on its local machine;
[0107] All smart terminals in the distribution area send heartbeat messages (fixed frames EnCmd_iamalive) via UDP broadcast at 5-second intervals. The messages may include node ID, priority, current role (master / standby), etc.
[0108] While sending heartbeat messages, all smart terminals in the distribution area monitor the status of the primary and backup nodes by receiving messages from other smart terminals in the distribution area. If a node is found to have not received a heartbeat for 10 consecutive times (e.g., terminal B is faulty), the node is marked as "faulty".
[0109] If terminal B fails and its heartbeat times out, while terminal A detects a host failure, then terminal A will be promoted to host according to priority, and terminal C will remain as standby.
[0110] At this time, terminal A acts as the host, collecting the operating data of its own area and areas 2 and 3 (such as the photovoltaic output power of area 2 being 10kW, the charging pile current of area 3 being 20A, etc.), and storing it together with the local process data into the shared memory area.
[0111] When the data changes (e.g., the SOC of energy storage in area 2 drops from 80% to 75%), terminal A sends the changed data (command code EnCmd_trans_para, data area contains SOC value 75%) to the standby unit via UDP broadcast;
[0112] At this time, terminals B and C act as backup units, receiving the changed data broadcast by the host (such as the update of the energy storage SOC in area 2), and updating the corresponding field in the local shared memory area (FIELD="energy storage SOC") to ensure consistency with the host data; the backup unit can also collect data in its own area (or not collect it), but only caches it and does not actively update it to the shared memory area, unless it is upgraded to the host.
[0113] A preferred embodiment 2 of this implementation relates to a three-area low-voltage interconnection system, including area 1, area 2, and area 3, with corresponding intelligent terminals A, B, and C, respectively. When the system is first started, none of the intelligent terminals in each area have established a host node; the initialization steps include:
[0114] After all terminals start up, they first send a fixed frame message EnCmd_query_master via UDP broadcast to request a response from the current host;
[0115] If terminal B does not receive any host response at this time (i.e., there is no host node), then the "self-start as host" process is executed.
[0116] If terminal A receives a response from the host (e.g., terminal B replies with EnCmd_query_master_respone), then the "join standby" procedure is executed.
[0117] The initialization steps for terminal B as the host node include:
[0118] Read initialization data (such as basic parameters of the transformer area, default energy management policy, etc.) from the local configuration and fill it into the shared memory area;
[0119] Start a TCP listening thread to wait for standby connection requests, and initialize a real-time data processing thread to receive subsequent data updates.
[0120] The initialization steps for terminal A as a standby node include:
[0121] After detecting the existence of the host (terminal B), it actively establishes a TCP connection to the host and requests full data synchronization;
[0122] Terminal B sends a full data mirror (including basic parameters and real-time data for all stations) via the variable frame message EnCmd_rt_insert. After receiving it, Terminal A initializes its local shared memory area to ensure consistency with the host data.
[0123] After the above initialization steps, the host (terminal B) shared memory area contains the initial data configured on the host machine, and the data in the standby (terminal A) shared memory area is completely synchronized with the host machine.
Claims
1. A method for software detection and master / slave switching in a low-voltage interconnection system, wherein the low-voltage interconnection system includes multiple low-voltage distribution areas, each low-voltage distribution area is provided with a distribution area intelligent terminal, one distribution area intelligent terminal operates as a master node, and the other distribution area intelligent terminals operate as standby nodes, characterized in that, The method is applied to each smart terminal in each distribution area and includes the following steps: A shared memory area is established to store system operating status data. The system operating status data is designed as different views according to the meaning of the data representation and stored in memory in a relational database manner. It is retrieved by primary key values according to the relational database retrieval method. The primary key values include view number and domain number. The view number is used to identify view data. The view data includes archive parameter data and real-time data. The domain number is used to identify the domain segment of the real-time data. The system operating status data includes process running data of host nodes and operating status data of all low-voltage stations in the low-voltage interconnection system. Search host nodes; If a master node exists, the local machine will be run as a standby node, and the system running status data will be obtained from the master node using TCP point-to-point transmission to initialize the shared memory area. If no host node exists, the local machine will be run as the host node, and the system running status data will be obtained from the local machine configuration to initialize the shared memory area; Heartbeat messages are sent via UDP broadcast at set time intervals, while listening for heartbeat messages from other smart terminals in other areas to determine the operating status of the primary and backup nodes. Based on the current operating status of the primary and backup nodes and the preset node priority order, select whether to run the local machine as the primary node or as the backup node. When running as the master node, the system operation status data is collected and stored in the shared memory area. After generating change data based on the view number and the domain number to be synchronized as needed, the change data is sent to the standby node via UDP broadcast. The change data includes the changed real-time data and its corresponding primary key value. When running as a standby node, it receives the changed data sent by the master node and saves the changed real-time data to the shared memory area according to the parsed primary key value.
2. The method according to claim 1, characterized in that, The shared memory area includes a record sequence number area, a record identifier area, a domain segment description area, and a data area. The primary key value also includes an object number and a record number.
3. The method according to claim 2, characterized in that, The initialization of the shared memory area includes: The acquired system operating status data is stored one by one into the shared memory area in the order of view, object, and record. Initialize the record, the record identifier area, and the field.
4. The method according to claim 1, characterized in that, The process execution data is collected through the following methods: Obtain the running status data of each core process, and restart the core processes that have no records or are abnormal; Obtain the running status data of each thread within the core process, and restart any abnormal threads; The running status data of each core process and its thread after the restart is obtained as the process running data.
5. The method according to claim 4, characterized in that, The abnormal thread is determined by the following method: The thread that timed out during check-in within the core process is selected as the target thread. The target thread that is running abnormally is marked based on the service process status, and the target thread that is marked twice is designated as the abnormal thread.
6. The method according to claim 1, characterized in that, When running as a standby node, it also includes the step of collecting the operating status data of this low-voltage distribution area and caching it to a non-shared memory area.
7. The method according to claim 1, characterized in that, The step of selecting whether to run the local machine as a primary node or a standby node based on the operating status of the primary and standby nodes and a preset priority order includes: Based on the operating status of the primary and backup nodes, the faulty and non-faulty nodes of the low-voltage interconnection system are determined; When the master node fails and the local machine is the highest priority non-failed node, the local machine will be selected to run as the master node; otherwise, the local machine will be selected to run as the standby node.
Citation Information
Patent Citations
Double-computer hot standby method based on memory page replacement synchronization
CN103532753A