Electric meter data processing method and device, computer device and storage medium

By creating terminal objects for electricity meters, obtaining server load rates, and managing data using handle red-black trees, the problem of low efficiency in traditional electricity meter data processing is solved, achieving efficient electricity meter data processing.

CN116246450BActive Publication Date: 2026-05-12SHENZHEN POWER SUPPLY BUREAU
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN POWER SUPPLY BUREAU
Filing Date
2023-01-04
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Traditional methods of processing electricity meter data rely on manual collection and transmission, resulting in low efficiency.

Method used

By creating a terminal object for each electricity meter, obtaining the server's current load rate for connection, managing terminal handles using a handle red-black tree, and writing the electricity meter data into the server's memory pool, efficient data processing is achieved.

Benefits of technology

It improves the efficiency of querying and reading/writing electricity meter data, makes full use of server resources, and enhances the efficiency of electricity meter data processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116246450B_ABST
    Figure CN116246450B_ABST
Patent Text Reader

Abstract

The application relates to an electric meter data processing method and device, computer equipment, a storage medium and a computer program product. The method comprises the following steps: creating terminal objects corresponding to a plurality of electric meters respectively; the terminal object is used for collecting electric meter data of the electric meter; obtaining current load rates corresponding to a plurality of servers respectively, connecting each terminal object with a corresponding server based on each current load rate; creating a terminal handle corresponding to the terminal object based on a handle red-black tree corresponding to the server connected by the terminal object, and adding the created terminal handle to the corresponding handle red-black tree; and writing the electric meter data collected by the terminal object into a memory pool corresponding to the server connected by the terminal object based on the terminal handle corresponding to the terminal object. The method can improve the efficiency of electric meter data processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of power technology, and in particular to a method, apparatus, computer equipment, storage medium, and computer program product for processing electricity meter data. Background Technology

[0002] With the construction and improvement of power information systems, meter data acquisition technology has emerged. Meter acquisition technology refers to collecting meter data from various meters in the power information system and transmitting the data to the corresponding system.

[0003] However, the traditional method involves manually collecting and transmitting electricity meter data. This manual data processing is time-consuming and labor-intensive, resulting in low efficiency. Summary of the Invention

[0004] Therefore, it is necessary to provide a method, apparatus, computer equipment, computer-readable storage medium, and computer program product for processing electricity meter data that can improve the efficiency of electricity meter data processing, in response to the above-mentioned technical problems.

[0005] This application provides a method for processing electricity meter data. The method includes:

[0006] Create multiple terminal objects corresponding to each electricity meter; the terminal objects are used to collect electricity meter data.

[0007] Get the current load rate of each of the multiple servers, and connect each terminal object to the corresponding server based on the current load rate.

[0008] Based on the handle red-black tree of the server to which the terminal object is connected, create the terminal handle corresponding to the terminal object and add the created terminal handle to the corresponding handle red-black tree;

[0009] Based on the terminal handle corresponding to the terminal object, the meter data collected by the terminal object is written into the memory pool corresponding to the server to which the terminal object is connected.

[0010] This application also provides an electricity meter data processing device. The device includes:

[0011] The terminal object creation module is used to create terminal objects corresponding to multiple electricity meters; the terminal objects are used to collect electricity meter data.

[0012] The terminal object connection module is used to obtain the current load rate of multiple servers and connect each terminal object to the corresponding server based on the current load rate.

[0013] The terminal handle creation module is used to create a terminal handle corresponding to the terminal object based on the handle red-black tree of the server to which the terminal object is connected, and add the created terminal handle to the corresponding handle red-black tree.

[0014] The meter data writing module is used to write the meter data collected by the terminal object into the memory pool of the server to which the terminal object is connected, based on the terminal handle corresponding to the terminal object.

[0015] A computer device includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps of the above-described electricity meter data processing method.

[0016] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above-described electricity meter data processing method.

[0017] A computer program product includes a computer program that, when executed by a processor, implements the steps of the above-described electricity meter data processing method.

