A power quality report generation method and system for heterogeneous binary data
Patent Information
- Application Number
- CN202611070560.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-18
- Publication Date
- 2026-10-20
AI Technical Summary
[0005]本申请实施例提供一种异构二进制数据的电能质量报告生成方法及系统,用于解决如何提高电能质量报告生成效率的技术问题
1、通过全局语义标签与电能质量指标的一一对应关系、字段目录的构建、跨周期对齐聚合以及统一虚拟数据池的索引检索,使得原始二进制数据文件的物理结构与报告模板的逻辑需求之间建立起独立的语义映射层,报告模板不再直接依赖原始数据编号或二进制结构体字段名,当新增或变更异构二进制文件类型时仅需扩展预设映射规则而无需修改报告模板,同时所有异构数据源经过对齐聚合后以统一的数据帧形式供所有模板共享调用,从而提高了电能质量报告生成效率。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing, and in particular to a method and system for generating power quality reports from heterogeneous binary data. Background Technology
[0002] Power quality monitoring equipment outputs various binary data files, each with different sampling periods, data numbers, and binary structures. Traditional report generation methods directly bind the parsing logic to a specific template. When the equipment firmware is upgraded or the report indicators are adjusted, the parsing code and export code need to be modified simultaneously, resulting in high maintenance costs.
[0003] To address the aforementioned issues, an existing technology employs a fixed parsing framework: the system predefines the mapping relationship between data numbers and binary structure fields using a configuration file. During parsing, the system looks up the field offset and data type based on the data number, converts the payload into a memory object, and then writes it into a pre-defined template through a fixed report module.
[0004] However, in real-world testing scenarios, a comprehensive report often needs to reference multiple fields from device information files, periodic sampling files, and event log files simultaneously. While existing frameworks can parse each file separately, the independent data numbering systems of different files necessitate additional mapping code when integrating cross-file fields. This approach means that each new field combination in the report template requires additional mapping logic, reducing the efficiency of generating the final power quality report. Summary of the Invention
[0005] This application provides a method and system for generating power quality reports using heterogeneous binary data, which addresses the technical problem of how to improve the efficiency of power quality report generation.
[0006] In a first aspect, embodiments of this application provide a method for generating power quality reports using heterogeneous binary data, including: Obtain the report generation request and at least two heterogeneous binary data files corresponding to the report generation request, and load the component-based report template. The component-based report template contains several component elements, each component element is configured with at least one global semantic tag, and one global semantic tag corresponds to one power quality index. The binary data file includes the raw sampling data of at least one power quality index. Based on preset file parsing rules, data blocks in an independent state are extracted from each binary data file, and a field directory corresponding to the data block is generated. The field directory includes the original data number, discrete timestamp, and data value. Based on the preset mapping rules, the original data numbers corresponding to the data blocks in all binary data files that are associated with the same power quality index are mapped to the same global semantic label to obtain the target data block; Based on discrete timestamps, target data blocks with the same global semantic label but belonging to different binary data files are aligned and aggregated across cycles on the global time axis to generate structured semantic data frames with continuous time series, and all structured semantic data frames are written into a unified virtual data pool. Iterate through all component elements, use the global semantic tags configured in the component elements as addressing indexes, and extract the structured semantic data frames corresponding to the addressing indexes from the unified virtual data pool across files as target data frames. All target data frames are assembled and rendered to generate a power quality report.
[0007] Optionally, based on discrete timestamps, target data blocks with the same global semantic label but belonging to different binary data files are aligned and aggregated across periods on the global time axis to generate structured semantic data frames with continuous time series. This includes: obtaining a set of target data blocks corresponding to global semantic labels, where the set contains multiple target data blocks; arranging the target data blocks in the set according to the order of their discrete timestamps to generate the original discrete sequence corresponding to the global semantic label; identifying the time interval between two adjacent discrete timestamps in the original discrete sequence; using the greatest common divisor of all time intervals as the global alignment reference period, and dividing the global time axis corresponding to the original discrete sequence into continuous, equally spaced time grids according to the global alignment reference period; for each time grid, determining whether there is a discrete timestamp corresponding to each time grid in the original discrete sequence; if so, using the data value corresponding to the existing discrete timestamp as the target data value of the time grid; if not, determining the target data value of the time grid based on the two adjacent discrete timestamps before and after the time grid and the data values corresponding to the adjacent timestamps; and arranging all time grids and their target data values in chronological order to generate a structured semantic data frame with global semantic labels.
[0008] Optionally, before generating a structured semantic data frame with a continuous time series by performing cross-period alignment and aggregation on the global time axis for target data blocks with the same global semantic label but belonging to different binary data files based on discrete timestamps, the method further includes: if there are conflicting data blocks with the same global semantic label and the same discrete timestamp, extracting the sampling resolution precision parameter of the conflicting data block from the binary data file corresponding to the conflicting data block as the basic confidence weight of the conflicting data block, and marking the discrete timestamp corresponding to the conflicting data block as the conflicting timestamp; determining the baseband noise standard deviation corresponding to the conflicting data block based on historical time series slices, and calculating the dynamic attenuation coefficient corresponding to the conflicting data block based on the baseband noise standard deviation, the historical time series slices are used to characterize historical data within a preset time window centered on the conflicting timestamp; dynamically adjusting the fusion weight of each conflicting data block based on the basic confidence weight and the dynamic attenuation coefficient; for the same conflicting timestamp, determining the data value of the conflicting timestamp according to each fusion weight and the data values corresponding to all conflicting data blocks, and synchronously generating a conflict smoothing log.
[0009] Optionally, all component elements are traversed, and the global semantic tags configured in the component elements are used as addressing indexes. Structured semantic data frames corresponding to the addressing indexes are extracted from the unified virtual data pool across files as target data frames. This includes: using the global semantic tags configured in the component elements as addressing indexes, performing an initial search in the unified virtual data pool to obtain an initial set of data frames for the power quality indicators corresponding to the component elements; determining whether there are data gaps or faults in the data timeline that do not completely cover the target time window based on the data timeline recorded in the initial data frame set and the target time window corresponding to the report generation request; if so, obtaining conversion indicators that have a physical conversion relationship with the power quality indicators with data gaps and belong to different binary data files based on preset power indicator companion rules; using the global semantic tags corresponding to the conversion indicators as backup addressing indexes to extract the corresponding compensation data frames, and filling the data values of the compensation data frames into the data gaps to generate structured semantic data frames without data gaps as target data frames.
[0010] Optionally, all target data frames are assembled and rendered to generate a power quality report, including: identifying the component type of the component element corresponding to the target data frame to be rendered, where the component type includes single-value components, data block components, and chart components; if the component type is a single-value component, then a statistical value is determined from the target data frame using a preset statistical function as the rendering result of the target data frame; if the component type is a data block component, then a data value sequence is extracted from the target data frame, and the maximum, minimum, average, and P95 values of the data value sequence are calculated respectively, and the maximum, minimum, average, and P95 values are organized into a table to obtain the rendering result of the target data frame; if the component type is a chart component, then discrete timestamps are extracted from the target data frame. The sequence and data value sequence are generated into a chart description object containing coordinate axis parameters and a set of data points, resulting in the rendering result of the target data frame. When it is identified that the component element corresponding to the target data frame to be rendered is configured with a compound calculation formula, the data values and discrete timestamps corresponding to the global semantic tags of each component element are extracted from the target data frame to generate a numerical list variable. The numerical list variable is substituted into the compound calculation formula for serialization operation to obtain the rendering result of the target data frame. If a field is missing or an expression parsing error occurs, the error event is captured and a placeholder text with error message is generated. The placeholder text is used as the rendering result of the target data frame. Based on the rendering results of all target data frames, a power quality report is generated.
[0011] Optionally, the method further includes: serializing the field directory, the index mapping relationship in the unified virtual data pool, and the rendering results of each target data frame to generate a parsed data packet; performing hash calculation on the parsed data packet to generate a data fingerprint of the parsed data packet; when a new report generation request is received, obtaining the time range identifier and indicator requirements in the new report generation request; if there is a data fingerprint that matches both the time range identifier and indicator requirements, then using the matching parsed data packet as the target data packet, and reusing the structured semantic data frame and the rendering results of each target data frame in the target data packet to generate a power quality report corresponding to the new report generation request.
[0012] Optionally, all target data frames are assembled and rendered to generate a power quality report. The method further includes: based on a historical power quality event database, statistically analyzing the anomaly contribution factors of each power quality indicator in historical physical power anomaly determinations, and obtaining the report hit probability of each global semantic tag in the previous statistical period; calculating the basic business priority of each global semantic tag within the component-based report template; determining the scheduling priority of component elements based on the basic business priority of all global semantic tags in the component elements and the estimated rendering time of the component-based report template; and collecting real-time computing resource utilization and network communication transmission latency status using diagnostic probes; based on computing resources... Based on the source utilization and network communication transmission latency status, determine whether there is a risk of critical computing power or rendering timeout disconnection. If so, divide the components to be processed into a core guarantee set and a secondary suspension set based on the scheduling priority. For the core component elements in the core guarantee set, assemble and render the target data frames corresponding to the core component elements to obtain the rendering result of the core component elements. Intercept and suspend the parsing and execution requests of the binary data files corresponding to the secondary component elements in the secondary suspension set. At the target page anchor point corresponding to the secondary component elements in the power quality report, generate a light load prompt placeholder as the rendering result of the secondary component elements.
[0013] Secondly, embodiments of this application provide a power quality report generation system for heterogeneous binary data. The power quality report generation system for heterogeneous binary data includes: one or more processors and a memory; the memory is coupled to one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the power quality report generation system for heterogeneous binary data to perform the method described in the first aspect and any possible implementation thereof.
[0014] Thirdly, embodiments of this application provide a computer program product containing instructions that, when the computer program product is run on a power quality report generation system for heterogeneous binary data, cause the power quality report generation system for heterogeneous binary data to perform the method described in the first aspect and any possible implementation thereof.
[0015] Fourthly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a power quality report generation system for heterogeneous binary data, cause the power quality report generation system for heterogeneous binary data to perform the method described in the first aspect and any possible implementation thereof.
[0016] In summary, one or more technical solutions provided in this application have at least the following technical effects or advantages: 1. By establishing a one-to-one correspondence between global semantic tags and power quality indicators, constructing field directories, cross-cycle alignment and aggregation, and indexing and retrieving a unified virtual data pool, an independent semantic mapping layer is established between the physical structure of the original binary data file and the logical requirements of the report template. The report template no longer directly depends on the original data number or binary structure field name. When adding or changing heterogeneous binary file types, only the preset mapping rules need to be extended without modifying the report template. At the same time, all heterogeneous data sources are aligned and aggregated and then shared by all templates in a unified data frame format, thereby improving the efficiency of power quality report generation.
[0017] 2. By using cross-period alignment and aggregation with the greatest common divisor as the reference period, data blocks from different sampling periods are unified to the same time axis grid point. Missing time grid points are filled by interpolation based on adjacent timestamps, enabling heterogeneous data from different sampling periods such as seconds, minutes, and hours to be jointly analyzed on the same time base. By calculating the dynamic attenuation coefficient and adjusting the fusion weight through the sampling resolution accuracy parameter of conflicting timestamps and the standard deviation of baseband noise, the system can adaptively select the best data to be fused when multiple source data conflict at the same time, avoiding data distortion caused by simple weighted averaging. At the same time, by using preset power index companion rules, backup indicators with physical conversion relationships are automatically obtained to compensate and fill data gaps when data voids or faults are detected. This allows data loss caused by network failures or equipment power outages to be automatically repaired based on domain knowledge, thereby improving the completeness and accuracy of the basic data on which the power quality report is based.
[0018] 3. Differentiated rendering of single-value components, data block components, chart components, and composite calculation formula components is achieved through component type identification. Simultaneously, anomalies such as missing fields or expression parsing errors in composite calculation formulas are captured and replaced with placeholder text to prevent system-level crashes. This ensures that the report generation process can still output the normal content of other components even when some components malfunction. Data reuse across report requests is achieved through serialized storage of parsed data packets and a fast matching mechanism using hash fingerprints. Anomaly contribution factors of various indicators are statistically analyzed using a historical power quality event database, and a degradation circuit breaker strategy is triggered based on real-time computing resource utilization. High-priority core components are rendered in full, while low-priority secondary components are replaced with lightweight placeholders. This ensures that the system can prioritize the high-speed generation and presentation of core components related to fault diagnosis even when computing resources are limited or the network is unstable, thereby improving the fault tolerance and operational stability of the power quality report generation system. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating the method for generating power quality reports from heterogeneous binary data provided in this application embodiment; Figure 2This is a schematic diagram of the data frame generation process provided in the embodiments of this application; Figure 3 This is another flowchart illustrating the method for generating power quality reports from heterogeneous binary data provided in this application embodiment; Figure 4 This is a schematic diagram of the structure of a power quality report generation system for heterogeneous binary data provided in an embodiment of this application.
[0020] Explanation of reference numerals in the attached figures: 401, Central Processing Unit; 402, Read-Only Memory; 403, Random Access Memory; 404, Bus; 405, Input / Output Interface; 406, Input Section; 407, Output Section; 408, Storage Section; 409, Communication Section; 410, Driver; 411, Removable Media. Detailed Implementation
[0021] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0022] In the description of the embodiments of this application, the words "for example" or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design that is described as "for example" or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design options. Rather, the use of the words "for example" or "for instance" is intended to present the relevant concepts in a specific manner.
[0023] In the description of the embodiments of this application, the term "multiple" means two or more. For example, multiple systems means two or more systems, and multiple screen terminals means two or more screen terminals. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0024] This application provides a method and system for generating power quality reports using heterogeneous binary data, which addresses the technical problem of how to improve the efficiency of power quality report generation.
[0025] Figure 1 This is a flowchart illustrating the method for generating power quality reports from heterogeneous binary data provided in this application embodiment.
[0026] This application discloses a method for generating power quality reports using heterogeneous binary data, such as... Figure 1 As shown, the steps include the following.
[0027] S101. Obtain the report generation request and at least two heterogeneous binary data files corresponding to the report generation request, and load the component-based report template. The component-based report template contains several component elements, each component element is configured with at least one global semantic tag, and one global semantic tag corresponds to one power quality index. The binary data file includes the raw sampling data of at least one power quality index.
[0028] Specifically, a report generation request is a trigger command submitted by the user through a human-computer interaction interface or application programming interface (API) to instruct the initiation of a power quality report generation task. It contains at least two necessary pieces of information: the target time window to be analyzed (i.e., the time range within which the report needs to be generated) and the identifier or storage path of the component-based report template to be used. Binary data files are different types of raw files written to the storage medium by the power quality monitoring equipment according to their respective independent sampling periods within the target time window. Different types of files have different binary structure definitions and different data numbering systems. Based on the file path list carried in the report generation request or according to the preset directory scanning rules, these files are retrieved from the local disk, network storage, or the built-in memory of the monitoring equipment. After retrieving the files, the component-based report template is loaded. This template is a predefined report style description file, stored in JSON or XML format, which describes which content modules are included in the final output power quality report, the display format of each module, and the data source of each module. The template contains several component elements, each of which corresponds to an independent content block in the report, such as the detection conclusion summary at the top of the page, the voltage deviation statistics table in the middle area, the voltage trend graph at the bottom, or the harmonic distortion rate index card on the right. Each component element is configured with at least one global semantic tag. This global semantic tag is an abstract business identifier that is independent of the original data numbering system and the physical structure of the binary file. For example, the tag "VOLTAGE_A_RMS" represents the "effective value of phase A voltage", the tag "CURRENT_B_RMS" represents the "effective value of phase B current", and the tag "FREQUENCY_DEVIATION" represents the "frequency deviation". One global semantic tag corresponds to one power quality index, that is, there is a one-to-one mapping relationship between global semantic tags and power quality indices. For example, "VOLTAGE_AB_UNBALANCE" uniquely corresponds to "three-phase voltage unbalance", and similarly, "THD_U_A" uniquely corresponds to "total harmonic distortion rate of phase A voltage". The binary data files include raw sampling data of at least one power quality indicator. Each raw file records continuous sampling values of at least one power quality indicator on the time axis. For example, the info.pqf file records equipment information, the cyc.pqf file records cycle-level effective value sampling data (one data point per cycle, approximately 50 points per second at a 50Hz power frequency), the cyc10s.pqf file records 10-second aggregated data (one data point every 10 seconds), and the event.pqf file records high-frequency waveform data when transient events are triggered (up to 256 sampling points per cycle). The raw sampling data of these files is a binary sequence directly written to the storage medium after A / D conversion, without any processing or statistics at the business level.
[0029] The report generation request represents a complete instruction data packet initiated by a user or upper-layer application system to instruct the initiation of the power quality report generation process. A binary data file represents the raw data file written to the storage medium by the power quality monitoring equipment according to a proprietary binary protocol defined at the firmware layer. This binary protocol includes at least a file header structure, a record header structure, and a payload structure. The binary structure definitions for different file types are independent and incompatible. A component-based report template represents a report style description file predefined and persistently stored in a structured data format (JSON or XML), used to describe the layout structure and content composition of the power quality report. A component element represents a data structure unit within the component-based report template that describes a single, independent block of report content. A global semantic tag represents a globally unique abstract business identifier within the namespace of the component-based report template. Global semantic tags possess semantic stability across file types, device models, and firmware versions, uniquely identifying a power quality indicator regardless of its storage location, data number, or physical structure within a specific binary file. Power quality indicators represent characteristic physical quantities used to assess power quality levels, including but not limited to RMS voltage, RMS current, frequency deviation, voltage deviation, three-phase voltage imbalance, total harmonic distortion (THD), harmonic content, voltage fluctuation and flicker, sag depth, sag amplitude, and interruption duration. Raw sampled data represents a sequence of binary values obtained by the analog-to-digital converter (ADC) of power quality monitoring equipment after equally spaced sampling of the secondary signals from voltage and current transformers; these data are unprocessed and lack statistical or business semantic annotation.
[0030] S102. Based on the preset file parsing rules, extract the data blocks in an independent state from each binary data file and generate a field directory corresponding to the data blocks. The field directory includes the original data number, discrete timestamp, and data value.
[0031] Specifically, for any binary data file, the preset file parsing rules first identify the file type and determine the binary structure definition and sampling period attribute used in the file based on the file type. Then, the file header is read to extract metadata information such as device identifier, firmware version, and measurement start time. Next, the record headers are read line by line according to the physical arrangement of the binary records in the file, starting from the beginning of the file. Each record header contains at least the original data number, payload length, and record generation timestamp for that record. After successfully reading the record header, the preset structure mapping table is queried based on the file type and original data number to determine the binary structure definition corresponding to the original data number. This structure mapping table is pre-configured. The correspondence between each original data number and binary field offset, field data type, and field length under this file type was established. According to the queried binary structure definition, the binary content of each field was read sequentially starting from the beginning byte of the load. The binary content was converted into runtime data values according to the field data type. Then, all the converted field values were summarized to form a data block. This data block contains the values of all fields in the record and the generation timestamp of the record. At the same time, the data number in each record was also retained as the original data number of the data block. This ensures that each extracted data block is independent and complete, and can independently express the sampled value of one or more power quality indicators corresponding to the record at a certain moment. During or after data block extraction, a corresponding field directory entry is generated for each data block. The content of this entry includes the original data number of the data block (directly taken from the record header), the data value contained in the data block (taken from the load parsing result), and the discrete timestamp corresponding to the data block (calculated by superimposing the record generation timestamp in the record header or the measurement start time in the file header with the record offset). The field directory stores the original data number, discrete timestamp, and data value of all data blocks in memory in the form of a structured table, forming a metadata index for subsequent mapping and alignment steps.
[0032] The preset file parsing rules represent a set of pre-configured parsing strategies for different types of binary data files. This set of strategies includes at least the identification method for each file type, the corresponding binary structure mapping table for each file type, and the sampling period attribute for each file type. These strategies guide differentiated parsing operations for binary data files of different file types. A data block represents a data structure extracted from a single binary record, containing a triplet of original data number, discrete timestamp, and data value information for at least one power quality indicator. It is the smallest unit of operation for subsequent mapping and alignment steps. The field directory represents a tabular index structure for data blocks. Each row corresponds to an index entry for a data block, containing at least three fields: the original data number, discrete timestamp, and data value. This allows for quick lookups by the preset mapping rules step and the cross-period alignment aggregation step.
[0033] S103. Based on the preset mapping rules, map the original data numbers corresponding to the data blocks in all binary data files that are associated with the same power quality index to the same global semantic label to obtain the target data block.
[0034] Specifically, after generating a field directory containing the original data numbers, discrete timestamps, and data values of all data blocks, each record in the field directory is traversed, and the original data numbers of each data block are mapped to global semantic tags based on preset mapping rules. The preset mapping rules are pre-configured in the form of a mapping table in a non-volatile storage medium. Each record in this mapping table contains three fields: source file type, source original data number, and corresponding target global semantic tag. For any data block in the field directory, the file type of the binary data file from which the data block originates is obtained (e.g., "cyc.pqf" represents a cycle-level valid value file, "cyc10s.pqf" represents a 10-second-level aggregation file, and "event.pqf" represents a transient event file) and the original data number of the data block are obtained. Then, using the combination of file type and original data number as the key, the preset mapping table is queried to retrieve the global semantic tag corresponding to the combination. If the query is successful, the global semantic tag is written to the field directory entry of the data block, and the data block is marked as the target data block. If the query fails, that is, the combination does not have a corresponding entry in the mapping table, the global semantic tag field of the data block is marked as null, and a mapping missing log is recorded for subsequent manual verification and mapping table supplementation. During the mapping process, multiple data blocks from different sources but with the same physical meaning (e.g., the A-phase voltage RMS value corresponding to original data number 0x102 in cyc.pqf, the A-phase voltage RMS value corresponding to original data number 0x307 in cyc10s.pqf, and the A-phase voltage waveform value corresponding to original data number 0x501 in event.pqf) are all mapped to the same global semantic label (e.g., "VOLTAGE_A_RMS") because they all physically represent the same power quality indicator (A-phase voltage RMS value), differing only in sampling period and binary structure. This mapping relationship is pre-configured manually by technicians based on the binary protocol document of the monitoring equipment, with the sole criterion being whether the physical definition of the same power quality indicator is the same in different file types. After mapping, each data block in the field directory is assigned a global semantic label, and the labeled data block becomes the target data block. Although they differ in their original data numbers and originate from different binary data files, they all correspond to the same power quality indicator at the business semantic level, thus providing a basis for subsequent cross-period alignment and aggregation by indicator dimension.
[0035] The preset mapping rules represent a set of pre-configured correspondences between original data numbers and global semantic tags. These rules are used to map original data with different numbers but the same physical meaning from different binary data files to unified business semantic tags. This set of correspondences is stored in the form of a structured mapping table.
[0036] Through the above embodiments, a mapping and conversion mechanism from original data numbers to business semantic tags has been established, enabling the unified collection of the same power quality index data from different binary data files with different original data numbers at the semantic level. When a new binary file type is added to the monitoring equipment or the firmware upgrade changes the meaning of a certain original data number, it is only necessary to add or modify the corresponding mapping entry in the preset mapping table. All configured component-based report templates can be automatically compatible with the new data source without any modification, thereby reducing the maintenance cost and expansion difficulty of the system in the long-term operation process. At the same time, it also provides a query basis for subsequent cross-cycle alignment and aggregation steps to collect data by index dimension.
[0037] S104. Based on discrete timestamps, target data blocks with the same global semantic label but belonging to different binary data files are aligned and aggregated across cycles on the global time axis to generate structured semantic data frames with continuous time series, and all structured semantic data frames are written into a unified virtual data pool.
[0038] Specifically, after mapping all target data blocks from their original data numbers to global semantic tags, all records marked as target data blocks in the field directory are grouped using the global semantic tags as the grouping key. This ensures that target data blocks with the same global semantic tag are grouped into the same data block set, with each set corresponding to a power quality index. For each data block set corresponding to a global semantic tag, a unified global time axis grid system is constructed based on the distribution characteristics of all target data blocks in that set along the time axis. This grid system does not depend on the native sampling period of any specific file but is dynamically determined by statistical analysis of the timestamps of all target data blocks in the set, resulting in the optimal time granularity. Then, using this unified grid system as a framework, the sampled values in the original discrete target data blocks are remapped to each grid point of the framework, forming a continuous, uninterrupted, equally spaced data sequence, resulting in structured semantic data frames. All structured semantic data frames are then written to a unified virtual data pool using the global semantic tag as the key. As an optional implementation, see [link to implementation details]. Figure 2 , Figure 2 This is a schematic diagram of the data frame generation process provided in the embodiments of this application, targeting... Figure 1 The step of generating structured semantic data frames in step S104 shown can be achieved through... Figure 2 Steps S1041-S1047 are implemented, and will be explained in detail below.
[0039] S1041. Obtain the set of target data blocks corresponding to the global semantic tags. The set of target data blocks contains multiple target data blocks.
[0040] Specifically, using global semantic tags as the grouping basis, each target data block record in the field directory is traversed, and the global semantic tag field already filled in the record is read. Using the global semantic tag as the key, a grouping mapping table is maintained in memory with the global semantic tag as the key and the target data block list as the value. For each traversed target data block record, it is checked whether an entry with the global semantic tag as the key already exists in the grouping mapping table. If it does not exist, a new empty list is created and the target data block is added to the list; if it already exists, the target data block is appended to the end of the existing list. After all target data block records in the field directory have been traversed, the target data block list corresponding to each key (i.e., a global semantic tag) in the grouping mapping table is the target data block set corresponding to that global semantic tag. Each target data block set contains multiple target data blocks from the same binary data file or multiple different binary data files. Each target data block has the sampled data value of the power quality index indicated by the global semantic tag corresponding to the set at a certain discrete timestamp.
[0041] The target data block set represents the collection of all target data blocks mapped to the same global semantic label in the field directory, which is the aggregation of sampled data of the same power quality index at multiple discrete time points.
[0042] S1042. Arrange the target data blocks in the target data block set according to the order of discrete timestamps to generate the original discrete sequence corresponding to the global semantic label.
[0043] Specifically, after obtaining the set of target data blocks corresponding to the global semantic tag, the discrete timestamp field carried by each target data block is read from the target data block set. This discrete timestamp field is recorded in each target data block in a uniform time format (e.g., a millisecond-level Unix timestamp calculated from 00:00 on January 1, 1970). Based on the numerical value of the discrete timestamp, a memory sorting algorithm (e.g., quicksort or mergesort) is used to sort all target data blocks in the target data block set in ascending order according to the discrete timestamp. For target data blocks with completely identical discrete timestamps (i.e., multiple data blocks generated at the same time but from different binary data files), they are not deduplicated or merged during the sorting process. Instead, all target data blocks are retained and their order in the sorting result is maintained in any order. After sorting, the sorted target data blocks are output as a sequence, which is the original discrete sequence corresponding to the global semantic tag.
[0044] The original discrete sequence represents an ordered sequence obtained by arranging all target data blocks in the target data block set in ascending order according to their discrete timestamps. This sequence retains complete information about each target data block, including but not limited to the original data number, discrete timestamp, data value, and global semantic label. At the same time, the order of this sequence reflects the natural evolution of the original sampled data of the power quality index corresponding to the global semantic label in the time dimension.
[0045] S1043. Identify the time interval between two adjacent discrete timestamps in the original discrete sequence; use the greatest common divisor of all time intervals as the global alignment reference period, and divide the global time axis corresponding to the original discrete sequence into continuous equally spaced time grids according to the global alignment reference period.
[0046] Specifically, starting from the beginning of the original discrete sequence, the target data blocks at every two adjacent positions in the sequence are accessed sequentially. The discrete timestamps carried by these two target data blocks are read, and the time interval value corresponding to the adjacent position pair is obtained by subtracting the previous discrete timestamp from the subsequent timestamp. This process is repeated for all adjacent position pairs in the original discrete sequence until the end of the sequence, resulting in a time interval set containing multiple time interval values. Each time interval value in this set is a positive value, and its unit is consistent with the unit of the discrete timestamp (e.g., milliseconds). Then, the greatest common divisor (GCD) calculation operation is performed on all values in this time interval set. The Euclidean algorithm is used to successively solve for the GCD of all time interval values: first, the GCD of the first time interval value is calculated with the second time interval value; then, the result is calculated with the third time interval value, and so on, until all values in the time interval set have been traversed. The final GCD is used as the global alignment reference period. This global alignment reference period is the common time unit of all adjacent time intervals in the original discrete sequence. For example, if the time interval set contains values such as 20ms, 10000ms, and 5000ms, then their GCD is 20ms. After determining the global alignment reference period, the discrete timestamp corresponding to the first target data block in the original discrete sequence is obtained as the start timestamp, and the discrete timestamp corresponding to the last target data block in the original discrete sequence is obtained as the end timestamp. The global time axis range of the original discrete sequence is defined by the start timestamp and the end timestamp. The start timestamp is used as the first time grid point, and the subsequent time grid points are generated incrementally with the global alignment reference period as the step size until the generated time grid points reach or exceed the end timestamp, thereby dividing the global time axis into a series of continuous and equally spaced time grid points, each time grid point covering the entire time interval from the start timestamp to the end timestamp.
[0047] Meanwhile, due to the crystal oscillator frequency deviation and interruption response delay of the power quality monitoring equipment, multiple recording intervals within the same nominal sampling period may exhibit random jitter on the order of ±0.1ms. If the precise greatest common divisor of all adjacent intervals is directly used as the reference period, this common divisor will degenerate to the microsecond or even submicrosecond level, leading to a surge in the number of time grid points and making engineering implementation impossible. Therefore, before performing cross-period alignment aggregation, tolerance merging processing is performed on all adjacent time intervals in the original discrete sequence: adjacent intervals with numerical differences less than a preset tolerance threshold (e.g., ±0.5ms) are grouped into the same nominal interval category; the frequency of occurrence of adjacent intervals in each category is counted, and the interval value corresponding to the category with the highest frequency is determined as the main period; then, the main period is used as the global alignment reference period, and the precise greatest common divisor of all intervals is no longer taken. If there are multiple different main period categories (e.g., 20ms cycle-level data coexisting with 10000ms second-level data), the greatest common divisor of these main period values is calculated again, and this common divisor is used as the final global alignment reference period. The tolerance threshold ranges from 0.5% to 5% of the nominal sampling period, and the specific value is dynamically configured based on the crystal oscillator accuracy and sampling period of the device.
[0048] S1044. For each time grid point, determine whether there is a discrete timestamp corresponding to each time grid point in the original discrete sequence.
[0049] Specifically, after dividing the global time axis into a series of continuous, equally spaced time grids according to the global alignment reference period, each time grid is accessed one by one. For the target time grid currently being processed, the corresponding time value (i.e., the absolute time position of the time grid on the global time axis) is extracted from the time grid. Then, using the time value as the query key, starting from the beginning position of the original discrete sequence, the discrete timestamp field carried by each target data block in the sequence is accessed in sequence. The value of this field is compared with the time value of the target time grid, and the matching result (whether there is a match or not) of each time grid is recorded, as well as the position of the corresponding matching data block when there is a match.
[0050] S1045. If it exists, then the data value corresponding to the existing discrete timestamp is taken as the target data value of the time grid point.
[0051] Specifically, if a target data block is located in the original discrete sequence whose discrete timestamp is equal to the time value of the current time grid point, then the target data block is the matching data block of the time grid point. The data value field of the matching data block stores the value that was extracted together with the discrete timestamp in the same record and maintained in a binding relationship. The value in the data value field is directly read out and stored as the target data value of the time grid point. During storage, a one-to-one correspondence is established between the time value of the time grid point and the target data value, and it is recorded in the time grid point-target data value mapping table in memory for subsequent steps to read in chronological order when generating structured semantic data frames.
[0052] S1046. If it does not exist, then the target data value of the time grid point is determined based on the two adjacent discrete timestamps before and after the time grid point, and the data values corresponding to the adjacent timestamps.
[0053] Specifically, when it is determined that there is no precisely matching discrete timestamp in the original discrete sequence for the current time grid point, the process traverses backward from the starting position of the original discrete sequence to locate the two nearest target data blocks before and after the current time grid point. If the first data block with a time value greater than the current time grid point exists, this data block is taken as the next adjacent data block, and the data block at the previous position is taken as the previous adjacent data block. If the current time grid point is earlier than the timestamp of the first data block in the sequence, only the first data block is taken as the next adjacent data block, and the target data value is dynamically calculated based on the data value of this data block and its time interval with the current time grid point. If the current time grid point is later than the timestamp of the last data block in the sequence, only the last data block is taken as the previous adjacent data block, and the target data value is also dynamically calculated based on the data value of this data block and its time interval with the current time grid point. During dynamic calculation, a preset change function is selected for extrapolation according to the power quality index type corresponding to the data block. For example, linear extrapolation is used for frequency deviation index, mean preservation is used for harmonic distortion rate index, or a global change function is generated by fitting existing data values on the global time axis for unified filling. If the current time grid point is located between the beginning and end of the sequence, both the preceding and following adjacent data blocks are simultaneously acquired. The discrete timestamp of the preceding adjacent data block is recorded as the "previous timestamp," and the data value as the "previous value." Similarly, the discrete timestamp of the following adjacent data block is recorded as the "following timestamp," and the data value as the "following value." Then, the target data value is calculated using the linear interpolation formula: Target data value = Previous value + (Following value - Previous value) × [(Current time grid point's time value - Previous timestamp) / (Following timestamp - Previous timestamp)]. This formula is based on the assumption that power quality indicators change approximately linearly between adjacent sampling points, and calculates the estimated data value of the time grid point through relative positional proportions. The calculated estimated data value is stored as the target data value for that time grid point in the time grid point-target data value mapping table. If the current time grid point has multiple combinations of preceding and following adjacent data blocks, only the temporally closest pair is used as the interpolation basis; the others are reserved for subsequent conflict resolution steps.
[0054] For example, taking the original discrete sequence corresponding to the global semantic label "FREQUENCY" as an example, the timestamp of the first target data block of this sequence is May 1, 2026, 00:00:00.000, with a data value of 50.02Hz, and the timestamp of the last target data block is May 1, 2026, 00:00:10.000, with a data value of 49.98Hz. The global alignment reference period of this sequence is 20ms. Three situations are encountered when traversing the time grid: In the first case, the time grid point 00:00:00.100 on [Date] is located between the beginning and end of the original discrete sequence. The data value at the preceding adjacent data block is 00:00:00.080, which is 50.01Hz, and the data value at the following adjacent data block is 00:00:00.120, which is 50.00Hz. Substituting these values into the linear interpolation formula, we calculate 50.01 + (50 - 50.01) × (0.02 / 0.04) to obtain 50.005Hz, which is taken as the target data value for this grid point. In the second scenario, the time grid point 00:00:00.010 on [Date] is earlier than the timestamp 00:00:00.020 of the first data block in the sequence. In this case, there is no preceding adjacent data block, and only the first data block is used as the following adjacent data block. Based on the change characteristics of the frequency deviation index in the early stage of device startup, the preset change function is queried as "constant value maintenance". The data value of the following adjacent data block, 50Hz, is directly used as the target data value of the time grid point. In the third scenario, the time grid point 00:00:15.000 on [Date] is later than the timestamp 00:00:10.000 of the last data block in the sequence (assuming a data value of 49.98Hz). In this case, there is no subsequent adjacent data block, and only the last data block is used as the preceding adjacent data block. Based on the trend of the existing data values from 00:00:00.000 (assuming a data value of 50.02Hz) to 00:00:10.000 on the global time axis, a global change function is fitted. This function is a linear decreasing function with a slope of -0.004Hz / s. Extrapolating to 00:00:15.000, we obtain 49.96Hz as the target data value for this time grid point.
[0055] The above embodiments supplement the data missing on the time axis caused by the sparse sampling points in data files of different sampling periods, so that the final generated structured semantic data frame has complete data values at every time grid point on the global time axis, thereby ensuring that each component element can obtain the value at any time point when referencing this indicator during the subsequent report generation process.
[0056] S1047. Arrange all time grid points and the target data values of each time grid point in chronological order to generate a structured semantic data frame with global semantic labels.
[0057] Specifically, from the time grid-target data value mapping table corresponding to the global semantic tag, all stored time grids and their corresponding target data value records are read. The time grid-target data value mapping table is a data structure gradually constructed and stored in memory in the preceding steps. Each row of the mapping table contains the time value of a time grid and the target data value corresponding to that time grid. All records in the mapping table are sorted in ascending order according to the time values of the time grids, ensuring that the time grid in each record is earlier than the time grid in the next record after sorting. After sorting, the time grids in each record are extracted from the sorted record sequence to form a time grid sequence, and the target data values in each record are extracted to form a target data value sequence. The time grid sequence and the target data value sequence maintain a one-to-one correspondence in position. The time grid sequence and the target data value sequence with this one-to-one correspondence are organized into a data structure, and this data structure is bound to the currently processed global semantic tag as the structured semantic data frame corresponding to that global semantic tag. The above operations are performed independently for each global semantic tag until all structured semantic data frames corresponding to all global semantic tags have been generated.
[0058] The structured semantic data frame represents a complete data unit continuously sampled on the global time axis according to the global alignment reference period, identified by a global semantic tag. The data unit contains at least multiple time grids arranged in chronological order and the target data value corresponding to each time grid, which is used for addressing and reading through the global semantic tag when traversing the component elements in the report template.
[0059] Based on the above embodiments, as an optional embodiment, see [link to embodiment]. Figure 3 , Figure 3 This is another flowchart illustrating the method for generating power quality reports using heterogeneous binary data provided in this application. Figure 1 Before step S104 shown, it may also include Figure 3 Steps S201-S204 are explained in detail below.
[0060] S201. If there are conflicting data blocks with the same global semantic label and the same discrete timestamp, extract the sampling resolution precision parameter of the conflicting data block from the binary data file corresponding to the conflicting data block, use it as the basic confidence weight of the conflicting data block, and mark the discrete timestamp corresponding to the conflicting data block as the conflict timestamp.
[0061] Specifically, using the combination of global semantic tag and discrete timestamp as the key, each target data block record in the field directory is traversed. For each record, the combination of the record's global semantic tag and discrete timestamp is used as the grouping key, and all target data blocks with the same grouping key are grouped into the same group. If the number of target data blocks in a group is greater than or equal to 2, then all target data blocks in that group are conflicting data blocks, and the discrete timestamp corresponding to that group is marked as a conflict timestamp. If the number of target data blocks in a group is equal to 1, then there is no conflict. When a conflicting data block is detected, for each conflicting data block, its source information is obtained. This source information includes at least the file type of the binary data file from which the conflicting data block originates and the storage location of the conflicting data block in the field directory. Then, based on the file type from which the conflicting data block originates, a preset device parameter library is queried. This device parameter library pre-stores sampling resolution precision parameters corresponding to each file type. These sampling resolution precision parameters characterize the fineness of quantization of physical quantities by the binary data file corresponding to that file type at the sampling time. A higher value indicates a higher sampling resolution and higher data reliability. This sampling resolution precision parameter is extracted from the preset device parameter library and used as the basic confidence weight for the conflicting data block. For example, if the sampling resolution of a certain file type is 12-bit ADC, its basic confidence weight is 4096; if the sampling resolution of another file type is 16-bit ADC, its basic confidence weight is 65536. The above extraction operation is performed for each conflicting data block to obtain the basic confidence weight corresponding to each conflicting data block. At the same time, the discrete timestamps corresponding to the group are marked as conflict timestamps, and the basic confidence weights of the conflict timestamps and all conflict data blocks associated with the conflict timestamps are stored in a conflict record table in memory for use in subsequent steps for fusion weight calculation and conflict smoothing log generation.
[0062] In this context, conflicting data blocks represent multiple target data blocks with the same global semantic label and the same discrete timestamp; that is, multiple data values obtained by sampling the same power quality index from multiple binary data files at the same time. The sampling resolution precision parameter represents the quantization precision of the analog-to-digital converter (ADC) of the binary data file from which the conflicting data block originates. It is expressed in bits and is used to quantify the measurement fineness of the data block at the physical sampling time, serving as a basis for measuring the data confidence of the data block relative to other data blocks at the same time.
[0063] S202. Based on historical time-series slices, determine the baseband noise standard deviation corresponding to the conflicting data block, and calculate the dynamic attenuation coefficient corresponding to the conflicting data block based on the baseband noise standard deviation. The historical time-series slices are used to characterize historical data within a preset time window centered on the conflict timestamp.
[0064] Specifically, for each conflicting data block, the file type of the binary data file from which the conflicting data block originates is obtained. Then, based on the file type, a preset sampling period parameter is queried to determine the sampling period corresponding to the conflicting data block. A preset time window is determined with the conflict timestamp as the center and a radius equal to a multiple of the sampling period (e.g., three or five times). The front boundary of the preset time window is obtained by subtracting the preset multiple of the sampling period from the conflict timestamp, and the back boundary is obtained by adding the preset multiple of the sampling period to the conflict timestamp. All data blocks with the same global semantic label and whose discrete timestamps fall within the preset time window are retrieved from the field directory. Given target data blocks within a time window, extract the data values from these target data blocks to form a set of historical time-series slice data sequences that share the same source and label as the currently conflicting data block. Calculate the standard deviation of all data values in this historical time-series slice data sequence. This involves first calculating the mean of the sequence, then averaging the squares of the differences between each data value and the mean, and finally taking the square root. Use this result as the baseband noise standard deviation corresponding to the conflicting data block. After obtaining the baseband noise standard deviation, calculate the dynamic attenuation coefficient corresponding to the conflicting data block based on this standard deviation. The specific calculation formula is: Dynamic attenuation coefficient = 1 / (1+(σ / σ0)). 2 ), where σ is the baseband noise standard deviation corresponding to the conflicting data block, and σ0 is a preset reference noise benchmark value. This benchmark value is pre-configured according to the power quality index type corresponding to the conflicting data block. The benchmark value for voltage index is 0.5V, the benchmark value for current index is 0.1A, the benchmark value for frequency index is 0.02Hz, and the benchmark value for harmonic index is 0.2%. This is used to convert the dimensional noise standard deviation into a dimensionless ratio, ensuring that the dimensions on both sides of the formula are consistent, and avoiding the influence of unit differences on the weight comparison of current and voltage.
[0065] Here, a historical time-series slice represents a sequence of data values from a set of target data blocks retrieved from the field directory within a preset time window, centered on the conflict timestamp and sharing the same global semantic label, with discrete timestamps falling within that window. The baseband noise standard deviation represents the standard deviation calculated for all data values in the historical time-series slice. It quantifies the measurement dispersion of the data channel from which the conflict data block originates near the conflict timestamp; a larger standard deviation indicates more drastic fluctuations and poorer stability in the channel's measurements during that time period. The dynamic attenuation coefficient is used to correct the basic confidence weight of the conflict data block in subsequent fusion weight adjustments; its value decreases as the baseband noise standard deviation increases.
[0066] For example, suppose the conflict timestamp is T = May 1, 2026 00:00:00.000, and a conflicting data block originates from the file cyc.pqf with a sampling period of 20ms. Centered on the conflict timestamp and with a radius of five times the sampling period (i.e., 100ms), a preset time window is determined as [May 1, 2026 00:00:00.000 - 100ms, May 1, 2026 00:00:00.000 + 100ms], i.e., [00:00: -0.100, 00:00:00.100]. All target data blocks with the same global semantic label and whose discrete timestamps fall within this window are retrieved from the field directory, yielding 11 historical data values (including the data value of the conflict timestamp itself). The mean of the sequence is calculated, and the average of the squares of the differences between each data value and the mean is further calculated, yielding a baseband noise standard deviation of 0.0085 (in volts squared). Substituting this into the formula: Dynamic attenuation coefficient = 1 / (1+0.0085) = 0.9916. This dynamic attenuation coefficient is close to 1, indicating good measurement stability of the channel within this time window. If the baseband noise standard deviation is larger (e.g., 0.5), the dynamic attenuation coefficient is 1 / (1+0.5) = 0.6667, indicating greater data fluctuation within this time window and decreased data reliability.
[0067] Suppose that a conflicting data block originates from the cyc.pqf file, and the corresponding power quality index is the effective voltage value (reference noise baseline value σ0=0.5V), and the conflict timestamp is T=May 1, 2026 00:00:00.000. A preset time window [00:00:-0.100, 00:00:00.100] is determined with T as the center and five times the sampling period (100ms) as the radius. Data values [220.1, 220.3, 220.0, 219.9, 220.2, 220.5, 219.8, 220.1, 220.2, 220.0, 220.3] (unit: V) of 11 target data blocks falling within this window are retrieved from the field directory. The mean of this sequence is calculated to be approximately 220.1V. The square root of the sum of the squared deviations of each data value from the mean is then calculated to obtain the baseband noise standard deviation σ = 0.18V. Substituting this into the formula: Dynamic attenuation coefficient = 1 / (1+(0.18 / 0.5)). 2 =1 / (1+0.1296) = 1 / 1.1296 ≈ 0.886. This coefficient is close to 1, indicating that the channel has small measurement fluctuations and good data stability during this period. If another conflicting data block corresponds to the same conflict timestamp and the same power quality index, but its baseband noise standard deviation σ = 1.2V, then the dynamic attenuation coefficient = 1 / (1+(1.2 / 0.5)). 2=1 / (1+5.76)=1 / 6.76≈0.148. This coefficient is significantly lower than 0.886, indicating that the channel's measurement fluctuated drastically during this period and the data reliability was greatly reduced.
[0068] S203. Based on the basic confidence weight and dynamic decay coefficient, dynamically adjust the fusion weight of each conflicting data block.
[0069] Specifically, for each conflicting data block, due to the significant differences in the sampling resolution precision parameters of the binary data files from which the conflicting data blocks originate (for example, the base confidence weight of a 16-bit ADC is 65536, while that of a 12-bit ADC is only 4096), if the product is directly used as the fusion weight, the weight of the high-resolution data block will dominate the fusion result, causing the adjustment effect of the dynamic attenuation coefficient to be overwhelmed by the magnitude difference in the base confidence weight. Therefore, a normalization preprocessing is performed on the base confidence weight of each conflicting data block: the base confidence weights of all conflicting data blocks associated with the current conflict timestamp are summed to obtain the total base confidence weight, and then the base confidence weight of each conflicting data block is divided by this sum to obtain the normalized base confidence weight. The numerical range of this normalized base confidence weight is compressed to between 0 and 1, and the sum of the normalized base confidence weights of all conflicting data blocks is 1, thereby eliminating the weight value difference caused by the different sampling resolution units between different data sources. The normalized base confidence weight of each conflicting data block is multiplied by its dynamic decay coefficient to obtain the fusion weight of that data block. A second normalization is performed on the fusion weights of all conflicting data blocks associated with the current conflicting timestamp: the fusion weights of each conflicting data block are summed to obtain a total fusion weight; then, the fusion weight of each conflicting data block is divided by this total to obtain a normalized fusion weight, the sum of which is 1. This normalized fusion weight is used as the final weight allocation for each conflicting data block when determining the conflicting timestamp data value.
[0070] The fusion weight represents the proportion of each conflicting data block's data value in the weighted fusion process when determining the conflict timestamp data value later. The larger the proportion, the greater the impact of the conflicting data block's data value on the final fusion result.
[0071] For example, assume there are three conflicting data blocks at the conflict timestamp T, with the following basic confidence weights: cyc.pqf source 65536 (16-bit ADC), cyc10s.pqf source 4096 (12-bit ADC), and event.pqf source 16384 (14-bit ADC). Normalizing these basic confidence weights: the total basic confidence weights = 65536 + 4096 + 16384 = 86016. The normalized basic confidence weights are: cyc.pqf source = 65536 / 86016 ≈ 0.762, cyc10s.pqf source = 4096 / 86016 ≈ 0.048, and event.pqf source = 16384 / 86016 ≈ 0.190. The sum of the three normalized basic confidence weights is 1. Assume the dynamic decay coefficients of the three conflicting data blocks are 0.9916 for cyc.pqf source, 0.9230 for cyc10s.pqf source, and 0.9840 for event.pqf source. Calculate the fusion weights as follows: cyc.pqf source = 0.762 × 0.9916 ≈ 0.756, cyc10s.pqf source = 0.048 × 0.9230 ≈ 0.044, event.pqf source = 0.190 × 0.9840 ≈ 0.187. The total fusion weights are 0.756 + 0.044 + 0.187 = 0.987. After secondary normalization: cyc.pqf source = 0.756 / 0.987 ≈ 0.766, cyc10s.pqf source = 0.044 / 0.987 ≈ 0.045, event.pqf source = 0.187 / 0.987 ≈ 0.189. The final normalized sum of the fusion weights is 1.
[0072] S204. For the same conflict timestamp, determine the data value of the conflict timestamp according to the data values corresponding to each fusion weight and all conflicting data blocks, and generate a conflict smoothing log synchronously.
[0073] Specifically, the data value of each conflicting data block is multiplied by its normalized fusion weight to obtain the weighted data value of that conflicting data block. Then, the weighted data values of all conflicting data blocks associated with the current conflicting timestamp are summed, and the sum is taken as the final data value of the conflicting timestamp. This can be expressed as: Final data value of conflicting timestamp = Σ(data value of each conflicting data block × normalized fusion weight of that conflicting data block). This final data value integrates sampled values from multiple binary data files at the same time using a weighted average method. This preserves the effective information from each data source while achieving differentiated control over the contribution of different data sources through the normalized fusion weight. After determining the final data value of the conflicting timestamp, a conflict smoothing log corresponding to that timestamp is generated synchronously. The conflict smoothing log records: the time value of the conflicting timestamp, the data values of all conflicting data blocks associated with that timestamp and their corresponding normalized fusion weights, the final data value of the conflicting timestamp, and the source identifier corresponding to the final data value of the conflicting timestamp (used to indicate that the final data value is the result of multi-source weighted fusion). The conflict smoothing log is stored in an in-memory log buffer in a structured format (such as JSON or table row format) for later use as data annotation information or data quality traceability when generating power quality reports. The final data value determination operation and conflict smoothing log generation operation described above are performed independently for each tagged conflict timestamp until all conflict timestamps have been processed.
[0074] Through the above embodiments, the original information of all conflicting data blocks is preserved (through conflict smoothing log recording), enabling data users to trace the source and fusion process of the final data value at the conflict timestamp when reviewing reports later, thus improving data traceability and reliability. Furthermore, because the weighted average calculation preserves the continuous trend of each data value, it avoids numerical jumps that might occur with discrete selection methods such as taking the maximum, minimum, or median, ensuring a smooth transition of the final data value sequence on the timeline. This is beneficial for trend analysis and chart presentation in subsequent power quality reports.
[0075] S105. Traverse all component elements, use the global semantic tags configured in the component elements as addressing indexes, and extract the structured semantic data frames corresponding to the addressing indexes from the unified virtual data pool across files as target data frames.
[0076] Specifically, for the component element currently being processed, its configuration information is read, and the global semantic tags specified by the component element are extracted from the configuration information. Each component element may be configured with one or more global semantic tags depending on the needs of its displayed content (for example, a voltage trend graph component may only be configured with one global semantic tag "VOLTAGE_A_RMS", while a three-phase imbalance formula component may be configured with three global semantic tags "VOLTAGE_A_RMS", "VOLTAGE_B_RMS", and "VOLTAGE_C_RMS"). After extracting the global semantic tags, the global semantic tags are used as addressing indexes, and the addressing indexes are used as query keys to perform retrieval operations in a unified virtual data pool. The unified virtual data pool stores data with global semantic tags as keys and corresponding structured semantic data frames as values. During retrieval, the addressing index is compared one by one with each key in the unified virtual data pool. If the comparison matches, the structured semantic data frame corresponding to that key is retrieved. If the current component element is configured with multiple global semantic tags, the above retrieval operation is performed for each global semantic tag, retrieving the corresponding structured semantic data frames and organizing these data frames into a data frame set. After successfully retrieving one or more structured semantic data frames, these structured semantic data frames are marked as target data frames for the component element, and the target data frame is bound to its corresponding component element for use in subsequent assembly and rendering steps. If no structured semantic data frame matching the addressing index is found in the unified virtual data pool during retrieval, the component element is marked as a missing data component, the missing global semantic tag is recorded, and corresponding placeholder information is generated for the component element in subsequent assembly and rendering steps without interrupting the entire traversal process.
[0077] The addressing index represents the query identifier used to locate structured semantic data frames in the unified virtual data pool. In this step, the addressing index is the global semantic tag itself. The unified virtual data pool represents a cache area of structured semantic data frames in memory, organized in key-value pairs, where the key is the global semantic tag and the value is the structured semantic data frame corresponding to that tag. The target data frame represents the structured semantic data frame retrieved from the unified virtual data pool and identified as the data source of the current component element, used for subsequent assembly and rendering steps to generate the rendering result of the component element.
[0078] Based on the above embodiments, as an optional embodiment, for Figure 1 Step S105 shown can be achieved through the following steps, which are explained in detail below.
[0079] Using the global semantic tags configured for component elements as addressing indexes, an initial retrieval is performed in a unified virtual data pool to obtain an initial set of data frames for the power quality indicators corresponding to the component elements. Based on the data timeline recorded in the initial data frame set and the target time window corresponding to the report generation request, it is determined whether there are data gaps or faults in the data timeline that do not completely cover the target time window. If so, based on the preset power indicator companion rules, conversion indicators that have a physical conversion relationship with the power quality indicators with data gaps and belong to different binary data files are obtained. The global semantic tags corresponding to the conversion indicators are used as backup addressing indexes to extract the corresponding compensation data frames, and the data values of the compensation data frames are filled into the data gaps to generate a structured semantic data frame without data gaps as the target data frame.
[0080] Specifically, using the global semantic tag configured for the current component element as the addressing index, an initial retrieval is performed in the unified virtual data pool to obtain the structured semantic data frame corresponding to the global semantic tag. This is recorded as the initial data frame for the power quality index corresponding to the component element. The time grid sequence recorded in the initial data frame is read, and the smallest time grid point in the time grid sequence is extracted as the starting boundary of the data time axis, and the largest time grid point is extracted as the ending boundary of the data time axis. Simultaneously, a target time window is extracted from the report generation request. This target time window includes the target start time and the target end time, specifying the time range that this power quality report needs to cover. The starting boundary of the data time axis is compared with the target start time, and the ending boundary of the data time axis is compared with the target end time. If the starting boundary of the data time axis is later than the target start time, it is determined that there is a data hole / fault on the starting side of the data time axis that does not cover the target time window; if the ending boundary of the data time axis is earlier than the target end time, it is determined that there is a data hole / fault on the ending side of the data time axis that does not cover the target time window; if the starting boundary of the data time axis is earlier than the target end time, it is determined that there is a data hole / fault on the ending side of the data time axis that does not cover the target time window. If the boundary is earlier than or equal to the target start time and the termination boundary is later than or equal to the target termination time, it is determined that there is no data hole fault. If no data hole fault is determined, the initial data frame is directly used as the target data frame. If a data hole fault is determined, the preset power index companion rules are queried. These rules are pre-configured in a non-volatile storage medium in the form of a mapping table. Each record in the mapping table contains at least: a first power index, a second power index, and a physical conversion relationship expression between the first and second power indexes. The physical conversion relationship expression is used to indicate how to deduce the corresponding value of the first power index based on the value of the second power index. Using the power quality index with a data hole fault as the query key, the preset power index companion rules are used to retrieve the conversion index that has a physical conversion relationship with the power quality index. If the retrieval is successful, the global semantic tag corresponding to the conversion index is obtained, and the global semantic tag is used as a backup addressing index. The corresponding structured semantic data frame is extracted from the unified virtual data pool as a compensation data frame. After the compensation data frame is extracted, the data value within the same time interval as the data hole fault within the target time window is read from the compensation data frame. The data value is converted according to the physical conversion relationship expression. The calculation result is filled into the target data value of the missing time grid corresponding to the data hole fault in the initial data frame, thereby generating a complete structured semantic data frame without data fault as the target data frame. If the retrieval fails, that is, there is no conversion index with a physical conversion relationship with the power quality index with data hole fault in the preset power index companion relationship, the initial data frame is kept unchanged, the information of the data hole fault is recorded, and the information is passed to the subsequent rendering steps for corresponding processing.
[0081] The initial data frame set represents the structured semantic data frames corresponding to the global semantic tags configured for the current component element, retrieved from the unified virtual data pool. The target time window represents the time range to be analyzed specified in the report generation request, including the target start and end times. Data gaps / faults represent missing intervals in the target time window where the data timeline fails to fully cover the data, including missing data at the start, end, or both. Preset power quality indicator companion rules represent a set of pre-configured physical conversion relationships between different power quality indicators, used to supplement missing data of a certain power quality indicator by extrapolating data from other power quality indicators with which it has a physical conversion relationship. The conversion indicator represents another power quality indicator with a physical conversion relationship to the power quality indicator exhibiting data gaps; its data value can be converted to the target indicator's data value according to the physical conversion relationship expression. The compensation data frame represents the structured semantic data frame extracted from the unified virtual data pool using the global semantic tag corresponding to the conversion indicator as a backup addressing index.
[0082] Through the above embodiments, when a data gap is detected in a power quality indicator due to monitoring equipment not being started or not recording, the inherent physical conversion relationships between power quality indicators are utilized to extract complete structured semantic data frames of the conversion indicators from a unified virtual data pool for reverse calculation and completion, thus achieving automatic repair of data gaps. The data values completed through such physical conversion relationships have clear physical meaning and acceptable engineering precision, ensuring that the report can still cover the complete target time window even when some data is missing. This improves the completeness and reliability of report generation and avoids situations where report generation is completely abandoned due to missing data.
[0083] S106. Assemble and render all target data frames to generate a power quality report.
[0084] Specifically, the layout information and hierarchical relationships of each component element defined in the component-based report template are obtained. The layout information indicates the position coordinates and footprint of each component element on the report layout, while the hierarchical relationships indicate their stacking order. Based on this layout information and hierarchical relationships, a component rendering plan queue is generated. This queue arranges the component elements to be rendered in a top-to-bottom and left-to-right order according to their position on the layout, and records whether there are data dependencies between each component element. Then, rendering operations are performed on each component element sequentially according to the order of the rendering plan queue. For component elements without data dependencies in the rendering plan queue, they are marked as parallel rendering nodes and assigned to different processing threads for parallel execution. For component elements with data dependencies, their execution order is determined according to the dependencies, and the rendering result of the upstream dependency is used as the rendering input parameter for the downstream dependency. During the rendering operation, the rendering content corresponding to the component element is generated based on the target data frame and component type. Once the rendering content of all component elements is generated, according to the layout position and hierarchy of each component element defined in the component-based report template, the rendering content of each component element is sequentially combined and spliced to the corresponding position on the report page in the order of the rendering schedule queue, generating a complete power quality report.
[0085] Based on the above embodiments, as an optional embodiment, for Figure 1 Step S106 shown can be achieved through the following steps, which are explained in detail below.
[0086] The system identifies the component type of the component element corresponding to the target data frame to be rendered. Component types include single-value components, data block components, and chart components. If the component type is a single-value component, a statistical value is determined from the target data frame using a preset statistical function as the rendering result of the target data frame. If the component type is a data block component, a data value sequence is extracted from the target data frame, and the maximum, minimum, average, and P95 values of the data value sequence are calculated respectively. The maximum, minimum, average, and P95 values are then organized into a table to obtain the rendering result of the target data frame. If the component type is a chart component, a discrete timestamp sequence and a data value sequence are extracted from the target data frame to generate a chart description object containing coordinate axis parameters and a set of data points, thus obtaining the rendering result of the target data frame. When it is identified that the component element corresponding to the target data frame to be rendered is configured with a composite calculation formula, the data values and discrete timestamps corresponding to the global semantic tags of each component element are extracted from the target data frame to generate a numerical list variable; the numerical list variable is substituted into the composite calculation formula for serialization operation to obtain the rendering result of the target data frame. If a field is missing or an expression parsing error occurs, the error event is captured, and placeholder text with error message is generated; the placeholder text is then used as the rendering result of the target data frame. A power quality report is generated based on the rendering results of all target data frames.
[0087] Specifically, for the component element to be rendered, the configuration information of the component element in the component-based report template is read. The component type of the component element is identified from the configuration information. Component types include single-value components, data block components, and chart components. If the component type of the current component element is identified as a single-value component, all time grid points and their corresponding target data values within the target time window are extracted from the target data frame bound to the component element. Then, the preset statistical function type is read from the configuration information of the component element. The preset statistical function types include average, maximum, minimum, latest value, and sample count. The corresponding statistical operation is performed on all the extracted target data values according to the specified statistical function type, and the calculated result is obtained. The single value is used as the rendering result of the target data frame. If the component type of the current component element is identified as a data block component, all target data values within the target time window are extracted from the target data frame bound to the component element to form a data value sequence. Then, the maximum value, minimum value, average value and P95 value are calculated for the data value sequence. The P95 value is calculated by arranging the data value sequence in ascending order and taking the value at the 95th percentile. After the four indicators are calculated, the four values of maximum value, minimum value, average value and P95 value are associated with the corresponding indicator names and organized into a two-dimensional table structure containing a header row and data rows. This table structure is used as the rendering result of the target data frame. If the component type of the current component element is identified as a chart component, then all time grid points within the target time window are extracted from the target data frame bound to the component element to form a discrete timestamp sequence, and the target data values corresponding to each time grid point are extracted to form a data value sequence. Then, the discrete timestamp sequence is used as the horizontal axis coordinate data and the data value sequence is used as the vertical axis coordinate data to generate a chart description object containing a set of data point coordinate pairs, horizontal axis labels, vertical axis labels, coordinate axis value ranges, and legend information. This chart description object is used as the rendering result of the target data frame.
[0088] If the configuration information of the current component element contains a composite calculation formula field, then regardless of the component type of the component element, the target data value sequence corresponding to each global semantic tag is extracted from each target data frame bound to the current component element. Each target data value sequence is converted into a numerical list variable. Each element in each numerical list variable maintains a one-to-one correspondence with the time grid point in the target data frame corresponding to the variable. Each numerical list variable is serialized according to the operation logic defined in the composite calculation formula. The serialization operation includes element-wise addition, subtraction, multiplication, and division operations between each numerical list variable, as well as maximum value, minimum value, average value, P95 value, sample number, and summation statistical operations performed on a single numerical list variable. After the serialization operation is completed, a calculation result sequence or a single calculation result value is obtained, and the calculation result sequence or single calculation result value is used as the rendering result of the target data frame.
[0089] During the rendering process of the aforementioned single-value components, data block components, chart components, and composite calculation formulas, if an error event occurs, such as a missing field in the target data frame or an expression in the composite calculation formula cannot be parsed, the error event is captured, and an error message containing a description of the error type and the location of the error is generated. This error message is then included in placeholder text, which is used as the rendering result for that target data frame. Simultaneously, the rendering of the next component element continues without interrupting the overall process. After the rendering results of all component elements are determined, the rendering results of all component elements are sequentially combined and assembled according to the layout and hierarchical relationship of each component element defined in the component-based report template to generate a complete power quality report.
[0090] For example, suppose the current report template contains four component elements: The first component is a single-value component, configured with the preset statistical function of average value, and its global semantic tag is "FREQUENCY". It extracts all frequency data values from the target data frame bound to this component and calculates the average value, resulting in 49.98Hz as the rendering result; The second component is a data block component, with the global semantic tag "VOLTAGE_A_RMS". It extracts all voltage data value sequences from the target data frame, calculates the maximum value as 225.0V, the minimum value as 218.0V, the average value as 220.5V, and the P95 value as 222.0V, and organizes them into a table as the rendering result; The third component is a chart component, Its global semantic tag is "VOLTAGE_A_RMS". It extracts time grid points and voltage data values from the target data frame and generates a curve description object containing a set of time-voltage data points as the rendering result. The fourth component is configured with a composite calculation formula "Three-phase voltage imbalance = (VOLTAGE_A_RMS - VOLTAGE_B_RMS) / VOLTAGE_A_RMS × 100%". It extracts data value sequences from the two target data frames, VOLTAGE_A_RMS and VOLTAGE_B_RMS, converts them into two numerical list variables, and then performs subtraction, division, and multiplication operations on each element to obtain the imbalance result sequence as the rendering result. Finally, the rendering results of all four components are combined according to the template layout to generate the final report.
[0091] Through the above embodiments, by identifying different component types of the component to be rendered and adopting differentiated rendering strategies, single-value components display key indicators in a concise numerical form, data block components summarize multi-dimensional statistical information in a well-organized table format, and chart components present data change trends in a visual graphical form, thereby meeting the diverse needs of displaying different types of content in power quality reports. Simultaneously, by using composite calculation formulas to support the participation of data value sequences corresponding to multiple global semantic tags in list-level operations, the tedious process of iteratively calculating each time point at the template level is avoided, improving the calculation efficiency of complex power quality indicators. An exception handling mechanism ensures that the rendering process is not interrupted when fields are missing or expressions are misconfigured, and error messages are displayed through placeholder text, improving the robustness of report generation.
[0092] Based on the above embodiments, as an optional embodiment, for Figure 1 The step S106 shown can also be achieved through the following steps, which are explained in detail below.
[0093] Based on a historical power quality event database, the anomaly contribution factors of each power quality indicator in historical physical power anomaly determinations are statistically analyzed, and the report hit probability of each global semantic tag in the previous statistical period is obtained. The basic service priority of each global semantic tag within the component-based report template is calculated. Based on the basic service priority of all global semantic tags in the component element and the estimated rendering time of the component-based report template, the scheduling priority of the component element is determined. Diagnostic probes are used to collect real-time data on computing resource utilization and network communication transmission delay status. Based on computing resource utilization and network communication transmission delay status, the system determines... Determine if there is a risk of critical computing power or rendering timeout disconnection; if so, divide the components to be processed into a core protection set and a secondary suspension set based on the scheduling priority; for the core component elements in the core protection set, assemble and render the target data frames corresponding to the core component elements to obtain the rendering result of the core component elements; intercept and suspend the parsing and execution requests of the binary data files corresponding to the secondary component elements in the secondary suspension set, and generate a light load prompt placeholder at the target page anchor point corresponding to the secondary component element in the power quality report as the rendering result of the secondary component element.
[0094] Specifically, after loading the component-based report template, the system reads the historical power quality event database pre-stored in non-volatile storage. This database records detailed information about each power quality anomaly event within a historical time period in the form of a structured data table. This includes the anomaly occurrence time, anomaly type, the power quality indicators involved in the judgment, and their diagnostic contribution weight factors in the anomaly judgment—the anomaly contribution factor. This factor quantifies the influence of each power quality indicator on the final diagnostic conclusion in anomaly judgment. Its value ranges from 0 to 1; a higher value indicates a stronger dominant role of the indicator in judging the anomaly. Using global semantic tags as the statistical dimension, the system traverses all anomaly event records in the historical power quality event database. For each global semantic tag, its anomaly contribution factor in each anomaly event is summed and averaged to obtain the statistical value of the anomaly contribution factor corresponding to that global semantic tag. This statistical value characterizes the fault sensitivity of the power quality indicator in historical anomaly scenarios; the higher the statistical value of the anomaly contribution factor, the more important the indicator is in anomaly diagnosis. Simultaneously, the system operation log is read to record the number of times each global semantic tag was referenced by component elements in the report template and successfully rendered within the previous statistical period (e.g., the past 30 days). This number is divided by the total number of times the global semantic tag was referenced within the previous statistical period to obtain the report hit probability of each global semantic tag. This probability is used to characterize the actual usage frequency of the power quality indicator in recent report generation needs. The anomaly contribution factor statistical value of each global semantic tag is weighted and summed with the report hit probability to obtain the basic business priority of that global semantic tag.After obtaining the basic business priorities of all global semantic tags within the component-based report template, the configuration information of each component element in the current component-based report template is read. For the current component element, a list of all global semantic tags referenced by the component element is obtained from the configuration information. The basic business priority of each global semantic tag in the list is read from memory, and the average of these basic business priorities is taken as the business priority aggregation value of the component element. Based on the component type and rendering load experience parameters of the component element, the computational resource consumption required for the component element to complete full assembly rendering is estimated in milliseconds to obtain the estimated rendering time of the component element. Then, the business priority aggregation value of the component element is divided by the estimated rendering time to obtain the scheduling priority of the component element. A higher scheduling priority indicates that the component element should be given priority for rendering in resource-constrained scenarios. After prioritizing the scheduling of all component elements, an application diagnostic probe deployed at the operating system level collects the current server's computing resource utilization in real time at a preset sampling period (e.g., every 100 milliseconds). This includes at least the percentage of CPU utilization and memory usage, as well as network communication latency, including at least the average round-trip time of current network requests. Based on the collected computing resource utilization and network communication latency, it is determined whether there is a critical computing power risk or a rendering timeout disconnection risk: if the CPU utilization is continuously higher than the first preset threshold (e.g., higher than 85% for 5 consecutive seconds) or the memory usage is continuously higher than the second preset threshold (e.g., higher than 90% for 5 consecutive seconds), then a critical computing power risk is determined to exist; if the average round-trip time of network communication is continuously higher than the third preset threshold (e.g., higher than 500 milliseconds for 3 consecutive seconds), then a rendering timeout disconnection risk is determined to exist. If a critical computing power risk or rendering timeout disconnection risk is identified, the components are sorted from highest to lowest scheduling priority. The top N components are designated as the core protection set, with N dynamically determined based on current computing resource utilization; the higher the utilization, the smaller N becomes (e.g., when CPU utilization exceeds 85%, N is 30% of the total number of components in the template). The bottom M components are designated as the secondary suspension set, and the remaining components are processed sequentially according to their relative scheduling priority. For each core component in the core protection set, a complete assembly rendering operation is performed on the corresponding target data frames to obtain the rendering result for that core component.For minor component elements within the minor suspension set, intercept and suspend the parsing and execution requests of the binary data file corresponding to the minor component element. Do not perform data reading, field mapping, cross-cycle alignment aggregation, and data frame assembly operations for the minor component element within the current report generation cycle. Instead, directly render a light load placeholder at the target page anchor point corresponding to the minor component element in the final generated power quality report as the rendering result of the minor component element. This light load placeholder is used to inform the user that the content block is delayed in generation due to system resource limitations.
[0095] For example, assume the current component-based report template contains 12 component elements. From the historical power quality event database, the anomaly contribution factor statistics for the "VOLTAGE_AB_UNBALANCE" (three-phase voltage imbalance) tag are 0.85, "VOLTAGE_A_RMS" is 0.50, and "FREQUENCY" is 0.70. Combined with the report hit probability of each tag in the previous statistical period, the basic business priority of each global semantic tag is calculated using weighted averages. The scheduling priority of each of the 12 component elements is then calculated. Simultaneously, application diagnostic probes detect a current CPU utilization of 92%, memory usage of 88%, and network round-trip latency of 600 milliseconds, indicating potential risks of near-critical computing power and rendering timeout disconnection. Based on scheduling priority from highest to lowest, the first four component elements are assigned to the core guarantee set, the last four to the secondary suspended set, and the middle four are processed sequentially based on resource release status. For the four component elements in the core guarantee set, a complete assembly rendering is performed to obtain the complete rendering result. For the four component elements in the secondary suspension set, intercept their underlying binary file parsing requests and generate a "Content not yet loaded" placeholder in the corresponding position of the report.
[0096] Through the above embodiments, the global semantic tags corresponding to power quality indicators with high fault sensitivity and high actual usage frequency are given higher basic business priority. Furthermore, combined with the estimated rendering time of each component element, components that are business-critical and render quickly are given higher scheduling priority. When system resources are sufficient, all components render normally and output a complete report. When system resources are scarce, high scheduling priority components are given priority to complete rendering, while low scheduling priority components are suspended and replaced with light-load placeholders. This ensures that the system can prioritize the high-speed generation and presentation of core components related to high-sensitivity power fault diagnosis in harsh environments with limited computing resources or unstable networks, thereby improving the operational stability and critical information delivery capability of the power quality report generation system in resource-constrained scenarios.
[0097] Based on the above embodiments, as an optional embodiment, see [link to embodiment]. Figure 3,against Figure 1 The method for generating power quality reports using heterogeneous binary data, as shown, may further include... Figure 3 Steps S301-S304 are explained in detail below.
[0098] S301. Serialize the field directory, the index mapping relationship in the unified virtual data pool, and the rendering results of each target data frame to generate a parsed data packet.
[0099] Specifically, after the power quality report is generated, all structured data assets generated during the report generation process are read from memory. This includes the field directory, the index mapping relationships in the unified virtual data pool, and the rendering results of the target data frames corresponding to each component element. The index mapping relationships in the unified virtual data pool refer to the key-value correspondence between global semantic tags and structured semantic data frames. This correspondence records the storage address or identifier of the structured semantic data frame corresponding to each global semantic tag in memory, which is used to quickly locate and restore the structured semantic data frames in subsequent reuse processes. The field directory is serialized into a table structure as the first data file, the index mapping relationships in the unified virtual data pool are serialized into a key-value pair structure as the second data file, and the rendering results of each target data frame are serialized into a third data file according to the component element identification and layout order. The first, second, and third data files are compressed and packaged into a complete parsing data package, and metadata information generated during the packaging process is attached. The metadata information includes at least the data package generation time, the file list of the original binary data files, the report template identifier, and the target time window. After packaging, the generated parsed data packets are stored in non-volatile storage media (such as local disk or network storage), so that they exist independently from memory and the original binary data files, and can be directly loaded when subsequent report generation requests reuse data.
[0100] S302. Perform hash calculation on the parsed data packet to generate the data fingerprint of the parsed data packet.
[0101] Specifically, the complete binary content of the parsed data packet is read from the storage medium. This complete binary content is used as the input parameter for a hash algorithm. A preset hash function is called to perform a one-way hash calculation on the input parameter, resulting in a fixed-length hash value, which serves as the data fingerprint of the parsed data packet. The hash function employs a cryptographically secure hash algorithm (such as SHA-256 or SHA-3), with an output length of at least 256 bits. This ensures that the probability of collisions between data fingerprints calculated from differences in the content of different parsed data packets is negligible. During the hash calculation process, the binary content of the parsed data packet is read byte by byte and sequentially input into the compression iteration operation of the hash function until all bytes are processed. Finally, a hash value represented as a hexadecimal string is output, which is the data fingerprint of the parsed data packet. The calculated data fingerprint is then associated with the storage path, generation time, and file list of the original binary data file of the parsed data packet, and recorded in the system's data fingerprint index table. This index table uses the data fingerprint as the primary key and the storage path of the parsed data packet as the value, and is used for quick retrieval and matching of the corresponding parsed data packet when a new report generation request is received.
[0102] S303. When a new report generation request is received, obtain the time range identifier and indicator requirements in the new report generation request.
[0103] Specifically, when a new report generation request is received through a human-computer interaction interface or application programming interface, key fields from the request header and request body are extracted from the request data packet. The request body is deserialized and parsed according to a preset request data format specification. The time range identifier field is located and read from the parsed request data. This time range identifier field stores the target time interval to be analyzed in this new report generation request in a structured format. For example, it contains two subfields, "startTime" and "endTime", which represent the start and end times of the target time window, respectively. At the same time, the indicator requirement field is read from the parsed request data. This indicator requirement field stores the global semantic tags of each power quality indicator involved in the report to be generated in this new report generation request in a list form, such as "VOLTAGE_A_RMS", "VOLTAGE_B_RMS", "FREQUENCY_DEVIATION", etc. After extracting the time range identifier and indicator requirements, they are temporarily stored in the request parameter cache in memory as the parameter input for this new report generation request, for use in subsequent data packet parsing matching and reuse judgment steps.
[0104] S304. If a data fingerprint exists that matches both the time range identifier and the indicator requirement, the matching parsed data packet is used as the target data packet, and the structured semantic data frame and the rendering results of each target data frame in the target data packet are reused to generate the power quality report corresponding to the new report generation request.
[0105] Specifically, after extracting the time range identifier and indicator requirements from the new report generation request, the system performs a matching retrieval operation in the local data fingerprint index table using the time range identifier and the indicator requirements as combined matching conditions. The data fingerprint index table is a structured index that is gradually built and persistently stored in non-volatile storage media during the historical report generation process. Each record in this index table contains at least four fields: the first field is the data fingerprint field, which stores the hash value of the parsed data packet; the second field is the time range field, which stores the start and end times of the target time window corresponding to the parsed data packet; the third field is the indicator requirements field, which stores a list of all global semantic tags contained in the parsed data packet; and the fourth field is the storage path field, which stores the access address of the parsed data packet in the non-volatile storage media. In the matching retrieval operation, firstly, the extracted time range identifier is compared with the time range field of each record in the data fingerprint index table, filtering out a set of candidate records with completely identical time ranges. Then, the extracted list of global semantic tags in the indicator requirements is compared with the indicator requirement fields of each record in the candidate record set, determining whether any candidate record has an indicator requirement field that completely covers all global semantic tags in the indicator requirements without missing any. If so, this record is marked as a matching record, and the data fingerprint field in this matching record is determined to be the data fingerprint that matches both the time range identifier and the indicator requirements. If the matching retrieval operation successfully finds a matching data fingerprint, the corresponding parsing data packet is read from the non-volatile storage medium based on the storage path field in the matching record, and this parsing data packet is used as the target data packet for this new report generation request. After successfully reading the target data packet, unpacking and deserialization operations are performed on the target data packet to recover the structured semantic data frame and the rendering results of each target data frame. From the recovered rendering results, the rendering results of component elements that match the indicator requirements are selected. According to the layout order and hierarchical relationship of the report template specified in the new report generation request, the selected rendering results are combined and spliced to generate the power quality report corresponding to the new report generation request. The content of this report is completely consistent with the report generated by the first report generation request in terms of data content, but there is no need to re-execute the underlying binary file parsing, field mapping, cross-cycle alignment aggregation, and re-rendering calculation operations.
[0106] Through the above embodiments, when a new report generation request is received, the data fingerprint index table is retrieved using the time range identifier and indicator requirements as combined matching conditions. After a successful match, the structured semantic data frame and rendering result in the stored parsed data packet are directly reused. This allows the response process for the new report generation request to completely avoid computationally intensive steps such as underlying binary file parsing, field mapping, cross-cycle alignment aggregation, and reassembly rendering. This significantly reduces the processing latency and computational resource consumption of the new report generation request. It is especially suitable for batch processing scenarios where multiple reports in different formats need to be generated from the same monitoring data or the same report needs to be generated repeatedly, thereby improving the processing efficiency and resource utilization of the power quality report generation system.
[0107] The following describes the power quality report generation system for heterogeneous binary data in the embodiments of this invention from the perspective of hardware processing. Please refer to [link / reference needed]. Figure 4 , Figure 4 This is a schematic diagram of the structure of a power quality report generation system for heterogeneous binary data provided in an embodiment of this application.
[0108] It should be noted that, Figure 4 The structure of the power quality report generation system for heterogeneous binary data shown is merely an example and should not impose any limitations on the functionality and scope of the embodiments of this application.
[0109] like Figure 4 As shown, the power quality report generation system for heterogeneous binary data includes a central processing unit 401, which can perform various appropriate actions and processes based on a program stored in read-only memory 402 or a program loaded from storage section 408 into random access memory 403, such as performing the methods described in the above embodiments. The random access memory 403 also stores various programs and data required for system operation. The central processing unit 401, read-only memory 402, and random access memory 403 are interconnected via bus 404. Input / output interface 405 is also connected to bus 404.
[0110] The following components are connected to the input / output interface 405: an input section 406 including audio input devices, push-button switches, etc.; an output section 407 including a liquid crystal display (LCD) and audio output devices, indicator lights, etc.; a storage section 408 including a hard disk, etc.; and a communication section 409 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 409 performs communication processing via a network such as the Internet. A drive 410 is also connected to the input / output interface 405 as needed. A removable medium 411, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 410 as needed so that computer programs read from it can be installed into the storage section 408 as needed.
[0111] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 409, and / or installed from removable medium 411. When the computer program is executed by central processing unit 401, it performs the various functions defined in the present invention. It should be noted that specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this invention, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0112] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. Each block in a flowchart or block diagram may represent a module, program segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those shown in the drawings.
[0113] Specifically, the power quality report generation system for heterogeneous binary data in this embodiment includes a processor and a memory. The memory stores a computer program, and when the computer program is executed by the processor, it implements the power quality report generation method for heterogeneous binary data provided in the above embodiment.
[0114] In another aspect, the present invention also provides a computer-readable storage medium, which may be included in the power quality report generation system for heterogeneous binary data described in the above embodiments; or it may exist independently and not assembled into the power quality report generation system for heterogeneous binary data. The storage medium carries one or more computer programs, which, when executed by a processor of the power quality report generation system for heterogeneous binary data, cause the power quality report generation system for heterogeneous binary data to implement the power quality report generation method for heterogeneous binary data provided in the above embodiments.
[0115] The above description is merely an exemplary embodiment of this disclosure and should not be construed as limiting the scope of this disclosure. Any equivalent changes and modifications made in accordance with the teachings of this disclosure shall still fall within the scope of this disclosure. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not described in this disclosure. The specification and embodiments are considered exemplary only, and the scope and spirit of this disclosure are defined by the claims.
Claims
1. A method for generating power quality reports using heterogeneous binary data, characterized in that, include: Obtain a report generation request and at least two heterogeneous binary data files corresponding to the report generation request, and load a component-based report template. The component-based report template contains several component elements, each of which is configured with at least one global semantic tag. One global semantic tag corresponds to a power quality index. The binary data file includes raw sampling data of at least one power quality index. Based on preset file parsing rules, data blocks in an independent state are extracted from each of the binary data files, and a field directory corresponding to the data blocks is generated. The field directory includes the original data number, discrete timestamp, and data value. Based on a preset mapping rule, the original data numbers corresponding to the data blocks in all the binary data files that are associated with the same power quality index are mapped to the same global semantic label to obtain the target data block; Based on the discrete timestamp, the target data blocks that have the same global semantic label but belong to different binary data files are aligned and aggregated across periods on the global time axis to generate structured semantic data frames with continuous time series, and all the structured semantic data frames are written into a unified virtual data pool. Traverse all the component elements, use the global semantic tags configured in the component elements as addressing indexes, and extract the structured semantic data frames corresponding to the addressing indexes from the unified virtual data pool across files as target data frames; All the target data frames are assembled and rendered to generate a power quality report.
2. The method according to claim 1, characterized in that, Based on the discrete timestamps, the target data blocks with the same global semantic labels but belonging to different binary data files are aligned and aggregated across periods on the global time axis to generate structured semantic data frames with continuous time series, including: Obtain the set of target data blocks corresponding to the global semantic tag, wherein the set of target data blocks contains multiple target data blocks; Arrange the target data blocks in the target data block set according to the order of the discrete timestamps to generate the original discrete sequence corresponding to the global semantic label; Identify the time interval between two adjacent discrete timestamps in the original discrete sequence; A global alignment reference period is determined based on all the time intervals, and the global time axis corresponding to the original discrete sequence is divided into continuous equally spaced time grid points according to the global alignment reference period. For each of the time grid points, determine whether there exists a discrete timestamp corresponding to each of the time grid points in the original discrete sequence; If it exists, the data value corresponding to the existing discrete timestamp will be used as the target data value of the time grid point. If it does not exist, the target data value of the time grid point is determined based on the two adjacent discrete timestamps that are adjacent to the time grid point before and after it, and the data values corresponding to the adjacent timestamps. Arrange all the time grid points and the target data values of each time grid point in chronological order to generate a structured semantic data frame with global semantic tags.
3. The method according to claim 1, characterized in that, Before performing cross-period alignment and aggregation on the global time axis on the target data blocks that have the same global semantic label but belong to different binary data files based on the discrete timestamps to generate structured semantic data frames with continuous time series, the method further includes: If there are conflicting data blocks with the same global semantic label and the same discrete timestamp, then the sampling resolution precision parameter of the conflicting data block is extracted from the binary data file corresponding to the conflicting data block as the basic confidence weight of the conflicting data block, and the discrete timestamp corresponding to the conflicting data block is marked as the conflict timestamp. Based on historical time-series slices, the baseband noise standard deviation corresponding to the conflicting data block is determined, and the dynamic attenuation coefficient corresponding to the conflicting data block is calculated based on the baseband noise standard deviation. The historical time-series slices are used to characterize historical data within a preset time window centered on the conflict timestamp. Based on the basic confidence weight and the dynamic decay coefficient, the fusion weight of each conflicting data block is dynamically adjusted; For the same conflict timestamp, the data value of the conflict timestamp is determined according to the data values corresponding to each of the fusion weights and all the conflict data blocks, and a conflict smoothing log is generated synchronously.
4. The method according to claim 1, characterized in that, The step of traversing all the component elements, using the global semantic tags configured in the component elements as addressing indexes, and extracting structured semantic data frames corresponding to the addressing indexes from the unified virtual data pool as target data frames includes: Using the global semantic tag configured in the component element as the addressing index, an initial retrieval is performed in the unified virtual data pool to obtain the initial data frame set of the power quality index corresponding to the component element; Based on the data timeline recorded in the initial data frame set and the target time window corresponding to the report generation request, it is determined whether there are data holes or faults in the data timeline that do not completely cover the target time window. If it exists, then based on the preset power index associated rules, obtain the conversion index that has a physical conversion relationship with the power quality index of the data void fault and belongs to different binary data files. The global semantic label corresponding to the conversion index is used as a backup addressing index to extract the corresponding compensation data frame, and the data value of the compensation data frame is filled into the data hole fault to generate a structured semantic data frame without data fault as the target data frame.
5. The method according to claim 1, characterized in that, The step of assembling and rendering all the target data frames to generate a power quality report includes: Identify the component type of the component element corresponding to the target data frame to be rendered, wherein the component type includes single-value components, data block components, and chart components; If the component type is the single-value component, then a statistical value is determined from the target data frame using a preset statistical function as the rendering result of the target data frame; If the component type is the data block component, then extract the data value sequence from the target data frame, calculate the maximum value, minimum value, average value and P95 value of the data value sequence respectively, and organize the maximum value, minimum value, average value and P95 value into a table to obtain the rendering result of the target data frame; If the component type is the chart component, then the discrete timestamp sequence and data value sequence are extracted from the target data frame to generate a chart description object containing coordinate axis parameters and a set of data points, and the rendering result of the target data frame is obtained. When a component element corresponding to the target data frame to be rendered is identified as having a composite calculation formula, the data values and discrete timestamps corresponding to the global semantic tags of each component element are extracted from the target data frame to generate a numerical list variable; the numerical list variable is substituted into the composite calculation formula for serialization operation to obtain the rendering result of the target data frame; if a field is missing or an expression parsing error occurs, an error event is captured and a placeholder text carrying error message is generated; the placeholder text is used as the rendering result of the target data frame. A power quality report is generated based on the rendering results of all the target data frames.
6. The method according to claim 5, characterized in that, The method further includes: The field directory, the index mapping relationship in the unified virtual data pool, and the rendering results of each target data frame are serialized to generate a parsed data packet; Perform a hash calculation on the parsed data packet to generate a data fingerprint of the parsed data packet; When a new report generation request is received, the time range identifier and indicator requirements in the new report generation request are obtained; If a data fingerprint exists that matches both the time range identifier and the indicator requirement, the matching parsed data packet is used as the target data packet, and the structured semantic data frames in the target data packet and the rendering results of each target data frame are reused to generate the power quality report corresponding to the new report generation request.
7. The method according to claim 5, characterized in that, The method of assembling and rendering all the target data frames to generate a power quality report further includes: Based on the historical power quality event database, the abnormal contribution factors of each power quality indicator in the historical physical power anomaly judgment are statistically analyzed, and the report hit probability of each global semantic tag in the previous statistical period is obtained. The basic business priority of each global semantic tag in the component-based report template is calculated. Based on the basic business priority of all the global semantic tags in the component element and the estimated rendering time of the component-based report template, the scheduling priority of the component element is determined. By applying diagnostic probes, the utilization rate of computing resources and the status of network communication transmission latency can be collected in real time. Based on the computing resource utilization rate and the network communication transmission delay status, determine whether there is a computing power criticality risk or a rendering timeout disconnection risk. If they exist, then based on the scheduling priorities, the component elements to be processed are divided into a core guarantee set and a secondary suspension set. For the core component elements within the core protection set, the target data frames corresponding to the core component elements are assembled and rendered to obtain the rendering result of the core component elements; Intercept and suspend the parsing and execution requests of the binary data files corresponding to the secondary component elements in the secondary suspension set, and generate a light load prompt placeholder as the rendering result of the secondary component element at the target page anchor point corresponding to the secondary component element in the power quality report.
8. A power quality report generation system for heterogeneous binary data, characterized in that, The power quality report generation system for heterogeneous binary data includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code including computer instructions, and the one or more processors call the computer instructions to cause the power quality report generation system for heterogeneous binary data to perform the method as described in any one of claims 1-7.
9. A computer-readable storage medium comprising instructions, characterized in that, When the instruction is executed on a power quality report generation system for heterogeneous binary data, the power quality report generation system for heterogeneous binary data performs the method as described in any one of claims 1-7.
10. A computer program product, characterized in that, When the computer program product is run on a power quality report generation system for heterogeneous binary data, the power quality report generation system for heterogeneous binary data performs the method as described in any one of claims 1-7.