A multi-channel endpoint linkage switching and field data acquisition method and system for a building automation industrial control human-machine terminal
By binding multiple channel addresses in the building automation system and using unified status snapshots and local data storage, the problems of asynchronous channel status and insufficient data continuity in the existing technology are solved, realizing multi-channel linkage switching and efficient acquisition of field data.
Patent Information
- Application Number
- CN202611562201.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-10
- Publication Date
- 2026-11-24
AI Technical Summary
In existing building automation systems, the Web display channel, remote call control channel, and on-site data acquisition channel are prone to status asynchrony during failures. A single health detection is difficult to use as a unified switching basis, on-site acquisition requests and point table updates are difficult to coordinate, and on-site data continuity is insufficient during short-term backend failures.
By binding the Web access address, remote call address, and Modbus gateway target address to the same endpoint configuration, a unified status snapshot is used to determine the endpoint health status, and the three types of channels are updated according to a unified time sequence when the endpoint is unavailable. Combined with continuous failure counting and minimum switching interval, multi-channel linkage switching is achieved. When the backend is inaccessible, a local scanning plan is used to continue collecting data and storing it locally to ensure data continuity.
It achieves consistency in status between web display, remote control, and on-site data acquisition, reduces inconsistencies in channel recovery, improves the continuity of data acquisition and the orderly reporting of data, and reduces the impact of network fluctuations on the system.
Smart Images