[0018] The aforementioned meter data processing method, apparatus, computer equipment, storage medium, and computer program product, by creating corresponding terminal objects for each meter and collecting meter data based on these terminal objects, further obtains the current load rate of each server and determines the server each terminal object connects to based on the current load rate. This fully utilizes the resources of each server, thereby improving the efficiency of meter data processing. Based on the handle red-black tree corresponding to the server connected to the terminal object, a terminal handle corresponding to the terminal object is created, added to the corresponding red-black tree, and the meter data collected by the terminal object is written to the memory pool corresponding to the server connected to the terminal object. Creating corresponding terminal handles for each terminal object and adding them to the corresponding handle red-black tree, and managing the terminal objects corresponding to each terminal handle in the handle red-black tree, effectively improves the efficiency of meter data query and read / write, thereby improving the efficiency of meter data processing. Attached Figure Description

[0019] Figure 1 This is an application environment diagram of a meter data processing method in one embodiment;

[0020] Figure 2 This is a flowchart illustrating a method for processing electricity meter data in one embodiment;

[0021] Figure 3 This is a flowchart illustrating the process of handling kernel tasks in one embodiment;

[0022] Figure 4This is a flowchart illustrating the process of selecting a communication object model in one embodiment;

[0023] Figure 5 This is a schematic diagram of meter data processing in one embodiment;

[0024] Figure 6 This is a structural block diagram of an electricity meter data processing device in one embodiment;

[0025] Figure 7 This is a structural block diagram of the meter data processing device in another embodiment;

[0026] Figure 8 This is an internal structural diagram of a computer device in one embodiment;

[0027] Figure 9 This is a diagram of the internal structure of a computer device in another embodiment. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0029] The meter data processing method provided in this application embodiment can be applied to, for example... Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated onto server 104 or located on the cloud or other network servers. Terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can be smart TVs, smart in-vehicle devices, etc. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc. Server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers. Terminal 102 and server 104 can be directly or indirectly connected via wired or wireless communication, which is not limited herein.

[0030] Both the terminal and the server can be used independently to execute the meter data processing method provided in the embodiments of this application.

[0031] For example, the terminal creates multiple terminal objects corresponding to different electricity meters. These terminal objects are used to collect electricity meter data. The terminal obtains the current load rate of multiple servers and, based on each current load rate, connects each terminal object to its corresponding server. The terminal creates a terminal handle for each terminal object based on the handle red-black tree of the server to which it is connected, and adds the created terminal handle to the corresponding handle red-black tree. Finally, based on the terminal handle of each terminal object, the terminal writes the electricity meter data collected by the terminal object into the memory pool of the server to which the terminal object is connected.

[0032] The terminal and server can also work together to execute the meter data processing method provided in the embodiments of this application.

[0033] For example, a terminal sends a meter data processing request to a server. Based on the request, the server creates multiple terminal objects corresponding to different meters. These terminal objects are used to collect meter data. The server obtains the current load rate of each of the multiple servers and connects each terminal object to its corresponding server based on that load rate. The server creates a terminal handle for each terminal object based on the handle red-black tree of the server to which it is connected and adds the created handle to the corresponding red-black tree. Based on the terminal handle, the server writes the meter data collected by the terminal object into the memory pool of the server to which it is connected. The server then sends the acquired meter data to the terminal, which can then display the meter data or respond to related meter data processing tasks based on it.

[0034] In one embodiment, such as Figure 2 As shown, a method for processing electricity meter data is provided. Taking the application of this method to a computer device as an example, the computer device can be a terminal or a server. The method can be executed independently by the terminal or server, or it can be implemented through interaction between the terminal and the server. The electricity meter data processing method includes the following steps:

[0035] Step S202: Create terminal objects corresponding to multiple electricity meters; the terminal objects are used to collect electricity meter data.

[0036] In this context, "terminal object" refers to the software program used to monitor electricity meter data and operating status. Different types of electricity meters correspond to different terminal objects, and the terminal object corresponding to each meter must be adapted to the meter's functions to comprehensively collect various electricity data recorded in the meter. Electricity meter data refers to the electricity data recorded by the meter, including but not limited to at least one of the following: electricity consumption, voltage, current, and power.

[0037] For example, the computer device creates a corresponding terminal object for each electricity meter based on its meter type, and collects meter data based on the terminal object. Each terminal object connects to its corresponding server, and after the terminal object collects the corresponding meter data, it writes the collected meter data into the server's memory pool.

