Method, system and equipment for calculating water quantity and water rate of water meter based on vector calculation and medium

By optimizing the water meter water volume and water fee calculation process through vector calculation, the problem of low efficiency in traditional methods is solved, and efficient and accurate water meter data processing is achieved, meeting the real-time billing requirements of smart water management.

CN122066478APending Publication Date: 2026-05-19CHONGQING SENXINJU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHONGQING SENXINJU INTELLIGENT TECH CO LTD
Filing Date
2026-02-04
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing water meter water volume and water fee calculation methods are inefficient and cannot meet the real-time and high-efficiency requirements of large-scale water meter data. They also suffer from I/O bottlenecks, computational latency, and poor scalability.

Method used

A vector-based computation method is adopted to construct water meter data into a columnar data structure. Batch operations are performed using the SIMD parallel instruction set. The computation process is optimized through Boolean masking and matrix operations, including steps such as meter reading water volume calculation, total meter grouping, water volume allocation, and tiered billing.

Benefits of technology

It significantly improves the performance of water meter reading and water bill calculation, meets the real-time billing needs of water utilities, reduces calculation errors, and reduces hardware and software maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122066478A_ABST
    Figure CN122066478A_ABST
Patent Text Reader

Abstract

The invention discloses a vector calculation-based water meter water quantity and water rate calculation method, and aims to solve the technical problems of I / O bottleneck, high calculation delay and poor expansibility in existing large-scale water meter charging. The method comprises the following steps: constructing a water meter data column vector, calculating an original difference vector based on a current-period reading vector and a previous-period reading vector, and performing Boolean mask processing to obtain a meter reading water volume vector; actual water consumption accounting, total and score table allocation and allocated water amount calculation are achieved through vector operation; a billing water volume vector is obtained in combination with a preferential strategy, and an actual water fee is finally obtained through mixed water splitting, stepped billing matrix operation and water fee preferential adjustment. According to the method, vectorization and matrix operation are adopted to replace traditional line-by-line calculation, so that the operation efficiency can be improved through parallel calculation, the vector algorithm is designed to adapt to complex water affair billing logic, the processing performance is effectively improved, efficient and large-scale billing is achieved, the intelligent water affair development requirement is met, and practicability and popularization value are achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of water supply system billing technology, specifically relating to a method, system, equipment, and medium for calculating water meter water volume and water fees based on vector calculation. Background Technology

[0002] With the rapid development of the smart water industry, the number of water meters managed by water utilities is growing exponentially, placing extremely high demands on the efficiency and real-time performance of water volume and water bill calculations based on large-scale water meter data. Water bill calculation, as a core business of water utilities, is becoming increasingly complex, requiring over a dozen sequential business steps, including meter reading data cleaning, water discharge and cycle detection, main meter and sub-meter allocation, multi-meter accumulation, mixed water usage breakdown, multi-mode tiered billing, and multiple preferential strategies. Traditional calculation methods are gradually becoming inadequate for these business needs.

[0003] Currently, most mainstream billing systems for water utilities are based on stored procedures in relational databases or employ a row-by-row calculation model at the application layer to calculate costs. This row-by-row cursor calculation method has significant technical bottlenecks: First, it suffers from prominent I / O bottlenecks, with frequent disk I / O operations and context switching resulting in low data reading efficiency as data is read row by row. Second, it suffers from severe computational latency; for data from tens of millions of water meters, the complex tiered billing and total meter allocation logic are executed serially, taking an extremely long time and failing to meet the business needs of enterprises for real-time billing and efficient operation and maintenance. Third, it has poor scalability; the business logic and computation model are highly coupled, making it difficult to utilize the SIMD parallel instruction set and parallel computing capabilities of modern CPUs, thus failing to fully unleash the hardware performance.

[0004] In the existing technology, there is a lack of an efficient computing solution that can adapt to complex billing logic. It is impossible to transform serial, line-by-line computing logic into a computing mode that can adapt to the parallel capabilities of hardware. As a result, there is always a performance bottleneck in large-scale water meter billing scenarios, which restricts the large-scale development of smart water management. Summary of the Invention

[0005] The technical problem to be solved by the present invention is to overcome the low efficiency of existing water meter water volume and water fee calculation methods, thereby providing a water meter water volume and water fee calculation method, system, equipment and medium based on vector calculation.

