A method, device and storage medium for generating a report in a power system
Patent Information
- Application Number
- CN202610935805.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-26
- Publication Date
- 2026-10-16
AI Technical Summary
[0002]现有技术中,电力系统中的传统报表生成技术存在数据筛选冗余、内存资源利用率低、实时性差、容错性不足等问题,难以适配高并发、大容量、高精度的电力业务报表输出需求,导致海量电力数据加载与渲染过程中的内存溢出、资源浪费、卡顿延迟问题
[0021]The technical advantages of this invention are as follows: This invention provides a method, apparatus, and storage medium for generating reports in a power system. The method includes: an acquisition step S101, receiving a data source selected by a user for generating the report, and preprocessing the data source to obtain preprocessed report source data; a parsing step S102, loading the report source data into memory space according to the type of the report to be generated, parsing the report source data in memory to obtain the row and column data corresponding to the generated report, and performing memory garbage collection using an adaptive memory garbage collection strategy; and a rendering step S103, loading the corresponding report template based on the type of the report, loading the row and column data into the report template for rendering to obtain the generated report, and outputting and displaying the generated report. This invention addresses the problems of data filtering redundancy, low memory resource utilization, poor real-time performance, and insufficient fault tolerance inherent in traditional report generation technologies in power systems, which are difficult to adapt to the high-concurrency, large-capacity, and high-precision power business report output requirements. This invention designs a dedicated dynamic memory management mechanism for power reports, and solves the problems of memory overflow, resource waste, and lag during the loading and rendering of massive amounts of power data through a developed adaptive garbage collection strategy. This invention constructs different garbage collection (GC) methods based on the type of report. It abandons the general JVM fixed-time GC and throughput-first/pause-time-first static strategies. Instead, it designs a dual-mode adaptive garbage collection strategy of load triggering + timed completion, which is tailored to the business load characteristics of power reports. This makes memory management compatible with the diverse business loads of power reports, such as high-concurrency batch export, real-time online preview, and historical archive report backtracking. This improves the efficiency of report generation in the power system and reduces the impact of report generation on system performance.
Smart Images