[0038] Step S204: Obtain the current load rate of each of the multiple servers, and connect each terminal object to the corresponding server based on the current load rate.

[0039] The current load rate refers to the ratio between the current actual load of the server and its peak load.

[0040] For example, the computer device obtains the current load rate of each server, compares the current load rates of each server, determines the server corresponding to each terminal object, and connects each terminal object to the corresponding server.

[0041] Step S206: Based on the handle red-black tree of the server to which the terminal object is connected, create a terminal handle corresponding to the terminal object and add the created terminal handle to the corresponding handle red-black tree.

[0042] A handle-based red-black tree is a data structure used to organize and manage data. Nodes in a handle-based red-black tree are the terminal handles of terminal objects, allowing for the management of various terminal objects. A terminal handle is the identifier corresponding to a terminal object.

[0043] For example, the computer device obtains the handle red-black tree corresponding to the server connected to a single terminal object, creates a terminal handle corresponding to the single terminal object based on each terminal handle in the handle red-black tree, and adds the terminal handle corresponding to the single terminal object to the corresponding handle red-black tree. Using the same method, terminal handles corresponding to other terminal objects are created, and the terminal handles of the other terminal objects are added to their respective handle red-black trees, ensuring that the terminal handles corresponding to each terminal object are all added to their respective handle red-black trees.

[0044] Step S208: Based on the terminal handle corresponding to the terminal object, write the meter data collected by the terminal object into the memory pool corresponding to the server to which the terminal object is connected.

[0045] For example, a computer device acquires meter data collected by a single terminal object, determines the corresponding storage space of the terminal object in the server memory pool based on the terminal handle corresponding to that terminal object, and then writes the meter data collected by the terminal object into the corresponding storage space in the server memory pool. Using the same method, meter data collected by other terminal objects are written into their respective server memory pools, ensuring that meter data collected by each terminal object is written into its corresponding memory pool.

[0046] In the aforementioned electricity meter data processing method, corresponding terminal objects are created for each electricity meter, and meter data is collected based on these terminal objects. Then, the current load rate of each server is obtained, and the server to which each terminal object connects is determined based on the current load rate. This fully utilizes the resources of each server, thereby improving the efficiency of electricity meter data processing. Based on the handle red-black tree corresponding to the server to which the terminal object connects, a terminal handle is created for each terminal object. These terminal handles are added to their respective red-black trees, and the electricity meter data collected by the terminal object is written to the memory pool of the server to which it connects. Creating corresponding terminal handles for each terminal object and adding them to the corresponding handle red-black tree, and managing the terminal objects corresponding to each terminal handle in the handle red-black tree, effectively improves the efficiency of electricity meter data querying and reading / writing, thus enhancing the overall efficiency of electricity meter data processing.

[0047] In one embodiment, obtaining the current load rate of multiple servers includes:

[0048] Obtain the current number of connections and the maximum number of connections for each server; use the ratio between the current number of connections and the maximum number of connections for the same server as the current load rate for that server, and obtain the current load rate for each server.

[0049] The current connection count refers to the number of terminal objects currently connected to the server, which represents the server's current actual load. The maximum connection count refers to the maximum number of terminal objects that the server can connect to, which represents the highest load the server can handle.

[0050] For example, the computer device obtains the current number of connections and the maximum number of connections for each server. The ratio between the current number of connections and the maximum number of connections for the same server is calculated to obtain the current load rate for that server. The same method is used to calculate the current load rate for each of the other servers, thus obtaining the current load rate for each individual server.

[0051] In the above embodiments, by obtaining the current number of connections and the maximum number of connections corresponding to each server, the ratio between the current number of connections and the maximum number of connections corresponding to the same server is used as the current load rate of the server. The ratio between the current number of connections and the maximum number of connections corresponding to the same server can accurately reflect the current load rate of that server. Determining the servers that each terminal object connects to based on each current load rate can make full use of the resources of each server, thereby improving the efficiency of meter data processing.

[0052] In one embodiment, based on the current load rate, each terminal object is connected to its corresponding server, including:

[0053] Determine the current terminal object from among the various terminal objects; select the server with the minimum current load rate as the target server; connect the current terminal object to the target server; update the current load rate of the target server; return to the step of determining the current terminal object from among the various terminal objects, until each terminal object is connected to its corresponding server.