[0006] A method for calculating water meter usage and water charges based on vector computation includes the following steps: Step S1: Obtain water meter data and construct the water meter data into a columnar data structure, including the current period's reading vector. Previous period reading vector Water meter ID identifier vector Water meter master ID vector ; Step S2: Based on the current period's reading vector and the previous period reading vector Calculate the original difference vector ; Based on the original difference vector The meter reading vector is calculated using vector selection operations through Boolean masking. ; Step S3: Based on the meter reading water volume vector Calculate the practical water volume vector ; Based on the water meter ID identification vector and the water meter master ID vector Calculate the grouping vector of the master table ; Based on the practical water volume vector and the grouping vector of the summary table Calculate the total practical water volume vector. ; Based on the practical water volume vector and the grouping vector of the summary table Calculate the total water volume vector of the sub-meters under the main table. Based on the total water volume vector of the sub-meters under the master table. and the total table's practical water volume vector Calculate the total score difference vector ; Calculate the allocated water volume vector based on the preset allocation strategy vector. ; Step S4: Based on the practical water volume vector and the allocated water volume vector Calculate the water volume vector Based on the aforementioned water volume vector Calculate the billing water volume vector based on the preset water volume discount strategy. ; Step S5: Based on a preset mixed water usage splitting strategy, the billing water volume vector is... Convert to billing water volume matrix The billing water volume matrix The columns are added together to form the billing water volume vector. ; Based on a preset stepped threshold matrix and the billing water volume matrix Calculate the step water distribution tensor ; Step S6: Based on the billing water volume matrix and the stepped water distribution tensor The mask is calculated based on whether the water usage characteristics are set in a stepped manner. Calculate the tiered water fee Non-tiered water rates The water billing fee is calculated by summarizing the data. ; Based on the aforementioned water billing fee The actual water bill is calculated using the preset water discount strategy vector. .

[0007] Furthermore, based on the original difference vector Calculate the meter reading water volume vector This includes the following steps: Set a negative value mask The negative value mask is in the original difference vector Valid only when the value is negative; Based on the negative value mask Set the water discharge judgment mask The water discharge judgment mask The negative mask is valid and the original difference vector It is valid when the absolute value is not greater than the preset threshold; Based on the negative value mask and the aforementioned water discharge judgment mask Set a circle-crossing detection mask In the case where the negative mask is valid and the original difference vector It is valid when the absolute value is greater than the preset threshold; Based on the aforementioned water receding judgment mask and the aforementioned loop detection mask Set up a vector selection operation; the vector selection operation is performed on the water discharge judgment mask. When effective, the meter reading water volume vector is set. The corresponding value is zero, in the round-judgment mask. When effective, the meter reading water volume vector is set. The corresponding value is the difference vector between the complete scale range of the water meter and the original value. The sum of the absolute values, otherwise the original difference vector. .

[0008] Furthermore, the water meter ID identifier vector The water meter's master ID vector is a unique identifier vector for the water meter. This is the main meter identifier vector corresponding to the water meter; the value is empty when there is no corresponding main meter. Based on the water meter ID identification vector and the water meter master ID vector Calculate the grouping vector of the master table This includes the following steps: Based on the water meter ID identification vector Construct a water meter ID hash mapping table; the water meter ID hash mapping table The table key is the water meter ID, and the table value is the water meter ID in the water meter ID identifier vector. Line number subscripts in the text; The water meter master ID vector Input the water meter ID hash mapping table For the water meter master ID vector Perform a lookup operation on each element in the table; if the element is in the water meter ID hash mapping table... If a corresponding table key exists, retrieve the table value and assign it to the corresponding water meter master ID vector. If the element is in the water meter ID hash map table If no corresponding table key exists, then use the corresponding water meter master ID vector. Assign the preset sentinel value; obtain the summary table grouping vector. .

[0009] Furthermore, calculate the total score difference vector. This includes the following steps: Based on the grouping vector of the master table From the practical water volume vector The system retrieves the water volume of the corresponding master table by index value, fills it into the row of the sub-table, and obtains the actual water volume vector of the master table. ; Sub-meter Practical Water Volume Vector The value is the practical water volume vector. The corresponding value in the middle table; Based on the practical water volume vector According to the grouping vector of the master table Perform vector aggregation to obtain the total water volume vector of the sub-meters under the master table. ; Calculate the total water volume vector of the table. The vector of total water volume under the sub-meters of the main table The difference is used to obtain the total score difference vector. .

[0010] Furthermore, the allocated water volume vector is calculated based on the preset allocation strategy vector. This includes the following steps: If the allocation strategy is a table-based, non-allocation strategy, then the allocated water volume vector described in the table-based strategy... The value is zero for the allocated water volume vector described in the summary table. The total score difference vector With the practical water volume vector The difference; If the allocation strategy is a proportional allocation strategy, calculate the actual water volume vector of the sub-meter. The vector of total water volume under the sub-meters of the main table The ratio is the apportionment coefficient. ; The total score difference vector in the summary table Broadcast to the corresponding sub-table row to obtain the sub-table's allocated water volume vector. .

