Wired water meter communication positioning method with water consumption point geographic information as index
By combining Geohash encoding and ant colony optimization algorithm, a structured association and dynamic routing planning of geographical location and communication address in large-scale irrigation wired water meter network is realized, which solves the problems of low communication addressing efficiency and poor adaptability to topology changes in the existing technology, and improves communication efficiency and reliability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- XINJIANG ZHUHUA WATER IND TECH CO LTD
- Filing Date
- 2026-03-23
- Publication Date
- 2026-05-19
AI Technical Summary
In large-scale irrigation wired water meter networks, existing technologies cannot quickly and accurately locate and access target water meters, and static address allocation methods cannot adapt to changes in network topology and link failures, resulting in increased communication delays and invalid traffic.
Geohash encoding is used to structurally associate the geographical location of irrigation water points with communication addresses. Combined with ant colony optimization algorithm, dynamic routing is planned. Fast communication addressing and adaptive routing are achieved through geographic index register and dynamic routing table, avoiding invalid traffic under broadcast polling.
It enables fast communication addressing and dynamic routing planning based on geographic indexes, improving communication addressing efficiency and routing reliability, and reducing communication power consumption and invalid traffic.
Smart Images

Figure CN122069449A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of routing communication technology, specifically relating to a wired water meter communication positioning method indexed by the geographical information of water usage points. Background Technology
[0002] In agricultural irrigation, wired water meters, as the core equipment for measuring irrigation water usage, are typically connected to a concentrator via wired communication methods such as RS-485 bus, M-Bus bus, or power line carrier, with the concentrator handling remote data acquisition. With the expansion of irrigation scale and the increasing demand for refined management, the number of wired water meters connected to concentrators within a single irrigation service area continues to grow. Currently, large irrigation districts can have hundreds or even thousands of water meters. How to quickly and accurately locate and access target water meters within a large-scale wired communication network has become a key technical challenge for remote meter reading systems for irrigation.
[0003] In existing technologies, wired water meter communication addressing generally adopts a static address allocation method based on device number. This means that during the system installation and commissioning phase, a fixed bus slave address is pre-configured for each water meter, and the concentrator completes data collection by polling each meter sequentially or according to the address table. This method can meet basic needs in scenarios with a small number of water meters and a simple network topology, but it exposes several shortcomings in large-scale irrigation networks. First, static address allocation does not establish a correlation between the communication address and the physical installation location of the water meter. When it is necessary to selectively collect water meter data from specific plots based on geographical area, the system cannot directly perform communication addressing based on geographical location and still needs to traverse the entire address table one by one, resulting in low retrieval efficiency. Second, in wired communication networks, the route from the concentrator to the target water meter typically passes through multiple relay forwarding nodes. When the network topology changes or some links fail, the statically configured communication route cannot adaptively adjust, leading to the target water meter becoming unreachable or significantly increasing communication latency. In addition, the existing broadcast polling acquisition method requires activating all nodes on the entire bus network for each communication, generating a large amount of invalid traffic in large-scale networks, consuming communication bandwidth and increasing system power consumption.
[0004] Therefore, the existing technology lacks a method that can structurally associate the geographical location information of irrigation water points with the communication address of wired water meters, and on this basis realize fast communication addressing and dynamic routing planning based on geographic index. Summary of the Invention
[0005] The main objective of this invention is to provide a wired water meter communication and positioning method indexed by the geographic information of water usage points. This method realizes structured association retrieval of geographic location and communication address, spatial coding-driven routing direction guidance, adaptive link fault avoidance, and replacement of broadcast polling with directional communication links, thereby improving the communication addressing efficiency and routing reliability of large-scale irrigation wired water meter networks.
[0006] To solve the above problems, the technical solution of the present invention is implemented as follows: A wired water meter communication positioning method indexed by geographic information of water usage points includes the following steps: Step 1: Collect the geographic latitude and longitude coordinates of all irrigation water points within the irrigation service area, select the Geohash grid cell covering the irrigation service area as the spatial range of the quadtree root node, perform binary partitioning encoding on the latitude and longitude coordinates of each irrigation water point and merge them into a Geohash binary encoding string, perform recursive quadrant partitioning on the spatial range of the root node based on the Geohash binary encoding string to obtain all leaf nodes and their corresponding spatial address codes, and establish a mapping record for each irrigation water point in the concentrator's geographic index register; Step 2: Construct a communication topology graph with all leaf nodes as vertices and the physical connection relationship of wired communication cables as communication topology edges. Use the ant colony optimization algorithm to release virtual ants to perform iterative pathfinding. The next hop selection is based on the prefix matching depth between the spatial address code of the candidate vertex and the spatial address code of the target vertex and the pheromone concentration on the communication topology edge. After pheromone update iteration, the complete communication path with the minimum path cost is determined as the optimal dynamic communication route and written into the dynamic routing table of the concentrator. Step 3: Using the Geohash binary code string of the specified irrigation water point as the retrieval key, locate the corresponding spatial address code and communication device identifier from the mapping record of the geographic index register, extract the optimal dynamic communication route from the dynamic routing table, activate the relay forwarding nodes along the route hop by hop to establish a complete directional communication link, and complete the data collection and communication with the wired water meter of the specified irrigation water point.
[0007] Furthermore, in step 1, the Geohash grid cell covering the irrigation service area is the Geohash grid cell corresponding to the smallest prefix level selected from the Geohash standard grid system that can completely cover the irrigation service area.
[0008] Further, in step 1, the binary partitioning encoding process is as follows: within the longitude interval of the root node, the longitude value is continuously partitioned a preset number of times. Each time, the left half falling into the current interval is recorded as 0, and the right half falling into the current interval is recorded as 1. The half falling into the current interval is used as the current interval for the next partition. After all partitions are completed, the longitude binary encoding string is obtained. In the same way, the latitude value is continuously partitioned a preset number of times within the latitude interval of the root node to obtain the latitude binary encoding string. The longitude binary encoding string and the latitude binary encoding string are arranged bit by bit, with the longitude bits occupying odd positions and the latitude bits occupying even positions, and then merged into a Geohash binary encoding string.
[0009] Further, in step 1, the recursive four-quadrant partitioning process is as follows: The Geohash binary encoding string is truncated from the highest bit to each adjacent pair of bits to form a partition identifier. In each partition identifier, the first bit corresponds to the longitude partition selection, and the second bit corresponds to the latitude partition selection. Based on the first partition identifier, the spatial range of the root node is divided into four sub-quadrants, where partition identifier 00 corresponds to the southwest quadrant, 01 to the northwest quadrant, 10 to the southeast quadrant, and 11 to the northeast quadrant. For each sub-quadrant, the same four-quadrant partitioning is performed using the next partition identifier until the preset maximum recursion depth is reached or the number of irrigation water points in the current quadrant does not exceed the preset leaf node capacity threshold. All partition identifiers passed sequentially from the root node to each leaf node are concatenated in hierarchical order to form a spatial address code.
[0010] Furthermore, in step 1, the mapping record is a 3-ary mapping record, including the Geohash binary encoding string of the irrigation water point, the spatial address encoding of the leaf node to which the irrigation water point belongs, and the communication device identifier of the wired water meter connected to the irrigation water point.
[0011] Furthermore, in step 2, each communication topology edge records the number of relay forwarding nodes traversed on the corresponding wired communication cable as a hop value; each communication topology edge is set with a link availability status flag bit. When the corresponding wired communication cable is in normal communication status, the link availability status flag bit is valid, and when a circuit is broken or a relay forwarding node fails, the link availability status flag bit is invalid; the pheromone storage table of the concentrator allocates one pheromone concentration storage unit for each communication topology edge, and the initial value of all pheromone concentration storage units is set to a preset uniform initial concentration value.
[0012] Furthermore, in step 2, the spatial address code of the leaf node to which the target irrigation water point belongs is read from the mapping record of the geographic index register as the target spatial address code; each virtual ant starts from the starting vertex where the concentrator is located, and each maintains a set of visited vertices and a path cumulative hop count counter. The initial state of the set of visited vertices includes the starting vertex, and the initial value of the path cumulative hop count counter is 0; when performing the next hop selection, vertices already included in the set of visited vertices and vertices connected by communication topology edges with invalid link availability flags are excluded from all adjacent vertices of the current vertex to obtain a candidate vertex set; if the candidate vertex set is empty and the current vertex is not the leaf node vertex corresponding to the target spatial address code, the virtual ant is marked as having failed to find a path and the current path finding process is terminated.
[0013] Furthermore, in step 2, for each candidate vertex in the candidate vertex set, its spatial address code is compared bit by bit with the target spatial address code, starting from the most significant bit. The number of consecutive identical bits starting from the most significant bit is counted as the prefix matching depth. The current pheromone concentration value is then read from the pheromone concentration storage unit corresponding to the communication topology edge between the current vertex and the candidate vertex. When the candidate vertex set contains two or more candidate vertices, all candidate vertices are arranged in descending order of prefix matching depth. If the prefix matching depths are the same, they are arranged in descending order of current pheromone concentration value, resulting in a priority sorting sequence. When the candidate vertex set contains only one candidate vertex, it is directly selected as the next hop vertex. When the candidate vertex set contains exactly two candidate vertices, a random integer uniformly distributed between 1 and 100 is generated. If the random integer does not exceed the preset priority selection threshold, the first candidate vertex in the priority sorting sequence is selected as the next hop vertex; otherwise, the second candidate vertex is selected. When the candidate vertex set contains 3 or more candidate vertices, a random integer uniformly distributed between 1 and 100 is generated. If the random integer is between 1 and the preset first selection boundary value, the first candidate vertex is selected. If it is between the first selection boundary value plus 1 and the preset second selection boundary value, the second candidate vertex is selected. If it is between the second selection boundary value plus 1 and 100, one of the third and subsequent candidate vertices is randomly selected with equal probability as the next hop vertex. After selecting the next hop vertex, it is added to the visited vertex set, and the hop value of the corresponding communication topology edge is accumulated to the path cumulative hop count counter.
[0014] Furthermore, in step 2, the pheromone update iteration process is as follows: After all virtual ants complete pathfinding in each iteration, the current value of the pheromone concentration storage unit of all communication topology edges in the pheromone storage table is uniformly multiplied by a preset evaporation retention coefficient for attenuation processing; from all virtual ants that successfully reach the leaf node vertex corresponding to the target space address code in this iteration, the top preset number of elite virtual ants with the smallest total path hop count are selected and marked as elite ants; the current value of the pheromone concentration storage unit corresponding to all communication topology edges traversed by each elite ant is superimposed with a preset elite pheromone increment value; virtual ants marked as pathfinding failures do not participate in the pheromone update operation; after a preset total number of iterations, the complete communication path corresponding to the elite ant with the smallest total path hop count in all iterations is determined as the optimal dynamic communication route.
[0015] Furthermore, in step 3, the concentrator sends link activation commands to the relay forwarding nodes in each leaf node along the route in sequence according to the vertex sequence recorded in the optimal dynamic communication route. After receiving the link activation command, each relay forwarding node starts the data forwarding function of its own wired communication port and establishes a complete directional communication link from the concentrator through all intermediate leaf nodes to the wired water meter at the designated irrigation water point. The concentrator sends a data acquisition request frame to the wired water meter at the designated irrigation water point through the complete directional communication link and receives the metering data response frame returned by the wired water meter.
[0016] The wired water meter communication positioning method based on water usage point geographic information of the present invention has the following beneficial effects: The present invention converts the geographic latitude and longitude coordinates of irrigation water usage points into binary encoded strings using Geohash encoding, and uses this to drive the recursive four-quadrant partitioning of a quadtree. This makes the geospatial encoding and the quadtree hierarchical structure mathematically consistent. A 3-ary mapping record between geographic location, spatial address encoding, and communication device identifier is established in the concentrator's geographic index register, realizing rapid structured retrieval from geographic location to communication address. This overcomes the problem of low efficiency in regional data collection and retrieval caused by the lack of correlation between communication address and physical installation location in existing technologies. In the next-hop selection process of the ant colony optimization algorithm, the present invention uses the prefix matching depth between the spatial address encoding of candidate vertices and the target spatial address encoding as the primary evaluation dimension. This allows the Geohash spatial encoding to not only perform index retrieval functions but also directly participate in the direction guidance of route search, significantly compressing the search space of the ant colony optimization algorithm and accelerating route convergence. This invention introduces a link availability flag, enabling the ant colony's iterative pathfinding process to automatically avoid communication links that are broken or have failed relay nodes. When the network topology changes, routing planning can be re-executed to obtain a new optimal dynamic communication route, providing adaptive response capabilities to link failures and solving the problem that static routing configurations in existing technologies cannot cope with network topology changes. During the communication positioning phase, this invention activates relay nodes hop-by-hop along the optimal dynamic communication route to establish directional communication links, while inactive nodes remain silent. This avoids the invalid traffic and bandwidth waste caused by simultaneous responses from all nodes in the network under existing broadcast polling methods, and reduces communication power consumption. Attached Figure Description
[0017] Figure 1 This is a schematic diagram illustrating the principle of communication topology construction and link attribute identification provided in an embodiment of the present invention. Figure 2 This is a schematic diagram illustrating the principle of ant colony-optimized pathfinding and prefix matching depth guidance provided in an embodiment of the present invention. Detailed Implementation
[0018] A wired water meter communication positioning method indexed by geographic information of water usage points includes the following steps: Step 1: Collect the geographic latitude and longitude coordinates of all irrigation water points within the irrigation service area, select the Geohash grid cell covering the irrigation service area as the spatial range of the quadtree root node, perform binary partitioning encoding on the latitude and longitude coordinates of each irrigation water point and merge them into a Geohash binary encoding string, perform recursive quadrant partitioning on the spatial range of the root node based on the Geohash binary encoding string to obtain all leaf nodes and their corresponding spatial address codes, and establish a mapping record for each irrigation water point in the concentrator's geographic index register; Step 2: Construct a communication topology graph with all leaf nodes as vertices and the physical connection relationship of wired communication cables as communication topology edges. Use the ant colony optimization algorithm to release virtual ants to perform iterative pathfinding. The next hop selection is based on the prefix matching depth between the spatial address code of the candidate vertex and the spatial address code of the target vertex and the pheromone concentration on the communication topology edge. After pheromone update iteration, the complete communication path with the minimum path cost is determined as the optimal dynamic communication route and written into the dynamic routing table of the concentrator. Step 3: Using the Geohash binary code string of the specified irrigation water point as the retrieval key, locate the corresponding spatial address code and communication device identifier from the mapping record of the geographic index register, extract the optimal dynamic communication route from the dynamic routing table, activate the relay forwarding nodes along the route hop by hop to establish a complete directional communication link, and complete the data collection and communication with the wired water meter of the specified irrigation water point.
[0019] In one specific implementation, the irrigation service area is an agricultural irrigation zone containing several irrigation water points. Each irrigation water point is equipped with a wired water meter, and all wired water meters are connected to a concentrator via wired communication cables for remote data collection. To establish a fast retrieval relationship between geographic location and communication address, it is first necessary to construct a geospatial index structure that couples quadtree spatial partitioning with Geohash encoding.
[0020] The geographic latitude and longitude coordinates of all irrigation water points within the irrigation service area are collected. This can be done by construction personnel using BeiDou or GPS positioning terminals at the water meter installation site to read the longitude and latitude values of the installation points, or by extracting the design coordinates of each water point from the irrigation project's as-built drawings. The data collection accuracy should ideally reach six decimal places, corresponding to a ground resolution of approximately 0.11 meters, to ensure that subsequent spatial coding can distinguish adjacent installation locations. Assuming there are 200 irrigation water points within an irrigation service area, 200 sets of latitude and longitude coordinate pairs will be obtained after data collection.
[0021] After obtaining the geographic latitude and longitude coordinates of all irrigation water points, it is necessary to determine the spatial range of the quadtree root node. Here, the Geohash standard grid system is used to select the spatial range of the root node, rather than directly using the irregular geographic boundaries of the irrigation service area as the root node. The reason for this approach is that Geohash encoding itself is generated through hierarchical binary division within standardized latitude and longitude intervals. If the spatial range of the root node is aligned with the interval boundaries of the Geohash grid system, then the Geohash binary code string generated when performing binary division encoding on the irrigation water points will have a meaning for each bit that is naturally consistent with the quadtree splitting direction, preventing misalignment between the encoding level and the tree structure level.
[0022] The specific selection method is as follows: In the Geohash standard grid system, the system checks from low prefix levels to high prefix levels step by step to find the Geohash grid cell corresponding to the smallest prefix level that can completely cover the irrigation service area. The Geohash standard grid system divides the global longitude range into -180 degrees to 180 degrees and the latitude range into -90 degrees to 90 degrees. The higher the prefix level, the smaller the grid cell and the higher the spatial resolution. For example, a Geohash grid cell with a prefix level of 1 covers an area of approximately 5000 km by 5000 km, a prefix level of 5 covers an area of approximately 4.9 km by 4.9 km, and a prefix level of 6 covers an area of approximately 1.2 km by 0.6 km. Assuming the geographical range of the irrigation service area is approximately 3.5 km east-west and approximately 2.8 km north-south, the Geohash grid cell with a prefix level of 5 can completely cover this irrigation service area and is the smallest prefix level that satisfies the condition of complete coverage. Therefore, this Geohash grid cell with a prefix level of 5 is selected as the spatial range of the quadtree root node. Assuming the longitude range of the Geohash grid cell is 112.5 degrees to 118.125 degrees and the latitude range is 33.75 degrees to 39.375 degrees, then the spatial range of the quadtree root node is the rectangular geographical area enclosed by the longitude range of 112.5 degrees to 118.125 degrees and the latitude range of 33.75 degrees to 39.375 degrees.
[0023] In another alternative implementation, when the irrigation service area is small and regularly shaped, higher-prefix-level Geohash grid cells can be selected to reduce spatial redundancy, such as Geohash grid cells with a prefix level of 7 or 8. In this case, the root node space is more compact, and the recursion depth of the subsequent quadtree is correspondingly reduced. When the irrigation service area spans multiple Geohash grid cell boundaries, lower-prefix-level Geohash grid cells are selected to ensure complete coverage.
[0024] After determining the spatial range of the quadtree root node, a binary partitioning encoding is performed on the latitude and longitude coordinates of each irrigation point. Taking a certain irrigation point as an example, assume its longitude is 115.432100 degrees and its latitude is 36.876500 degrees.
[0025] The encoding process for longitude values is as follows: The longitude interval of the root node is used as the initial partition interval, i.e., the longitude interval is from 112.5 degrees to 118.125 degrees. The first binary partition determines the midpoint of this interval as 115.3125 degrees. Since the longitude value 115.432100 degrees is greater than the midpoint 115.3125 degrees, it falls into the right half of the interval and is recorded as 1. At this point, the current interval is updated to 115.3125 degrees to 118.125 degrees. The second binary partition determines the midpoint of the current interval as 116.71875 degrees. The longitude value 115.432100 degrees is less than the midpoint 116.71875 degrees and falls into the left half of the interval and is recorded as 0. The current interval is updated to 115.3125 degrees to 116.71875 degrees. This process continues with subsequent binary divisions. Each division compares the midpoint of the current interval; a midpoint falling into the left half is recorded as 0, and a midpoint falling into the right half is recorded as 1. The midpoint then replaces the current interval for the next division. After performing a preset number of binary divisions, the 0s and 1s generated in each division are arranged sequentially to obtain the longitude binary code string. The preset number of divisions determines the encoding precision along the longitude direction; in this embodiment, the preset number is set to 15, resulting in a 15-bit longitude binary code string.
[0026] The encoding process for latitude values is exactly the same as for longitude values, the only difference being that the initial partitioning interval is the latitude interval of the root node, i.e., the latitude interval is 33.75 degrees to 39.375 degrees. Taking a latitude value of 36.876500 degrees as an example, the midpoint of the first binary partition is 36.5625 degrees. Since the latitude value of 36.876500 degrees is greater than 36.5625 degrees, it falls into the right half of the interval, which is recorded as 1. The current interval is updated to 36.5625 degrees to 39.375 degrees. Subsequent partitions are executed in the same way. After the same 15 binary partitions, a 15-bit latitude binary code string is obtained.
[0027] In an optional implementation, the preset number of times can be adjusted according to the spatial distribution density of irrigation water points. When the irrigation water points are densely distributed, the preset number of times is increased to improve the coding resolution. For example, setting it to 20 times can distinguish adjacent water points with a distance of about 0.5 meters. When the irrigation water points are sparsely distributed, the preset number of times is decreased to reduce the coding length and storage overhead. For example, setting it to 10 times will result in a coding resolution of about 50 meters, which is sufficient to distinguish water points in different plots.
[0028] After obtaining the longitude and latitude binary encoded strings, they are merged into a Geohash binary encoded string by alternating their bitwise positions. The alternation rule is as follows: the bits of the longitude binary encoded string occupy all odd-numbered positions (1st, 3rd, 5th, etc.) of the merged encoded string, while the bits of the latitude binary encoded string occupy all even-numbered positions (2nd, 4th, 6th, etc.). In this embodiment, the longitude binary encoded string and the latitude binary encoded string are both 15 bits, resulting in a 30-bit Geohash binary encoded string. This alternation method ensures that every two adjacent bits in the Geohash binary encoded string contain exactly one bit of longitude information and one bit of latitude information, forming a partition identifier code, which naturally corresponds to the four-quadrant division direction of one level in a quadtree. This is the key to coupling Geohash encoding with quadtree spatial partitioning—the bit-by-bit generation process of Geohash encoding is mathematically identical to the level-by-level splitting process of quadtree, and each partition identifier uniquely determines which of the four sub-quadrants the current level selects to enter.
[0029] Subsequently, a recursive four-quadrant partition is performed on the spatial range of the root node based on the Geohash binary encoding string to construct a quadtree structure. The partitioning process starts from the highest bit of the Geohash binary encoding string, and every two adjacent bits are truncated into a partition identifier. The first bit of the partition identifier corresponds to the partition selection in the longitude direction, i.e., determining whether it falls into the left or right half of the longitude interval; the second bit corresponds to the partition selection in the latitude direction, i.e., determining whether it falls into the left or right half of the latitude interval. The combination of the two bits produces four possible values, corresponding to four sub-quadrants: partition identifier 00 indicates that both longitude and latitude fall into the left half, corresponding to the southwest quadrant; partition identifier 01 indicates that both longitude and latitude fall into the left half, corresponding to the northwest quadrant; partition identifier 10 indicates that both longitude and latitude fall into the right half, corresponding to the southeast quadrant; and partition identifier 11 indicates that both longitude and latitude fall into the right half, corresponding to the northeast quadrant.
[0030] Starting from the root node, the first partition identifier is used to divide the spatial range of the root node into four sub-quadrants. The value of the partition identifier determines which sub-quadrant the irrigation point belongs to. This sub-quadrant is then further divided using the second partition identifier. Each division bisects both the longitude and latitude intervals of the current spatial range, forming four smaller sub-quadrants. One of these sub-quadrants is then selected for further subdivision based on the partition identifier value. Each time a four-quadrant division is performed, the quadtree depth increases by one level, and the spatial range shrinks to one-quarter of its original size.
[0031] Recursive partitioning stops when either of the following conditions is met: First, the current quadtree depth has reached the preset maximum recursion depth. In this embodiment, the preset maximum recursion depth is set to 8 levels, corresponding to 256 minimum grid cells, at which point further subdivision is unnecessary. Second, the number of irrigation water points contained in the current quadrant does not exceed the preset leaf node capacity threshold. In this embodiment, the preset leaf node capacity threshold is set to 5. That is, when the number of irrigation water points in a quadrant does not exceed 5, that quadrant does not need to be further split and is directly retained as a leaf node. The preset maximum recursion depth and the preset leaf node capacity threshold can be adjusted according to the scale of the actual irrigation service area and the distribution characteristics of water points. In an optional implementation, the preset maximum recursion depth can be set to any integer between 5 and 12 levels, and the preset leaf node capacity threshold can be set to any integer between 1 and 10.
[0032] Once all irrigation points have been assigned to their corresponding quadrants and the recursive partitioning process is complete, the terminal node in the quadtree that no longer splits is called a leaf node. Each leaf node covers one sub-region within the irrigation service area, which contains several irrigation points. The spatial address code of a leaf node is formed by concatenating all partition identifiers passed from the root node to each leaf node in hierarchical order. For example, if a leaf node is located at level 4 of the quadtree, and the partition identifiers passed from the root node to this leaf node are 11, 01, 10, 00, then the spatial address code of this leaf node is 11011000. The length of the spatial address code is equal to the depth of the leaf node in the quadtree multiplied by 2, because each level corresponds to a 2-bit partition identifier. Different leaf nodes at the same level have spatial address codes of the same length, while leaf nodes at different levels have different spatial address code lengths. Spatial address codes have a prefix inclusion relationship: if the spatial address code of one leaf node is a prefix of the spatial address code of another leaf node, then the spatial range covered by the former includes the spatial range covered by the latter. This characteristic was used in the subsequent ant colony optimization algorithm pathfinding process to measure the geographical proximity between candidate vertices and target vertices. The greater the prefix matching depth, the closer the two leaf nodes are in the spatial location of the quadtree.
[0033] After all leaf nodes and their spatial address codes are determined, a 3-ary mapping record is established for each irrigation water point in the concentrator's geographic index register. The concentrator is the data acquisition master station device in the wired water meter communication network, and the geographic index register is a non-volatile storage area inside the concentrator used to persistently store the correspondence between irrigation water points and wired water meters. Each 3-ary mapping record contains three fields: the first field is the Geohash binary code string of the irrigation water point, used as a search key for fast matching during subsequent communication positioning; the second field is the spatial address code of the leaf node to which the irrigation water point belongs, used to locate the optimal dynamic communication route in the dynamic routing table; the third field is the communication device identifier of the wired water meter connected to the irrigation water point. The communication device identifier is a unique number pre-set at the factory for each wired water meter, used to accurately address the target water meter after establishing a directional communication link.
[0034] In optional implementations, the geographic index register can use a hash table structure to store 3-ary mapping records, using the Geohash binary encoded string as the hash key, to achieve constant-time retrieval; alternatively, it can use a sorted array structure, arranged lexicographically by the Geohash binary encoded string, to complete the retrieval in logarithmic time complexity through binary search. When the number of irrigation water points does not exceed 500, the difference in retrieval speed between the two storage structures is negligible in engineering practice; when the number of irrigation water points exceeds 1000, the hash table structure has a greater advantage in retrieval efficiency.
[0035] Taking 200 irrigation points as an example in this embodiment, after all the above processes, the concentrator's geographic index register stores 200 3-ary mapping records. The number of leaf nodes generated in the quadtree structure depends on the spatial distribution of the irrigation points and the preset leaf node capacity threshold. Assuming the 200 irrigation points are relatively evenly distributed within the irrigation service area, and the preset leaf node capacity threshold is 5, the number of leaf nodes will be approximately 40 to 50. Each leaf node covers one sub-region within the irrigation service area, managing approximately 3 to 5 irrigation points. This granularity ensures that the number of water points within each leaf node is easy to manage, while avoiding excessive subdivision that would increase the computational load of subsequent route planning due to an excessive number of leaf nodes.
[0036] After completing the geospatial index construction coupled with quadtree and Geohash encoding in step 1, the next step is to build a communication topology graph based on the leaf nodes of the quadtree, and then use the ant colony optimization algorithm to search for the optimal communication path from the concentrator to the target irrigation water point on the topology graph.
[0037] A communication topology graph is constructed using all leaf nodes of the quadtree obtained in step 1. A communication topology graph is a data structure that uses graph theory to abstractly describe a wired water meter communication network, where each leaf node serves as a vertex. In the aforementioned embodiment, the 200 irrigation water points, after recursively partitioning using the quadtree, generate approximately 40 to 50 leaf nodes, thus the communication topology graph contains approximately 40 to 50 vertices. Furthermore, the concentrator itself also participates in the graph construction as a special vertex; this vertex is called the starting vertex and serves as the starting point for all subsequent virtual ants to begin their pathfinding journey.
[0038] Whether a communication topology edge exists between vertices in a communication topology graph depends on whether there is a physical connection between the corresponding leaf nodes via wired communication cables. In actual irrigation scenarios, wired communication cables are typically laid along irrigation canals, field roads, or underground pipelines. The cable routing is influenced by factors such as terrain conditions, construction paths, and project costs, and does not strictly follow the quadrant adjacency relationships of a quadtree in geographic space. For example, two leaf nodes that do not share a quadrant boundary edge in a quadtree may have a direct communication connection because there is a communication cable laid along the main irrigation canal between them; conversely, two spatially adjacent leaf nodes in a quadtree may not have a cable laid between them because there is a river or cliff in between. Therefore, the establishment of communication topology edges is entirely based on the actual physical connection relationships of wired communication cables, rather than spatial adjacency relationships. This ensures that the communication topology graph can accurately reflect the accessibility of the on-site communication network.
[0039] If there is a physical connection between two leaf nodes via a wired communication cable, a communication topology edge is established between the corresponding two vertices. Each communication topology edge records the number of relay nodes traversed on the corresponding wired communication cable, and this number is used as the hop value of the communication topology edge. Relay nodes are signal relay devices installed along the wired communication cable, responsible for receiving upstream data and forwarding it downstream. The hop value reflects the number of forwardings required for communication data to travel from one leaf node to another; a larger hop value indicates higher communication latency and a higher probability of error. In the subsequent pathfinding process of the ant colony optimization algorithm, the hop value serves as a measure of path cost, causing the algorithm to tend to choose paths that traverse fewer relay nodes. In this embodiment, the hop value between leaf nodes is typically between 1 and 6, with closer leaf nodes usually having a hop value of 1 to 2, while leaf nodes spanning greater distances have a hop value of 4 to 6.
[0040] Simultaneously, a link availability flag is set for each communication topology edge. The link availability flag is a binary state variable, with a value of either valid or invalid. When the wired communication cable corresponding to the communication topology edge is in normal communication status, the link availability flag is valid; when the wired communication cable experiences an open circuit, insulation aging leading to a short circuit, or a relay node along the route fails due to power supply failure, the link availability flag is invalid. The introduction of the link availability flag allows the ant colony optimization algorithm to automatically avoid unavailable communication links during pathfinding. When a cable is interrupted due to construction damage or flooding, simply updating the link availability flag of the corresponding communication topology edge to invalid will allow the next route planning to bypass the faulty link. In an optional implementation, the link availability flag can be updated by the concentrator periodically sending heartbeat detection frames to each relay node. If no response frame is received from a relay node for three consecutive times, the link availability flags of all communication topology edges related to that relay node will be set to invalid.
[0041] refer to Figure 1 ,like Figure 1 As shown, after the quadtree recursively partitions in step 1, several leaf nodes are obtained, each covering a sub-region within the irrigation service area. When constructing the communication topology graph based on all leaf nodes, each leaf node is abstracted as a vertex in the communication topology graph. Figure 1 In this context, nodes are represented by circles, with vertex numbers labeled inside. The concentrator participates in the construction as a special vertex in the communication topology graph, located... Figure 1 The top position is the starting point for all virtual ants in the subsequent iterative pathfinding process of the ant colony. Figure 1 The CCP consists of 17 leaf nodes and 1 concentrator vertex, distributed across multiple levels, forming a tree-like expanding topology from top to bottom. The lines connecting the vertices represent communication topology edges, and each communication topology edge corresponds to a segment of actual wired communication cable. Figure 1 As can be observed, the establishment of communication topology edges is entirely based on the actual physical connections of wired communication cables. Some spatially distant leaf nodes have communication topology edges, while some spatially adjacent leaf nodes are not directly connected. This reflects the characteristic that the communication topology map and geographic spatial partitions are not strictly corresponding. Each communication topology edge is marked with its hop count. It means that, among them This represents the number of relay nodes traversed on the wired communication cable corresponding to the edge of this communication topology. For example... Figure 1 The communication topology edge between the concentrator and vertex 2 is labeled as follows: This indicates that the cable segment passes through one relay node; the communication topology edge between vertex 3 and vertex 8 is labeled as... This indicates that the data has passed through 3 relay nodes. The hop count is used as a metric for path cost in subsequent ant colony optimization algorithms. Virtual ants tend to choose communication topology edges with smaller hop counts because a smaller hop count means fewer relays the communication data passes through, resulting in lower communication latency and higher transmission reliability. Figure 1 The system also distinguishes between two link states: valid links and invalid links. A valid link indicates that the corresponding wired communication cable is in normal communication status, and the link availability flag is valid; an invalid link indicates that the corresponding wired communication cable is unavailable due to a circuit break or the failure of a relay node, and the link availability flag is invalid. Figure 1 The communication topology edges between vertex 3 and vertex 6, and between vertex 10 and vertex 14, are invalid links and are marked with the word "invalid". Invalid links are automatically excluded from the candidate vertex set during the ant colony's iterative pathfinding process. Virtual ants will not select vertices connected by invalid links, thus ensuring that all links on the searched communication path are in a usable state. Figure 1 The overall topology presented in the data indicates that there are usually multiple paths available from the concentrator to the leaf nodes at the bottom layer, which provides ample search space for the ant colony optimization algorithm.
[0042] After the communication topology graph is constructed, one pheromone concentration storage unit is allocated to each communication topology edge in the concentrator's pheromone storage table. The pheromone storage table is a storage area within the concentrator used to store the running state of the ant colony optimization algorithm. Pheromones play an indirect communication role in the ant colony optimization algorithm—virtual ants leave pheromones on a communication topology edge after passing through it. Subsequent virtual ants tend to choose edges with higher pheromone concentrations when selecting paths, thus accumulating pheromones on paths verified as superior by multiple ants, eventually converging to a globally optimal communication route. The initial value of all pheromone concentration storage units is set to a preset uniform initial concentration value. In this embodiment, the preset uniform initial concentration value is set to 1.0, so that the probability of each communication topology edge being selected in the early stages of the algorithm is not affected by pheromone bias, and the search direction is guided entirely by the prefix matching depth of spatial address encoding. In an optional implementation, the preset uniform initial concentration value can be set to any positive number between 0.1 and 10.0. A smaller initial value will accelerate the pheromone differentiation speed but may lead to premature convergence to a suboptimal path, while a larger initial value will prolong the exploration phase but help to discover a better path.
[0043] The following section uses a specific target irrigation point as an example to explain in detail the iterative pathfinding process of the ant colony optimization algorithm.
[0044] First, the spatial address code of the leaf node to which the target irrigation water point belongs is read from the concentrator's geographic index register, and this is used as the target spatial address code. Assume that the spatial address code of the target irrigation water point is 11011000, that is, the leaf node where the water point is located is located at the 4th level of the quadtree, and the partition identifier codes 11, 01, 10, and 00 are passed sequentially from the root node to the leaf node.
[0045] The ant colony iterative pathfinding process consists of multiple iterations. In this embodiment, the preset total number of iterations is set to 50. In optional implementations, the preset total number of iterations can be set to any integer between 20 and 200. More iterations result in a more thorough search but also longer computation time. For the communication topology graph of approximately 40 to 50 vertices in this embodiment, 50 iterations are usually sufficient for the pheromone distribution to converge.
[0046] refer to Figure 2 , Figure 2 Divided into two parts, the upper part shows the pathfinding process of a virtual ant on a communication topology graph, and the lower part shows the bitwise calculation method of prefix matching depth. In the upper part, the concentrator is marked as S, located in the upper left of the graph, serving as the starting vertex; the target leaf node is marked as T, located in the lower right of the graph, represented by a pentagram symbol, and its spatial address code is 11011000. Each vertex in the graph is labeled with its own spatial address code; for example, the spatial address code of vertex C is 11, the spatial address code of vertex E is 1101, and the spatial address code of vertex G is 110110. Figure 2 The diagram shows two communication paths from the concentrator S to the target T. The first path passes through S, C, E, G, and T in sequence, and is the optimal path obtained by the ant colony optimization algorithm after multiple iterations. Observing the spatial address codes of each vertex along this path, it can be found that after starting from S, the prefix matching depth of the spatial address code is 2 when passing through vertex C, increases to 4 when passing through vertex E, further increases to 6 when passing through vertex G, and finally achieves a complete match when reaching the target T. This indicates that in each step of the virtual ant selection, it tends to move to the vertex whose spatial address code is closer to the target, and the prefix matching depth shows a monotonically increasing trend during the pathfinding process. The second path passes through S, A, E, H, and T in sequence, and is a suboptimal path chosen by some virtual ants in the exploration phase of the ant colony optimization algorithm. This path chooses vertex A instead of vertex C in the initial stage. The spatial address code of vertex A is 10, and its prefix matching depth with the target code 11011000 is only 1, which is lower than the prefix matching depth of 2 of vertex C. This selection occurs when a random integer falls into a non-optimal selection range, reflecting the balance mechanism between exploration and utilization in the ant colony optimization algorithm. Figure 2The lower part presents the specific calculation process of the prefix matching depth in tabular form. Using the target spatial address code 11011000 as a reference, the prefix matching depths of vertices C, E, G, A, and F are calculated respectively. The calculation method involves comparing the spatial address codes of the candidate vertices with the target spatial address code bit by bit, starting from the most significant bit, and counting the number of consecutive identical bits from the most significant bit. The diagram shows the bit-by-bit comparison results of the 8-bit target code in a grid format. Successfully matched bits are represented by filled cells, and bits where the matching terminates are represented by blank cells. For example, vertex C's code is 11, which matches the first two bits of the target code, resulting in a prefix matching depth of 2; vertex E's code is 1101, which matches the first four bits of the target code, resulting in a depth of 4; vertex G's code is 110110, which matches the first six bits, resulting in a depth of 6. In contrast, vertex A's code is 10, which only matches the first bit of the target code (both are 1), and the second bit differs between 0 and 1, resulting in a match termination and a depth of only 1. Vertex F is encoded as 1100, with the first two bits matching the target but the third bit differing, and a depth of 2. Prefix matching depth, as the primary evaluation dimension for next-hop selection in the ant colony optimization algorithm, directly determines the position of candidate vertices in the priority sorting sequence. Candidate vertices with greater prefix matching depth are ranked higher and have a higher probability of being selected by virtual ants. This mechanism allows Geohash spatial encoding to not only perform the function of geographic index retrieval but also participate in the direction guidance of communication routing as heuristic information depth. It is the key to the tight coupling between quadtree spatial partitioning, Geohash spatial encoding, and the ant colony optimization algorithm.
[0047] A predetermined number of virtual ants are released in each iteration. These virtual ants are not physical entities, but rather software search agents running in the concentrator's processor. Each virtual ant independently performs one path search from the starting vertex to the target vertex. In this embodiment, 20 virtual ants are released per iteration. In optional implementations, the number of virtual ants can be set between 10 and 100; a larger number of virtual ants allows for more thorough exploration of the path space in a single iteration.
[0048] Each virtual ant starts from the initial vertex where the concentrator is located and maintains its own set of visited vertices and a path hop counter. The set of visited vertices records all vertices that the virtual ant has reached during this pathfinding round, preventing virtual ants from forming cycles in the graph. The initial state of the set of visited vertices includes the starting vertex, i.e., the vertex where the concentrator is located. The path hop counter records the sum of the hop values of all communication topology edges traversed by the virtual ant from its starting point to its current position, and its initial value is 0.
[0049] After reaching a vertex, a virtual ant needs to select the next hop vertex from all its adjacent vertices to continue moving forward. The selection process consists of two stages: constructing a set of candidate vertices and determining the next hop vertex.
[0050] When constructing the candidate vertex set, two types of vertices are excluded from all adjacent vertices of the current vertex: the first type consists of vertices already included in the visited vertex set; these are excluded to prevent virtual ants from backtracking and forming loops, thus invalidating the path. The second type consists of vertices connected to communication topology edges whose link availability flag is invalid; these are excluded to ensure that virtual ants only traverse currently available communication links. The vertices remaining after excluding these two types constitute the candidate vertex set.
[0051] The candidate vertex set may be empty, which occurs when all adjacent vertices of the current vertex have either been visited or their corresponding links are unavailable. If the candidate vertex set is empty and the current vertex is not a leaf node corresponding to the target spatial address code, it means that the virtual ant has reached a dead end, cannot continue moving, and has not yet reached the target. In this case, the virtual ant is marked as having failed in its pathfinding, and its pathfinding process for this round is terminated. Virtual ants marked as having failed in their pathfinding will not participate in subsequent pheromone update operations, and the paths they have traversed will not have any impact on the pheromone distribution, thus avoiding the misleading influence of incorrect paths on subsequent iterations.
[0052] If the candidate vertex set is not empty, different selection strategies are adopted according to the number of vertices in the candidate vertex set.
[0053] When the candidate vertex set contains only one candidate vertex, that candidate vertex is directly selected as the next hop vertex, without the need for evaluation and sorting operations. This situation is more common at the end branches of a communication topology graph.
[0054] When the candidate vertex set contains two or more candidate vertices, each candidate vertex needs to be evaluated. The evaluation operation involves two dimensions. The first dimension is the prefix matching depth: the spatial address code of the candidate vertex is compared bit by bit with the spatial address code of the target vertex, starting from the most significant bit. The number of consecutive identical bits from the most significant bit is determined as the prefix matching depth of the candidate vertex. Taking the target spatial address code as 11011000 as an example, assuming the spatial address code of a candidate vertex is 11010110, the comparison starts from the most significant bit. The first bit is the same as 1, the second bit is the same as 1, the third bit is the same as 0, the fourth bit is the same as 1, the fifth bit is the same as 0, the sixth bit is the same as 1, and the seventh bit is different. The comparison ends, and the prefix matching depth of this candidate vertex is 6. The larger the prefix matching depth, the more levels of ancestor nodes the candidate vertex shares with the target vertex in the quadtree, and the closer it is to the target irrigation water point in geospatial terms. Using prefix matching depth as the primary evaluation metric, the virtual ants tend to move in the direction that is geographically closer to the target at each step. This is the core mechanism of Geohash spatial encoding in routing—spatial address encoding is not only used for index retrieval, but also directly drives the direction selection of route search.
[0055] The second dimension is the current pheromone concentration value: the current pheromone concentration value is read from the pheromone storage table in the pheromone concentration storage unit corresponding to the communication topology edge between the current vertex and the candidate vertex. The pheromone concentration value reflects the cumulative strength of the high-quality paths that have passed through this edge in historical iterations. The higher the concentration, the more elite ants have chosen this edge in history, and the more likely this edge is to be a component of the optimal route.
[0056] After all candidate vertices have been evaluated in the two dimensions mentioned above, they are arranged in descending order of prefix matching depth. When candidate vertices with the same prefix matching depth exist, they are arranged in descending order of current pheromone concentration value, resulting in a priority ranking sequence. This ranking method establishes a two-layer selection priority of "space first, pheromone second"—the virtual ant first focuses on which direction is spatially closer to the target, and then refers to historically accumulated path quality information when the spatial proximity is the same.
[0057] After obtaining the priority sorting sequence, the virtual ants do not always choose the candidate vertex at the top of the list. Instead, a degree of exploration is introduced through a random mechanism. This design draws on the balance between exploitation and development in ant colony optimization algorithms: if the virtual ants always choose the candidate vertex with the highest current evaluation value, the algorithm may converge prematurely to a locally optimal path and miss a better global path; introducing randomness allows some virtual ants to explore edges that are not optimal but may lead to a better global path.
[0058] When the candidate vertex set contains exactly two candidate vertices, a random integer uniformly distributed between 1 and 100 is generated. If this random integer does not exceed a preset priority selection threshold, the candidate vertex ranked first in the priority sorting sequence is selected as the next hop vertex; if the random integer exceeds the preset priority selection threshold, the candidate vertex ranked second is selected as the next hop vertex. In this embodiment, the preset priority selection threshold is set to 75, meaning there is a 75% probability of selecting a candidate vertex ranked higher and a 25% probability of selecting a candidate vertex ranked lower. In an optional implementation, the preset priority selection threshold can be set to any integer between 60 and 90.
[0059] When the candidate vertex set contains three or more candidate vertices, a random integer uniformly distributed between 1 and 100 is generated. If the random integer is between 1 and a preset first selection boundary value, the candidate vertex ranked first in the priority sorting sequence is selected as the next-hop vertex. If the random integer is between the first selection boundary value plus 1 and a preset second selection boundary value, the candidate vertex ranked second is selected as the next-hop vertex. If the random integer is between the second selection boundary value plus 1 and 100, one candidate vertex is randomly selected from all candidate vertices ranked third and beyond with equal probability as the next-hop vertex. In this embodiment, the preset first selection boundary value is set to 60, and the preset second selection boundary value is set to 85. This means that the candidate vertex ranked first has a 60% probability of being selected, the candidate vertex ranked second has a 25% probability of being selected, and the candidate vertices ranked third and beyond share the remaining 15% probability. This segmented probability allocation causes most virtual ants to move along paths that are spatially close and have high pheromone concentrations, while a smaller number of virtual ants are assigned to explore lower-ranked alternative paths, providing an opportunity for the algorithm to escape local optima. In an optional implementation, the preset first selection boundary value can be set to any integer between 40 and 70, and the preset second selection boundary value can be set to any integer between the preset first selection boundary value plus 10 and the preset first selection boundary value plus 30. The specific values can be adjusted according to the connectivity density of the communication topology graph—when the connectivity density is high, the first selection boundary value should be appropriately reduced to enhance exploration, and when the connectivity density is low, the first selection boundary value should be appropriately increased to accelerate convergence.
[0060] After selecting the next-hop vertex, it is added to the set of visited vertices. The hop count of the communication topology edge between the current vertex and the next-hop vertex is accumulated in the path hop counter. Then, the virtual ant moves to the next-hop vertex. The virtual ant repeats the above next-hop selection process at the new current vertex until it reaches the leaf node vertex corresponding to the target spatial address code. When the virtual ant reaches the target vertex, all the vertices visited by the virtual ant in sequence form a complete communication path. The final value of the path hop counter is the total number of hops of this complete communication path.
[0061] In each iteration, after all virtual ants have completed their pathfinding process, whether they successfully reach the target or are marked as having failed, they enter the pheromone update phase. The pheromone update operation consists of two steps: decay processing and elite enhancement.
[0062] The attenuation process multiplies the current value of the pheromone concentration in the storage unit of all communication topology edges in the pheromone storage table by a preset evaporation retention coefficient. The purpose of the attenuation process is to gradually reduce the pheromone remaining from earlier iterations, preventing certain edges from accidentally being selected early on and continuously occupying excessively high pheromone concentrations, thus obscuring better paths discovered in subsequent iterations. The preset evaporation retention coefficient is a positive number greater than 0 and less than 1, representing the proportion of pheromone retained after each iteration. In this embodiment, the preset evaporation retention coefficient is set to 0.7, meaning that after each iteration, the pheromone concentration of each edge is retained at 70% of its original value. If the preset evaporation retention coefficient is expressed as... ,in The volatile retention coefficient has a value range of [value range missing]. Then, the pheromone concentration value of each communication topology edge after attenuation is equal to the pheromone concentration value before attenuation and... The product of . In an optional implementation, the preset evaporation retention coefficient can be set to any value between 0.5 and 0.9—a smaller evaporation retention coefficient makes pheromone forgetting faster and the algorithm more exploratory but converges slower, while a larger evaporation retention coefficient makes pheromone accumulation on high-quality paths more stable but may cause the algorithm to stall on suboptimal paths.
[0063] After the attenuation process is completed, elite enhancement is performed. From all virtual ants that successfully reach the target vertex in the current iteration, the top 3 virtual ants with the smallest total path hop count are selected and marked as elite ants. If the number of virtual ants that successfully reach the target in the current iteration is less than the preset elite number, then all successfully reached virtual ants are marked as elite ants. In this embodiment, the preset elite number is set to 3, meaning that the top 3 virtual ants with the smallest total path hop count are selected in each round. In an optional implementation, the preset elite number can be set between 1 and 5.
[0064] For all communication topology edges traversed by each elite ant, the current value of the corresponding pheromone concentration storage unit in the pheromone storage table is superimposed with a preset elite pheromone increment value. The preset elite pheromone increment value is a positive number, set to 2.0 in this embodiment. This means that each communication topology edge traversed by an elite ant will receive a pheromone increase of 2.0. If multiple elite ants traverse the same communication topology edge, the superimposed pheromone increment on that edge is the product of the number of times the elite ant traversed it and the preset elite pheromone increment value. The elite enhancement mechanism significantly increases the pheromone concentration on the best-performing path in the current iteration, thus making virtual ants in subsequent iterations more inclined to move along these high-pheromone edges, forming a positive feedback loop and accelerating the algorithm's convergence to the optimal route. Virtual ants marked as failing to find their way do not participate in the pheromone update operation, and no pheromone increases will occur on their traversed paths, ensuring that dead ends do not interfere with subsequent pathfinding.
[0065] The aforementioned decay process and elite enhancement constitute one complete pheromone update operation. Each iteration sequentially performs virtual ant release, pathfinding, and pheromone update before proceeding to the next iteration. The algorithm terminates after a preset total number of iterations.
[0066] The optimal dynamic communication route is determined as follows: from all elite ants in all iterations, the complete communication path corresponding to the elite ant with the smallest total path hop count is selected, and this complete communication path is determined as the optimal dynamic communication route for the target irrigation point. If multiple elite ants have the same total path hop count, and both are the minimum, then one of them is randomly selected. In this embodiment, after 50 iterations with 20 virtual ants per round, approximately 1000 search paths are generated. After deducting paths that failed to find their way, the complete communication path corresponding to the elite ant with the smallest total path hop count is the optimal dynamic communication route.
[0067] The optimal dynamic communication route is written into the concentrator's dynamic routing table. The dynamic routing table is a storage area within the concentrator used to store communication paths from the starting vertex to each target leaf node vertex. Each route record contains the spatial address code of the target leaf node and the vertex sequence recorded in the optimal dynamic communication route. The vertex sequence is an ordered list of all vertices traversed sequentially in the optimal dynamic communication route, starting from the starting vertex and ending at the target leaf node vertex.
[0068] It is worth noting that the above-described ant colony iterative pathfinding process targets a single target irrigation point. In actual operation, it is necessary to perform the ant colony iterative pathfinding process separately for each leaf node to which all irrigation points belong within the irrigation service area, writing their respective optimal dynamic communication routes into the dynamic routing table. Since different irrigation points may belong to the same leaf node, the actual number of routes to be planned is equal to the number of leaf nodes, not the number of irrigation points. In this embodiment, there are approximately 40 to 50 leaf nodes, meaning that 40 to 50 independent ant colony iterative pathfinding processes need to be executed. In an optional implementation, when the communication topology is large or the number of leaf nodes is large, the ant colony iterative pathfinding process can be executed in time slots—during off-peak water usage periods (such as nighttime), the concentrator utilizes idle computing resources to complete the route planning for each leaf node one by one.
[0069] When the irrigation communication network undergoes topology changes, such as the addition or removal of wired communication cables, recovery from a relay node failure, or the addition of a concentrator, the communication topology map needs to be updated and the ant colony iterative pathfinding process needs to be re-executed to obtain a new optimal dynamic communication route. Similarly, when the link availability flag of a communication topology edge changes from valid to invalid or from invalid back to valid, it can also trigger the replanning of the affected routes. This is the meaning of the "dynamic" in optimal dynamic communication routing—the route is not permanently fixed after a single planning, but is updated as the communication network state changes.
[0070] The following explains step 3.
[0071] When the concentrator needs to initiate communication access to the wired water meter at a designated irrigation point, the entire process begins with geographic index retrieval, proceeds through route extraction and link activation, and finally completes data acquisition and communication.
[0072] The concentrator first uses the Geohash binary code string of the specified irrigation point as the search key to perform a matching search in the 3-ary mapping records of the geographic index register. The Geohash binary code string has been generated and stored for each irrigation point in step 1, and is a unique digital representation of the geographical location of the irrigation point. The search process compares the search key with the first field (i.e., the Geohash binary code string field) of each 3-ary mapping record in the geographic index register one by one, and finds the record that matches perfectly. After a successful match, the second field—the spatial address code of the leaf node to which the irrigation point belongs—and the third field—the communication device identifier of the wired water meter connected to the irrigation point—are read from the 3-ary mapping record.
[0073] Spatial address encoding is used to locate communication routes in the dynamic routing table. The concentrator uses the spatial address encoding as an index key to search for a matching route record in the dynamic routing table, extracting the vertex sequence recorded in the optimal dynamic communication route. Assume the extracted vertex sequence is: starting vertex, leaf node A, leaf node B, leaf node C, and target leaf node, where the starting vertex is the vertex where the concentrator is located, and the target leaf node is the leaf node to which the specified irrigation water point belongs. This vertex sequence describes the hop-by-hop communication path from the concentrator to the target wired water meter.
[0074] Next, link activation is performed. The concentrator sends link activation commands sequentially to the relay nodes in each leaf node along the path, according to the vertex sequence recorded in the optimal dynamic communication route. The link activation command is a control frame sent by the concentrator to the relay nodes, containing the wired communication port number for which data forwarding needs to be enabled and the target forwarding direction. The hop-by-hop activation process is as follows: The concentrator first sends the link activation command to the relay nodes in leaf node A via the wired communication cable between itself and leaf node A. Upon receiving the link activation command, the relay nodes in leaf node A enable data forwarding on their wired communication ports corresponding to the direction of leaf node B and forward the link activation command to the relay nodes in leaf node B. Similarly, the relay nodes in leaf node B enable data forwarding on their wired communication ports corresponding to the direction of leaf node C and forward the command to the next hop. This process continues hop-by-hop until the relay nodes in the target leaf node have also enabled their ports.
[0075] After all relay nodes along the route have enabled data forwarding, a complete directional communication link is established from the concentrator through leaf nodes A, B, and C to the target leaf node. It's called a "directional" communication link because only relay nodes along the optimal dynamic communication route are activated; other relay nodes not on that route remain dormant or silent. Communication data flows unidirectionally along the activated path and does not propagate throughout the network. Compared to broadcast polling, the advantage of a directional communication link is reduced unnecessary network traffic and power consumption, especially in large-scale networks with a large number of irrigation points. If broadcasting were used for every communication, collecting data from just one water meter in a network of 200 irrigation points would trigger a network-wide response, resulting in a large amount of invalid traffic consuming communication bandwidth.
[0076] After the complete directional communication link is established, the concentrator sends a data acquisition request frame to the wired water meter at the designated irrigation point via this link. The data acquisition request frame carries the communication device identifier of the target wired water meter, which is the third field read from the 3-element mapping record. The data acquisition request frame reaches the target wired water meter hop-by-hop via each relay node along the way. Once the wired water meter recognizes that the communication device identifier in the data acquisition request frame matches its own preset device number, it encapsulates the current cumulative water volume reading, instantaneous flow rate, valve on / off status, and other metering data into a metering data response frame, and returns hop-by-hop to the concentrator along the reverse path of the complete directional communication link. Upon receiving the metering data response frame, the concentrator parses the metering data within, thus completing one data acquisition communication process with the wired water meter at the designated irrigation point.
[0077] After data acquisition and communication are completed, the concentrator can send a link release command to the relay nodes along the route, disabling the data forwarding function of the previously activated wired communication ports, restoring the relay nodes to a silent state, and releasing communication link resources for subsequent communication at other irrigation water points. In an optional implementation, an automatic timeout release mechanism can also be set—if a relay node does not receive any data frames within a preset time after enabling the data forwarding function, for example, a preset time of 30 seconds, the data forwarding function will automatically be disabled and the node will return to a silent state.
[0078] When the concentrator needs to perform periodic meter readings for all irrigation water points within the irrigation service area, step 3 is repeated sequentially for each irrigation water point. This involves using the Geohash binary code string of each irrigation water point as the search key to perform geographic index retrieval, route extraction, link activation, and data collection. The concentrator can sort all irrigation water points according to the lexicographical order of their Geohash binary code strings and collect data sequentially. The advantage of this collection order is that irrigation water points with adjacent Geohash binary code strings are usually also geographically adjacent. When continuously collecting spatially adjacent water points, the optimal dynamic communication route used in two consecutive communications is likely to share more common path segments, reducing the number of link activation and release switching operations. In this embodiment with 200 irrigation water points, sequential collection according to the lexicographical order of the Geohash binary code strings results in a route path overlap rate of 40% to 70% between adjacent collections, a significant improvement compared to the path overlap rate of random order collection (usually less than 20%).
[0079] In another alternative implementation, when the concentrator detects that the link availability flag of a communication topology edge involved in an optimal dynamic communication route in the dynamic routing table has been changed to invalid, the concentrator can first re-execute the ant colony iterative pathfinding process in step 2 for the affected target leaf node to obtain a new optimal dynamic communication route before executing step 3 for communication localization. This on-demand route replanning mechanism can automatically restore communication capabilities when there is a partial failure in the communication network, without the need for manual intervention to reconfigure routes.
[0080] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A wired water meter communication positioning method using geographic information of water usage points as an index, characterized in that, Includes the following steps: Step 1: Collect the geographic latitude and longitude coordinates of all irrigation water points within the irrigation service area, select the Geohash grid cell covering the irrigation service area as the spatial range of the quadtree root node, perform binary partitioning encoding on the latitude and longitude coordinates of each irrigation water point and merge them into a Geohash binary encoding string, perform recursive quadrant partitioning on the spatial range of the root node based on the Geohash binary encoding string to obtain all leaf nodes and their corresponding spatial address codes, and establish a mapping record for each irrigation water point in the concentrator's geographic index register; Step 2: Construct a communication topology graph with all leaf nodes as vertices and the physical connection relationship of wired communication cables as communication topology edges. Use the ant colony optimization algorithm to release virtual ants to perform iterative pathfinding. The next hop selection is based on the prefix matching depth between the spatial address code of the candidate vertex and the spatial address code of the target vertex and the pheromone concentration on the communication topology edge. After pheromone update iteration, the complete communication path with the minimum path cost is determined as the optimal dynamic communication route and written into the dynamic routing table of the concentrator. Step 3: Using the Geohash binary code string of the specified irrigation water point as the retrieval key, locate the corresponding spatial address code and communication device identifier from the mapping record of the geographic index register, extract the optimal dynamic communication route from the dynamic routing table, activate the relay forwarding nodes along the route hop by hop to establish a complete directional communication link, and complete the data collection and communication with the wired water meter of the specified irrigation water point.
2. The method according to claim 1, characterized in that, In step 1, the Geohash grid cell covering the irrigation service area is the Geohash grid cell corresponding to the smallest prefix level selected from the Geohash standard grid system that can completely cover the irrigation service area.
3. The method according to claim 1, characterized in that, In step 1, the binary partitioning encoding process is as follows: within the longitude interval of the root node, the longitude value is continuously partitioned a preset number of times. Each time the partition is performed, the left half that falls into the current interval is recorded as 0 and the right half that falls into the current interval is recorded as 1. The half that falls into the current interval is used as the current interval for the next partition. After all partitions are completed, the longitude binary encoding string is obtained. The latitude binary code string is obtained by performing the same preset number of binary partitions on the latitude values within the latitude range of the root node in the same manner. The longitude binary code string and the latitude binary code string are arranged bit by bit with the longitude bits occupying odd positions and the latitude bits occupying even positions, and then merged into the Geohash binary code string.
4. The method according to claim 1, characterized in that, In step 1, the recursive four-quadrant partitioning process is as follows: The Geohash binary encoding string is truncated from the highest bit to each adjacent pair of bits to form a partition identifier. In each partition identifier, the first bit corresponds to the longitude partition selection, and the second bit corresponds to the latitude partition selection. Based on the first partition identifier, the spatial range of the root node is divided into four sub-quadrants, where partition identifier 00 corresponds to the southwest quadrant, 01 to the northwest quadrant, 10 to the southeast quadrant, and 11 to the northeast quadrant. For each sub-quadrant, the same four-quadrant partitioning is performed using the next partition identifier until the preset maximum recursion depth is reached or the number of irrigation water points in the current quadrant does not exceed the preset leaf node capacity threshold. All partition identifiers passed sequentially from the root node to each leaf node are concatenated in hierarchical order to form a spatial address code.
5. The method according to claim 1, characterized in that, In step 1, the mapping record is a 3-ary mapping record, which includes the Geohash binary encoding string of the irrigation water point, the spatial address encoding of the leaf node to which the irrigation water point belongs, and the communication device identifier of the wired water meter connected to the irrigation water point.
6. The method according to claim 1, characterized in that, In step 2, each communication topology edge records the number of relay forwarding nodes that the corresponding wired communication cable passes through as the hop value; each communication topology edge is set with a link availability status flag bit. When the corresponding wired communication cable is in normal communication state, the link availability status flag bit is valid, and when a circuit is broken or a relay forwarding node fails, the link availability status flag bit is invalid. The pheromone storage table of the concentrator allocates one pheromone concentration storage unit for each communication topology edge, and the initial value of all pheromone concentration storage units is set to a preset uniform initial concentration value.
7. The method according to claim 6, characterized in that, In step 2, the spatial address code of the leaf node to which the target irrigation water point belongs is read from the mapping record of the geographic index register as the target spatial address code. Each virtual ant starts from the starting vertex where the concentrator is located and maintains a set of visited vertices and a path cumulative hop count counter. The initial state of the set of visited vertices includes the starting vertex, and the initial value of the path cumulative hop count counter is 0. When performing the next hop selection, vertices already included in the set of visited vertices and vertices connected by communication topology edges with invalid link availability flags are excluded from all adjacent vertices of the current vertex to obtain a candidate vertex set. If the candidate vertex set is empty and the current vertex is not the leaf node vertex corresponding to the target spatial address code, the virtual ant is marked as having failed to find a path and the current path finding process is terminated.
8. The method according to claim 7, characterized in that, In step 2, for each candidate vertex in the candidate vertex set, its spatial address code is compared bit by bit with the target spatial address code, starting from the most significant bit. The number of consecutive identical bits starting from the most significant bit is counted as the prefix matching depth. The current pheromone concentration value is then read from the pheromone concentration storage unit corresponding to the communication topology edge between the current vertex and the candidate vertex. When the candidate vertex set contains two or more candidate vertices, all candidate vertices are arranged in descending order of prefix matching depth. If the prefix matching depths are the same, they are arranged in descending order of current pheromone concentration value, resulting in a priority sorting sequence. When the candidate vertex set contains only one candidate vertex, it is directly selected as the next hop vertex. When the candidate vertex set contains exactly two candidate vertices, a new hop is generated. Generate a random integer that is uniformly distributed between 1 and 100. If the random integer does not exceed the preset priority selection threshold, select the first candidate vertex in the priority sorting sequence as the next hop vertex; otherwise, select the second candidate vertex. When the candidate vertex set contains 3 or more candidate vertices, generate a random integer that is uniformly distributed between 1 and 100. If the random integer is between 1 and the preset first selection boundary value, select the first candidate vertex. If it is between the first selection boundary value plus 1 and the preset second selection boundary value, select the second candidate vertex. If it is between the second selection boundary value plus 1 and 100, randomly select one of the third and subsequent candidate vertices with equal probability as the next hop vertex. After selecting the next hop vertex, add it to the set of visited vertices and add the hop value of the corresponding communication topology edge to the path cumulative hop counter.
9. The method according to claim 7, characterized in that, In step 2, the pheromone update iteration process is as follows: After all virtual ants complete pathfinding in each iteration, the current value of the pheromone concentration storage unit of all communication topology edges in the pheromone storage table is multiplied by a preset evaporation retention coefficient for decay processing; from all virtual ants that successfully reach the leaf node vertex corresponding to the target space address code in this iteration, the top preset number of elite virtual ants with the smallest total path jumps are selected and marked as elite ants; the current value of the pheromone concentration storage unit corresponding to all communication topology edges traversed by each elite ant is superimposed with a preset elite pheromone increment value; virtual ants marked as pathfinding failures do not participate in the pheromone update operation. After a preset total number of iterations, the complete communication path corresponding to the elite ant with the smallest total number of hops in all iterations is determined as the optimal dynamic communication route.
10. The method according to claim 1, characterized in that, In step 3, the concentrator sends link activation commands to the relay forwarding nodes in each leaf node along the route in sequence according to the vertex sequence recorded in the optimal dynamic communication route. After receiving the link activation command, each relay forwarding node starts the data forwarding function of its own wired communication port and establishes a complete directional communication link from the concentrator through all intermediate leaf nodes to the wired water meter at the designated irrigation water point. The concentrator sends a data acquisition request frame to the wired water meter at the designated irrigation water point through the complete directional communication link and receives the metering data response frame returned by the wired water meter.