[0054] The target server is the server that is connected to the current terminal object, which is determined based on the current load rate of each server.

[0055] For example, the computer device determines the current terminal object from among various terminal objects. It compares the current load rates of each server and selects the server with the lowest current load rate as the target server for the current terminal object, then connects the current terminal object to the target server. It updates the current connection count for the target server, and updates the current load rate of the target server based on the ratio between the current connection count and the maximum connection count. It then returns to the step of determining the current terminal object from among the terminal objects until all terminal objects are connected to their corresponding servers.

[0056] In one embodiment, the computer device can assign a priority to each terminal object. For example, the priority of a terminal object can be determined based on the importance of the geographical area where the corresponding electricity meter is located; the priority of the corresponding electricity meter can be determined based on the importance of the electricity meter in the power system; the priority of the terminal object can be determined based on the urgency of the electricity meter data recorded by the terminal object in the corresponding data processing task; and so on. When determining the current terminal object from among the various terminal objects, the current terminal object is determined based on the priority of each terminal object. For example, the terminal object with the highest priority can be directly used as the current terminal object; the current terminal object can be determined by combining priority and other influencing factors; and so on.

[0057] In the above embodiments, determining the current terminal object based on the priority of each terminal object allows higher-priority terminal objects to connect to their corresponding target servers first. Since the meter data collected by high-priority terminal objects is often of high importance in meter data processing tasks, determining the current terminal object based on its priority ensures the reliability of meter data processing. Furthermore, connecting the current terminal object to the server corresponding to the minimum current load rate fully utilizes the resources of each server, thereby improving the efficiency of meter data processing.

[0058] In one embodiment, the meter data processing method further includes:

[0059] After writing the meter data collected by the terminal object into the memory pool of the server to which the terminal object is connected, the connection between the terminal object and the corresponding server is disconnected.

[0060] For example, after the computer device obtains the electricity meter data collected by the terminal object and writes the electricity meter data collected by the terminal object into the memory pool corresponding to the server to which the terminal object is connected, it disconnects the connection between the terminal object and the server.

[0061] In the above embodiments, after writing the meter data collected by the terminal object into the memory pool corresponding to the server connected to the terminal object, disconnecting the connection between the terminal object and the corresponding server can effectively save computer resources and improve the utilization rate of computer resources. When the terminal object reconnects to the server, it can connect to the server with the minimum current load rate according to the current load rate of each server, so that the resources of each server are fully utilized, thereby improving the efficiency of meter data processing.

[0062] In one embodiment, the meter data processing method further includes:

[0063] Create a corresponding listening thread for each terminal object; based on each listening thread, monitor the operation of each electricity meter in parallel through each terminal object.

[0064] Among them, the listening thread refers to the thread used to monitor the meter's operating status collected by the terminal object. Meter operation refers to the meter's operational status, including meter status and meter data. Meter status includes normal operation status, fault status, standby status, etc.

[0065] For example, when the computer device creates corresponding terminal objects for each electricity meter, it also creates corresponding listening threads for each terminal object. Based on each listening thread, it listens in parallel to the electricity meter status and electricity meter data collected by each terminal object.

[0066] In the above embodiments, by creating corresponding listening threads for each terminal object, it is possible to monitor the operation of each electricity meter in parallel, which greatly improves the efficiency of electricity meter data collection and transmission and ensures the timeliness of electricity meter data.

[0067] In one embodiment, the meter data processing method further includes:

[0068] Obtain the asynchronous read request queue; determine the target asynchronous read request from the asynchronous read request queue, and determine the target terminal handle corresponding to the target asynchronous read request; read the meter data from the corresponding memory pool based on the target terminal handle; when the read meter data is empty, send a meter data collection request to the terminal object associated with the target terminal handle; read the meter data from the corresponding memory pool again based on the target terminal handle.

[0069] Here, an asynchronous read request refers to an asynchronous request to read meter data. An asynchronous read request queue is a queue composed of asynchronous read requests for meter data received sequentially. A meter data acquisition request is a request sent to a terminal object, used to request the terminal object to immediately perform meter data acquisition operations.