[0011] Furthermore, calculate the billing water volume vector. This includes the following steps: Calculate the practical water volume vector and the allocated water volume vector The sum of these values ​​yields the metered water volume vector. ; If the water volume discount strategy is a fixed volume discount strategy, the metered water volume vector will be... and preset fixed discount vector for water meters Take the smaller value to obtain the water discount vector. ; If the water volume discount strategy is a proportional discount strategy, then the metered water volume vector will be... Multiply this by the preset fixed discount ratio vector for water meters to obtain the water volume discount vector. ; Calculate the metered water volume vector With the aforementioned water volume discount vector The difference is set to zero if it is negative, thus obtaining the billing water volume vector. .

[0012] Furthermore, calculate the tiered water fee matrix. This includes the following steps: Calculate the billing water volume vector With the ladder threshold matrix Water volume threshold of the middle level The smaller value is used to obtain a water blocking vector. ; If the billing water volume vector Less than the ladder threshold matrix Second-level water volume threshold Then the second water volume vector If the value is zero, otherwise take the aforementioned billing water volume vector. With the aforementioned two water volume thresholds The difference and the second-level water volume threshold The smaller of the first-level water volume threshold and the second-level water volume vector is the second-level water volume vector. ; If the billing water volume vector Less than the ladder threshold matrix Three water volume thresholds Then the three-stage water volume vector If the value is zero, otherwise take the aforementioned billing water volume vector. With the three water volume thresholds The difference is the three-stage water volume vector. ; The water-blocking vector Second-stage water volume vector Three-stage water volume vector Multiply each of the corresponding tiered unit prices to obtain the tiered water fee matrix. .

[0013] A water meter water volume and water fee calculation system based on vector computing is used to calculate the water volume and water fee of a water meter using the aforementioned water meter water volume and water fee calculation method based on vector computing. The system is characterized by including a data storage layer and a vector computing engine.

[0014] A computer device includes a processor and a memory connected to the processor. The memory stores one or more programs that are executed by the processor to perform the steps in the vector-based water meter water consumption and water fee calculation method described above.

[0015] A computer-readable storage medium storing one or more programs, which are executed by a processor to implement the steps in the above-described method for calculating water meter usage and water fees based on vector computation.

[0016] Beneficial Effects: This invention abandons the traditional row-by-row cursor calculation mode and adopts columnar memory vectors to construct the full water meter data. This enables batch processing in conjunction with the SIMD parallel instruction set, solving the problems of frequent disk I / O and context switching in traditional methods. For processing water meter data of tens of millions, performance is significantly improved compared to traditional row-based calculation, enabling efficient large-scale billing and meeting the core needs of water utilities for real-time billing. By designing a dedicated vectorized calculation method, it accurately covers the entire process of meter reading cycle judgment, total meter allocation, mixed water usage breakdown, multi-mode tiered billing, and multiple discount calculations. The introduction of Boolean masking technology eliminates conditional branch redundancy, and matrix operations efficiently solve the problems of allocation and tiered splitting, avoiding coupling interference from traditional serial logic, significantly reducing calculation errors, and ensuring the accuracy of water billing.

[0017] This invention transforms complex business logic into vectorized and matrix-based operations, fully unleashing the parallel computing capabilities of modern CPUs. By integrating multiple serial steps through vector and matrix operations, it replaces traditional complex stored procedures and loop logic, reducing code redundancy and maintenance difficulty. The operation process does not rely on a specific relational database, resulting in stronger compatibility and effectively reducing the manpower and resource investment required by water utilities in hardware adaptation and software maintenance of billing systems. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a schematic flowchart illustrating the main method steps of the present invention. Detailed Implementation

[0020] To make the above-mentioned objectives, features, and advantages of this application more apparent and understandable, the specific embodiments of this application are described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of this application. However, this application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar modifications without departing from the spirit of this application. Therefore, this application is not limited to the specific embodiments disclosed below.

[0021] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0022] In this application, unless otherwise expressly specified and limited, the terms "installation," "connection," "joining," and "fixing," etc., should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral part; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; they can refer to the internal communication of two components or the interaction between two components, unless otherwise expressly limited. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.