Figure CN122927236A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer data processing and memory management technology, specifically to a method, apparatus, and storage medium for generating reports in a power system. Background Technology
[0002] Existing technologies for generating reports in power systems suffer from problems such as redundant data filtering, low memory resource utilization, poor real-time performance, and insufficient fault tolerance. These issues make it difficult to adapt to the high-concurrency, large-capacity, and high-precision power business report output requirements, leading to memory overflow, resource waste, and stuttering / latency problems during the loading and rendering of massive amounts of power data. Specifically, existing power system report generation suffers from drawbacks such as the large number of small, transient objects resulting from batch loading of massive time-series data, multi-threaded statistical calculations, frequent creation and destruction of temporary objects during template rendering, memory fragmentation, fixed-period garbage collection blocking report rendering, and OutOfMemoryError (OOM) when exporting large reports. Summary of the Invention
[0003] In view of one or more technical defects in the prior art, the present invention proposes the following technical solution.
[0004] A method for generating reports in a power system, the method comprising: The acquisition step involves receiving the data source selected by the user for generating the report, and preprocessing the data source to obtain preprocessed report source data. The parsing steps involve loading the report source data into the memory space according to the type of the generated report, parsing the report source data in the memory to obtain the row and column data corresponding to the generated report, and using an adaptive memory garbage collection strategy to perform memory garbage collection. The rendering step involves loading the corresponding report template based on the report type, loading the row and column data into the report template for rendering to obtain the generated report, and then outputting and displaying the generated report.
[0005] Furthermore, the report templates include user electricity metering templates, user electricity billing templates, electricity transmission loss templates, real-time power data display icon templates, and power data periodic statistical chart templates.
[0006] Furthermore, in the rendering step, the generated report is previewed in the preview interface. In the preview interface, header text can be entered, and the font attributes and cell attributes of the cells can be set. The font attributes include font size, weight, italics, and text color. The cell attributes include cell color, cell border, and cell content alignment.
[0007] Furthermore, the operation of preprocessing the data source to obtain preprocessed report source data includes: calculating the confidence level of the data in the data source; leaving data with a confidence level greater than or equal to a confidence level threshold unprocessed; correcting data with a confidence level less than the confidence level threshold by means of difference or multi-source data comparison; and obtaining the preprocessed report source data after all data processing is completed; the confidence level C of the data is calculated as follows: ; Where C represents the confidence level of the data. The time-series confidence score represents the data and is calculated by comparing time-series data before and after the data. Logical association confidence is calculated based on the physical constraints of power equipment operation. , As weight, .
[0008] Furthermore, in the parsing step: if the report type is a real-time report, memory fragmentation compaction is disabled, and only incremental memory garbage collection is allowed; if the report type is a background export report, full memory garbage compaction and collection are allowed.
[0009] Furthermore, the adaptive memory garbage collection strategy is as follows: Based on the type of report generated, the corresponding report generation task thread is launched, and the memory manager calculates the percentage of unreachable objects in memory in real time. Memory fragmentation rate Number of concurrent report generation tasks , in, , , This indicates the total memory occupied by objects that are no longer referenced in the heap and are eligible for garbage collection. Total heap memory allocated to the report generation task. This indicates the total free memory size in the heap; Indicates the maximum size of a contiguous block of free memory; Percentage of memory-unreachable objects Greater than or equal to the first memory-inaccessible object threshold, or the number of report generation tasks. Greater than or equal to the first task quantity threshold and memory fragmentation rate Incremental memory garbage collection is triggered when the fragmentation rate is greater than or equal to the first fragmentation rate threshold. Percentage of memory-unreachable objects When the threshold for the second unreachable memory object is greater than or equal to the threshold for the first unreachable memory object, a full memory garbage compaction and reclamation is triggered. At the same time, memory compaction is performed on surviving memory objects, and memory defragmentation is completed. The threshold for the second unreachable memory object is greater than the threshold for the first unreachable memory object. Time-based full memory garbage collection, based on the number of concurrent report generation tasks. Calculate the time interval for full memory garbage collection A full memory garbage collection is performed after a specified time interval. The calculation method is as follows: ,in, Full memory garbage collection occurs at fixed intervals. This represents the load attenuation coefficient, with a value between 0.1 and 0.25.
[0010] Furthermore, before performing memory garbage collection, calculate the garbage collection benefit value. If the garbage collection benefit value is greater than 0, then the corresponding memory garbage collection will be started; otherwise, the current memory garbage collection will be ignored and the next report generation task will be used for judgment.
[0011] Among them, the benefit value of waste recycling The calculation method is as follows: , This represents the effective utilization rate coefficient of memory reclamation. The value for incremental memory garbage collection is 0.86-0.94, and the value for full memory garbage collection is 0.7-0.85.
[0012] The present invention also proposes an apparatus for generating reports in a power system, the apparatus comprising: The acquisition unit receives the data source selected by the user for generating the report, and preprocesses the data source to obtain preprocessed report source data; The parsing unit loads the report source data into the memory space according to the type of the generated report, parses the report source data in the memory to obtain the row and column data corresponding to the generated report, and performs memory garbage collection using an adaptive memory garbage collection strategy. The rendering unit loads the corresponding report template based on the type of the report, loads the row and column data into the report template for rendering to obtain the generated report, and outputs and displays the generated report.
[0013] Furthermore, the report templates include user electricity metering templates, user electricity billing templates, electricity transmission loss templates, real-time power data display icon templates, and power data periodic statistical chart templates.
[0014] Furthermore, in the rendering unit, the generated report is previewed in the preview interface. In the preview interface, header text can be entered, and the font attributes and cell attributes of the cells can be set. The font attributes include font size, weight, italics, and text color. The cell attributes include cell color, cell border, and cell content alignment.
[0015] Furthermore, the operation of preprocessing the data source to obtain preprocessed report source data includes: calculating the confidence level of the data in the data source; leaving data with a confidence level greater than or equal to a confidence level threshold unprocessed; correcting data with a confidence level less than the confidence level threshold by means of difference or multi-source data comparison; and obtaining the preprocessed report source data after all data processing is completed; the confidence level C of the data is calculated as follows: ; Where C represents the confidence level of the data. The time-series confidence score represents the data and is calculated by comparing time-series data before and after the data. Logical association confidence is calculated based on the physical constraints of power equipment operation. , As weight, .
[0016] Furthermore, in the parsing step: if the report type is a real-time report, memory fragmentation compaction is disabled, and only incremental memory garbage collection is allowed; if the report type is a background export report, full memory garbage compaction and collection are allowed.
[0017] Furthermore, the adaptive memory garbage collection strategy is as follows: Based on the type of report generated, the corresponding report generation task thread is launched, and the memory manager calculates the percentage of unreachable objects in memory in real time. Memory fragmentation rate Number of concurrent report generation tasks , in, , , This indicates the total memory occupied by objects that are no longer referenced in the heap and are eligible for garbage collection. Total heap memory allocated to the report generation task This indicates the total free memory size in the heap; Indicates the maximum size of a contiguous block of free memory; Percentage of memory-unreachable objects Greater than or equal to the first memory-inaccessible object threshold, or the number of report generation tasks. Greater than or equal to the first task quantity threshold and memory fragmentation rate Incremental memory garbage collection is triggered when the fragmentation rate is greater than or equal to the first fragmentation rate threshold. Percentage of memory-unreachable objects When the threshold for the second unreachable memory object is greater than or equal to the threshold for the first unreachable memory object, a full memory garbage compaction and reclamation is triggered. At the same time, memory compaction is performed on surviving memory objects, and memory defragmentation is completed. The threshold for the second unreachable memory object is greater than the threshold for the first unreachable memory object. Time-based full memory garbage collection, based on the number of concurrent report generation tasks. Calculate the time interval for full memory garbage collection A full memory garbage collection is performed after a specified time interval. The calculation method is as follows: ,in, Full memory garbage collection occurs at fixed intervals. This represents the load attenuation coefficient, with a value between 0.1 and 0.25.
[0018] Furthermore, before performing memory garbage collection, calculate the garbage collection benefit value. If the garbage collection benefit value is greater than 0, then the corresponding memory garbage collection will be started; otherwise, the current memory garbage collection will be ignored and the next report generation task will be used for judgment.
[0019] Among them, the benefit value of waste recycling The calculation method is as follows: , This represents the effective utilization rate coefficient of memory reclamation. The value for incremental memory garbage collection is 0.86-0.94, and the value for full memory garbage collection is 0.7-0.85.
[0020] The present invention also proposes a computer-readable storage medium storing computer program code, which, when executed by a computer, performs any of the methods described above.
[0021] The technical advantages of this invention are as follows: This invention provides a method, apparatus, and storage medium for generating reports in a power system. The method includes: an acquisition step S101, receiving a data source selected by a user for generating the report, and preprocessing the data source to obtain preprocessed report source data; a parsing step S102, loading the report source data into memory space according to the type of the report to be generated, parsing the report source data in memory to obtain the row and column data corresponding to the generated report, and performing memory garbage collection using an adaptive memory garbage collection strategy; and a rendering step S103, loading the corresponding report template based on the type of the report, loading the row and column data into the report template for rendering to obtain the generated report, and outputting and displaying the generated report. This invention addresses the problems of data filtering redundancy, low memory resource utilization, poor real-time performance, and insufficient fault tolerance inherent in traditional report generation technologies in power systems, which are difficult to adapt to the high-concurrency, large-capacity, and high-precision power business report output requirements. This invention designs a dedicated dynamic memory management mechanism for power reports, and solves the problems of memory overflow, resource waste, and lag during the loading and rendering of massive amounts of power data through a developed adaptive garbage collection strategy. This invention constructs different garbage collection (GC) methods based on the type of report. It abandons the general JVM fixed-time GC and throughput-first / pause-time-first static strategies. Instead, it designs a dual-mode adaptive garbage collection strategy of load triggering + timed completion, which is tailored to the business load characteristics of power reports. This makes memory management compatible with the diverse business loads of power reports, such as high-concurrency batch export, real-time online preview, and historical archive report backtracking. This improves the efficiency of report generation in the power system and reduces the impact of report generation on system performance. Attached Figure Description
[0022] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings.
[0023] Figure 1 This is a flowchart of a method for generating reports in a power system according to an embodiment of the present invention.
[0024] Figure 2 This is a structural diagram of an apparatus for generating reports in a power system according to an embodiment of the present invention. Detailed Implementation
[0025] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, only the parts relevant to the invention are shown in the accompanying drawings.
[0026] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0027] Figure 1 This invention illustrates a method for generating reports in a power system, the method comprising: In step S101, the user selects a data source for generating the report, and preprocesses the data source to obtain preprocessed report source data. In step S102, according to the type of the generated report, the report source data is loaded into the memory space, and the report source data is parsed in the memory to obtain the row and column data corresponding to the generated report. Then, an adaptive memory garbage collection strategy is used to perform memory garbage collection. In rendering step S103, the corresponding report template is loaded based on the type of the report, and the row and column data are loaded into the report template for rendering to obtain the generated report. The generated report is then output and displayed.
[0028] This invention addresses the problems of redundant data filtering, low memory resource utilization, poor real-time performance, and insufficient fault tolerance inherent in traditional report generation technologies for power systems. These issues make it difficult to meet the demands of high-concurrency, large-capacity, and high-precision power business report output. This invention designs a dedicated dynamic memory management mechanism for power reports. Through a developed adaptive garbage collection strategy, it solves the problems of memory overflow, resource waste, and stuttering / latency during the loading and rendering of massive amounts of power data. This is one of the key inventive concepts of this invention.
[0029] In this invention, the system first receives the user-selected data source for generating the report, preprocesses the data source to obtain preprocessed report source data, and then loads the report source data into memory space according to the type of report (real-time report, background-generated report). The system then parses the report source data in memory to obtain the row and column data corresponding to the generated report, performs memory garbage collection using an adaptive memory garbage collection strategy, loads the corresponding report template into memory based on the report type, and loads the row and column data into the report template for rendering to obtain the generated report. The generated report is then output and displayed; for example, a real-time report. The data and template are loaded into the first-level cache for processing to ensure... For real-time reporting, data and templates are loaded into the second or third-level cache for processing to ensure the system can receive other real-time tasks. Different garbage collection (GC) methods are constructed based on the report type, abandoning the general JVM fixed-time GC and throughput-first / pause-time-first static strategies. Instead, a dual-mode adaptive garbage collection strategy of load triggering + timed completion is designed to address the characteristics of power report business loads. This ensures that memory management matches the diverse business loads of high-concurrency batch export, real-time online preview, and historical archive report backtracking in the power system, improving the efficiency of report generation in the power system and reducing the impact of report generation on system performance. This is another important inventive concept of this invention.
[0030] In one embodiment, the report templates include user electricity metering templates, user electricity billing templates, electricity transmission loss templates, real-time power data display icon templates, and power data periodic statistical chart templates, etc. The above only lists some commonly used templates in the power system, and users can customize the templates they need as required.
[0031] In one embodiment, in rendering step S103, the generated report is previewed in a preview interface. The preview interface allows users to input header text and set font and cell attributes. Font attributes include font size, weight, italics, and text color. Cell attributes include cell color, cell border, and cell content alignment. This invention creatively proposes allowing users to modify the table style in the preview interface, ensuring the output table meets user needs. This eliminates the need for users to modify the table after final output. The advantage of this approach is that the memory occupied by the preview data is reclaimed, improving memory utilization efficiency. This is the inventive concept behind this invention. Of course, users can also modify the report after it is output.
[0032] In one embodiment, the operation of preprocessing the data source to obtain preprocessed report source data includes: calculating the confidence level of the data in the data source; leaving data with a confidence level greater than or equal to a confidence level threshold unprocessed; correcting data with a confidence level less than the confidence level threshold by means of difference or multi-source data comparison; and obtaining the preprocessed report source data after all data processing is completed; the confidence level C of the data is calculated as follows: ; Where C represents the confidence level of the data. The time-series confidence score represents the data and is calculated by comparing time-series data before and after the data. Logical association confidence is calculated based on the physical constraints of power equipment operation. , This is the weight, and its specific value can be set according to the report type, the historical reliability of the data source, etc. This invention combines the time-series continuity and logical correlation characteristics of power data to construct a power data confidence assessment model, enabling the accurate removal and correction of abnormal and invalid data, while retaining high-quality data to ensure the accuracy of report generation. This is another important inventive concept of this invention.
[0033] The data sources in a power system generally include the following: 1) Dispatch and operation data: sourced from SCADA system and EMS energy management system, including second-level real-time time-series data such as bus voltage, line load, power flow distribution, and switch status, providing support for power grid operation reports and power flow statistics reports; 2) Equipment operation and maintenance data: sourced from the PMS2.0 equipment management system and IoT monitoring terminals, including operating parameters, fault records, and maintenance logs of transformers, circuit breakers, and lines, supporting equipment fault analysis and equipment status assessment reports; 3) Marketing metering data: sourced from the electricity marketing system, including user electricity consumption, electricity bill settlement, line loss statistics, and connection and repair data, supporting marketing statistics and line loss analysis reports; 4) Comprehensive statistical data: sourced from the power grid management platform, including data on power supply reliability, power outage duration, energy efficiency loss, and renewable energy consumption, supporting comprehensive power grid operation analysis reports.
[0034] In one embodiment, in the parsing step S102: if the report type is a real-time report, memory fragmentation compression and defragmentation are disabled, and only incremental memory garbage collection is allowed; if the report type is a background export report, full memory garbage compression and collection are allowed. This invention addresses the problems of massive time-series data batch loading, multi-threaded statistical operations, and frequent creation and destruction of temporary objects during template rendering in power report generation scenarios, leading to numerous instantaneous small objects, memory fragmentation, fixed-period GC blocking report rendering, and OOM (Out of Memory) issues during large report export. It abandons the general JVM fixed-time GC and throughput-first / pause-time-first static strategies, and proposes a GC strategy based on report task type tailored to the business load characteristics of power report operations. This is another important inventive concept of this invention.
[0035] In one embodiment, the adaptive memory garbage collection strategy is: Based on the type of report generated, the corresponding report generation task thread is launched, and the memory manager calculates the percentage of unreachable objects in memory in real time. Memory fragmentation rate Number of concurrent report generation tasks , in, , , This indicates the total memory occupied by objects that are no longer referenced in the heap and are eligible for garbage collection. Total heap memory allocated to the report generation task This indicates the total free memory size in the heap; Indicates the maximum size of a contiguous block of free memory; Percentage of memory-unreachable objects Greater than or equal to the first memory-inaccessible object threshold, or the number of report generation tasks. Greater than or equal to the first task quantity threshold and memory fragmentation rate Incremental memory garbage collection is triggered when the fragmentation rate is greater than or equal to the first fragmentation rate threshold. Percentage of memory-unreachable objects When the threshold for the second unreachable memory object is greater than or equal to the threshold for the first unreachable memory object, a full memory garbage compaction and reclamation is triggered. At the same time, memory compaction is performed on surviving memory objects, and memory defragmentation is completed. The threshold for the second unreachable memory object is greater than the threshold for the first unreachable memory object. Time-based full memory garbage collection, based on the number of concurrent report generation tasks. Calculate the time interval for full memory garbage collection A full memory garbage collection is performed after a specified time interval. The calculation method is as follows: ,in, Full memory garbage collection occurs at fixed intervals. This represents the load attenuation coefficient, with a value between 0.1 and 0.25.
[0036] The adaptive memory garbage collection strategy of this invention solves the problems in existing technologies where frequent GC during low-load periods leads to CPU waste and interrupts asynchronous report rendering threads, while GC lags during high-load batch report export, resulting in a large accumulation of unreachable objects, fragmentation of available contiguous memory blocks, and a surge in fragmentation rate. Even with sufficient total remaining memory, it is impossible to allocate large contiguous memory to store the complete report dataset, triggering memory overflow. Furthermore, by using timed fallback GC, executed according to a dynamically adjusted GC cycle, expired secondary cache, invalid report file handles, and residual objects from historical idle tasks are cleaned up. This is another important inventive concept of this invention.
[0037] In one embodiment, a garbage collection benefit value is calculated before performing memory garbage collection. If the garbage collection benefit value is greater than 0, then the corresponding memory garbage collection will be started; otherwise, the current memory garbage collection will be ignored and the next report generation task will be used for judgment.
[0038] Among them, the benefit value of waste recycling The calculation method is as follows: , This represents the effective utilization rate coefficient of memory reclamation. Incremental memory garbage collection has a value of 0.86-0.94, while full memory garbage collection has a value of 0.7-0.85. This indicates the amount of memory reclaimed, in MB. This represents the pause cost coefficient, with a value of 1.2 for real-time reports and 0.3 for reports exported from the backend. This indicates the actual pause time for this memory garbage collection, in milliseconds (ms).
[0039] This invention addresses the extreme sensitivity of real-time online power report preview services to garbage collection (GC) pauses. It necessitates quantifying the benefits of GC recovery and the costs of pauses, constructing a GC execution benefit discrimination function to avoid negative GC optimization and prevent meaningless GC from consuming CPU resources for report computation. This is another important inventive concept of this invention.
[0040] Figure 2 An apparatus for generating reports in a power system is shown, the apparatus comprising: The acquisition unit 201 receives the data source selected by the user for generating the report, and preprocesses the data source to obtain preprocessed report source data; The parsing unit 202 loads the report source data in the memory space according to the type of the generated report, parses the report source data in the memory to obtain the row and column data corresponding to the generated report, and performs memory garbage collection using an adaptive memory garbage collection strategy. The rendering unit 203 loads the corresponding report template based on the type of the report, loads the row and column data into the report template for rendering to obtain the generated report, and outputs and displays the generated report.
[0041] This invention addresses the problems of redundant data filtering, low memory resource utilization, poor real-time performance, and insufficient fault tolerance inherent in traditional report generation technologies for power systems. These issues make it difficult to meet the demands of high-concurrency, large-capacity, and high-precision power business report output. This invention designs a dedicated dynamic memory management mechanism for power reports. Through a developed adaptive garbage collection strategy, it solves the problems of memory overflow, resource waste, and stuttering / latency during the loading and rendering of massive amounts of power data. This is one of the key inventive concepts of this invention.
[0042] In this invention, the system first receives the user-selected data source for generating the report, preprocesses the data source to obtain preprocessed report source data, and then loads the report source data into memory space according to the type of report (real-time report, background-generated report). The system then parses the report source data in memory to obtain the row and column data corresponding to the generated report, performs memory garbage collection using an adaptive memory garbage collection strategy, loads the corresponding report template into memory based on the report type, and loads the row and column data into the report template for rendering to obtain the generated report. The generated report is then output and displayed; for example, a real-time report. The data and template are loaded into the first-level cache for processing to ensure... For real-time reporting, data and templates are loaded into the second or third-level cache for processing to ensure the system can receive other real-time tasks. Different garbage collection (GC) methods are constructed based on the report type, abandoning the general JVM fixed-time GC and throughput-first / pause-time-first static strategies. Instead, a dual-mode adaptive garbage collection strategy of load triggering + timed completion is designed to address the characteristics of power report business loads. This ensures that memory management matches the diverse business loads of high-concurrency batch export, real-time online preview, and historical archive report backtracking in the power system, improving the efficiency of report generation in the power system and reducing the impact of report generation on system performance. This is another important inventive concept of this invention.
[0043] In one embodiment, the report templates include user electricity metering templates, user electricity billing templates, electricity transmission loss templates, real-time power data display icon templates, and power data periodic statistical chart templates, etc. The above only lists some commonly used templates in the power system, and users can customize the templates they need as required.
[0044] In one embodiment, the rendering unit 203 previews the generated report in a preview interface. The preview interface allows users to input header text and set font and cell attributes. Font attributes include font size, weight, italics, and text color. Cell attributes include cell color, cell border, and cell content alignment. This invention creatively proposes allowing users to modify the table style in the preview interface, ensuring the output table meets user needs. This eliminates the need for users to modify the table after final output. The advantage of this approach is that the memory occupied by the preview data is reclaimed, improving memory utilization efficiency. This is the inventive concept behind this invention. Of course, users can also modify the report after it is output.
[0045] In one embodiment, the operation of preprocessing the data source to obtain preprocessed report source data includes: calculating the confidence level of the data in the data source; leaving data with a confidence level greater than or equal to a confidence level threshold unprocessed; correcting data with a confidence level less than the confidence level threshold by means of difference or multi-source data comparison; and obtaining the preprocessed report source data after all data processing is completed; the confidence level C of the data is calculated as follows: ; Where C represents the confidence level of the data. The time-series confidence score represents the data and is calculated by comparing time-series data before and after the data. Logical association confidence is calculated based on the physical constraints of power equipment operation. , This is the weight, and its specific value can be set according to the report type, the historical reliability of the data source, etc. This invention combines the time-series continuity and logical correlation characteristics of power data to construct a power data confidence assessment model, enabling the accurate removal and correction of abnormal and invalid data, while retaining high-quality data to ensure the accuracy of report generation. This is another important inventive concept of this invention.
[0046] The data sources in a power system generally include the following: 1) Dispatch and operation data: sourced from SCADA system and EMS energy management system, including real-time time-series data at the second level such as bus voltage, line load, power flow distribution, and switch status, providing support for power grid operation reports and power flow statistics reports; 2) Equipment operation and maintenance data: sourced from the PMS2.0 equipment management system and IoT monitoring terminals, including operating parameters, fault records, and maintenance logs of transformers, circuit breakers, and lines, supporting equipment fault analysis and equipment status assessment reports; 3) Marketing metering data: sourced from the electricity marketing system, including user electricity consumption, electricity bill settlement, line loss statistics, and connection and repair data, supporting marketing statistics and line loss analysis reports; 4) Comprehensive statistical data: sourced from the power grid management platform, including data on power supply reliability, power outage duration, energy efficiency loss, and renewable energy consumption, supporting comprehensive power grid operation analysis reports.
[0047] In one embodiment, in the parsing unit 202: if the report type is a real-time report, memory fragmentation compression and defragmentation are disabled, and only incremental memory garbage collection is allowed; if the report type is a background export report, full memory garbage compression and collection are allowed. This invention addresses the problems of large numbers of instantaneous small objects, memory fragmentation, fixed-period GC blocking report rendering, and large report export OOM (Out of Memory) issues caused by batch loading of massive time-series data, multi-threaded statistical operations, and frequent creation and destruction of temporary objects during template rendering in power report generation scenarios. It abandons the general JVM fixed-time GC and throughput-first / pause-time-first static strategies, and proposes a GC strategy based on report task type tailored to the business load characteristics of power report operations. This is another important inventive concept of this invention.
[0048] In one embodiment, the adaptive memory garbage collection strategy is: Based on the type of report generated, the corresponding report generation task thread is launched, and the memory manager calculates the percentage of unreachable objects in memory in real time. Memory fragmentation rate Number of concurrent report generation tasks , in, , , This indicates the total memory occupied by objects that are no longer referenced in the heap and are eligible for garbage collection. Total heap memory allocated to the report generation task This indicates the total free memory size in the heap; Indicates the maximum size of a contiguous block of free memory; Percentage of memory-unreachable objects Greater than or equal to the first memory-inaccessible object threshold, or the number of report generation tasks. Greater than or equal to the first task quantity threshold and memory fragmentation rate Incremental memory garbage collection is triggered when the fragmentation rate is greater than or equal to the first fragmentation rate threshold. Percentage of memory-unreachable objects When the threshold for the second unreachable memory object is greater than or equal to the threshold for the first unreachable memory object, a full memory garbage compaction and reclamation is triggered. At the same time, memory compaction is performed on surviving memory objects, and memory defragmentation is completed. The threshold for the second unreachable memory object is greater than the threshold for the first unreachable memory object. Time-based full memory garbage collection, based on the number of concurrent report generation tasks. Calculate the time interval for full memory garbage collection A full memory garbage collection is performed after a specified time interval. The calculation method is as follows: ,in, Full memory garbage collection occurs at fixed intervals. This represents the load attenuation coefficient, with a value between 0.1 and 0.25.
[0049] The adaptive memory garbage collection strategy of this invention solves the problems in existing technologies where frequent GC during low-load periods leads to CPU waste and interrupts asynchronous report rendering threads, while GC lags during high-load batch report export, resulting in a large accumulation of unreachable objects, fragmentation of available contiguous memory blocks, and a surge in fragmentation rate. Even with sufficient total remaining memory, it is impossible to allocate large contiguous memory to store the complete report dataset, triggering memory overflow. Furthermore, by using timed fallback GC, executed according to a dynamically adjusted GC cycle, expired secondary cache, invalid report file handles, and residual objects from historical idle tasks are cleaned up. This is another important inventive concept of this invention.
[0050] In one embodiment, a garbage collection benefit value is calculated before performing memory garbage collection. If the garbage collection benefit value is greater than 0, then the corresponding memory garbage collection will be started; otherwise, the current memory garbage collection will be ignored and the next report generation task will be used for judgment.
[0051] Among them, the benefit value of waste recycling The calculation method is as follows: , This represents the effective utilization rate coefficient of memory reclamation. Incremental memory garbage collection has a value of 0.86-0.94, while full memory garbage collection has a value of 0.7-0.85. This indicates the amount of memory reclaimed, in MB. This represents the pause cost coefficient, with a value of 1.2 for real-time reports and 0.3 for reports exported from the backend. This indicates the actual pause time for this memory garbage collection, in milliseconds (ms).
[0052] This invention addresses the extreme sensitivity of real-time online power report preview services to garbage collection (GC) pauses. It necessitates quantifying the benefits of GC recovery and the costs of pauses, constructing a GC execution benefit discrimination function to avoid negative GC optimization and prevent meaningless GC from consuming CPU resources for report computation. This is another important inventive concept of this invention.
[0053] One embodiment of the present invention provides a computer storage medium storing a computer program. When the computer program on the computer storage medium is executed by a processor, the above-described method is implemented. The computer storage medium may be a hard disk, DVD, CD, flash memory, or other storage device.
[0054] For ease of description, the above apparatus is described by dividing it into various functional units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.
[0055] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, 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 storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the apparatus described in various embodiments or some parts of the embodiments of this application.
[0056] Finally, it should be noted that the above embodiments are for illustration only and not for limiting the technical solutions of the present invention. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the present invention without departing from the spirit and scope of the present invention. Any modifications or partial substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for generating reports in a power system, characterized in that, The method includes: The acquisition step involves receiving the data source selected by the user for generating the report, and preprocessing the data source to obtain preprocessed report source data. The parsing steps involve loading the report source data into the memory space according to the type of the generated report, parsing the report source data in the memory to obtain the row and column data corresponding to the generated report, and using an adaptive memory garbage collection strategy to perform memory garbage collection. The rendering step involves loading the corresponding report template based on the report type, loading the row and column data into the report template for rendering to obtain the generated report, and then outputting and displaying the generated report.
2. The method according to claim 1, characterized in that, The report templates include user electricity metering templates, user electricity billing templates, electricity transmission loss templates, real-time power data display icon templates, and power data periodic statistical chart templates.
3. The method according to claim 2, characterized in that, In the rendering step, the generated report is previewed in the preview interface. The preview interface is used to input header text and set the font attributes and cell attributes of cells. The font attributes include font size, weight, italics and text color. The cell attributes include cell color, cell border and cell content alignment.
4. The method according to claim 3, characterized in that, The operation of preprocessing the data source to obtain preprocessed report source data includes: calculating the confidence level of the data in the data source; leaving data with a confidence level greater than or equal to a confidence level threshold unprocessed; correcting data with a confidence level less than the confidence level threshold by means of difference or multi-source data comparison; and obtaining the preprocessed report source data after all data processing is completed. The confidence level C of the data is calculated as follows: ; Where C represents the confidence level of the data. The time-series confidence score represents the data and is calculated by comparing time-series data before and after the data. Logical association confidence is calculated based on the physical constraints of power equipment operation. , As weight, .
5. The method according to claim 4, characterized in that, In the parsing step: if the report type is a real-time report, memory fragmentation compression and defragmentation are disabled, and only incremental memory garbage collection is allowed; if the report type is a background export report, full memory garbage compression and collection are allowed.
6. An apparatus for generating reports in a power system, characterized in that, The device includes: The acquisition unit receives the data source selected by the user for generating the report, and preprocesses the data source to obtain preprocessed report source data; The parsing unit loads the report source data into the memory space according to the type of the generated report, parses the report source data in the memory to obtain the row and column data corresponding to the generated report, and performs memory garbage collection using an adaptive memory garbage collection strategy. The rendering unit loads the corresponding report template based on the type of the report, loads the row and column data into the report template for rendering to obtain the generated report, and outputs and displays the generated report.
7. The apparatus according to claim 6, characterized in that, The report templates include user electricity metering templates, user electricity billing templates, electricity transmission loss templates, real-time power data display icon templates, and power data periodic statistical chart templates.
8. The apparatus according to claim 7, characterized in that, In the rendering unit, the generated report is previewed in the preview interface. The preview interface is used to input header text and set the font attributes and cell attributes of cells. The font attributes include font size, weight, italics and text color. The cell attributes include cell color, cell border and cell content alignment.
9. The apparatus according to claim 8, characterized in that, The operation of preprocessing the data source to obtain preprocessed report source data includes: calculating the confidence level of the data in the data source; leaving data with a confidence level greater than or equal to a confidence level threshold unprocessed; correcting data with a confidence level less than the confidence level threshold by means of difference or multi-source data comparison; and obtaining the preprocessed report source data after all data processing is completed. The confidence level C of the data is calculated as follows: ; Where C represents the confidence level of the data. The time-series confidence score represents the data and is calculated by comparing time-series data before and after the data. Logical association confidence is calculated based on the physical constraints of power equipment operation. , As weight, .
10. A computer storage medium, characterized in that, The computer storage medium stores a computer program, which, when executed by a processor, implements the method described in any one of claims 1-5.