[0070] For example, the computer device acquires an asynchronous read request queue, determines a target asynchronous read request from among the asynchronous read requests in the queue, identifies the meter data required by the target asynchronous read request and the terminal handles corresponding to each meter data, and uses the terminal handles corresponding to each meter data as the target terminal handles for the target asynchronous read request. Based on each target terminal handle, the corresponding meter data is read from the corresponding memory pool. When the meter data read based on the target terminal handle is empty, a data acquisition request is sent to the terminal object associated with the target terminal handle, and the meter data is read again from the corresponding memory pool based on the target terminal handle.

[0071] In one embodiment, the computer device can assign a priority to each asynchronous read request. For example, it can record the time when an asynchronous read request is received and assign a higher priority to asynchronous read requests received earlier; determine the amount of meter data required in the asynchronous read request and assign a higher priority to asynchronous read requests requiring less meter data; determine the estimated processing time of the asynchronous read request and assign a higher priority to asynchronous read requests with shorter estimated processing times; and so on. Based on the priorities corresponding to each asynchronous read request, the target asynchronous read request is determined from the asynchronous read request queue.

[0072] In the above embodiments, by determining the target asynchronous read request among the asynchronous read requests based on their respective priorities, higher-priority asynchronous read requests are responded to first. Determining the target terminal handles corresponding to the target asynchronous read requests and reading the corresponding meter data from the corresponding memory pool based on each target terminal handle effectively improves the efficiency of meter data reading, thereby improving the efficiency of meter data processing. When the read meter data is empty, a data acquisition request is sent to the terminal object associated with the target terminal handle, enabling the terminal object to promptly acquire meter data again, greatly reducing the impact of abnormal meter data acquisition on meter data processing, thus improving the efficiency of meter data processing.

[0073] In one embodiment, such as Figure 3 As shown, the electricity meter data processing method also includes:

[0074] Step S302: Obtain the kernel task corresponding to the current server.

[0075] Step S304: Transfer the supplementary data corresponding to the kernel task to the memory pool of the current server.

[0076] Step S306: Based on the meter data and supplementary data in the current server's memory pool, process the kernel task in the current server's memory pool to obtain the corresponding processing result.

[0077] Here, "current server" refers to any one of the various servers. A kernel task refers to a meter data processing task implemented based on message passing in kernel space and data processing directly in the memory pool. Examples of kernel tasks include meter data analysis, meter alarm response, and meter status analysis. Supplementary data refers to other data not included in the memory pool that is required to complete the kernel task. For example, when the kernel task is meter alarm response, the supplementary data is the meter alarm information; when the kernel task is meter status analysis, the supplementary data is the meter status information; and so on.

[0078] For example, the computer device obtains the kernel task corresponding to the current server, determines the supplementary data required by the kernel task, obtains the corresponding supplementary data, and writes the supplementary data into the memory pool of the current server. Based on the meter data and supplementary data in the memory pool of the current server, corresponding data processing is performed in the memory pool of the current server to complete the kernel task and obtain the corresponding processing result.

[0079] In the above embodiments, after obtaining the kernel task corresponding to the current server, the supplementary data corresponding to the kernel task is transferred to the memory pool of the current server. Based on the meter data and supplementary data in the memory pool of the current server, the kernel task is processed in the server's memory pool. Since all meter data is stored in the memory pool, processing the task in the memory pool can reduce the time spent on a large amount of data transfer, thereby improving the efficiency of meter data processing.

[0080] In one specific embodiment, the meter data processing method of this application can be applied to meter reading operations for various electricity meters in a power system. The meter data processing method includes the following steps:

[0081] 1. Connect to the server

[0082] The power system creates corresponding terminal objects for each electricity meter and obtains the current load rate of each server in the system. Based on the current load rate, each terminal object connects to its corresponding server. For example... Figure 4 As shown, when there are n terminal objects waiting to be connected, the power system uses a minimum connection calculation algorithm for scheduling and selection, thereby choosing the optimal communication object model. Minimum connection calculation involves obtaining the current number of connections and the maximum number of connections for each server, using the ratio between the current number of connections and the maximum number of connections for the same server as the server's current load rate, and determining the minimum value among these current load rates. Communication object model selection involves selecting the server with the minimum current load rate as the target server, connecting the current terminal object to the target server, and obtaining the current communication object model. A callback is then performed based on the current communication object model, returning to the steps of obtaining the current number of connections and the maximum number of connections for each server, until all terminal objects are connected to their corresponding servers.