[0023] Reference Figure 1 As shown, this embodiment provides a method for calculating water meter usage and water fees based on vector calculation, including: Step S1: Obtain water meter data and construct the water meter data into a columnar data structure, including the current period's reading vector. Previous period reading vector Water meter ID identifier vector Water meter master ID vector ; Step S2: Based on the current period's reading vector and the previous period reading vector Calculate the original difference vector ; Based on the original difference vector The meter reading vector is calculated using vector selection operations through Boolean masking. ; Step S3: Based on the meter reading water volume vector Calculate the practical water volume vector ; Based on the water meter ID identification vector and the water meter master ID vector Calculate the grouping vector of the master table ; Based on the practical water volume vector and the grouping vector of the summary table Calculate the total practical water volume vector. ; Based on the practical water volume vector and the grouping vector of the summary table Calculate the total water volume vector of the sub-meters under the main table. Based on the total water volume vector of the sub-meters under the master table. and the total table's practical water volume vector Calculate the total score difference vector ; Calculate the allocated water volume vector based on the preset allocation strategy vector. ; Step S4: Based on the practical water volume vector and the allocated water volume vector Calculate the water volume vector Based on the aforementioned water volume vector Calculate the billing water volume vector based on the preset water volume discount strategy. ; Step S5: Based on a preset mixed water usage splitting strategy, the billing water volume vector is... Convert to billing water volume matrix The billing water volume matrix The columns are added together to form the billing water volume vector. (Fixed quantity, remaining quantity, package surplus) Based on a preset stepped threshold matrix and the billing water volume matrix Calculate the step water distribution tensor Based on the preset tiered unit price and the tiered water volume distribution tensor Calculate the tiered water fee matrix ; Step S6: Based on the billing water volume matrix and the stepped water distribution tensor The mask is calculated based on whether the water usage characteristics are set in a stepped manner. Calculate the tiered water fee Non-tiered water rates The water billing fee is calculated by summarizing the data. ; Based on the aforementioned water billing fee The actual water bill is calculated using the preset water discount strategy vector. .

[0024] In this embodiment, the water meter data is constructed as a columnar data structure, including the current period's reading vector. Previous period reading vector Water meter ID identifier vector Water meter master ID vector Water meter range vector Average water volume vector of the first three periods .

[0025] Specifically, this embodiment uses an in-memory data structure based on the Apache Arrow format. All fields involved in the calculation are defined as vector arrays of equal length. In this embodiment, the number of water meters that the system needs to process is set to be... Therefore, the length of the vector is N, and the numerical order of each vector strictly corresponds to that of each water meter. When no values ​​are available, it is defined as Null. Water meter ID identifier vector. This is a unique identifier vector for the water meter. This represents the master meter identifier vector corresponding to the water meter. These represent the current and previous period reading vectors of the water meter, respectively, and are of data type Float64. This represents the average water volume vector for the first three periods, and its data type is Float64.

[0026] In this embodiment, the water meter ID identifier vector This is a unique identifier vector for various types of water meters, including master meters, sub-meters, duplex water meters, ordinary meters, IoT meters, and other types of water meters. In this embodiment, the master-sub-meter relationship has only one level. Sub-meters under the master meter will not be master meters of other sub-meters, and a sub-meter can only have at most one master meter.

[0027] In step S2, based on the original difference vector Calculate the meter reading water volume vector This includes the following steps: The original difference vector is represented as: ; Set a negative value mask The negative value mask is in the original difference vector It is valid when it is negative, and is represented as ; Based on the negative value mask Set the water discharge judgment mask The water discharge judgment mask The negative mask is valid and the original difference vector It is valid when the absolute value is not greater than a preset threshold, and is expressed as follows: The preset threshold is ten times the average water volume vector of the previous three periods. Among them, the receding conditions are expressed as: .

[0028] Based on the negative value mask and the aforementioned water discharge judgment mask Set a circle-crossing detection mask In the case where the negative mask is valid and the original difference vector It is valid when the absolute value is greater than a preset threshold, and is expressed as follows: ; Based on the aforementioned water receding judgment mask and the aforementioned loop detection mask Set up a vector selection operation; the vector selection operation is performed on the water discharge judgment mask. When effective, the meter reading water volume vector is set. The corresponding value is zero, in the round-judgment mask. When effective, the meter reading water volume vector is set. The corresponding value is the difference vector between the complete scale range of the water meter and the original value. The sum of the absolute values, otherwise the original difference vector. Specifically, it is expressed as: ; in, Represents the first element in the corresponding vector. Each element.

[0029] Finally, the meter reading water volume vector The vectorized form of the ternary operator is as follows: .

[0030] In step S3, the water volume vector is represented as follows: ; in, The water volume vector from the old meter read during meter replacement is a sparse vector. ,in Indicates an index. Represents the corresponding numerical value, or as . Adding a water volume vector to the water meter results in a sparse vector. ,in Indicates an index. Represents the corresponding numerical value, or as .

