A service function pruning method applied to an electric energy meter
Patent Information
- Application Number
- CN202610896329.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-22
- Publication Date
- 2026-10-09
AI Technical Summary
[0006]因此,本发明提供了一种应用于电能表的业务功能裁剪方法解决现有电能表软件静态裁剪方法因缺乏对关键时隙动态多维资源冲突与深层隐性拓扑依赖的量化感知,导致系统在多业务并发时易发生时序违规、级联崩溃或核心计量数据丢失的问题
[0017]与现有技术相比,本发明的有益效果:本发明通过量化各业务模块在关键时隙下的多维硬件资源冲突度,使用图卷积网络挖掘代码间隐藏的拓扑级联崩溃风险,实现对电能表复杂并发场景下潜在故障的高维前馈推理;结合离散时间轴叠加仿真实施出厂 / 装配前的严格时序校验,避免因时隙交叠与资源拥堵引发的系统级死锁,降低核心计量数据丢失风险,最大化利用底层嵌入式存储资源,还能确保核心计量数据的安全与智能终端综合运行的稳定性。
Smart Images

Figure CN122886150A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of electricity meters, and more particularly to a method for tailoring business functions of electricity meters. Background Technology
[0002] As smart meters integrate increasingly complex extended business modules, a large number of components operate concurrently with limited embedded hardware resources. Traditional methods for tailoring and managing smart meter software typically focus only on static code size compression, lacking awareness of dynamic resource consumption characteristics. Due to the non-uniform time-slot characteristics of smart meter hardware resource consumption, the instantaneous load on the processor, flash memory, and bus can spike dramatically when performing metering tasks such as hourly freezing and high-frequency sampling. Conventional methods cannot quantify the multi-dimensional resource conflict degree of each module under dynamic critical time slots, making the trimmed and assembled system prone to timing violations such as processor overruns and flash memory congestion when critical time slots overlap, leading to missed collection of critical metering data or system crashes.
[0003] Furthermore, network topology dependencies are often hidden between various extended service modules. Existing pruning methods cannot extract and assess the impact of pruning actions on the overall resilience of the dependent topology in advance, making it difficult to quantify and analyze potential system-level implicit cascading failure risks, resulting in blindness in the assembly process.
[0004] Conventional technologies severely lack discrete time-series dynamic simulation verification methods before delivery. For resource overloads that occur during operation, they can only rely on watchdog timers for passive restarts, resulting in the permanent loss of critical physical metering status at the moment of restart. This makes it difficult to meet the stability requirements of new power systems for terminal equipment. Summary of the Invention
[0005] In view of the aforementioned existing problems, the present invention is proposed.
[0006] Therefore, this invention provides a business function trimming method for electricity meters to solve the problem that existing static trimming methods for electricity meter software lack quantitative awareness of dynamic multi-dimensional resource conflicts and deep implicit topological dependencies in key time slots, which leads to timing violations, cascading crashes, or loss of core metering data when multiple services are running concurrently.
[0007] To address the aforementioned technical problems, this invention provides the following technical solution: acquiring description data of each business module to be pruned and metering task configuration of the electricity meter; inputting the description data and the metering task configuration into a preset risk assessment decision framework to obtain a set of candidate pruning schemes; wherein, the risk assessment decision framework is used to perform multi-dimensional resource conflict feature extraction and topology risk mapping on the input description data and the metering task configuration; performing superimposed simulation verification on the set of candidate pruning schemes based on preset discrete time axis logic; and outputting the final pruning configuration file in response to the target pruning scheme in the set of candidate pruning schemes passing the superimposed simulation verification.
[0008] As a preferred embodiment of the business function tailoring method for electricity meters described in this invention, the following steps are taken: The description data is acquired and a module description table is generated; a dependency graph is constructed based on the module description table, and an initial closure set is generated; a resource occupancy matrix is generated based on the module description table, and a key time slot table is generated based on the metering task configuration, the key time slot table containing multiple key time slots; a multidimensional conflict matrix is calculated based on the resource occupancy matrix and the key time slot table; a risk prediction model is trained based on the dependency graph and the multidimensional conflict matrix to obtain the risk assessment decision framework.
[0009] As a preferred embodiment of the business function pruning method for electricity meters described in this invention, the hardware resource occupancy parameters of each business module to be pruned under the multiple key time slots are normalized to obtain normalization results; a weighted calculation is performed based on the normalization results to obtain the basic conflict degree; the priority level and interruption attribute of each business module to be pruned are obtained; a priority correction term is calculated based on the priority level, and an interruption penalty term is calculated based on the interruption attribute; the basic conflict degree, the priority correction term, and the interruption penalty term are summed to generate the multidimensional conflict matrix.
[0010] As a preferred embodiment of the business function tailoring method for electricity meters described in this invention, the hardware resource occupancy parameters include processor time occupancy, flash memory write occupancy, and bus access occupancy. The weighted calculation based on the normalized processing result to obtain the basic conflict degree includes: obtaining historical conflict samples of the electricity meter's operating environment; labeling the processor time occupancy weight, flash memory write occupancy weight, and bus access occupancy weight corresponding to the multiple key time slots based on the historical conflict samples; multiplying the normalized processor time occupancy, the normalized flash memory write occupancy, and the normalized bus access occupancy by their corresponding weights and summing them to obtain the basic conflict degree; wherein, the multiple key time slots include at least a sampling processing time slot and a freezing processing time slot; the processor time occupancy weight corresponding to the sampling processing time slot is higher than the processor time occupancy weight corresponding to the freezing processing time slot.
[0011] As a preferred embodiment of the business function pruning method for electricity meters described in this invention, the step of training a risk prediction model based on the dependency graph and the multidimensional conflict matrix to obtain the risk assessment decision framework includes: obtaining the operational characteristic parameters of each business module to be pruned, wherein the operational characteristic parameters include at least average execution time, peak execution time, storage usage, and the interruption attribute; converting the dependency graph into an adjacency matrix, concatenating the operational characteristic parameters into a node feature matrix, and inputting it into the input layer of the risk prediction model; adding self-loops to each node in the adjacency matrix to retain the unique characteristics of each business module to be pruned, and performing normalization on the adjacency matrix after adding self-loops. The normalized adjacency matrix is obtained; the normalized adjacency matrix, the node feature matrix, and the first weight matrix are multiplied by a first-layer graph convolution to achieve the fusion of conflict features between adjacent modules in the dependency graph for each business module to be pruned, and the first hidden feature is obtained by processing with an activation function; the normalized adjacency matrix, the first hidden feature, and the second weight matrix are multiplied by a second-layer graph convolution to achieve the aggregation of risk features on the indirect dependency path, and the second hidden feature is obtained by processing with an activation function again; the output layer of the risk prediction model maps the second hidden feature to the combined risk value corresponding to each business module to be pruned, thus completing the training of the risk prediction model.
[0012] As a preferred embodiment of the business function trimming method for electricity meters described in this invention, the step of performing superimposed simulation verification on the candidate trimming scheme set based on a preset discrete time axis logic includes: constructing a task sequence for each candidate trimming scheme that includes metering fixed tasks, scheme-related tasks, and boundary event triggering tasks; performing simulation according to preset scheduling rules along the discrete time axis, and statistically analyzing key task delays, key time slot processor overruns, key time slot flash memory overruns, and key time slot bus violation counts; and determining that the candidate trimming scheme has timing violations and removing it in response to any of the statistical indicators exceeding the allowable range.
[0013] As a preferred embodiment of the business function trimming method for electricity meters described in this invention, the final trimming configuration file includes flexible control rules for each business module to be trimmed within multiple key time slots. The flexible control rules include: in response to the conflict degree of each business module to be trimmed in the multi-dimensional conflict matrix exceeding a preset threshold within a specific key time slot, writing a suspension flag or a prohibition flag for the corresponding module in the final trimming configuration file; the suspension flag is used to instruct the electricity meter operating environment to suspend the corresponding task when the specific key time slot arrives, and resume execution after the specific key time slot ends.
[0014] This invention provides a business function tailoring system for electricity meters, comprising: a description data acquisition module for acquiring description data of each business module to be tailored and the metering task configuration of the electricity meter; a risk assessment and prediction module for inputting the description data and the metering task configuration into a preset risk assessment decision framework to obtain a set of candidate tailoring schemes; wherein the risk assessment decision framework is used to perform multi-dimensional resource conflict feature extraction and topology risk mapping on the input description data; a simulation verification module for performing superimposed simulation verification on the set of candidate tailoring schemes based on preset discrete time axis logic; and a configuration output module for outputting a final tailoring configuration file in response to the target tailoring scheme in the set of candidate tailoring schemes passing the superimposed simulation verification.
[0015] The present invention provides an electronic device comprising: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, wherein when the computer-executable instructions are executed by the processor, the steps of a business function tailoring method applied to an electricity meter are implemented.
[0016] The present invention provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the business function tailoring method applied to an electricity meter.
[0017] Compared with existing technologies, the beneficial effects of this invention are as follows: This invention quantifies the multi-dimensional hardware resource conflict degree of each business module under critical time slots, uses graph convolutional networks to mine the hidden topology cascade collapse risk between codes, and realizes high-dimensional feedforward inference for potential faults in complex concurrent scenarios of electricity meters; combined with discrete time axis superposition simulation to implement strict timing verification before leaving the factory / assembly, avoids system-level deadlock caused by time slot overlap and resource congestion, reduces the risk of core metering data loss, maximizes the utilization of underlying embedded storage resources, and also ensures the security of core metering data and the stability of the comprehensive operation of smart terminals. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart illustrating the overall process of the business function tailoring method applied to electricity meters. Figure 2 is a flowchart of the risk assessment decision-making framework for the business function tailoring method applied to electricity meters. Figure 3 is a flowchart of the multi-dimensional conflict matrix calculation for the business function trimming method applied to electricity meters. Figure 4 This is a flowchart of the discrete-time axis superposition simulation verification and flexible control process for the business function tailoring method applied to electricity meters. Detailed Implementation
[0020] To make the above-mentioned objects, features, and advantages of the present invention more readily understood, specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the protection scope of the present invention.
[0021] Example 1, referring to Figure 1 As an embodiment of the present invention, a method for tailoring business functions applied to an electricity meter is provided, comprising: S1: Obtain the description data of each business module to be cut and the metering task configuration of the electricity meter; S2: Input the descriptive data and measurement task configuration into the preset risk assessment decision framework to obtain a set of candidate pruning schemes; wherein, the risk assessment decision framework is used to perform multi-dimensional resource conflict feature extraction and topological risk mapping on the input descriptive data and measurement task configuration; S3: Based on the preset discrete time axis logic, perform superimposed simulation verification on the candidate pruning scheme set; S4: In response to the target pruning scheme in the candidate pruning scheme set, the final pruning configuration file is output through superimposed simulation verification.
[0022] Existing methods for firmware trimming or optimization in electricity meters typically focus on static code size compression, lacking awareness of dynamic resource consumption characteristics during runtime. Because electricity meter hardware resource consumption exhibits non-uniformity across discrete time slots, the instantaneous load on processor time, flash memory writes, and bus access spikes dramatically when the meter performs critical metering tasks such as hourly freeze operations, high-frequency sampling processing, or large-scale remote data retrieval. Conventional trimming methods cannot precisely quantify the multi-dimensional resource conflicts of each expansion module under dynamic critical time slots. This leads to timing violations such as processor overruns or flash memory congestion when critical time slots overlap, potentially causing missed core metering data collection or instantaneous system crashes. Furthermore, conventional methods usually only identify explicitly declared shallow direct call interfaces, failing to proactively analyze the impact of trimming actions on the overall module dependency topology resilience and assess potential system-level implicit cascading failure risks. This results in significant blind spots in the functional trimming and firmware assembly process.
[0023] To address the issues of lack of dynamic time slot awareness and implicit topology assessment leading to timing violations and cascading collapses in existing static pruning technologies, this invention acquires basic data in step S1, and in step S2, utilizes a risk assessment decision framework to extract multi-dimensional resource conflict features and map topology risks to the input descriptive data and metering task configuration. This risk assessment decision framework can precisely quantify the dynamic resource conflict degree of each service module to be pruned across multiple dimensions such as processor, flash memory, and bus. It can also proactively mine hidden topology dependency risks and cascading collapse probabilities between service modules using graph convolutional networks, generating a set of candidate pruning schemes that balances multi-dimensional resource equilibrium and topology security at a macro level. Subsequently, in step S3, this embodiment introduces a preset discrete time axis logic to perform superimposed simulation verification on the candidate pruning scheme set, thereby performing realistic discrete time-series dynamic deduction before the electricity meter firmware is assembled or shipped, enabling proactive identification and elimination of combinations with timing violations. Finally, in step S4, the embodiment of this application outputs the final trimmed configuration file, which maximizes the release of embedded storage resources while preventing system-level deadlock caused by time slot overlap, thus ensuring the security of core metering data.
[0024] Example 2, refer to Figure 1-4 As an embodiment of the present invention, based on the above embodiment, a method for tailoring business functions applied to electricity meters is provided.
[0025] It should be noted that, in order to intuitively and clearly illustrate the underlying algorithm logic of multi-dimensional resource conflict feature extraction and risk mapping in this invention, the hardware resource occupancy parameters, weight values, and conflict degree scores used in the following embodiments are derived from exemplary simulation data and engineering test experience values constructed based on typical operating conditions of electricity meters during the R&D phase. Those skilled in the art should understand that the introduction of these specific values is only for the concrete demonstration of the algorithm logic, proving the feasibility of this solution on physical devices, and does not constitute a hard limitation on the actual physical operating parameters of this invention.
[0026] S1: Obtain the description data of each business module to be cut and the metering task configuration of the electricity meter; Before the firmware customization and assembly stage of the electricity meter, the baseline resource consumption declarations of all optional extended business components involved in the customization are collected from the underlying operating system kernel, as well as the mandatory physical resource red line budget of the core legal metering tasks that the electricity meter itself must unconditionally guarantee. This provides a basic data source input stream for the subsequent establishment of a multi-dimensional resource conflict calculation model in a high-dimensional space.
[0027] Specifically, in this embodiment, the system extracts four optional, customizable service modules at the application layer through the underlying operating system package manager. In actual electricity meter application scenarios, these customizable service modules correspond to various extended application components developed based on the HarmonyOS operating system. The electricity meter includes a non-intrusive load identification module, a high-frequency power quality monitoring module, a local fee control processing module, and an advanced communication protocol parsing module. For ease of detailed deduction and explanation, this embodiment uses the above four modules as examples, referring to them as the first customizable service module, the second customizable service module, the third customizable service module, and the fourth customizable service module, respectively.
[0028] For ease of explanation, these modules in this embodiment are collectively referred to as the first to fourth business modules to be cut.
[0029] These are respectively labeled as the first, second, third, and fourth business modules to be cut. The description data for each business module to be cut includes corresponding hardware resource usage parameters, including processor time usage, flash memory write usage, and bus access usage. The specific numerical representation of the description data is as follows: The processor time usage of the first business module to be cut is 2 milliseconds, the flash memory write usage is 128 kilobytes, and the bus access usage is 4 megabits per second. The second business module to be cut has a processor time usage of 4 milliseconds, a flash memory write usage of 64 kilobytes, and a bus access usage of 8 megabits per second. The processor time usage of the third business module to be cut is 5 milliseconds, the flash memory write usage is 256 kilobytes, and the bus access usage is 12 megabits per second. The processor time usage of the fourth business module to be cut is 1 millisecond, the flash memory write usage is 32 kilobytes, and the bus access usage is 2 megabits per second.
[0030] The system reads the metering task configuration of the electricity meter. The metering task configuration includes the hard real-time resource budget boundaries for the electricity meter when performing statutory metering guarantee tasks: at the processor level, the maximum total processor time budget allocated to the extended service module is set at 10 milliseconds; at the flash memory level, the maximum flash memory capacity budget allowed for a single concurrent write is set at 512 kilobytes; at the bus level, the maximum internal system bus bandwidth budget allowed for multiplexing is set at 20 megabits per second. Furthermore, the metering task configuration also pre-declares representative key physical time slots within the electricity meter that are prone to resource congestion, specifically including sampling processing time slots and freeze processing time slots.
[0031] S2: Input the descriptive data and measurement task configuration into the preset risk assessment decision framework to obtain a set of candidate pruning schemes; wherein, the risk assessment decision framework is used to perform multi-dimensional resource conflict feature extraction and topological risk mapping on the input descriptive data and measurement task configuration; Overcoming the limitations of traditional static code size reduction, this paper constructs a high-dimensional mathematical and graph theory model to transform abstract software business modules into quantifiable resource conflict indicators and topological cascading risk characteristics. This provides a reliable decision-making basis for generating a set of candidate reduction schemes that conform to the underlying physical operation of electricity meters.
[0032] The steps for establishing the risk assessment decision-making framework include S2.1-S2.5: S2.1: Obtain description data and generate a module description table; The system extracts structured features from the hardware resource usage parameters of nodes v1, v2, v3, and v4 obtained in S1, maps and persists them to the storage area of the electricity meter's operating environment, and generates a standardized module description table. This module description table provides deterministic numerical input for subsequent multi-dimensional resource conflict feature extraction.
[0033] S2.2: Construct a dependency graph based on the module description table and generate an initial set of closures; To prevent the forced stripping of strongly coupled business components during feature reduction, thus avoiding damage to the logical integrity and runtime stability of the underlying firmware code of the electricity meter, the system can specifically use the Tarjan strongly connected component algorithm to scan the dependency graph, identify and bind components that constitute circular dependencies, and use them as the initial set of closures.
[0034] S2.3: Generate a resource occupancy matrix based on the module description table, and generate a key time slot table based on the metering task configuration. The key time slot table contains multiple key time slots. Specifically, the system parses the calling interface reference relationships in the module description table, establishes directed connections between nodes v1 and v4, and thus constructs a dependency graph. In the operational simulation of this embodiment, the system detects a strong dependency interface relationship with mutual circular calls between the second business module to be pruned, marked as node v2, and the third business module to be pruned, marked as node v3, through low-level code static analysis. The system then performs a strong connected component contraction operation on the dependency graph, merging nodes v2 and v3 into an indivisible initial closure set. The formation of the initial closure set means that in the subsequent pruning decision generation, nodes v2 and v3 must be retained or pruned simultaneously as a bound combination, ensuring the closed loop of dependency logic in the assembled firmware. The physical time slots in the key time slot table reflect the hard real-time constraint boundaries of the energy meter. The sampling processing time slot corresponds to the high-frequency computationally intensive window where the energy meter performs AC analog-to-digital conversion and harmonic analysis; while the 'freeze processing time slot' corresponds to the storage-intensive window where the energy meter writes large amounts of electricity settlement data to non-volatile memory at the top of the hour or at the end of the day.
[0035] Furthermore, the trimming management program generates a critical time slot table based on the metering task configuration. The metering task configuration typically consists of the main metering program, a scheduling table, and a time triggering strategy, explicitly specifying the triggering conditions, execution order, and time requirements for tasks such as sampling processing, demand calculation, and freeze processing. The trimming management program extracts sampling processing time slots, demand calculation time slots, and freeze processing time slots from these configurations. Each critical time slot records its triggering conditions, duration, processor-allocated budget, flash memory write budget, bus access budget, and the maximum allowed module priority.
[0036] The processor allocable budget is not directly equal to the total duration of critical time slots. The pruning management program first performs a baseline measurement, retaining only the main metering task and necessary system services, to obtain the processor occupancy of the baseline metering task in each critical time slot. Then, based on the total available processor time and safety reserves, it calculates the processor allocable budget for prudent business modules. Let the total processor time of a certain critical time slot be... The processor time required for the baseline metering task is Safety reserve is Then the processor in that critical time slot can be allocated a budget. Determine by the following formula: Where k represents the critical time slot number, , , and All units are time. The safety margin is obtained from historical operational fluctuation statistics, and can be determined based on the high percentile fluctuation of the baseline metering task execution time. If the equipment model is changed, the processor frequency is changed, or the metering main program version is updated, the trimming management program will re-execute the baseline measurement and update. .
[0037] For flash memory write budgets, the pruning manager determines them based on the number of writes allowed within a frozen processing slot, the number of write page switches, and the non-volatile memory write duration calibration results. This is typically expressed as the number of writes allowed per critical slot or the amount of write operations. For bus access budgets, the pruning manager does not use continuous values but instead describes them in a hierarchical manner, such as prohibited access, restricted access, and allowed access. Subsequently, the pruning manager maps the bus access types of business modules to the same hierarchical system.
[0038] S2.4: Calculate the multidimensional conflict matrix based on the resource occupancy matrix and the key time slot table.
[0039] The inconsistent hardware resource consumption is converted into a dimensionless mathematical conflict degree through mathematical normalization and weighted mapping, which quantifies the probability of a specific business module causing system overload or crash under a specific physical time slot.
[0040] Specifically, the calculation steps for the multidimensional conflict matrix include S2.41 to S2.45: S2.41: Normalize the hardware resource usage parameters of each business module to be cut under multiple key time slots to obtain the normalization result.
[0041] Hardware resource usage parameters include processor time usage, flash memory write usage, and bus access usage. The normalized calculation formula is as follows: in, This represents the normalized resource usage result. The actual usage parameters declared by the module. The physical budget cap defined in the metering task configuration.
[0042] In actual operation, It is not arbitrarily set by the trimming management program, but comes from the offline performance test records in the module description table, the device-side operation statistics records, or the resource declarations in the build phase; The processor-allocable budget, flash write budget, or bus access budget are derived from the metering task configuration for the corresponding critical time slot.
[0043] The pruning management program normalizes processor time usage, flash memory write usage, and bus access usage separately to convert resource usage of different dimensions, such as milliseconds, write counts, write operation volume, and bus access level, to a unified comparison scale. For bus access usage, the pruning management program first maps the bus access type of the business module and the bus access budget of the critical time slot to the same level system, and then converts it into a normalized result based on the level difference; if the access level of the business module exceeds the allowable level of the critical time slot, the normalized result falls into the limit range.
[0044] S2.42: A weighted calculation is performed based on the normalization results to obtain the basic conflict degree. Specifically, the following steps A1 to A3 are executed: A1: Obtain historical conflict samples of the electricity meter's operating environment; A2: Based on historical conflict samples, the processor time occupancy weight, flash memory write occupancy weight, and bus access occupancy weight are respectively labeled for multiple key time slots; among them, the processor time occupancy weight corresponding to the sampling processing time slot is higher than the processor time occupancy weight corresponding to the freeze processing time slot.
[0045] A3: Multiply the normalized processor time usage, normalized flash write usage, and normalized bus access usage by their respective weights and sum them to obtain the base conflict degree. The calculation formula is as follows: in, Based on the degree of conflict, These are the normalized processor, flash memory, and bus usage, respectively. These are the corresponding weighting coefficients.
[0046] After setting weights according to key time slots, let the normalized value of processor time occupancy of a certain business module i in key time slot k be... The normalized value of flash write usage is Bus access occupancy normalized value Then the basic conflict degree of this business module in the critical time slot k Calculate using the following formula: in, , and These represent the weights of processor time usage, flash memory write usage, and bus access usage in critical time slot k, respectively, with a sum of 1. The weights represent the proportion of each resource factor contributing to the basic conflict level; their values can be obtained from the statistical calibration of historical conflict samples, or an initial value can be given according to a preset method when there are insufficient historical samples, and then recalibrated in subsequent versions in combination with newly added samples.
[0047] It should be noted that the weights mentioned above are not fixed constants preset in this invention, nor are they mathematical formulas themselves proposed as an inventive contribution. The role of the weights is to enable the trimming management program to dynamically express the differences in the contributions of three types of resources—processor time, flash memory write, and bus access—to conflict judgment based on the metering task sensitivity points of different key time slots; their sources can be historical conflict samples, offline simulation samples, equipment-side operation statistics records, or scheduling strategy calibration results of the same type of energy meter.
[0048] The purpose of differentiating the basic conflict level is to first determine the initial encroachment of business modules on critical time slot resource budgets without incorporating module priorities and interruption attributes. This initial encroachment level answers which type of physical resource a module primarily uses during critical time slots such as sampling processing, demand calculation, or freeze processing, and whether the resource pressure is approaching the metering task's acceptable boundary. Subsequent addition of priority correction and interruption attribute correction avoids conflating resource pressure, scheduling authority, and interruption behavior into a single, inexplicable risk value.
[0049] Therefore, the basic conflict level in this method serves as an intermediate quantity for generating candidate pruning schemes, risk prediction model node features, and key time slot restriction rules. If only the final risk value is used, the pruning management program can only determine the risk level of a module, but cannot distinguish whether a module should be disabled, whether triggering should be prohibited in a specific time slot, or whether it should be temporarily suspended in a specific time slot. By preserving the hierarchical relationship between the basic conflict level and the correction items, the final pruning configuration file can output more granular control rules.
[0050] S2.43: Obtain the priority level and interruption attribute of each business module to be cut.
[0051] The system reads the runtime attribute description dictionary of each node, extracting the priority value of each module, whether it is allowed to be interrupted, whether it is allowed to execute across time slots, and interrupt trigger attributes. The runtime attribute description dictionary is a structured data file stored in the energy meter firmware registry or build configuration file, used to define the underlying scheduling permissions of each business module during runtime.
[0052] The aforementioned operational attributes are not arbitrarily provided by the trimming management program, but rather derived from business module interface declarations, operating system scheduling configurations, device-side operational statistics records, or test records of the same model of energy meter. The purpose of the trimming management program reading these attributes is to determine whether a business module might preempt the main metering task after entering a critical time slot, and whether the business module can be temporarily suspended when the critical time slot arrives.
[0053] S2.44: Calculate the priority correction item based on the priority level and the interrupt penalty item based on the interrupt attribute.
[0054] The trimming management program adjusts the basic conflict level by considering the priority level of business modules, whether interruption is allowed, whether cross-time slot execution is allowed, and the upper limit of the priority of modules allowed to enter in critical time slots. This adjustment is not to introduce new mathematical formulas, but to incorporate the scheduling behavior of business modules into the critical time slot judgment.
[0055] Specifically, when the priority of a business module is higher than the upper limit of the module priority allowed to enter a critical time slot, it indicates that the module may preempt processor resources during the execution of a critical metering task. The trimming management program accordingly increases the conflict judgment of the module in the corresponding critical time slot. When a business module is not allowed to be interrupted and its execution time may cross into the critical task scheduling window, the trimming management program increases the conflict judgment of the module in the corresponding critical time slot.
[0056] The values of priority correction items and interruption attribute correction items can be calibrated using historical simulation samples, equipment scheduling strategies, or known operational constraints, and should remain consistent under the same equipment model and scheduling strategy. If the scheduling strategy, critical time slot length, or priority system is adjusted, the trimming management program should recalibrate the correction items to avoid using fixed replacement values that are out of touch with the equipment's operating conditions.
[0057] S2.45: Summing the basic conflict degree, priority correction term, and interruption penalty term to generate a multidimensional conflict matrix.
[0058] After completing the basic conflict degree calculation, the trimming management program adjusts the basic conflict degree by taking into account the priority level of the business module, whether interruption is allowed, whether cross-time slot execution is allowed, and the upper limit of the priority of the module allowed to enter in the critical time slot, so as to obtain the adjusted conflict degree of the business module in the corresponding critical time slot.
[0059] The revised conflict level can be expressed by the following formula: in, This represents the corrected conflict degree of the i-th business module in the critical time slot k; This represents the basic conflict degree of the i-th business module in the critical time slot k; This represents the priority adjustment term for the i-th business module in critical time slot k; This represents the interruption attribute correction item for the i-th service module in critical time slot k; i represents the service module number, and k represents the critical time slot number.
[0060] Priority correction items and interruption attribute correction items also do not use fixed replacement values. Their values are derived from device scheduling strategies, historical simulation samples, or known operational constraints: when the priority of a business module is higher than the upper limit of the module priority allowed to enter a critical time slot, it indicates that it may preempt the main metering task, and the trimming management program increases the conflict judgment of the corresponding critical time slot; when a business module is not allowed to be interrupted and its peak execution time may intrude into the critical task scheduling window, the trimming management program increases the conflict judgment of the corresponding critical time slot.
[0061] After the above corrections, the pruning management program arranges the corrected conflict degrees of all business modules under all key time slots according to both module and time slot dimensions, generating a multi-dimensional conflict matrix. This matrix is not used to prove the creativity of the weighting formula itself, but rather serves as a unified input for subsequent risk prediction, constraint solving, and pruning configuration file generation, enabling the system to link resource usage, metering timing, and scheduling attributes to the same pruning link.
[0062] S2.5: Train the risk prediction model based on the dependency graph and multidimensional conflict matrix to obtain the risk assessment decision framework.
[0063] By leveraging the efficient processing capabilities of deep learning's graph convolutional neural networks for topological data, we can not only assess the direct risks of individual business modules, but also proactively uncover potential cascading failures between modules caused by call chains, thereby achieving feedforward prediction of system-level risks.
[0064] Specifically, perform the following steps S2.51-S2.56: S2.51: Obtain the operational characteristic parameters of each business module to be trimmed. The operational characteristic parameters include at least the average execution time, peak execution time, storage usage, and interrupt attributes. The system reads the operational characteristic data of each module from the firmware database.
[0065] The first business module to be cut has an average execution time of 3 milliseconds, a peak execution time of 8 milliseconds, a storage usage of 64 kilobytes, and an interrupt trigger frequency of 2 times per second.
[0066] The second business module to be cut has an average execution time of 6 milliseconds, a peak execution time of 12 milliseconds, a storage usage of 128 kilobytes, and an interrupt trigger frequency of 1 time per second.
[0067] The third business module to be cut has an average execution time of 8 milliseconds, a peak execution time of 16 milliseconds, a storage usage of 256 kilobytes, and an interrupt trigger frequency of 4 times per second.
[0068] The average execution time of the fourth business module to be cut is 2 milliseconds, the peak execution time is 4 milliseconds, the storage usage is 16 kilobytes, and the interrupt trigger frequency is 1 time per second.
[0069] S2.52: Convert the dependency graph into an adjacency matrix, concatenate the running feature parameters into a node feature matrix, and input it into the input layer of the risk prediction model; Based on the dependency graph constructed in S2.2, the system constructs a 4x4 adjacency matrix, where an element of 1 indicates the existence of a call dependency and an element of 0 indicates the absence of a dependency. The system concatenates the runtime feature parameters from S2.51 column-wise to form a 4x4 node feature matrix, and inputs this matrix along with the adjacency matrix into the input layer of the graph convolutional neural network.
[0070] S2.53: Add self-loops to each node in the adjacency matrix to preserve the characteristics of each business module to be pruned, and perform normalization processing on the adjacency matrix after adding self-loops to obtain a normalized adjacency matrix. The system adds an identity matrix to the main diagonal of the adjacency matrix to preserve the node's own feature information during convolution. Subsequently, the system calculates the degree matrix of each node and takes its inverse square root, then performs symmetric normalization on the adjacency matrix using the following formula: .in, The adjacency matrix after adding self-loops, This is the corresponding degree matrix. This is the normalized adjacency matrix.
[0071] S2.54: The normalized adjacency matrix, node feature matrix and first weight matrix are multiplied by the first layer graph convolution to realize the fusion of conflict features between adjacent modules in the dependency graph of each business module to be pruned, and the first hidden feature is obtained by processing through the activation function. The formula for convolution operation of the first layer image is: .in, This is the first hidden feature matrix. The node feature matrix, This is the first weight matrix. The ReLU activation function is used. This calculation process weights and aggregates the resource characteristics of the first business module to be cut and its directly adjacent modules to generate a preliminary risk characterization.
[0072] S2.55: The normalized adjacency matrix, the first hidden feature, and the second weight matrix are multiplied by the second layer graph convolution to achieve the aggregation of risk features on the indirect dependency path, and the second hidden feature is obtained by processing through the activation function again. The formula for convolution operation of the second layer image is: .in, This is the second hidden feature matrix. This is the second weight matrix. This calculation process further aggregates the multi-hop neighborhood risks of modules in the dependency topology, achieving high-dimensional feature extraction of implicit cascade collapse risks.
[0073] S2.56: The output layer of the risk prediction model maps the second hidden feature to the combined risk value corresponding to each business module to be cut, thus completing the training of the risk prediction model.
[0074] The output layer maps the second hidden features to the combined risk value corresponding to each business module to be pruned. The combined risk value is used to represent the overall instability of the business module after considering its own resource attributes, key time slot conflict degree, and dependency path propagation. Its magnitude is determined by the training samples and model parameters.
[0075] Training samples must include at least historical execution records, offline simulation results, module combination relationships, dependencies, and labels indicating whether critical task delays, processor budget overruns, flash memory budget overruns, or bus access violations have occurred. After training, the pruning management program only performs forward inference during actual pruning, using the combination risk value as one of the inputs for generating and ranking candidate pruning schemes.
[0076] S3: Based on the preset discrete time axis logic, perform superimposed simulation verification on the candidate pruning scheme set; without actually burning the code into the physical instrument, use the discrete event sandbox to complete the timing violation verification under extreme boundary conditions in memory, avoiding the risk of delay in key metering tasks caused by resource contention.
[0077] Specifically, perform the following steps S3.1-S3.3: S3.1: For each candidate pruning scheme, construct a task sequence that includes fixed measurement tasks, scheme-related tasks, and boundary event triggering tasks; The system establishes a simulation time window with a total length of 100 milliseconds. The fixed metering task of the electricity meter is set to periodically occupy 5 milliseconds of processor time. With the candidate pruning schemes for the first and fourth business modules to be pruned retained, the total processor time occupied by the scheme-related tasks is 3 milliseconds. A strong electromagnetic interference signal lasting 1.5 milliseconds is injected into the system as a boundary event trigger task.
[0078] S3.2: Perform simulations along the discrete time axis according to the preset scheduling rules, and count the critical task delays, critical time slot processor overruns, critical time slot flash memory overruns, and critical time slot bus violations. The system is simulated in a step-by-step manner along a timeline. Within the simulated sampling processing time slots, the total processor time occupied by the metering fixed task, scheme-related task, and boundary event triggering task is 5 milliseconds + 3 milliseconds + 1.5 milliseconds, totaling 9.5 milliseconds. Comparing this value with the 10-millisecond processor time budget limit defined in the metering task configuration, the processor over-budget is 0. The simulation shows that flash memory write usage is 160 kilobytes, lower than the budget limit of 512 kilobytes, resulting in a flash memory over-budget of 0. Bus access usage is 6 megabits per second, lower than the budget limit of 20 megabits per second, resulting in 0 bus violations.
[0079] S3.3: In response to any statistical indicator exceeding the allowed range, determine that the candidate pruning scheme has a timing violation and remove it.
[0080] During the simulation process described above, none of the resource statistics exceeded the physical budget limit. The system determined that the candidate pruning scheme passed the superimposed simulation verification and was confirmed as the target pruning scheme.
[0081] S4: In response to the target pruning scheme in the candidate pruning scheme set being verified through superimposed simulation, the final pruning configuration file is output. The final pruning configuration file contains flexible control rules for each business module to be pruned in multiple key time slots. The flexible control rules include: in response to the conflict degree of each business module to be pruned in the multi-dimensional conflict matrix exceeding a preset threshold in a specific key time slot, a suspension flag or a prohibition flag is written for the corresponding module in the final pruning configuration file. The suspension flag is used to instruct the energy meter operating environment to suspend the corresponding task when the specific key time slot arrives and resume execution after the specific key time slot ends.
[0082] When the combined risk value of a certain business module reaches the risk threshold calibrated by historical conflict samples or offline simulation samples, the trimming management program, based on the conflict matrix elements and interruption attributes of that module in key time slots, determines its control method in the final trimming configuration file. If the module is allowed to be interrupted and only creates resource pressure on the metering task within specific key time slots, the trimming management program writes a suspension flag for the corresponding key time slot; if the module is not allowed to be interrupted or entering a key time slot would disrupt the frozen write path, the trimming management program writes a prohibition trigger flag or excludes it during the candidate solution stage. The system then distributes the final trimming configuration file containing the above-mentioned restriction rules to the energy meter's memory, completing the closed-loop construction of the business function trimming process.
[0083] When determining the final pruning plan, the pruning management program first calculates three ranking indicators: feature retention level, critical time slot budget margin, and plan combination risk value. Feature retention level describes the proportion of a candidate pruning plan retained relative to the optional business modules in the business requirements data; critical time slot budget margin describes the combined margin of the remaining processor budget, flash memory write budget, and bus access budget for the plan during critical time slots; plan combination risk value describes the overall instability of the selected modules after dependency propagation. The pruning management program ranks the plans in order of high feature retention level, large critical time slot budget margin, and low plan combination risk value, and then performs program memory capacity checks on the top-ranked plans in sequence, determining the first candidate pruning plan that passes the capacity check as the final pruning plan.
[0084] Based on the final pruning scheme, the pruning management program generates a pruning configuration file. The pruning configuration file includes at least a list of retained modules, a list of disabled modules, assembly rules for strongly connected dependencies, and key time slot restriction rules. The list of retained and disabled modules uses module identifiers as primary indexes and also records module names; the assembly rules for strongly connected dependencies instruct the build tool to assemble all modules within the same indivisible unit as mutually exclusive objects, preventing the accidental deletion of some modules within a unit.
[0085] The key time slot restriction rules are directly related to the conflict matrix. For a business module whose conflict degree in a frozen processing time slot exceeds the conflict degree limit value corresponding to the frozen processing time slot, but whose conflict degree in other key time slots meets the corresponding limit value, the trimming management program will not directly disable the module. Instead, it will write a frozen processing time slot trigger prohibition flag into the trimming configuration file, so that the corresponding business module will not enter the trigger path within the frozen processing time slot.
[0086] For service modules whose conflict level in a sampling processing slot exceeds the conflict level limit corresponding to that slot and which are allowed to be interrupted, the pruning management program writes a sampling processing slot suspension flag into the pruning configuration file. The suspension flag allows the service module to be triggered, but once the sampling processing slot arrives, the scheduler immediately suspends the task corresponding to that service module until the sampling processing slot ends. For service modules whose conflict level in a sampling processing slot exceeds the limit and are not allowed to be interrupted, these service modules are typically excluded during the simulation phase and will not be included in the final pruning scheme.
[0087] When generating the trimming configuration file, the trimming management program also provides the flash memory usage from the module description table along with the list of retained modules for the final trimming scheme to the build tool. The build tool calculates the flash memory usage based on the list of retained modules and checks whether the calculated result falls within the device's program storage area. If it exceeds the range, the build tool returns an insufficient capacity message, and the trimming management program checks the subsequently validated candidate trimming schemes in sorted order, re-performing the capacity check until a scheme that meets the program storage area requirements is found.
[0088] Example 3, based on the same inventive concept, provides a business function trimming system for electricity meters, applicable to the business function trimming method for electricity meters described in the above embodiments; the system includes: The description data acquisition module is used to acquire the description data of each business module to be cut and the metering task configuration of the electricity meter. The risk assessment and prediction module is used to input descriptive data and measurement task configuration into a preset risk assessment decision framework to obtain a set of candidate pruning schemes; wherein, the risk assessment decision framework is used to perform multi-dimensional resource conflict feature extraction and topological risk mapping on the input descriptive data and measurement task configuration. The simulation verification module is used to perform superimposed simulation verification on the candidate pruning scheme set based on the preset discrete time axis logic; The configuration output module is used to output the final clipping configuration file in response to the target clipping scheme in the candidate clipping scheme set being verified through superimposed simulation.
[0089] This embodiment also provides an electronic device, including: a memory and a processor; the memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the business function tailoring method for electricity meters proposed in the above embodiments.
[0090] This embodiment also provides a computer-readable storage medium storing computer-executable instructions. When executed by a processor, these instructions implement the business function tailoring method for electricity meters as proposed in the above embodiments. The computer-readable storage medium proposed in this embodiment and the method proposed in the above embodiments belong to the same inventive concept. Technical details not described in detail in this embodiment can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0091] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods of the various embodiments of the present invention.
[0092] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for tailoring business functions in electricity meters, characterized in that, include: Obtain description data for each business module to be cut and metering task configuration for the electricity meter; The description data and the metering task configuration are input into a preset risk assessment decision framework to obtain a set of candidate pruning schemes; wherein, the risk assessment decision framework is used to perform multi-dimensional resource conflict feature extraction and topology risk mapping on the input description data and the metering task configuration; Based on the preset discrete time axis logic, superimposed simulation verification is performed on the candidate pruning scheme set; In response to the target cropping scheme in the candidate cropping scheme set being verified by the superimposed simulation, the final cropping configuration file is output.
2. The method for tailoring business functions of an electricity meter according to claim 1, characterized in that, The steps for establishing the risk assessment decision-making framework include: Obtain the description data and generate a module description table; Construct a dependency graph based on the module description table and generate an initial set of closures; A resource occupancy matrix is generated based on the module description table, and a key time slot table is generated based on the metering task configuration. The key time slot table contains multiple key time slots. Calculate the multidimensional conflict matrix based on the resource occupancy matrix and the key time slot table; The risk prediction model is trained based on the dependency graph and the multidimensional conflict matrix to obtain the risk assessment decision framework.
3. The method for tailoring business functions of an electricity meter according to claim 2, characterized in that, The calculation steps for the multidimensional conflict matrix include: The hardware resource usage parameters of each business module to be cut under the multiple key time slots are normalized to obtain the normalization result. The basic conflict degree is obtained by performing a weighted calculation based on the normalization result. Obtain the priority level and interruption attribute of each of the business modules to be cut; Calculate the priority correction item based on the priority level, and calculate the interrupt penalty item based on the interrupt attribute; The multidimensional conflict matrix is generated by summing the basic conflict degree, the priority correction term, and the interruption penalty term.
4. The method for tailoring business functions of an electricity meter according to claim 3, characterized in that, The steps for obtaining the basic conflict degree by performing a weighted calculation based on the normalization result include: Obtain historical conflict samples of the electricity meter's operating environment; Based on the historical conflict samples, multiple occupancy weights are assigned to the hardware resource occupancy parameters; wherein, the multiple occupancy weights include at least a processor time occupancy weight. The basic conflict degree is obtained by multiplying the multiple occupancy weights by the normalization result and summing them. Among them, the multiple key time slots include at least a sampling processing time slot and a freezing processing time slot; The processor time occupancy weight corresponding to the sampling processing time slot is higher than the processor time occupancy weight corresponding to the freeze processing time slot.
5. The method for tailoring business functions of an electricity meter according to claim 2, characterized in that, The risk prediction model trained based on the dependency graph and the multidimensional conflict matrix, resulting in the risk assessment decision framework, includes: Obtain the operational characteristic parameters of each of the business modules to be pruned; The dependency graph is converted into an adjacency matrix, and the running feature parameters are concatenated into a node feature matrix, which is then input into the input layer of the risk prediction model. In the adjacency matrix, self-loops are added to each node to preserve the characteristics of each business module to be pruned, and the adjacency matrix after adding self-loops is normalized to obtain a normalized adjacency matrix. The normalized adjacency matrix, the node feature matrix, and the first weight matrix are multiplied by the first layer graph convolution to realize the fusion of conflict features between each business module to be pruned and its adjacent modules in the dependency graph, and the first hidden feature is obtained by processing through the activation function. The normalized adjacency matrix, the first hidden feature, and the second weight matrix are multiplied by the second layer graph convolution to aggregate risk features on the indirect dependency path, and then the second hidden feature is obtained by processing with an activation function. The output layer of the risk prediction model maps the second hidden feature to the combined risk value corresponding to each business module to be pruned, thus completing the training of the risk prediction model.
6. The method for tailoring business functions of an electricity meter according to claim 2, characterized in that, The superimposed simulation verification of the candidate pruning scheme set based on the preset discrete time axis logic includes: constructing a task sequence for each candidate pruning scheme that includes a fixed measurement task, scheme-related tasks, and boundary event triggering tasks; The simulation proceeds along the discrete time axis according to the preset scheduling rules, and the latency of critical tasks, the overrun of processors in critical time slots, the overrun of flash memory in critical time slots, and the number of violations of bus in critical time slots are counted. If any of the statistical indicators exceeds the allowed range, the candidate pruning scheme is determined to have a timing violation and is removed.
7. The method for tailoring business functions of an electricity meter according to claim 3, characterized in that, The final trimming configuration file contains flexible control rules for each business module to be trimmed within the multiple key time slots. These flexible control rules include: In response to the conflict degree of each business module to be cut in the multi-dimensional conflict matrix within a specific key time slot exceeding a preset threshold, a suspension flag or a trigger prohibition flag is written for the corresponding module in the final cut configuration file. The suspension flag is used to indicate that the electricity meter operating environment suspends the corresponding task that can be interrupted when the specific critical time slot arrives, and resumes execution after the specific critical time slot ends; The trigger prohibition flag is used to indicate that the electricity meter operating environment prohibits the triggering of corresponding tasks that cannot be interrupted during the specific critical time slot, and allows triggering again after the critical time slot ends.
8. A business function trimming system for electricity meters, employing the business function trimming method for electricity meters as described in any one of claims 1-7, characterized in that, include: The description data acquisition module is used to acquire the description data of each business module to be cut and the metering task configuration of the electricity meter. The risk assessment and prediction module is used to input the descriptive data and the measurement task configuration into a preset risk assessment decision framework to obtain a set of candidate pruning schemes; wherein, the risk assessment decision framework is used to perform multi-dimensional resource conflict feature extraction and topological risk mapping on the input descriptive data and the measurement task configuration; The simulation verification module is used to perform superimposed simulation verification on the candidate pruning scheme set based on a preset discrete time axis logic. The configuration output module is used to output the final clipping configuration file in response to the target clipping scheme in the candidate clipping scheme set passing the superposition simulation verification.
9. An electronic device, characterized in that, include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, they implement the steps of the business function tailoring method for electricity meters as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the business function trimming method for an electricity meter as described in any one of claims 1 to 7.