[0083] The power system obtains the red-black tree of terminal handles corresponding to the servers connected to a single terminal object. Based on the terminal handles in the red-black tree, it creates a terminal handle corresponding to the single terminal object and adds it to the corresponding red-black tree. Using the same method, it creates terminal handles for each of the other terminal objects and adds them to their respective red-black trees, ensuring that all terminal handles for each terminal object are included in their designated red-black trees.

[0084] 2. Collect electricity meter data

[0085] The power system creates a corresponding terminal listening thread for each terminal object. Based on each listening thread, it monitors the meter status and meter data collected by each terminal object in parallel. Based on the terminal handle corresponding to the terminal object, it writes the meter data collected by the terminal object into the memory pool of the server to which the terminal object is connected, and triggers a disconnection event, that is, disconnects the connection between the terminal object and the server.

[0086] 3. Respond to asynchronous read requests

[0087] The power system acquires an asynchronous read request queue, identifies the target asynchronous read request from the queue, and determines the target terminal handle corresponding to the target asynchronous read request. Based on the target terminal handle, it reads meter data from the corresponding memory pool. When the read meter data is empty, it sends a meter data acquisition request to the terminal object associated with the target terminal handle, and then reads meter data from the corresponding memory pool again based on the target terminal handle.

[0088] In the above embodiments, such as Figure 5 As shown, firstly, corresponding terminal objects and terminal listening threads are created for each electricity meter (electricity meter data acquisition terminal), and each terminal object is connected to its corresponding server. Based on the terminal handle red-black tree in the server to which the terminal object is connected, a corresponding terminal handle is created for the terminal object, and the terminal handle corresponding to the terminal object is added to the terminal handle red-black tree. Then, based on the terminal handle, the corresponding terminal object is associated. After the terminal listening thread corresponding to the terminal object obtains the electricity meter data, the electricity meter data is written to the data memory pool of the server to which the terminal object is connected, and a disconnection event is triggered to disconnect the connection between the terminal object and the server. In addition, based on the obtained asynchronous read request queue, the target asynchronous read request is determined, and a read event is triggered. Based on the target terminal handle corresponding to the target asynchronous read request, the electricity meter data is read from the corresponding data memory pool. Based on the read electricity meter data, the corresponding functions are completed, such as message parsing, electricity meter alarm response, heartbeat response, terminal status analysis, and data forwarding. By using asynchronous communication technology and a multi-threaded communication management model processing mechanism, high-concurrency asynchronous communication and high-efficiency meter reading are achieved, greatly improving the efficiency of electricity meter data processing. It fully leverages the parallel processing advantages of multi-core computers to achieve multi-threaded event capture capabilities. At the same time, it determines the optimal communication object model through least-connection calculation, making full use of system resources and meeting the needs of massive data access.

[0089] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0090] Based on the same inventive concept, this application also provides a meter data processing apparatus for implementing the meter data processing method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more meter data processing apparatus embodiments provided below can be found in the limitations of the meter data processing method described above, and will not be repeated here.

[0091] In one embodiment, such as Figure 6 As shown, a meter data processing device is provided, including: a terminal object creation module 602, a terminal object connection module 604, a terminal handle creation module 606, and a meter data writing module 608, wherein:

[0092] The terminal object creation module 602 is used to create terminal objects corresponding to multiple electricity meters; the terminal objects are used to collect electricity meter data.

[0093] The terminal object connection module 604 is used to obtain the current load rate of multiple servers respectively, and connect each terminal object to the corresponding server based on the current load rate.

[0094] The terminal handle creation module 606 is used to create a terminal handle corresponding to the terminal object based on the handle red-black tree of the server to which the terminal object is connected, and add the created terminal handle to the corresponding handle red-black tree.

[0095] The meter data writing module 608 is used to write the meter data collected by the terminal object into the memory pool of the server to which the terminal object is connected, based on the terminal handle corresponding to the terminal object.