[0031] The water meter ID identification vector The water meter's master ID vector is a unique identifier vector for the water meter. This is the main meter identifier vector corresponding to the water meter; the value is empty when there is no corresponding main meter. Based on the water meter ID identification vector and the water meter master ID vector Calculate the grouping vector of the master table This includes the following steps: Construct an ID-to-Index Map: based on the water meter ID identifier vector. Construct a water meter ID hash mapping table; the water meter ID hash mapping table The key of the hash map is the water meter ID, and the value is the water meter ID in the water meter ID identifier vector. line number subscript ( ), represented as: ; Perform a vectorized lookup: This involves finding the water meter master ID vector... Input the water meter ID hash mapping table For the water meter master ID vector Perform a lookup operation on each element in the table; if the element is in the water meter ID hash mapping table... If a corresponding table key exists, retrieve the table value and assign it to the corresponding water meter master ID vector. If the element is in the water meter ID hash map table If there is no corresponding table key, for example, if the corresponding table key is null or 0, then the corresponding water meter master ID vector will be used. Assign a preset Sentinel Value, which is set to -1 in this embodiment; obtain the summary table grouping vector. .

[0032] Specifically, calculate the total score difference vector. This includes the following steps: Based on the grouping vector of the master table From the practical water volume vector The system retrieves the water volume of the corresponding master table by index (Gather operation), fills it into the row of the sub-table, and obtains the actual water volume vector of the master table. , represented as: ; Sub-meter Practical Water Volume Vector The value is the practical water volume vector. The corresponding value in the middle table is represented as: ; Based on the practical water volume vector According to the grouping vector of the master table Perform a vector aggregation operation (GroupSum operation) to obtain the total water volume vector of the sub-tables under the master table. ; Calculate the total water volume vector of the table. The vector of total water volume under the sub-meters of the main table The difference is used to obtain the total score difference vector. , represented as: ; Specifically, the allocated water volume vector is calculated based on the preset allocation strategy vector. This includes the following steps: If the allocation strategy is a table-based, non-allocation strategy, then the allocated water volume vector described in the table-based strategy... The value is zero for the allocated water volume vector described in the summary table. The total score difference vector With the practical water volume vector The difference is expressed as: (Regarding table partitioning) (For the master table).

[0033] If the allocation strategy is a proportional allocation strategy, calculate the actual water volume vector of the sub-meter. The vector of total water volume under the sub-meters of the main table The ratio is the apportionment coefficient. , represented as: ; The total score difference vector in the summary table Broadcast to the corresponding sub-table row to obtain the sub-table's allocated water volume vector. , represented as: ; In this embodiment, the following steps are also included: Vectorized rounding, in this embodiment, is rounding to the nearest integer, expressed as: ; In this embodiment, the grouping aggregation operator (Group By) is used to group the summary table. Calculate the total water volume of all sub-meters under each master meter after rounding, and compare it with the difference in the master meter to determine the remaining water volume vector for that group. , represented as: ; In some implementations of this embodiment, to achieve surplus, the remaining water volume is compensated to the sub-table (or sub-tables) with the largest water volume or the last sorted value within the group. In a vectorized environment, the compensation object is identified by the row number over the group. Sort all sub-tables belonging to the same master table. In this embodiment, sort by sub-table ID in ascending order to generate a group sequence number and a unique sequence number vector within the group. ; Calculate whether the sequence number of each sub-table is equal to the maximum sequence number of that group to obtain the last-digit sub-table mask. , represented as: ; Calculated total package surplus Broadcast back to the sub-table row. Satisfy. The masked table obtains this portion of the water volume. The final allocated water volume. The synthesis formula is expressed as: .

[0034] In step S4, the billing water volume vector is calculated. This includes the following steps: Calculate the practical water volume vector and the allocated water volume vector The sum of these values ​​yields the metered water volume vector. , represented as: .

[0035] In some implementations of this example, when processing duplicate tables, the water volume of the child tables is accumulated to the parent table via GroupBy(parent table ID). and sub-table Set to 0.

[0036] If the water volume discount strategy is a fixed volume discount strategy, the metered water volume vector will be... and preset fixed discount vector for water meters Take the smaller value to obtain the water discount vector. , represented as: ; in, This indicates the fixed discount vector for the water meter; if there is no fixed discount vector, it is set to 0.

[0037] If the water volume discount strategy is a proportional discount strategy, then the metered water volume vector will be... Multiply this by the preset fixed discount ratio vector for water meters to obtain the water volume discount vector. , represented as: ; in, This is the fixed discount rate set for the water meter; if there is no discount rate, it is set to 0.

[0038] Calculate the metered water volume vector With the aforementioned water volume discount vector The difference is set to zero if it is negative, thus obtaining the billing water volume vector. , represented as: ; In this embodiment, for pure metering meters (such as landscaping meters), the billed water volume is vectorized. Set to 0.