Figure CN123164136A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of industrial automation monitoring and human-machine interaction technology, specifically to a method and system for multi-channel endpoint linkage switching and on-site data acquisition for building automation industrial control human-machine terminals. Background Technology
[0002] Human-machine interfaces (HMIs) in building automation systems typically handle tasks such as equipment monitoring, status presentation, control operations, and on-site data acquisition. Taking subway station building automation applications as an example, on-duty personnel continuously monitor electromechanical equipment such as ventilation, air conditioning, water supply and drainage, and lighting through industrial control screens or industrial tablets. In existing systems, industrial control terminals often act as browsers loading remote web monitoring pages, while on-site Modbus data is collected and reported by independent acquisition gateways. Some systems also deploy primary / backup redundancy logic on the server side, causing the terminals to passively follow the backend status.
[0003] In the above architecture, the web display channel, remote call control channel, and on-site data acquisition channel typically maintain their respective target addresses and fault handling logic. When a backend node fails, the web page may have already switched to the backup node, while the remote call connection or Modbus acquisition still points to the original failed node. This results in the display being restored, but control or data acquisition not yet being restored, requiring additional configuration or manual intervention. Furthermore, if health assessment relies solely on a single HTTP probe or a single heartbeat, it cannot simultaneously reflect the operational status of web access, remote control services, and on-site acquisition links, easily leading to inconsistencies between the switching timing and the actual fault state.
[0004] For on-site Modbus data acquisition, initiating read requests point-by-point when there are a large number of points increases the number of bus requests and makes it difficult to control the acquisition cycle. Existing address merging methods, without combining PLC forwarding address partitioning, function code derivation, and online point table update relationships, struggle to simultaneously address read / write security, request volume, and hot updates of the engineering point table. When the backend service is temporarily inaccessible, if the terminal stops acquiring data or lacks a local persistent reporting queue, data gaps may form during the offline period, and the order of historical data transmission may be disordered after recovery.
[0005] In summary, existing technologies suffer from several drawbacks, including asynchronous states due to separate switching of multiple communication channels, difficulty in using a single health probe as a unified switching basis, difficulty in coordinating field data collection requests and point table updates, and insufficient continuity of field data during short-term backend failures. Summary of the Invention
[0006] To address the aforementioned deficiencies in the existing technology, the technical solution provided by this invention is as follows: A method for multi-channel endpoint linkage switching and field data acquisition for building automation industrial control human-machine terminals includes the following processing steps: Loading multiple sets of endpoint configurations, each set including at least a Web access address, a remote call address, and a Modbus gateway target address; determining the active endpoint according to endpoint priority; and synchronously establishing a Web display channel, a remote call control channel, and a Modbus acquisition channel based on the active endpoint. Periodically acquiring the Web channel health status, the remote call channel health status, and the Modbus acquisition health status corresponding to the continuous failure count generated by the Modbus acquisition process of the active endpoint; summarizing the three types of health status into a unified status snapshot. Based on the unified status snapshot, determining whether the active endpoint is unavailable; if the active endpoint is unavailable and a backup endpoint exists, selecting the backup endpoint as the target endpoint; updating the active endpoint identifier according to a preset linkage switching order; reloading the target endpoint's Web access address; disconnecting the remote call connection and reconstructing the remote call connection according to the target endpoint's remote call address; stopping Modbus acquisition scheduling and restarting Modbus acquisition according to the target endpoint's Modbus gateway target address; and clearing the continuous failure count to obtain the unified status snapshot after the switch. During Modbus data acquisition, the field slave stations are polled and read according to the scanning plan. When a round of acquisition is successful, the consecutive failure count is cleared. When acquisition fails, the consecutive failure count is updated. When the consecutive failure count reaches the consecutive failure threshold, the Modbus acquisition health status is updated to an abnormal status, so that the abnormal status enters the unified status snapshot of the next cycle and participates in the determination of active endpoint unavailability.
[0007] Furthermore, the host port corresponding to the Web access address is parsed and a transport layer connectivity probe is performed to obtain the Web channel health status; a connectivity probe is performed on the service port corresponding to the remote call address to obtain the remote call channel health status; and the Modbus collection health status is obtained based on the continuous cumulative results of connection failures or complete round read failures during the Modbus collection process. A unified status snapshot is used to associate and save the current active endpoint, the health status of each channel, and the corresponding fault type.
[0008] Furthermore, the preset linkage switching sequence is constrained by the minimum switching interval. If the time since the last endpoint switching has not reached the minimum switching interval, the switching is suppressed again. After a round of Modbus acquisition is successful or the endpoint switching is completed and the Modbus acquisition target is rebounded, the consecutive failure count is cleared to zero.
[0009] Furthermore, the scan plan is generated based on the point list or a snapshot of the local point table. For the forwarding address of the point, the Modbus register partition is distinguished according to the address prefix and address value of the forwarding address, and the read function code or write function code is automatically matched according to the register partition; for write requests, only the command stream issued by the backend is responded to, and the write request is intercepted when the target register partition is a read-only register area.
[0010] Furthermore, the points are grouped according to the device identifier and register area, and sorted by forwarding address within the same group; when the address gap between adjacent forwarding addresses is less than the configured merging threshold, the corresponding register addresses are merged into a quasi-continuous read interval; when the number of registers in the quasi-continuous read interval exceeds the upper limit of a single frame message, the quasi-continuous read interval is split into multiple read intervals, and a read request set is formed based on the obtained read intervals; when an incremental change of a point is received, only the scanning group and acquisition thread corresponding to the device that has changed are reconstructed.
[0011] Furthermore, when the backend service is inaccessible, on-site data collection continues based on locally saved scan plan snapshots. The collected samples are converted into engineering quantities and filtered for dead zones before being written to local persistent sample storage, and the data to be reported is written to the reporting queue. After the backend communication is restored, cached data is read from the reporting queue in batches and reported in the order of collection time. At the same time, the disk usage level is monitored. When the disk usage level exceeds the cleanup threshold, historical samples that have been reported are cleaned up first, and a storage alarm is triggered when the disk pressure continues to exceed the preset conditions.
[0012] This invention also provides a multi-channel endpoint linkage switching and field data acquisition system for building automation industrial control HMI terminals. Deployed within the HMI terminal, the system includes a configuration loading module, an endpoint management module, a health determination module, a switching orchestration module, a web host module, a remote call client module, a Modbus scheduling and slave station working module, a local sample caching and reporting queue module, and a status presentation module. Each module performs endpoint configuration loading, unified health determination, linkage switching, field data acquisition, local caching, recovery reporting, and status presentation according to the data and status transmission relationships described above.
[0013] The present invention also provides a computer-readable storage medium, a computer, and a computer program product. The computer-readable storage medium stores a computer program; the computer includes a processor and a memory; and the computer program product includes a computer program; when the corresponding computer program is executed by the processor, it implements the above-described method.
[0014] Compared with the prior art, the advantages of the technical solution provided by the present invention are as follows: By binding the Web access address, remote call address, and Modbus gateway target address to the same endpoint configuration, and updating the three types of channels according to a unified time sequence when the endpoint is unavailable, the Web display, remote control, and on-site data collection can share the same active endpoint status, reducing the inconsistency in the target caused by the separate recovery of different channels.
[0015] By acquiring the health status of the Web channel, the remote call channel, and the Modbus collection health status separately and forming a unified status snapshot, the endpoint switching criteria simultaneously include three operational dimensions: display, control, and collection, and the corresponding fault types can be distinguished in the interface.
[0016] By combining continuous failure counting, zeroing after successful acquisition or handover, and minimum handover interval, short-term network fluctuations will not directly cause frequent endpoint switching, while continuous acquisition anomalies can be fed back to the endpoint health assessment link.
[0017] By deriving register partitions and function codes based on forwarding addresses and intercepting write requests to read-only register regions, the scan plan generation is kept consistent with read and write permissions. By performing quasi-continuous interval merging and over-limit frame splitting based on device identifiers and register regions, multiple adjacent points can be covered by a smaller read window.
[0018] By rebuilding only the scanning group and acquisition thread corresponding to the changed device when the point is incrementally changed, the point table update does not have to stop all field acquisition.
[0019] By continuing data collection using local scan plan snapshots during periods of backend inaccessibility, and by preserving data through local sample storage and reporting queues, and by replaying the data in chronological order after link recovery, the field data during offline periods is continuously recorded and reported in an orderly manner; and by managing disk levels, local storage is prevented from becoming continuously full.
[0020] This invention is applicable to subway stations and other industrial automation scenarios that use building automation human-machine terminals for Web monitoring, remote control, and Modbus field data acquisition. Attached Figure Description
[0021] Figure 1 This is a block diagram of the system modules of the present invention.
[0022] Figure 2 This is a flowchart of the multi-channel health determination and linkage switching process of the present invention.
[0023] Figure 3 This is a flowchart of the single-slave polling, consecutive failure counting, and exponential backoff reconnection process of the present invention.
[0024] Figure 4 This is a flowchart illustrating the derivation of the forwarding address function code and the merging of intervals in this invention.
[0025] Figure 5 This is a flowchart of the offline caching and recovery reporting process of the present invention. Detailed Implementation
[0026] To make the processing relationships and advantages of the technical solution provided by the present invention clearer, the technical solution provided by the present invention will now be described in further detail with reference to the accompanying drawings.
[0027] Implementation Method 1: This implementation method presents a multi-channel endpoint linkage switching and field data acquisition method and system for building automation industrial control HMI terminals. In this implementation, an endpoint refers to a complete set of backend service address configurations, which includes at least a Web access address, a remote call address, and a Modbus gateway target address. Upon startup, the industrial control HMI terminal reads its local configuration and generates multiple endpoint records, while simultaneously reading operating parameters such as the acquisition cycle, acquisition timeout, consecutive failure threshold, minimum switching interval, and endpoint priority. The endpoint management module determines the initial active endpoint based on priority and enables the Web host module, remote call client module, and Modbus scheduling and slave working module to simultaneously use the target address corresponding to the active endpoint.
[0028] In this embodiment, the health determination module periodically performs multi-channel health determinations based on the active endpoint. For the Web display channel, it parses the host and port in the active endpoint's Web access address and performs transport layer connectivity probing to form the Web channel's health status. For the remote call control channel, it performs connectivity probing on the service port corresponding to the remote call service address to form the remote call channel's health status. For the Modbus acquisition channel, it receives the consecutive failure counts fed back by the Modbus scheduling and slave working modules, and forms the Modbus acquisition health status based on the relationship between the consecutive failure counts and the consecutive failure threshold. The health determination module associates the above three types of statuses with the current active endpoint, fault type, and status time to form a unified status snapshot, and sends the unified status snapshot to the status presentation module, while also serving as the basis for the switching orchestration module's judgment.
[0029] When the unified state snapshot indicates that Modbus acquisition is unhealthy, or when the combination of the three channel states meets the condition that the active endpoint is unavailable as a whole, and there is a usable backup endpoint in the endpoint configuration, the switching orchestration module selects the backup endpoint as the target endpoint. After the minimum switching interval has been reached since the last switch, the switching orchestration module performs a linked switch in a transactional sequence: first, the active endpoint identifier is updated; then, the Web host module is notified to load the Web access address of the target endpoint; next, the current remote call connection is disconnected and the connection is rebuilt according to the remote call address of the target endpoint; then, the current Modbus acquisition scheduling is stopped, the Modbus gateway target address is switched and the acquisition thread is restarted, while the consecutive failure count is cleared; finally, the unified state snapshot is regenerated and the state presentation module is notified to refresh. This sequence ensures that all three channels use the same target endpoint as the working object after the switch.
[0030] In this implementation, the Modbus scheduling and slave station working module maintains an independent connection for each field slave station and performs polling data acquisition according to the scanning plan. When a connection fails, an exponential backoff reconnection process is initiated. The consecutive failure count is reset to zero upon successful acquisition and incremented by one upon failure. When the consecutive failure count reaches the consecutive failure threshold, the Modbus acquisition health status is updated to abnormal and sent back to the health assessment module. Similarly, the consecutive failure count is reset to zero upon endpoint switching and rebinding to the Modbus acquisition target, ensuring that the consecutive failure count always corresponds to the currently active endpoint.
[0031] In this embodiment, the scan plan processing unit receives a list of points from the backend or reads a snapshot of the point table stored locally. Point information includes at least the device identifier and forwarding address, and may also include dead zone thresholds and engineering quantity conversion parameters. The forwarding address (forward_address) is used to map Modbus register partitions to offsets. The scan plan processing unit distinguishes between register partitions (0, 1, 3, and 4) based on the address prefix and address value of the forwarding address, and automatically matches the corresponding read or write function code. The write function code only responds to the command stream sent from the backend; write requests are directly rejected for read-only register areas.
[0032] When generating a read request, the scan plan processing unit groups the points according to the device identifier and register area, and sorts the forwarding addresses within the same group. When the gap between adjacent addresses is less than the configured merging threshold, the corresponding addresses are merged into the same quasi-continuous read interval. When the number of registers after merging exceeds the upper limit of a single frame, the read interval is further split into multiple read intervals, thus forming a set of read requests corresponding to the scan plan. When the backend issues incremental changes to the points, only the devices that have changed are regenerated scan groups and their corresponding acquisition threads are rebuilt; the acquisition threads of other devices continue to run.
[0033] In this embodiment, the collected raw data undergoes engineering quantity conversion and dead zone filtering according to the point parameters to form a collection sample. The collection sample is written to local persistent sample storage, and the data to be reported is written to the reporting queue. When the backend service is inaccessible, the terminal continues to read the local point table snapshot and execute the scanning plan, continuously saving the collection samples generated during the offline period; after the backend communication is restored, the reporting queue is read in batches according to the collection time order and historical cached data is uploaded. The terminal also monitors the disk usage level, and when it exceeds the cleanup threshold, it prioritizes the cleanup of historical old samples that have been reported. When the disk pressure continues to exceed the preset conditions, a storage alarm is triggered.
[0034] The system described in this embodiment is deployed within an industrial control human-machine interface. Modules communicate with each other via in-process calls or message callbacks, transmitting endpoint configurations, channel health status, consecutive failure counts, unified status snapshots, switching events, scan plans, and collected samples, without relying on an additional hardware bus. The configuration loading module, endpoint management module, health determination module, and switching orchestration module constitute the endpoint management and linkage switching link; the Web host module, remote call client module, and Modbus scheduling and slave work module respectively execute the operation and rebinding of the three types of channels; the local sample cache and reporting queue module handles persistence and recovery reporting; and the status presentation module displays the current endpoint, the health status of each channel, fault types, and switching events.
[0035] Implementation Method Two: This implementation method presents a data and status transmission process in a subway station building automation scenario. The industrial control human-machine interface (HMI) provides station staff with a web-based monitoring interface for equipment such as ventilation, air conditioning, water supply and drainage, and lighting. Simultaneously, it sends control requests via a remote access interface and connects to a field PLC or other slave stations through a Modbus gateway to obtain equipment operation data. The terminal locally stores at least two sets of endpoint configurations, each endpoint configuration being associated with a corresponding web access address, remote access address, and Modbus gateway target address. Therefore, the same endpoint identifier can serve as a common index for the three types of channels.
[0036] After the terminal starts, the configuration loading module parses the endpoint records and runtime parameters in the XML configuration into a set of endpoint configurations in memory. The endpoint management module selects the active endpoint from this set according to priority. The active endpoint identifier is passed to the Web host module, the remote call client module, and the Modbus scheduling and slave module, respectively, so that the three modules read their respective target addresses from the same endpoint record. The Web host module loads the Web access address as the monitoring page, the remote call client module establishes a control connection according to the remote call address, and the Modbus scheduling and slave module establishes a field acquisition connection according to the Modbus gateway target address.
[0037] When the health assessment period arrives, the Web host generates a Web connectivity probe result, the remote call client generates a service connectivity probe result, and the Modbus scheduling and slave module outputs the current consecutive failure count. The health assessment module converts these three types of inputs into corresponding health flags and writes them, along with endpoint identifiers, fault types, and status timestamps, into a unified status snapshot. This unified status snapshot is sent to the status presentation module, enabling the interface to display Web anomalies, remote call anomalies, or Modbus data acquisition anomalies, respectively; it is also sent to the switching orchestration module as input for whether to perform endpoint switching.
[0038] When a Modbus link continues to fail, the consecutive failure count increments with each failure round. Once the consecutive failure count reaches the consecutive failure threshold, the Modbus health status changes to abnormal, and the new abnormal status is entered into the unified status snapshot. If this status meets the condition that the active endpoint is unavailable, the switching orchestration module queries the endpoint management module to obtain the next backup endpoint. When the minimum switching interval is met, the switching orchestration module first updates the active endpoint identifier to the backup endpoint, and then sequentially drives the Web host, remote call client, and Modbus scheduling module to complete the rebinding. After the switch is complete, the consecutive failure count returns to zero, and the status presentation module receives the new unified status snapshot and updates the interface.
[0039] During on-site data acquisition, the endpoint list carries the device identifier, forwarding address, dead zone threshold, and engineering quantity conversion parameters. The scan plan processing unit first uses the prefix and value of the forwarding address to determine the register area and corresponding function code, and then establishes scan groups using the device identifier and register area as keys. Within each scan group, addresses are sorted and merged into one or more quasi-continuous read intervals based on the address gap threshold; intervals exceeding the upper limit of the number of registers in a single frame are further split. Read requests generated from each read interval enter the corresponding slave station acquisition thread, and the returned register data is then decomposed into the original values of each point according to the point mapping relationship. After engineering quantity conversion and dead zone filtering, the acquired sample is obtained.
[0040] When the backend is online, collected samples are written to local sample storage and entered the reporting path. When the backend is briefly offline, the terminal does not rely on the backend to issue the point table in real time, but instead reads a snapshot of the local point table to continue generating a scan plan and executing collection, while continuously writing the data to be reported to the reporting queue. After the link recovery signal arrives, the reporting queue outputs historical records in the order of collection time and reports them in batches. Thus, a complete input, processing intermediate results, and output transmission link is formed from endpoint configuration, health status, handover control, scan plan, sample collection, to recovery reporting.
[0041] Implementation Method 3: Combination Figures 1 to 5 This implementation method provides a specific software implementation and operation process. Figure 1The software functional modules of the system shown are deployed within an ARM64-based industrial control display terminal. The operating system can be the OpenHarmony standard system, and the application program can be implemented using the Stage model and ArkTS. The configuration file is in XML format, and the configuration items include the modbusScanPeriodMs acquisition period, modbusScanTimeoutMs acquisition timeout, and modbusConsecutiveFailLimit maximum threshold for consecutive failures. It also stores multiple sets of endpoint web access addresses, remote call addresses, and Modbus gateway target addresses. The platform and parameter names mentioned above are used to describe a feasible software organization method and are not intended to restrict the system to using a specific operating system or programming language.
[0042] like Figure 2 As shown, after loading multiple endpoint configurations, the terminal determines the initial active endpoint, loads the Web monitoring page, establishes a remote call connection, and starts Modbus data acquisition scheduling. The health assessment module periodically parses the Web host port to perform TCP connectivity probes and performs TCP connectivity probes on the remote call service port; the Modbus acquisition thread records the number of polling failures. These three results form a unified status snapshot. When the number of consecutive failures reaches the maximum consecutive failure threshold, or when the overall channel status indicates that the current active endpoint is unavailable, the switching orchestration module selects a backup endpoint and performs a coordinated switch. In specific execution, the endpoint management module first updates the backup endpoint to the new active endpoint, the switching orchestration module stops the current Modbus scheduling and disconnects the remote call, then rebuilds the remote call connection and Modbus acquisition connection using the new endpoint parameters, while the Web host module loads the new Web address, and finally refreshes the status bar through a callback notification interface.
[0043] like Figure 3 As shown, each field slave station has independent connection and polling tasks. When connection establishment fails, the acquisition thread enters an exponential backoff wait and reconnects after the waiting time. After successful connection, a round of polling reads is executed according to the scan plan. If a round of acquisition is successful, the consecutive failure count is reset to zero and the next round of acquisition begins; if a round of acquisition fails, the consecutive failure count is incremented by one. Polling continues until the count reaches the maximum consecutive failure threshold. When the count reaches the threshold, the Modbus acquisition health status is set to abnormal and fed back to the health judgment module. After endpoint switching, the new acquisition connection corresponds to a new active endpoint; therefore, the consecutive failure count is reset to zero when the connection is re-established.
[0044] like Figure 4As shown, in the point list or local point table snapshot sent by the backend, each point record has a forward address (forward_address). The forward address encodes the Modbus register partitions and offsets according to PLC-style addresses. The scan plan processing unit uses address prefixes to distinguish between zones 0, 1, 3, and 4, and matches corresponding read / write function codes for different register regions. For write operations, only command streams sent by the backend are accepted; if the target address belongs to a read-only register region, it is rejected before entering the Modbus write request. For read operations, groups are first established according to device identifier and register region, and then sorted by forward address. If the address gap between adjacent registers is less than the configured merging threshold, they are merged into the same read window; if the number of registers in the window exceeds the number allowed in a single frame, the window is split into multiple read windows, ultimately resulting in the read request set in the scan plan.
[0045] When the backend sends an incremental update message for a location, the terminal locates the affected scan group based on the device identifier of the changed location. It only regenerates the scan group corresponding to that device and rebuilds the slave acquisition thread for that device. Devices that have not been changed continue to acquire data according to the original scanning plan. When using this method, the device serves as the update boundary between the point table update and the on-site acquisition, and it is not required to globally stop all acquisition tasks.
[0046] like Figure 5 As shown, after the acquisition thread obtains the raw register values, it generates engineering quantity data based on the engineering quantity conversion parameters in the point records, and filters out minor changes that do not need to be reported based on the dead zone threshold. Processed samples are written to the `samples` table in the local relational database, while data requiring reporting is simultaneously written to the `upload_queue` reporting queue. When the backend service is inaccessible, the terminal reads the locally saved scan plan snapshot to continue acquisition and continues writing to the `samples` table and the `upload_queue` reporting queue; when the communication link is restored, historical cached data is dequeued in batches according to the acquisition time order and reported.
[0047] This implementation also manages the local storage space. The terminal periodically obtains the disk usage rate. When the disk usage rate exceeds the cleanup threshold, it prioritizes the cleanup of historical old samples that have already been reported. If the disk pressure still exceeds the preset conditions after cleanup, it can perform controlled cleanup on the historical data at the head of the reporting queue and trigger an alarm simultaneously, so that maintenance personnel can be aware of the storage pressure status.
[0048] In a dual-endpoint configuration verification scenario, the Modbus link corresponding to the currently active endpoint experiences continuous connection or polling failures. Once the consecutive failure count reaches a threshold, the terminal automatically switches to the backup endpoint. The web page, remote call connection, and Modbus acquisition target all switch synchronously with the active endpoint. The status interface can distinguish between web errors, remote call errors, and Modbus acquisition errors. When performing scan plan processing on the point list, adjacent addresses are covered by the read window, and incremental point updates only affect the acquisition thread of the corresponding device. During short-term backend offline periods, the terminal continues to acquire data and writes it to local storage. After the link is restored, the cached data is reported in the order of acquisition time.
[0049] Implementation Method Four: This implementation method further explains the remaining operational details of the aforementioned multi-channel endpoint linkage switching, on-site data acquisition, scanning plan, and local caching process. The entire system is deployed as software within the industrial control HMI terminal, comprising nine software functional modules: configuration loading module, endpoint management module, health determination module, switching orchestration module, web host module, remote call client module, Modbus scheduling and slave station working module, local sample caching and reporting queue module, and status presentation module. Interaction between modules is achieved through in-process calls and message callbacks. This interaction represents the data, status, and control message transmission relationship between software modules and is not a hardware bus connection. The configuration loading module reads the local XML configuration file, loads multiple sets of endpoint configurations, where each endpoint configuration corresponds to the web access address, remote call address and port, Modbus gateway address and port, and reads operational parameters such as acquisition period, acquisition timeout, consecutive failure threshold, and minimum switching interval. The endpoint management module maintains the priority order of currently active endpoints and primary / backup endpoints, and provides the switching orchestration module with a call interface to switch to the backup endpoint or the next available endpoint.
[0050] The health assessment module can perform multi-dimensional health evaluations on the currently active endpoint in parallel or in a time-sharing manner. For the Web display channel, it parses the host and port of the Web access address and performs transport layer connectivity probing; for the remote call control channel, it performs connectivity and service status probing on the remote call service port. In one specific implementation, the remote call uses gRPC, and the terminal performs TCP connectivity probing on the gRPC service port; for the Modbus acquisition channel, the acquisition health status is characterized by a consecutive failure count formed by connection failures or complete round read failures. The health assessment module forms independent health flags for each channel and summarizes them into a unified status snapshot. The status presentation module displays the current endpoint information, endpoint status bar, health flags for each channel, exception types, and switching event logs based on the unified status snapshot, enabling Web exceptions, remote call exceptions, and Modbus acquisition exceptions to be presented separately.
[0051] When the unified state snapshot determines that the current active endpoint is unavailable, the switching orchestration module first queries the endpoint set and priority maintained by the endpoint management module. If a usable backup endpoint exists, the next endpoint is selected in primary / backup order, and a transactional switching is performed. During the switching, the active endpoint identifier is updated first, then the Web host module reloads the Web address corresponding to the new endpoint, then the current remote call connection is disconnected and reconnected according to the host and port of the new endpoint, then Modbus acquisition scheduling is stopped, the acquisition target is switched to the Modbus gateway corresponding to the new endpoint, acquisition is restarted, and the consecutive failure count is cleared. Finally, the switching log is recorded, and the status presentation module is notified to refresh the interface via message callback. The two endpoint switchings are also subject to a minimum switching interval constraint. If the minimum switching interval is not reached, the switching will not be performed again to suppress round-trip switching caused by short-term fluctuations. If the current endpoint is determined to be unavailable but there is no usable backup endpoint in the endpoint set, the current endpoint configuration remains unchanged, and subsequent health checks and running tasks that can be executed under the current conditions continue to be executed. At the same time, an alarm for no backup endpoint is output and an exception log is recorded. The endpoint switching judgment will be entered again after the switching conditions are detected later.
[0052] For a single field slave station, the Modbus scheduling and slave station working module creates a Modbus connection during initialization, sets the consecutive failure count to zero, and sets the initial base value for exponential backoff. After initialization, it waits for the acquisition cycle to arrive or the scan plan to be triggered. When the connection status is normal, Modbus read requests are executed according to the scan plan. The read request can be a merged read frame or a read request formed according to register partitions. When a round of reading is successful, the consecutive failure count is cleared, the backoff base value is reset, and the read result is continued to be passed to sample conversion, dead zone filtering, and enqueue processing. When a round of reading fails, the consecutive failure count is incremented by one, where read failure includes connection failure, read timeout, or read exception. When the consecutive failure count does not reach the consecutive failure threshold, the next round of polling begins. When the consecutive failure threshold is reached, the acquisition unhealthy status is reported to the health judgment module and an endpoint switching evaluation is triggered.
[0053] When a slave connection becomes abnormal or the connection is lost due to a read failure, the Modbus scheduling and slave working module enter an exponential backoff reconnection process. The backoff waiting time is determined by time = min(base × 2^n, max), where base represents the initial backoff base value, n represents the current consecutive failure count, and max represents the maximum allowed backoff waiting time. After the wait period, the Modbus connection is re-established using the target host and port corresponding to the currently active endpoint. If the reconnection is successful, the consecutive failure count is cleared and the backoff base value is reset, then the acquisition cycle or scan plan is re-entered to trigger the waiting state; if the reconnection fails, the failure state is retained and the process is repeated according to subsequent backoff cycles. Thus, connection anomalies, read anomalies, consecutive failure counts, health anomaly reporting, and endpoint switching assessment form a continuous feedback loop.
[0054] The scan plan processing unit receives a list of points from the backend or a snapshot of the point table stored locally. The point data includes the forward address and may carry dead zone thresholds and engineering quantity conversion parameters. The scan plan processing unit first parses the forward address value, determines the corresponding register region (zone 0, 1, 3, or 4) based on the address prefix and value, and then maps the corresponding Modbus read or write function code according to the register region, while simultaneously forming a read-only region mark. For write requests, only command streams issued by the backend are processed; if the target register region is marked as a read-only region, the write request is directly rejected; if the read / write permission is determined, the write request is added to the write command queue for execution. For read requests, points are bucketed according to device identifier and register region, sorted by forward address within each bucket, and quasi-continuous interval merging is performed according to the condition that the address gap is less than or equal to the configured merging threshold; if the number of registers after merging exceeds the single frame packet limit, it is split into multiple frames according to the single frame length constraint, ultimately forming a read request set with the fewest possible number. When the backend issues incremental changes to the points, it uses the device as the update granularity, only rebuilding the scanning group and slave acquisition thread corresponding to the changed device. Devices that have not been changed maintain the original scanning plan and acquisition task, thereby completing the hot update of the point table without requiring a global halt to acquisition.
[0055] After the on-site data acquisition thread obtains the raw register values according to the scanning plan, it performs sample conversion based on the engineering quantity conversion parameters in the point record and performs dead zone filtering according to the dead zone threshold. The processed samples are persistently saved in the `samples` table of the local relational database, while data to be reported is simultaneously written to the `upload_queue` queue. The terminal performs a bypass check on disk usage. When disk usage exceeds a preset threshold, it prioritizes cleaning up the oldest historical samples that have already been reported to free up storage space. If disk pressure remains too high after the above cleanup, the oldest unreported data can be cleaned from the head of the `upload_queue` queue, and a disk space alarm is triggered simultaneously. Disk level processing and on-site data acquisition are executed in parallel, allowing the terminal to continue data acquisition according to available conditions while performing storage cleanup and alarms.
[0056] When the backend is reachable, the terminal retrieves data to be reported in batches from the upload_queue according to the collection time order and performs the reporting. Upon successful reporting, the corresponding record is marked as reported and dequeued from the upload_queue; if reporting fails, the corresponding queue record is retained and awaits subsequent retries, without changing the time sequence of unreported data. When the backend is unreachable, the terminal enters offline caching mode, using locally saved scan plan snapshots to continue sample collection, sample conversion, dead zone filtering, and writing to the samples table and upload_queue, while continuously monitoring backend reachability; once the link is detected to be restored, batch reporting resumes according to the collection time order. Thus, during short-term backend offline periods, continuous recording of on-site data is maintained, and the historical data time sequence is preserved when reporting resumes.
[0057] During the operational verification process, a dual-endpoint operating environment with a primary endpoint and a backup endpoint was first configured. The web page, remote call client, and Modbus acquisition scheduling were then launched, and the Modbus link corresponding to the currently active endpoint was continuously subjected to connection failures or polling read failures. Once the consecutive failure count reached a set threshold, the terminal performed a backup endpoint switch. The results showed that after the active endpoint switch, the web page address, remote call connection, and Modbus acquisition target were updated synchronously according to the linkage sequence, and the status interface could display web errors, gRPC errors, and Modbus acquisition errors respectively. Subsequently, a point list carrying forwarding addresses, dead zone thresholds, and engineering quantity conversion parameters was sent to the terminal. Adjacent addresses were merged according to device identifiers and register areas, and read intervals exceeding the single-frame message limit were split. The results showed that compared to the point-by-point reading method, the number of bus read requests was reduced; when incremental point updates were sent only to some devices, only the scan groups and acquisition threads of the corresponding devices were rebuilt, while the remaining devices maintained their acquisition status.
[0058] During the offline caching and recovery reporting verification process, the terminal was first allowed to collect data normally and write the processed samples to the `samples` table and the `upload_queue` queue. Then, the backend service was briefly made inaccessible. During the backend inaccessibility period, the terminal continuously performed scanning and collection using local point table snapshots and continuously wrote data to local storage. After backend communication was restored, the terminal retrieved the cached data from the offline period in batches according to the collection time order and performed reporting. The results showed that on-site data collection did not stop during the short-term backend offline period, and historical data was reported in the order of collection time after the link was restored, without any data disorder during the recovery phase.
[0059] In this implementation, BAS represents a building or environmental automation system; endpoint represents a complete set of backend service address configurations used to jointly associate Web access, remote calls, and Modbus gateway targets; forward address represents a PLC-style address in the point table used to map Modbus register partitions and offsets; consecutive failure count represents the cumulative number of consecutive Modbus connection failures or whole-round read failures under the currently active endpoint; quasi-continuous interval merging means that when the gap between two register addresses meets the configuration threshold condition, the corresponding addresses are included in the same Modbus read request window. The above definitions are used to explain the data meaning and processing boundaries in this implementation.
[0060] The technical solution provided by the present invention has been described above through four specific embodiments. Embodiment one fully inherits the protection scheme of the present invention; Embodiment two elaborates on the data transmission relationship between endpoint configuration, health status, switching control, scan plan, sample collection, and recovery reporting; Embodiment three combines specific software implementation and... Figures 1 to 5 Further explanations are provided for each processing step. Implementation method four supplements the explanations regarding handling exceptions without backup endpoints, exponential backoff reconnection, read / write permissions and write command queues, least-read-request sets, device-level hot updates, offline queue retries and dequeue cleanup, and the operational verification process and results. The above implementation methods are not intended to limit the scope of protection of this invention; reasonable modifications, equivalent substitutions, and combinations of implementation methods made within the spirit and principles of this invention should all be included within the scope of protection of this invention.
Claims
1. A method for multi-channel endpoint linkage switching and field data acquisition for human-machine interfaces in building automation industrial control, characterized in that, include: Load multiple sets of endpoint configurations. Each set of endpoint configurations includes at least a Web access address, a remote call address, and a Modbus gateway target address. Determine the active endpoint according to the endpoint priority, and synchronously establish a Web display channel, a remote call control channel, and a Modbus acquisition channel based on the active endpoint. The Web channel health status, remote call channel health status, and Modbus acquisition health status corresponding to the continuous failure count generated by the Modbus acquisition process are periodically acquired from the active endpoint. The Web channel health status, the remote call channel health status, and the Modbus acquisition health status are then aggregated into a unified status snapshot. Based on the unified state snapshot, it is determined whether the active endpoint is unavailable. When the active endpoint is unavailable and a backup endpoint exists, the backup endpoint is selected as the target endpoint. The active endpoint identifier is updated according to the preset linkage switching order, the Web access address of the target endpoint is reloaded, the remote call connection is disconnected and rebuilt according to the remote call address of the target endpoint, the Modbus collection scheduling is stopped and the Modbus collection is restarted according to the Modbus gateway target address of the target endpoint, and the consecutive failure count is cleared to obtain the unified state snapshot after switching. During Modbus data acquisition, the field slave stations are polled and read according to the scanning plan. When a round of acquisition is successful, the consecutive failure count is cleared. When acquisition fails, the consecutive failure count is updated. When the consecutive failure count reaches the consecutive failure threshold, the Modbus acquisition health status is updated to an abnormal status so that the abnormal status enters the unified status snapshot of the next cycle and participates in the determination of active endpoint unavailability.
2. The method according to claim 1, characterized in that, The periodic acquisition of the Web channel health status, remote call channel health status, and Modbus acquisition health status of the active endpoint includes: parsing the host port corresponding to the Web access address and performing transport layer connectivity probing to obtain the Web channel health status; performing connectivity probing on the service port corresponding to the remote call address to obtain the remote call channel health status; obtaining the Modbus acquisition health status based on the continuous cumulative results of connection failures or full-round read failures during the Modbus acquisition process; the unified status snapshot also associates and saves the current active endpoint, the health status of each channel, and the corresponding fault type.
3. The method according to claim 1, characterized in that, The preset linkage switching sequence is also constrained by the minimum switching interval; when the time since the last endpoint switching has not reached the minimum switching interval, the switching is suppressed again; after a round of Modbus acquisition is successful or the endpoint switching is completed and the Modbus acquisition target is rebound, the consecutive failure count is cleared to zero.
4. The method according to claim 1, characterized in that, The scanning plan is generated based on the point list or a snapshot of the local point table; for the forwarding address of the point, the Modbus register partition is distinguished according to the address prefix and address value of the forwarding address, and the read function code or write function code is automatically matched according to the register partition; for write requests, only the command stream issued by the backend is responded to, and the write request is intercepted when the target register partition is a read-only register area.
5. The method according to claim 4, characterized in that, Generating the scanning plan further includes: grouping the points according to the device identifier and register area, and sorting them according to the forwarding address within the same group; when the address gap between adjacent forwarding addresses is less than the configured merging threshold, merging the corresponding register addresses into a quasi-continuous reading interval; when the number of registers in the quasi-continuous reading interval exceeds the upper limit of a single frame message, splitting the quasi-continuous reading interval into multiple reading intervals, and forming a read request set based on the obtained reading intervals; when receiving incremental changes to the points, only reconstructing the scanning group and acquisition thread corresponding to the device that has changed.
6. The method according to claim 1, characterized in that, When the backend service is inaccessible, on-site data collection continues based on locally saved scan plan snapshots. The collected samples are converted into engineering quantities and filtered for dead zones before being written to local persistent sample storage, and the data to be reported is written to the reporting queue. After the backend communication is restored, cached data is read from the reporting queue in batches and reported in the order of collection time. At the same time, the disk usage level is monitored. When the disk usage level exceeds the cleanup threshold, historical samples that have been reported are cleaned up first, and a storage alarm is triggered when the disk pressure continues to exceed the preset conditions.
7. A multi-channel endpoint linkage switching and field data acquisition system for building automation industrial control human-machine terminals, characterized in that, Deployed within the industrial control human-machine terminal, it includes a configuration loading module, an endpoint management module, a health judgment module, a switching orchestration module, a web host module, a remote call client module, a Modbus scheduling and slave station working module, a local sample cache and reporting queue module, and a status presentation module; The configuration loading module is used to load multiple sets of endpoint configurations and operating parameters. Each set of endpoint configurations includes at least a Web access address, a remote call address, and a Modbus gateway target address. The endpoint management module is used to determine active endpoints and maintain backup endpoints according to endpoint priority. The health determination module is used to obtain the Web channel health status of the active endpoint, the remote call channel health status, and the Modbus collection health status corresponding to the consecutive failure count, and to summarize and generate a unified status snapshot. The switching orchestration module is used to select a target endpoint when the unified state snapshot indicates that the active endpoint is unavailable and a backup endpoint exists, and to control the Web host module to reload the Web access address of the target endpoint, control the remote call client module to rebuild the remote call connection according to the target endpoint, and control the Modbus scheduling and slave station working module to restart Modbus acquisition and clear the consecutive failure count according to the target endpoint. The Modbus scheduling and slave station working module is also used to perform polling and data acquisition on the field slave stations according to the scanning plan, update the consecutive failure count based on successful or failed acquisition, and feed back the corresponding Modbus acquisition health status to the health determination module. The local sample cache and reporting queue module is used to store collected samples and data to be reported, and to report cached data in the order of collection time after the backend communication is restored. The status presentation module is used to present the current endpoint, the health status of each channel, the fault type, and the switching event.
8. A computer-readable storage medium for storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of claim 1.
9. A computer, comprising a processor and a memory, characterized in that, The memory stores a computer program, and when the processor executes the computer program, it implements the method of claim 1.
10. A computer program product, characterized in that, It includes a computer program, which, when executed by a processor, implements the method of claim 1.