[0096] The aforementioned electricity meter data processing device creates corresponding terminal objects for each electricity meter and collects meter data based on these terminal objects. It then obtains the current load rate of each server and determines the server each terminal object connects to based on this load rate, thus fully utilizing server resources and improving the efficiency of electricity meter data processing. Based on the handle red-black tree corresponding to the server connected to each terminal object, it creates a terminal handle for each terminal object, adds these handles to the corresponding red-black tree, and writes the collected meter data to the memory pool of the server connected to the terminal object. Creating corresponding terminal handles for each terminal object and adding them to the corresponding handle red-black tree, and managing the terminal objects corresponding to each terminal handle in the handle red-black tree, effectively improves the efficiency of meter data querying and reading / writing, thereby enhancing the overall efficiency of electricity meter data processing.

[0097] In one embodiment, the terminal object connection module 604 is further configured to:

[0098] Obtain the current number of connections and the maximum number of connections for each server; use the ratio between the current number of connections and the maximum number of connections for the same server as the current load rate for that server, and obtain the current load rate for each server.

[0099] In one embodiment, the terminal object connection module 604 is further configured to:

[0100] Determine the current terminal object from among the various terminal objects; select the server corresponding to the minimum current load rate as the target server; connect the current terminal object to the target server; update the current load rate of the target server; return to the step of determining the current terminal object from among the various terminal objects until each terminal object is connected to its corresponding server.

[0101] In one embodiment, such as Figure 7 As shown, the electricity meter data processing device also includes:

[0102] The terminal object disconnection module 702 is used to disconnect the connection between the terminal object and the corresponding server after writing the meter data collected by the terminal object into the memory pool of the server to which the terminal object is connected.

[0103] The listening thread creation module 704 is used to create corresponding listening threads for each terminal object; based on each listening thread, the operation of each electricity meter is monitored in parallel through each terminal object.

[0104] The read request response module 706 is used to obtain an asynchronous read request queue; determine a target asynchronous read request from the asynchronous read request queue, and determine the target terminal handle corresponding to the target asynchronous read request; read meter data from the corresponding memory pool based on the target terminal handle; when the read meter data is empty, send a meter data collection request to the terminal object associated with the target terminal handle; and read meter data from the corresponding memory pool again based on the target terminal handle.

[0105] Kernel task response module 708 is used to obtain the kernel task corresponding to the current server;

[0106] The supplementary data corresponding to the kernel task is transferred to the memory pool of the current server; based on the meter data and supplementary data in the memory pool of the current server, the kernel task is processed in the memory pool of the current server to obtain the corresponding processing result.

[0107] Each module in the aforementioned electricity meter data processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0108] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 8 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores data such as current load rate and meter readings. The I / O interfaces are used for information exchange between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a meter data processing method.

[0109] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 8As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a method for processing electricity meter data. The display unit is used to form a visually visible image and can be a display screen, projection device, or virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0110] Those skilled in the art will understand that Figure 8 , 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0111] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.

[0112] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above method embodiments.

[0113] In one embodiment, a computer program product or computer program is provided, the computer product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, causing the computer device to perform the steps in the above-described method embodiments.

[0114] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data shall comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0115] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0116] 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.

[0117] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this 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 application should be determined by the appended claims.

Claims

1. A method for processing electricity meter data, characterized in that, The method includes: Create multiple terminal objects corresponding to each electricity meter; the terminal objects are used to collect electricity meter data. Get the current load rate of each of the multiple servers, and connect each terminal object to the corresponding server based on the current load rate. Based on the handle red-black tree of the server to which the terminal object is connected, create the terminal handle corresponding to the terminal object and add the created terminal handle to the corresponding handle red-black tree; Based on the terminal handle corresponding to the terminal object, the electricity meter data collected by the terminal object is written into the memory pool corresponding to the server to which the terminal object is connected; Retrieve the kernel task corresponding to the current server; the kernel task refers to the meter data processing task implemented based on message passing in the kernel space and data processing directly in the memory pool; the kernel task includes meter data analysis, meter alarm response, and meter status analysis. The supplementary data corresponding to the kernel task is transferred to the memory pool of the current server; the supplementary data refers to other data required to complete the kernel task that is not included in the memory pool; when the kernel task is a meter alarm response, the supplementary data is the meter alarm information; when the kernel task is a meter status analysis, the supplementary data is the meter status information. Based on the meter data and supplementary data in the memory pool of the current server, the kernel task is processed in the memory pool of the current server to obtain the corresponding processing result.