[0039] In step S5, for mixed water use, a splitting rule matrix is ​​constructed, vectorized splitting calculations are performed, and vectorized rounding and inclusion operations are executed. For tiered billing, a tiered threshold matrix is ​​constructed. The billed water volume broadcast is expanded and compared with the threshold matrix to generate water volume distribution matrices for each tier. It supports vectorized adaptation for three modes: monthly tiered, annual tiered, and excess progressive annual tiered. In step S5, the business rules first perform mixed water usage volume splitting, and then, depending on whether tiered calculation is enabled for this water usage type, if tiered calculation is enabled, the water volume split from the water usage type is further split into tiered water volume.

[0040] Specifically, this involves calculating the billing water volume matrix. This includes the following steps: In this embodiment, mixed water use is divided into three types to construct a billing water volume matrix. It consists of N rows and 3 columns. In some water meters, the user's mixed water usage settings allow certain water usage types to be calculated based on a fixed amount, while others are calculated based on a percentage of remaining water. However, the sum of the percentages for water usage types is 100%. Therefore, it is necessary to first calculate the fixed amount calculation for each water usage type (billing water volume matrix). The first column), then calculated proportionally (billing water volume matrix). (The second column). In some embodiments of this example, the water volume of some water meters includes different water usage characteristics, with some water volume being non-chargeable water volume, such as landscaping water volume, some water volume being tiered-charged water volume, such as residential water volume, and some water volume being non-tiered-charged water volume, such as commercial water volume.

[0041] Perform fixed-volume splitting and billing water volume matrix The first column is represented as: ; in, This indicates the fixed value of the water meter setting; if no value is specified, set it to 0.

[0042] The remaining amount is split into its components, represented as follows: ; Proportional splitting, billing water volume matrix The second column is represented as: ; Perform the remaining water usage operation and billing water volume matrix. The third column is represented as: .

[0043] Specifically, calculating the tiered water fee matrix This includes the following steps: Calculate the billing water volume matrix With the ladder threshold matrix Water volume threshold of the middle level The smaller value is used to obtain a water blocking vector. , represented as: ; in, This is a fixed value set for the water meter's properties; if there is no such value, it is set to 0.

[0044] If the billing water volume matrix Less than the ladder threshold matrix Second-level water volume threshold Then the second water volume vector If the value is zero, otherwise take the aforementioned billing water volume matrix. With the aforementioned two water volume thresholds The difference and the second-level water volume threshold The smaller of the first-level water volume threshold and the second-level water volume vector is the second-level water volume vector. , represented as: ; If the billing water volume matrix Less than the ladder threshold matrix Three water volume thresholds Then the three-stage water volume vector If the value is zero, otherwise take the aforementioned billing water volume matrix. With the three water volume thresholds The difference is the three-stage water volume vector. , represented as: ; In practical applications, adjustments are made based on the annual / monthly tiered strategy. If the value of the vector is a yearly ladder, then This is the remaining annual quota.

[0045] As a further improvement to this embodiment, vectorized floor or round functions are also used to ensure... This allows for rounding and including the remainder.

[0046] The water-blocking vector Second-stage water volume vector Three-stage water volume vector Multiply each of the corresponding tiered unit prices to obtain the tiered water fee matrix. , represented as: .

[0047] in, , , This indicates the corresponding three water price tiers, i.e. .

[0048] In this embodiment, the billing water volume matrix is... Vector processing applicable to tiered pricing forms a tiered water volume distribution tensor. In this embodiment, the stepped water distribution tensor A water blocking vector Second-stage water volume vector Three-stage water volume vector composition.

[0049] In other embodiments of this example, the ladder calculation strategy is not necessarily fixed at three levels, but can have more or fewer levels.

[0050] In step S6, the tiered water fee is calculated: Calculate the water use properties for non-tiered calculations. That is, non-tiered water pricing, among which Represents the billing water volume matrix Water volume vectors for water usage types in China and Africa under tiered billing systems. This indicates the corresponding water price. The total water bill is calculated by summing these figures. Finally, based on the cost discount strategy vector... (Specifically, discount vector) Or fixed reduction / free vector ), calculate the actual water bill .

[0051] Specifically, this involves calculating and billing water fees. Set whether the water usage characteristics are used for step-by-step calculation masking. The water billing fee is expressed as follows: ; Where K is the number of mixed properties, or 1 if it is a single water use property.

[0052] In some business rules of this embodiment, the mixed water usage volume is first split, and then the water usage volume is split into tiered volumes only if the water usage nature is enabled.

[0053] This indicates whether tiered calculation is enabled for this water use type. It is set by the initialization rules for mixed water use splitting and calculation. If tiered calculation is enabled, water fees are calculated according to the tiers. If not enabled, the water fee is calculated as the unit price of this water use type multiplied by the water volume.

