Application method of Distance Map in water supply drawing of public building toilets
The pipeline path of the building bathroom water supply system is optimized by using the Distance Map and BFS algorithms, which solves the problem of excessive pipeline elbows in the existing technology, generates a reasonable pipeline path for actual layout, and improves design efficiency and accuracy.
Patent Information
- Application Number
- CN202211512620.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-28
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2042-11-28
AI Technical Summary
When designing bathroom pipes in existing building water supply systems, there are problems such as too many pipe elbows and jagged paths that cannot be practically arranged. Existing algorithms find it difficult to generate reasonable pipeline paths.
Distance Map combined with BFS algorithm is used to generate the shortest Manhattan distance path by establishing Distance Map and merging algorithm, avoid obstacles, optimize pipeline path, reduce elbows, and meet actual layout requirements.
The generated pipeline path has fewer elbows and can be effectively used for the layout of actual building water supply systems, improving design efficiency and accuracy.
Smart Images

Figure CN115906358B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of architectural design, and in particular relates to an application method based on a Distance Map in a large-scale drawing of water supply for public toilets in buildings. Background Art
[0002] A building water supply system is a cold water supply system that brings water from the urban water supply network or a private water source into indoor spaces, distributing it through distribution pipes to domestic, industrial, and firefighting water equipment, ensuring that the water quantity, pressure, and quality requirements of each water point are met. The building water supply and drainage system actually consists of two aspects: the building water supply system and the building drainage system. Based on the water supply target and requirements, the building water supply system can be divided into domestic water supply systems, industrial water supply systems, firefighting water supply systems, and combined water supply systems. The building water supply system primarily consists of five major components: inlet pipes, water meter nodes, water supply network, water distribution or water equipment, and water supply accessories. Existing building water supply systems mostly rely on manually designed piping layouts. This is inefficient and often leads to omissions in buildings with complex water supply requirements, such as bathrooms. Using conventional pathfinding algorithms to calculate pipeline paths results in numerous elbows and jagged paths along diagonal lines, making them unsuitable for practical layouts.
[0003] To address the shortcomings of existing technologies, researchers have conducted extensive research and proposed various solutions. For example, a Chinese patent document [202210476690.2] discloses a Steiner tree-based indoor water pipe routing method, device, and system. The method includes the following steps: obtaining household data and pipe laying cost data; actively generating a weighted routing graph based on the acquired data; calculating the optimal path between water sources, faucets, and each node in the weighted routing graph; finding the optimal path between all piped nodes and unconnected faucets that satisfies the constraints and has the lowest additional cost, and incorporating it into the routing scheme to obtain a preliminary water pipe routing scheme; obtaining a weighted support subgraph based on the nodes of the preliminary water pipe routing scheme; obtaining an improved water pipe routing scheme from its minimum spanning tree on the weighted support subgraph; and deleting redundant pipes from the improved water pipe routing scheme to obtain the final water pipe routing scheme.
[0004] The above solution solves the problem of automatic wiring of indoor water pipes to a certain extent, but the solution still has many shortcomings. For example, the generated pipelines still have a large number of jagged paths and cannot be used for actual layout. Summary of the Invention
[0005] The purpose of the present invention is to address the above problems and provide a method for applying Distance Map in a large-scale drawing of water supply for public toilets in a building, which has a reasonable design and a pipeline path that can be used for actual layout.
[0006] To achieve the above-mentioned object, the present invention adopts the following technical solutions: This method of applying Distance Map in the water supply master plan of public building toilets includes the following steps:
[0007] S1: Input the building water supply drawing, water use endpoints and pipeline starting points;
[0008] S2: Create a DistanceMap for each point, superimpose and merge the DistanceMaps of two adjacent points to obtain the shortest Manhattan distance path between the two points, and expand the process to all points to obtain the path;
[0009] S3: Output the water supply pipeline map. By improving the BFS algorithm and establishing a DistanceMap to obtain the paths of all points, the generated pipeline path has fewer elbows, making it easier to apply to actual water supply pipeline layout.
[0010] In the above-mentioned method for applying the Distance Map in the water supply master plan of a public building toilet, the building water supply master plan in step S1 includes a room area, an area coordinate system, and obstacles.
[0011] In the above-mentioned method for applying the Distance Map to the water supply master plan of a public building toilet, step S2 includes the following steps:
[0012] S21: Model the entire room based on the input spatial outline and inaccessible areas;
[0013] S22: Create a DistanceMap for the entire room;
[0014] S23: Use the merging algorithm to obtain the longest pipeline shared by all points. Use regional modeling to divide the room area to facilitate subsequent discretization processing.
[0015] In the aforementioned method for applying a distance map to a public building's toilet water supply master plan, step S21 divides the space into a grid and stores it in a two-dimensional array. Passable and impassable areas are marked on the grid, and distance calculations are then performed within the passable areas. Using a BFS algorithm, this calculation can be extended to cover all passable points within the space, avoiding design oversights.
[0016] In the above-mentioned application method based on Distance Map in the large-scale drawing of water supply for public toilets in buildings, step S22 operates on the two-dimensional array obtained in step S21, and increases the path distance by one each time the path moves forward from a point, and continuously expands using BFS until all passable points in the space are calculated.
[0017] In the above-mentioned application method based on Distance Map in the water supply master plan of a public building toilet, the merging algorithm in step S23 adopts the following steps for two water-using endpoints and one pipeline starting point:
[0018] S231: The two water-using endpoints are marked as P1 and P2, and the pipeline starting point is Pstart;
[0019] S232: Calculate the distance maps of the three points using the method of step S22, and add the three distance maps to obtain Dcombined = D1 + D2 + Dstart;
[0020] S233: The value of each point on Dcombined is the sum of the shortest distances from that point to all other points. The point with the smallest value is the optimal intersection of the two pipelines to be connected. The shortest paths from that point to the three points are calculated separately. The total pipeline length is minimized after connecting the end points. This merging algorithm is designed for two water-using endpoints and can quickly determine the optimal pipeline path.
[0021] In the above-mentioned application method based on Distance Map in the water supply drawing of public building toilets, the merging algorithm in S23 adopts the following steps for multiple water use endpoints:
[0022] S234: Add all water points to a list, and use the method from step S231 to step S232 to calculate the best intersection point between all points in the list;
[0023] S235: Find the confluence point farthest from the pipeline starting point, record it as a new virtual point Pnew, remove the two points corresponding to it from the list, and calculate the shortest path between the two points;
[0024] S236: Use the new virtual point Pnew as the representative of the two points and add it to the list for calculation with other points;
[0025] S237: Repeat steps S235 and S236 until only one point remains in the list. Calculate the shortest path from that point to the pipeline start point. Using a merging algorithm for multiple water-using endpoints can yield a more reasonable pipeline path, which, after post-processing, can be directly used for actual layout.
[0026] In the above-mentioned application method based on Distance Map in the water supply drawing of public building toilets, step S23 groups the walls of the rooms where the water use endpoints are located, and extracts a virtual point from each group as the water use endpoint to participate in pipeline calculation.
[0027] In the above-mentioned application method based on Distance Map in the water supply master plan of public building toilets, step S23 uses the shortest path algorithm to find possible virtual points. The usability of the overall algorithm is enhanced through the preprocessing step.
[0028] In the above-mentioned method for applying the Distance Map to the water supply master plan of a public building toilet, step S3 includes the following steps:
[0029] S31: Grid lines are obtained by discretizing the space, and the points in the grid become the points in the upper left corner of the grid. After the connection is completed, the pipeline is connected to the actual water end point;
[0030] S32: Traverse all pipelines, record all connection points, turning points and water end points, then record the connection between all points, and record all longest sides;
[0031] S33: For all longest edges passing through points, different processing is performed depending on the number of points on them; if there is only one water-using endpoint, the edge is connected to the actual water-using endpoint; if there are multiple water-using endpoints, the point through which the edge passes has the shortest total distance to the remaining water-using endpoints is calculated;
[0032] S34: If the distance from any other endpoint to the edge is less than the threshold, it is considered an error due to precision issues, and these endpoints are actually located on an edge. If the distance is greater than the threshold, an edge is connected to the endpoint. Discretization is used to adjust the location of the endpoint to the center grid line for easier calculation.
[0033] Compared with the existing technology, the advantages of the present invention are: it adopts a combination of multiple algorithms to realize automatic planning of water supply pipelines, and the generated pipeline path has fewer elbows, which is convenient for actual layout; it adopts regional modeling to divide the space, effectively avoid obstacles and improve subsequent processing efficiency; it adopts a merging algorithm to handle the collinearity of water use endpoints, and enhances the usability of the overall algorithm by adding some preprocessing steps. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 It is a schematic diagram of the application of the present invention;
[0035] Figure 2 is another application schematic diagram of the present invention;
[0036] Figure 3 It is a regional modeling schematic diagram of the present invention;
[0037] Figure 4 It is a visual view of the DistanceMap of the present invention.
[0038] Figure 5It is a point schematic diagram of the present invention.
[0039] Figure 6 It is a pipeline schematic diagram of the present invention.
[0040] Figure 7 It is a visual view of the merging algorithm of the present invention.
[0041] Figure 8 It is a multi-point pipeline schematic diagram of the present invention.
[0042] Figure 9 It is a discretized processing diagram of a single water-using endpoint of the present invention.
[0043] Figure 10 It is a discretized processing diagram of multiple water use endpoints of the present invention. DETAILED DESCRIPTION
[0044] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0045] like Figure 1-2 As shown in the figure, this method for applying Distance Map to water supply master plans for public building bathrooms is applied to pipeline drawing in building water supply master plans. The application scenarios are public building bathrooms and kindergarten bathrooms. Pipeline drawing in building water supply master plans uses pipes to connect certain water-using endpoints (toilets, urinals, long washbasins, showers, etc.) to the starting point of the pipe. When connecting pipes, the following key requirements must be met: a certain distance must be reserved between the water-using endpoint and the main pipe, and a branch pipe must be connected; the pipe path must be as short as possible; unnecessary elbows must be avoided; the pipe path length can be increased within an acceptable range; a maximum of tees must be used; elbows must avoid non-90-degree bends, and the pipe must remain horizontal and vertical; consideration must be given to avoiding obstacles; the overall pipe path must be a tree-like structure with no loops; the pipe path must be routed along boundaries (walls) as much as possible; wall penetrations must be minimized; and pipe crossings must be prohibited.
[0046] The specific steps include:
[0047] S1: Input the building water supply drawing, water use endpoints and pipeline starting points;
[0048] S2: Create a DistanceMap for each point, superimpose and merge the DistanceMaps of two adjacent points to obtain the shortest Manhattan distance path between the two points, and expand this process to all points to obtain the path. A similar technical solution is an algorithm abstracted according to the needs of the application scenario, which mainly establishes a Steiner tree under the Manhattan distance. For establishing the Steiner tree, the first algorithm is to use dynamic programming to find the Steiner point in the Steiner tree. This algorithm is usually used to calculate the shortest path, so it is difficult to balance the requirements of fewer bends and the shortest path possible. At the same time, when using Manhattan distance, the simplest mathematical geometry calculation will produce more path possibilities when encountering obstacles at the inflection point, and the number of bends for each path is different. When there are more than two endpoints, many possibilities will be combined when the tree is established later, which is very complex, the calculation speed is slowed down, and it is likely that the possibilities will not be exhausted.
[0049] The second algorithm creates a BFS (breadth-first search) grid across the entire room and finds the shortest distance from each point to the starting point, then combines the distances. This approach simultaneously solves the problem of calculating Manhattan distance to ensure the horizontal and vertical alignment of the pipeline and establish the shortest path. However, its drawback remains its inability to minimize bends: a large number of jagged paths may appear between two points in the diagonal direction. It is also difficult to control the occurrence of four-way intersections. Furthermore, this method is difficult to prevent four-way intersections.
[0050] S3: Output water supply pipeline diagram. No single existing algorithm can meet the actual requirements for drawing large-scale building water supply pipelines. Combining and improving multiple algorithms can effectively meet practical application requirements. The results and calculation speed are both within acceptable ranges.
[0051] Specifically, the building water supply proofing diagram in step S1 includes room areas, area coordinate systems, and obstacles.
[0052] In depth, step S2 includes the following steps:
[0053] S21: Model the entire room based on the input space outline and inaccessible areas; Figure 3 The black border shown calculates the bounding box (i.e., the entire square area) of the entire space. To simplify the calculation of the shortest distance from a point in space to the starting point, the space is discretized and divided into a grid with intervals of 100 mm (for example) to ensure that the pipes are laid horizontally and vertically. A 15m x 15m space will be divided into 150 x 150 grids and stored in a two-dimensional array.
[0054] S22: Create a Distance Map for the entire room; that is, calculate the distance map from all points in the space to a fixed point. Since the pipelines are horizontal and vertical, operations can be performed directly on the two-dimensional array obtained in step S21.
[0055] S23: Use a merging algorithm to obtain the longest pipeline shared by all points.
[0056] Furthermore, step S21 divides the space into grids and stores them in a two-dimensional array, and marks the passable areas and impassable areas on the grids, and then performs distance calculations in the passable areas. Figure 3 As shown, the dark area is the impassable area (the obstacles will be marked at this stage), and the subsequent distance calculation will only be performed in the impassable area.
[0057] Furthermore, step S22 operates on the two-dimensional array obtained in step S21, and increases the path distance by one each time a point advances one grid, and continuously expands using BFS until all passable points in the space are calculated. Figure 4 This is the visualization of the Distance Map. The darkest point in the passable area is the starting point. The darker the color, the closer the distance to the point.
[0058] In addition, Figure 5-6 As shown, the merging algorithm in step S23 adopts the following steps for two water-using endpoints and one pipeline starting point:
[0059] S231: The two water-using endpoints are marked as P1 and P2, and the pipeline starting point is Pstart;
[0060] S232: Calculate the distance maps of the three points using the method of step S22, and add the three distance maps to obtain Dcombined = D1 + D2 + Dstart;
[0061] S233: The value of each point on Dcombined is the sum of the shortest distances from that point to all other points. The point with the smallest value is the optimal intersection of the two pipelines to be connected. The shortest paths from that point to the three points are calculated respectively. The total pipeline length is the shortest after the end-to-end connection. The whole process can be referred to Figure 7-8 Visualization of Distance Map.
[0062] like Figure 5 As shown, the merging algorithm in S23 adopts the following steps for multiple water-using endpoints:
[0063] S234: Add all water points to a list, and use the method from step S231 to step S232 to calculate the best intersection point between all points in the list;
[0064] S235: Find the confluence point farthest from the pipeline starting point, record it as a new virtual point Pnew, remove the two points corresponding to it from the list, and calculate the shortest path between the two points;
[0065] S236: Use the new virtual point Pnew as the representative of the two points and add it to the list for calculation with other points;
[0066] S237: Repeat steps S235 and S236 until only one point remains in the list. The shortest path from that point to the pipeline's starting point is calculated. In practice, measures are taken to avoid repeated calculations and improve efficiency. This algorithm avoids tedious operations such as path merging and adjustment after adding obstacles, and directly avoids the creation of cross-connections, streamlining the process while achieving excellent results.
[0067] It can be seen that although the above algorithm has a good effect in processing the collinear merging of water points. However, in actual applications, there will still be redundant inflection points in places where the wall is more concave and convex. When some lines need to be merged in multiple room areas, there will be problems with the allocation of water points. The pipelines of some central island-type washbasins cannot be grouped by themselves. Therefore, some pre-processing steps are taken here to enhance the usability of the overall algorithm. Step S23 groups the walls of the room where the water points are located. The same wall is divided into one group. Some short walls with only a few water points will be merged into a group with nearby walls based on the distance and room relationship. One side of the island-type washbasin is divided into one group. One virtual point is extracted from each group as the water endpoint to participate in the pipeline calculation.
[0068] Because the spatial distance from each set of points to the starting point isn't simply a distance, but rather depends on the surrounding pipelines and room shapes. The virtual point itself is an inflection point on the pipeline, not just any point in the set. It could be an extension of the set of points or a point between two water points. Therefore, it's necessary to find a suitable point along the entire line segment for subsequent pipeline calculations.
[0069] Obviously, step S23 uses a shortest path algorithm to find possible virtual points. Add all room inflection points, obstacle inflection points, the projection points of each water point onto the room wall, and the starting point to the graph (computer architecture concept). Then, use the shortest path algorithm to calculate the shortest path from each water point in the room to the starting point. Find the point in each group with the shortest obstacle-avoiding distance from the starting point, or offset or find the midpoint between two points as a virtual point and add it to the above pipeline calculation.
[0070] Preferably, step S3 includes the following steps:
[0071] S31: Grid lines are obtained by discretizing the space. In actual applications, the location of the water point is most likely not on the grid line but in the middle of the grid line. The point in the grid becomes the point in the upper left corner of the grid. After the connection is completed, the pipeline is connected to the actual water endpoint.
[0072] After the connection is completed, the pipeline needs to be adjusted to connect to the actual water point. It should be noted that the grid side length setting (such as 100mm above) needs to ensure that no two water points are in the same grid (the grid side length is d, which means that the minimum distance between two water points should be greater than d.
[0073] S32: Traverse all pipelines, record all connection points, turning points and water end points, then record the connection between all points, and record all longest sides;
[0074] S33: For all the longest edges passing through the points, different processing is performed depending on the number of points on them; Figure 9 As shown, if there is only one water-using endpoint, the edge is connected to the actual water-using endpoint; if there are multiple water-using endpoints, calculate which point the edge passes through to have the shortest total distance to the remaining water-using endpoints;
[0075] S34: Figure 10 As shown in , if the distance from the other water-using endpoints to the edge is less than the threshold, it is regarded as an error caused by the precision problem, and these water-using endpoints are actually located on an edge; if it is greater than the threshold, an edge is connected to the water-using endpoint.
[0076] To summarize, the principle of this embodiment is to establish a Steiner tree around obstacles based on the distance map, establish a distance map for each point, superimpose and merge the distance maps of two adjacent points to obtain the shortest Manhattan distance path between the two points, and expand the process to all points to finally obtain the path. The entire process combines multiple overall algorithms to ensure that the requirements are met.
[0077] The specific embodiments described herein are merely illustrative of the spirit of the present invention. Persons skilled in the art may make various modifications, additions, or substitutions to the described specific embodiments without departing from the spirit of the present invention or exceeding the scope of the appended claims.
[0078] Although the terms "water end point" and "pipeline starting point" are frequently used herein, the possibility of using other terms is not excluded. These terms are used only to more conveniently describe and explain the essence of the present invention; interpreting them as any additional limitation is contrary to the spirit of the present invention.
Claims
1. A method for applying Distance Map to a water supply master plan of a public building toilet, characterized in that: The steps include: S1: Input the building water supply drawing, water use endpoints and pipeline starting points; S2: Create a DistanceMap for each point, superimpose and merge the DistanceMaps of two adjacent points to obtain the shortest Manhattan distance path between the two points, and expand the process to all points to obtain the path; S21: Model the entire room based on the input spatial outline and inaccessible areas; Step S21 divides the space into grids and stores them in a two-dimensional array. The passable and impassable areas are marked on the grids, and then distance calculation is performed within the passable areas. S22: Create a DistanceMap for the entire room. Step S22 operates on the two-dimensional array obtained in step S21, incrementing the path distance by one each time a point advances one square, and continuously expanding using BFS until all traversable points in the space are calculated. S23: Using a merging algorithm to obtain the longest pipeline shared by all points; S231: The two water-using endpoints are marked as P1 and P2, and the pipeline starting point is Pstart; S232: Calculate the distance maps of the three points using the method of step S22, and add the three distance maps to obtain Dcombined = D1 + D2 + Dstart; S233: The value of each point on Dcombined is the sum of the shortest distances from that point to all other points. The point with the smallest value is the optimal intersection of the two pipelines to be connected. The shortest paths from that point to the three points are calculated separately. The total pipeline length is the shortest after the end-to-end connection. S234: Add all water points to a list, and use the method from step S231 to step S232 to calculate the best intersection point between all points in the list; S235: Find the confluence point farthest from the pipeline starting point, record it as a new virtual point Pnew, remove the two points corresponding to it from the list, and calculate the shortest path between the two points; S236: Use the new virtual point Pnew as the representative of the two points and add it to the list for calculation with other points; S237: Repeat steps S235 and S236 until only one point remains in the list, and calculate the shortest path from the point to the starting point of the pipeline; S3: Output water supply pipeline diagram.
2. The method for applying Distance Map to a water supply master plan for a public building toilet according to claim 1, characterized in that: The building water supply proofing diagram in step S1 includes room areas, area coordinate systems, and obstacles.
3. The method for applying Distance Map to a water supply master plan of a public building toilet according to claim 1, characterized in that: The step S23 is to group the walls of the rooms where the water-using endpoints are located, and extract a virtual point from each group as the water-using endpoint to participate in the pipeline calculation.
4. The method for applying Distance Map to a water supply master plan for a public building toilet according to claim 3, characterized in that: The step S23 uses the shortest path algorithm to find possible virtual points.
5. The method for applying Distance Map to a water supply master plan of a public building toilet according to claim 1, characterized in that: The step S3 includes the following steps: S31: Grid lines are obtained by discretizing the space, and the points in the grid become the points in the upper left corner of the grid. After the connection is completed, the pipeline is connected to the actual water end point; S32: Traverse all pipelines, record all connection points, turning points and water end points, then record the connection between all points, and record all longest sides; S33: For all the longest edges passing through the points, different treatments are performed depending on the number of points on them; If there is only one water-using endpoint, connect the edge to the actual water-using endpoint; if there are multiple water-using endpoints, calculate which point the edge passes through to minimize the total distance to the remaining water-using endpoints; S34: If the distance from the remaining water-using endpoints to the edge is less than the threshold, it is considered an error caused by precision problems, and these water-using endpoints are actually located on an edge; if it is greater than the threshold, an edge is connected to the water-using endpoint.
Citation Information
Patent Citations
Indoor water pipe wiring method, device and system based on Steiner tree
CN114818215A
Basement domestic water supply pipe specification automatic calculation and route automatic generation device
CN113987635A