2. The method according to claim 1, characterized in that, The step of obtaining the current load rate of each of the multiple servers includes: Get the current number of connections and the maximum number of connections for each server; The ratio between the current number of connections and the maximum number of connections for the same server is used as the current load rate of the server, thus obtaining the current load rate for each server.

3. The method according to claim 1, characterized in that, The step of connecting each terminal object to its corresponding server based on the current load rate includes: The current terminal object is determined from among the various terminal objects; wherein, the process of determining the current terminal object includes: determining the priority of the terminal object based on the importance of the geographical area where the electricity meter corresponding to the terminal object is located; The priority of a terminal object is determined based on the importance of the electricity meter corresponding to that terminal object in the power system. The priority of a terminal object is determined based on the urgency of the meter data recorded by the terminal object in the corresponding data processing task. When determining the current terminal object from among various terminal objects, the current terminal object is determined based on the priority corresponding to each terminal object; the server corresponding to the minimum current load rate is selected as the target server. Connect the current terminal object to the target server; Update the current load rate of the target server; Return to the step of determining the current terminal from each terminal object and continue until each terminal object is connected to the corresponding server.

4. The method according to claim 1, characterized in that, The method further includes: After writing the meter data collected by the terminal object into the memory pool of the server to which the terminal object is connected, the connection between the terminal object and the corresponding server is disconnected.

5. The method according to claim 1, characterized in that, The method further includes: Create a corresponding listening thread for each of the aforementioned terminal objects; Based on each listening thread, the operation of each electricity meter is monitored in parallel through each terminal object.

6. The method according to claim 1, characterized in that, The method further includes: Get the asynchronous read request queue; Determine the target asynchronous read request from the asynchronous read request queue, and determine the target terminal handle corresponding to the target asynchronous read request; Read meter data from the corresponding memory pool based on the target terminal handle; When the read meter data is empty, a meter data acquisition request is sent to the terminal object associated with the target terminal handle; Based on the target terminal handle, the meter data is read again from the corresponding memory pool.

7. The method according to claim 6, characterized in that, The step of determining the target asynchronous read request from the asynchronous read request queue and determining the target terminal handle corresponding to the target asynchronous read request includes: Record the time when an asynchronous read request is received, and assign higher priority to asynchronous read requests that are received earlier; Determine the amount of meter data required in the asynchronous read request, and assign higher priority to asynchronous read requests that require less meter data; Determine the estimated processing time for asynchronous read requests and assign higher priority to asynchronous read requests with shorter estimated processing times; Based on the priority of each asynchronous read request, the target asynchronous read request is determined from each asynchronous read request in the asynchronous read request queue.

8. A data processing device for electricity meters, characterized in that, The device includes: The terminal object creation module is used to create terminal objects corresponding to multiple electricity meters; the terminal objects are used to collect electricity meter data. The terminal object connection module is used to obtain the current load rate of multiple servers and connect each terminal object to the corresponding server based on the current load rate. The terminal handle creation module is used to create a terminal handle corresponding to the terminal object based on the handle red-black tree of the server to which the terminal object is connected, and add the created terminal handle to the corresponding handle red-black tree. The meter data writing module is used to write the meter data collected by the terminal object into the memory pool of the server to which the terminal object is connected, based on the terminal handle corresponding to the terminal object. The kernel task response module is used to obtain the kernel task corresponding to the current server. A kernel task refers to a meter data processing task implemented based on message passing in the kernel space and data processing directly in the memory pool. Kernel tasks include meter data analysis, meter alarm response, and meter status analysis. Supplementary data corresponding to the kernel task is transmitted to the memory pool of the current server. This supplementary data refers to other data not included in the memory pool but required to complete the kernel task. When the kernel task is a meter alarm response, the supplementary data is the meter alarm information; when the kernel task is a meter status analysis, the supplementary data is the meter status information. Based on the meter data and supplementary data in the memory pool of the current server, the kernel task is processed in the memory pool of the current server to obtain the corresponding processing result.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.