[0054] Based on the aforementioned water billing fee The actual water bill is calculated using the preset water discount strategy vector. : If the water bill discount policy is a discount, it is represented as: ; in, Represented as a preset discount vector; If the water bill discount policy is a fixed reduction, it is represented as: ; in, It is represented as a preset fixed cost reduction vector.

[0055] The water meter water volume and water fee calculation method based on vector calculation provided in this embodiment eliminates the cost of CPU branch prediction failure by transforming complex condition judgment logic into Boolean mask operation, and significantly improves CPU cache hit rate through in-memory columnar calculation, thereby effectively improving calculation efficiency and saving computing resources.

[0056] The vector calculation method in this embodiment can be completed using Python NumPy or C++ Eigen libraries. It achieves full-process acceleration through columnar memory and SIMD instruction set. At the same time, after vector calculation, the difference between the total amount and the sum of the individual items can be calculated uniformly and corrected in one go through the tail difference vector to ensure accuracy.

[0057] This embodiment also provides a water meter water volume and water fee calculation system based on vector calculation, which is used to calculate the water volume and water fee of the water meter through the above-mentioned water meter water volume and water fee calculation method based on vector calculation. The system is characterized by including a data storage layer and a vector calculation engine.

[0058] The core of the data storage layer adopts a columnar memory structure in the Apache Arrow format to ensure that data is stored contiguously in memory to optimize CPU caching. The vector computing engine includes a library of operators (Mapping) customized for water-related businesses, and uses the underlying SIMD instruction set (such as AVX-512) to perform high-concurrency operations.

[0059] This embodiment also provides a computer device, which includes a processor and a memory. The memory is connected to the processor and stores one or more programs. The one or more programs are executed by the processor to implement the steps in the above-described method for calculating water meter water volume and water fees based on vector calculation.

[0060] This embodiment also provides a computer-readable storage medium storing one or more programs, which are executed by a processor to implement the steps in the above-described method for calculating water meter water volume and water fees based on vector calculation.

[0061] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0062] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for calculating water meter usage and water fees based on vector computation, characterized in that, Includes the following steps: Obtain water meter data and construct it into a columnar data structure, including a current period reading vector, a previous period reading vector, a water meter ID vector, and a water meter master ID vector; calculate the original difference vector based on the current period reading vector and the previous period reading vector; calculate the meter reading water volume vector based on the original difference vector using Boolean masking and vector selection operations; calculate the actual water volume vector based on the meter reading water volume vector; calculate the master meter grouping vector based on the water meter ID vector and the water meter master ID vector; calculate the master meter actual water volume vector based on the actual water volume vector and the master meter grouping vector; calculate the sum vector of water volume of sub-meters under the master meter based on the actual water volume vector and the master meter grouping vector; calculate the total difference vector based on the sum vector of water volume of sub-meters under the master meter and the master meter actual water volume vector; and calculate the total difference vector based on a preset sub-meter grouping vector. The process involves: calculating the allocated water volume vector using the allocation strategy vector; calculating the metered water volume vector based on the actual water volume vector and the allocated water volume vector; calculating the billed water volume vector based on the metered water volume vector and a preset water volume discount strategy; converting the billed water volume vector into a billed water volume matrix based on a preset mixed water use splitting strategy; summing the columns of the billed water volume matrix to obtain the billed water volume vector; calculating a tiered water volume distribution tensor based on a preset tiered threshold matrix and the billed water volume matrix; calculating a tiered water fee matrix based on a preset tiered unit price and the tiered water volume distribution tensor; obtaining tiered and non-tiered water fees by using a preset water use nature tiered calculation mask based on the billed water fee matrix and the tiered water volume distribution tensor, summarizing and calculating the billed water fee; and calculating the actual water fee based on the billed water fee and the preset water fee discount strategy vector.

2. The method for calculating water meter water volume and water fees based on vector calculation according to claim 1, characterized in that, The calculation of the meter reading water volume vector based on the original difference vector includes the following steps: setting a negative value mask, which is effective when the original difference vector is negative; setting a water discharge judgment mask based on the negative value mask, which is effective when the negative value mask is effective and the absolute value of the original difference vector is not greater than a preset threshold; setting a loop judgment mask based on the negative value mask and the water discharge judgment mask, which is effective when the negative value mask is effective and the absolute value of the original difference vector is greater than a preset threshold; setting a vector selection operation based on the water discharge judgment mask and the loop judgment mask; the vector selection operation sets the corresponding value of the meter reading water volume vector to zero when the water discharge judgment mask is effective, and sets the corresponding value of the meter reading water volume vector to the sum of the complete scale range of the water meter and the absolute value of the original difference vector when the loop judgment mask is effective, otherwise it is the original difference vector.

3. The method for calculating water meter water volume and water fees based on vector calculation according to claim 1, characterized in that, The water meter ID vector is a unique identifier vector for the water meter, and the water meter master ID vector is the master identifier vector corresponding to the water meter; the value is empty when there is no corresponding master meter. The calculation of the master meter grouping vector based on the water meter ID vector and the water meter master ID vector includes the following steps: constructing a water meter ID mapping table based on the water meter ID vector; the table key of the water meter ID hash mapping table is the water meter ID, and the table value is the row index of the water meter ID in the water meter ID vector; inputting the water meter master ID vector into the water meter ID hash mapping table, performing a table lookup operation on each element in the water meter master ID vector; if the element has a corresponding table key in the water meter ID hash mapping table, retrieving the table value and assigning it to the corresponding water meter master ID vector; if the element does not have a corresponding table key in the water meter ID hash mapping table, assigning the corresponding water meter master ID vector a preset sentinel value; obtaining the master meter grouping vector.

4. The method for calculating water meter water volume and water fees based on vector calculation according to claim 1, characterized in that, The calculation of the total score difference vector includes the following steps: Based on the total table grouping vector, the water volume of the corresponding total table is obtained from the actual water volume vector by indexing the value, and filled into the row of the sub-table to obtain the total table actual water volume vector; the value of the sub-table actual water volume vector is the corresponding value of the sub-table in the actual water volume vector; based on the actual water volume vector, a vector aggregation operation is performed according to the total table grouping vector to obtain the total water volume vector of the sub-tables under the total table; the difference between the total table actual water volume vector and the total water volume vector of the sub-tables under the total table is calculated to obtain the total score difference vector.

5. The method for calculating water meter water volume and water fees based on vector calculation according to claim 4, characterized in that, The calculation of the allocated water volume vector based on the preset allocation strategy vector includes the following steps: If the allocation strategy is a sub-meter no-allocation strategy, the allocated water volume vector value for the sub-meter is zero, and the allocated water volume vector for the total meter is the difference between the total difference vector and the actual water volume vector; if the allocation strategy is a proportional allocation strategy, the ratio of the actual water volume vector of the sub-meter to the total water volume vector of the sub-meters under the total meter is calculated as the allocation coefficient; the total difference vector of the total meter is broadcast to the corresponding sub-meter row to obtain the allocated water volume vector of the sub-meter.

6. The method for calculating water meter water volume and water fees based on vector calculation according to claim 1, characterized in that, Calculating the billing water volume vector includes the following steps: calculating the sum of the actual water volume vector and the allocated water volume vector to obtain the metered water volume vector; if the water volume discount strategy is a fixed volume discount strategy, taking the smaller value between the metered water volume vector and the preset water meter fixed discount vector to obtain the water volume discount vector; if the water volume discount strategy is a proportional discount strategy, multiplying the metered water volume vector and the preset water meter fixed discount proportional vector to obtain the water volume discount vector; calculating the difference between the metered water volume vector and the water volume discount vector, setting it to zero if it is negative, to obtain the billing water volume vector.

7. The method for calculating water meter water volume and water fees based on vector calculation according to claim 1, characterized in that, Calculating the tiered water pricing matrix includes the following steps: Calculating the smaller value between the billed water volume vector and the first-tier water volume threshold in the tiered threshold matrix to obtain the first-tier water volume vector; if the billed water volume vector is less than the second-tier water volume threshold in the tiered threshold matrix, then the second-tier water volume vector is zero; otherwise, the smaller value between the difference between the billed water volume vector and the second-tier water volume threshold, and between the second-tier water volume threshold and the first-tier water volume threshold, is taken as the second-tier water volume vector; if the billed water volume vector is less than the third-tier water volume threshold in the tiered threshold matrix, then the third-tier water volume vector is zero; otherwise, the difference between the billed water volume vector and the third-tier water volume threshold is taken as the third-tier water volume vector; multiplying the first-tier, second-tier, and third-tier water volume vectors by their corresponding tiered unit prices respectively to obtain the tiered water pricing matrix.

8. A water meter water consumption and water fee calculation system based on vector calculation, used to calculate the water consumption and water fee of a water meter using the water meter water consumption and water fee calculation method based on vector calculation as described in any one of claims 1-7, characterized in that, This includes a data storage layer and a vector computation engine.

9. A computer device, characterized in that, The computer device includes a processor and a memory connected to the processor. The memory stores one or more programs, which are executed by the processor to implement the steps in the vector-based water meter water volume and water fee calculation method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which are executed by a processor to implement the steps in the vector-based water meter water volume and water fee calculation method as described in any one of claims 1-7.