Data query method, device and electronic equipment in energy system

By preprocessing user query requests and identifying phylogenetic keys, a directed acyclic graph of logical tasks is generated, which solves the accuracy problem of natural language queries in energy systems, ensures the uniqueness of query objects and equipment binding, and improves the accuracy and efficiency of data queries.

CN122432394APending Publication Date: 2026-07-21SHANGHAI SIGE DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites -1 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANGHAI SIGE DIGITAL TECHNOLOGY CO LTD
Filing Date
2026-04-13
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

In the operation and maintenance monitoring of complex energy systems such as distributed photovoltaic + energy storage + charging integrated machines, the inaccuracy of data queries caused by natural language queries is a problem that existing technologies cannot solve, as the same query is mapped to different device levels or statistical calibers.

Method used

By acquiring user query request information, preprocessing is performed to generate standardized query information and a candidate set of standard indicators. The phylogenetic key is used to identify intent and decompose logical subtasks, generating a directed acyclic graph of logical tasks, and then query processing is executed to ensure the uniqueness and accuracy of the query object.

Benefits of technology

It achieves accuracy and consistency in natural language queries, avoids mapping the same query to different device levels or statistical standards, and improves the accuracy and efficiency of data queries.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122432394A_ABST
    Figure CN122432394A_ABST
Patent Text Reader

Abstract

The application provides a data query method and device in an energy system and electronic equipment. The method comprises the following steps: obtaining a query request information of a user; preprocessing the query request information to obtain a preprocessing result; obtaining a pedigree key of a query object based on entity words and device topology relations in standard query information, the pedigree key being a unique identifier of the query object information; performing intent recognition based on the standard query information and a standard index candidate set to obtain an intent recognition result, and splitting the intent recognition result into logical sub-tasks based on the pedigree key, each logical sub-task corresponding to a pedigree key; generating a logical task directed acyclic graph based on the logical sub-tasks; and performing query processing based on the logical task directed acyclic graph to realize strong binding of the query and the device pedigree, and avoid mapping the same query to different device levels or statistical indicators. The logical sub-tasks are split, the logical task directed acyclic graph is generated, the query process is standardized, and the accuracy of the query is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of energy data query technology, and in particular relates to a data query method, device and electronic equipment in an energy system. Background Technology

[0002] In the operation and maintenance monitoring of complex energy systems such as distributed photovoltaic + energy storage + charging integrated machines, staff often initiate data queries using natural language to obtain operational data from equipment such as power plants and inverters. However, the energy sector has a large number of industry jargon and aliases for indicators, such as "power," "output," and "PCS power," leading to inconsistent and ambiguous expressions in natural language queries. Existing LLM + Retrieval-Augmented Generation (RAG) or Natural Language to Structured Query Language (NL2SQL) solutions mostly rely on text similarity and simple mapping to convert natural language into structured queries. However, these solutions rely solely on text similarity and simple terminology mapping, which can easily result in the same query being mapped to different device levels or statistical calibers, i.e., cross-device chain / cross-caliber drift, making it difficult to meet the accuracy requirements of data queries. Summary of the Invention

[0003] In view of this, embodiments of this application provide a data query method, apparatus, and electronic device in an energy system, which can improve the accuracy of the query.

[0004] In a first aspect, embodiments of this application provide a data query method for an energy system, including: Obtain the user's query request information; The query request information is preprocessed to obtain a preprocessing result, which includes at least: standardized query information and a set of candidate standard indicators; Based on the entity words and device topology relationships in the standardized query information, the genealogy key of the query object is obtained, and the genealogy key is a unique identifier for the query object information; Intent recognition is performed based on the specified query information and the standard indicator candidate set to obtain intent recognition results. The intent recognition results are then divided into logical subtasks based on the genealogy key, with each logical subtask corresponding to a genealogy key. Generate a directed acyclic graph of logical tasks based on the aforementioned logical subtasks; Query processing is performed based on the directed acyclic graph of the logical task.

[0005] In some embodiments, the preprocessing result further includes: standardized time, and the generation of a directed acyclic graph of logical tasks based on the logical subtasks includes: When the logical subtask includes a data query subtask, the query time window is determined based on the standardized time and the baseline time. The indicator items of the data query subtask are matched with a preset indicator profile index. Logical query nodes are generated based on the genealogical key of the query object, the matching indicator profile index, and the query time window of the data query subtask. Based on the logical query node, corresponding derived calculation nodes and verification nodes are generated; A directed acyclic graph of logical tasks is generated based on the dependencies between nodes.

[0006] In some embodiments, the query processing based on the directed acyclic graph of the logical task includes: For each logical query node in the directed acyclic graph of the logical task, determine whether there are reusable historical query results corresponding to the logical query node. If reusable historical query results exist corresponding to the logical query node, an incremental supplementary query task is determined based on the historical query results and the logical query node; a data query is executed based on the incremental supplementary query task to obtain an incremental query result; the incremental query result is then concatenated, replaced, and / or recalculated with the historical query result to obtain the concatenated query result of the logical query node. If no reusable historical query results exist for the logical query node, a data query is performed based on the logical query node.

[0007] In some embodiments, determining the incremental supplementary query task based on the historical query results and logical query nodes includes: By comparing the historical time window of the historical query results with the query time window, a new time window is obtained; New indicator items are determined based on the indicator items of the logical query node and the indicator items in the historical query results; The incremental supplementary investigation task is determined based on the newly added time window and the newly added indicator item.

[0008] In some embodiments, the indicator profiling index includes: data query granularity, and the method further includes: If an anomaly occurs during the query based on the incremental supplementary query task, the current data query granularity of the incremental supplementary query task is increased, and the data query is executed with the increased data query granularity; or, the data source currently queried by the incremental supplementary query task is switched.

[0009] In some embodiments, the method further includes: The spliced ​​query results are verified based on the genealogical key corresponding to the logical query node, and the energy conservation rules and statistical whitelist are used for verification. If the verification fails, a preset rollback strategy is executed, which includes: supplementing the missing time window data, reducing the data query granularity and re-querying, or switching the data source and re-querying. After the preset rollback strategy is executed, the new query results are concatenated, replaced, and / or recalculated with the historical query results.

[0010] In some embodiments, the priority of retrieving data within a missing time window is greater than the priority of reducing the data query granularity and re-querying, and the priority of reducing the data query granularity and re-querying is greater than the priority of switching the data source and re-querying.

[0011] In some embodiments, the method further includes: Output the final results and generate a structured audit ledger of the entire query process.

[0012] Secondly, embodiments of this application provide a data query device for an energy system, comprising: The acquisition module is used to acquire user query request information; The preprocessing module is used to preprocess the query request information to obtain a preprocessing result, which includes at least: standardized query information and a set of standard indicator candidates. The genealogy key parsing module is used to obtain the genealogy key of the query object based on the entity words and device topology relationships in the standardized query information, wherein the genealogy key is a unique identifier of the query object information; The intent recognition module is used to perform intent recognition based on the normative query information and the standard indicator candidate set, obtain intent recognition results, and split the intent recognition results into logical subtasks based on the genealogy key, with each logical subtask corresponding to a genealogy key; The planning and scheduling module is used to generate a directed acyclic graph of logical tasks based on the logical subtasks; The query module is used to perform queries based on the directed acyclic graph of the logical task.

[0013] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement any of the methods described above.

[0014] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements any of the methods described above.

[0015] Fifthly, embodiments of this application provide a computer program product that, when run on a terminal device, causes an electronic device to execute any of the methods described above.

[0016] This application provides a data query method for an energy system. The method involves: acquiring user query request information; preprocessing the query request information to obtain a preprocessing result, which includes at least: standardized query information and a set of standard indicator candidates; obtaining a genealogical key for the query object based on entity words and equipment topology relationships in the standardized query information, where the genealogical key is a unique identifier for the query object information; performing intent recognition based on the standardized query information and the set of standard indicator candidates to obtain an intent recognition result, and then splitting the intent recognition result into logical subtasks based on the genealogical key, with each logical subtask corresponding to a genealogical key; generating a directed acyclic graph (DAG) of logical tasks based on the logical subtasks; and performing query processing based on the DAG. By preprocessing the query request, the method unifies indicator aliases and industry jargon in natural language, eliminating query ambiguity; generating a genealogical key as a unique identifier for the query object, achieving a strong binding between the query and the equipment genealogy, avoiding the same query from being mapped to different equipment levels or statistical calibers; and standardizing the query process and improving query accuracy by splitting logical subtasks and generating a DAG of logical tasks. Attached Figure Description

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

[0018] Figure 1 A schematic diagram illustrating the implementation process of a data query method in an energy system provided in this application embodiment; Figure 2 A schematic diagram illustrating the implementation process of step S105 provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of a data query system provided in an embodiment of this application; Figure 4 A schematic diagram illustrating the implementation process of a data query method in an energy system provided in this application embodiment; Figure 5 A schematic diagram of the structure of a data query device in an energy system provided in this application embodiment; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0019] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0020] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0021] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0022] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrases "if determined" or "if detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once detected," or "in response to detection."

[0023] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0024] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized.

[0025] To address the problems in related technologies, this application provides a data query method for energy systems that can be applied to electronic devices. These electronic devices may include: mobile phones, tablets, wearable devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), etc. The data query method for energy systems provided in this application can be implemented using the processor of the electronic device.

[0026] Figure 1 This is a schematic diagram illustrating the implementation process of a data query method in an energy system provided in an embodiment of this application, as shown below. Figure 1 As shown, data query methods in energy systems include: Step S101: Obtain the user's query request information.

[0027] In this embodiment of the application, the user's query request information refers to the natural language questions / text instructions entered by the user through the front end, such as "total power generation of yesterday" or "PCS power and unit output today", which may include the original query content of spoken language, aliases, fuzzy time, and fuzzy equipment names.

[0028] In this embodiment of the application, the original query content entered by the user on the operation and maintenance platform, interactive terminal, and system interface can be collected in real time; the query request information is unstructured natural language text, which may contain industry slang, indicator aliases, vague terms, and everyday expressions, such as "check yesterday's total station output", "check today's PCS power and battery cluster power consumption", "last week's inverter power generation", etc.

[0029] Step S102: Preprocess the query request information to obtain a preprocessing result. The preprocessing result includes at least: standardized query information and a set of standard indicator candidates.

[0030] In this embodiment, preprocessing includes standardization processes such as cleaning, normalization, alias mapping, and semantic regularization of the query request information. It does not involve low-level data retrieval, but only upper-level semantic alignment. Standardizing the query information involves translating colloquialisms and industry aliases into standardized terminology, such as standardizing "output / station power" as "equipment active power," thus eliminating semantic ambiguity. The standard indicator candidate set refers to the mapping results of a pre-established energy indicator standard library, matching user-defined indicators to unique system standard indicator IDs / names to identify queried target data items.

[0031] In this embodiment, to address the common problems of multiple aliases, mixed colloquialisms, and inconsistent expressions in the energy sector, a standardized preprocessing method is used for the original natural language query. This includes: performing terminology normalization and alias mapping, for example, converting various colloquial expressions such as "power / output / station power / PCS power" and "generation / output" into a unified standard semantic description unique to the system, forming standardized query information and eliminating ambiguity caused by differences in textual expressions; and based on a preset energy indicator standard library, identifying and matching business indicators from the original question, aggregating and generating a candidate set of standard indicators, and locking in the core data items that need to be retrieved for this query.

[0032] Step S103: Based on the entity words and device topology relationships in the standardized query information, obtain the genealogy key of the query object, whereby the genealogy key is a unique identifier for the query object information.

[0033] In this embodiment, entity words are keywords related to equipment, site, and hierarchy extracted from standard queries, such as location-related terms like "photovoltaic station, inverter, battery cluster, PCS". Equipment topology refers to the inherent hierarchical relationship architecture of the energy system, such as site → inverter → MPPT → battery cluster / EVDC / EVAC. Equipment topology records the hierarchical affiliation, mounting relationships, and equipment levels.

[0034] In this embodiment, entity words can be extracted from the standardized query information, i.e., keywords that clearly point to sites, equipment, and levels, such as photovoltaic power station, inverter, MPPT, battery cluster, EVDC / EVAC, etc.; then, the preset fixed equipment topology relationship of the energy system is associated, which is a hierarchical architecture: site → inverter → MPPT → energy storage / charging equipment, recording the affiliation relationship, upper and lower level attachments, and site and level attributes of all equipment. Combining the extracted entity words with the topology affiliation relationship, a unique corresponding genealogy key is generated; this genealogy key serves as a globally unique identifier for the query object, uniquely anchoring the specific site, specific equipment, and specific level corresponding to this query, accurately binding the abstract semantic intent to the physical equipment entity, fundamentally preventing the same question from being mapped to different equipment levels, different statistical levels, and different affiliation nodes, and completely solving the problems of query drift and object confusion.

[0035] Step S104: Based on the normative query information and the standard indicator candidate set, perform intent recognition to obtain intent recognition results, and split the intent recognition results into logical subtasks based on the genealogy key, with each logical subtask corresponding to a genealogy key.

[0036] In this embodiment, the LineageKey is a globally unique identifier that binds to a site, device, level, and affiliation; it is used to uniquely lock the query object, achieving a strong binding between semantics and physical devices, and preventing "the same query from finding different devices or different interpretations." Intent recognition refers to identifying whether the user's core business intent is to query power generation, power consumption, power, load, comparison, summary, etc., and stripping away irrelevant semantics. Logical subtasks refer to breaking down a complex query into multiple independently executable and dependently orchestratable smaller tasks, each with a LineageKey attached to it, ensuring that the object is not misaligned.

[0037] In this embodiment, precise intent recognition can be performed based on the standardized query and locked standard indicator set, distinguishing core user needs as business intents such as detailed query, summary statistics, energy consumption calculation, comparative analysis, and extreme value viewing, stripping away irrelevant semantic modifications, and locking in the core query purpose. Then, using the generated genealogy key as a unified binding benchmark, a complex overall query intent is decomposed into multiple lightweight, independently executable, and interdependent atomic logical subtasks. During the decomposition process, the original genealogy key is synchronously attached to each decomposed logical subtask, ensuring that all subtasks always point to the same query device, the same level, and the same belonging node, achieving task decomposition but without offsetting, switching, or confusing the query object, ensuring the uniqueness of the query object and the consistency of traceability throughout the entire process.

[0038] Step S105: Generate a directed acyclic graph of logical tasks based on the logical subtasks.

[0039] In this embodiment, the directed acyclic graph (DAG) of logical tasks is a task flow arranged according to dependencies, first basic query, then calculation, then verification, forming an ordered, serial / parallel execution topology without loop logic.

[0040] In this embodiment, a structured directed acyclic graph (DAG) of logical tasks can be constructed based on the data dependencies, computation order, and execution logic among the various logical subtasks. Basic raw data query tasks are set as front nodes, aggregation, comparison, and derived calculation tasks as intermediate nodes, and verification and checking tasks as back nodes, clearly defining the execution order and dependencies of all nodes. The DAG organizes scattered logical subtasks into an ordered, controllable, serializable, and parallelizable standardized execution flow, transforming complex natural language queries into a standardized task chain that is machine-schedulable, step-by-step, and traceable, providing a structured framework to support subsequent accurate query processing.

[0041] Step S106: Perform query processing based on the directed acyclic graph of the logical task.

[0042] In this embodiment of the application, the query processing is based on the DAG process, scheduling at least one of the following actions: data retrieval, concatenation, verification, and summarization.

[0043] In this embodiment, the entire query processing action can be scheduled and executed sequentially from top to bottom according to the pre-defined node order, dependencies, and task logic of the directed acyclic graph (DAG). This can include underlying execution operations such as retrieving corresponding device data based on subtasks and genealogical keys, collecting indicator information, and completing data matching and preliminary integration. By relying on the ordered arrangement of the DAG, it ensures that the query execution does not skip steps, is not out of order, and does not omit key tasks. The unified genealogical key is used throughout the process to lock the query object, inheriting all the standardized, unique, and structured processing results mentioned above, realizing a closed loop from user natural language input to data query, and ensuring that the final query execution is accurate, the object is consistent, and the result is controllable.

[0044] This application provides a data query method for an energy system. The method involves: acquiring user query request information; preprocessing the query request information to obtain a preprocessing result, which includes at least: standardized query information and a set of standard indicator candidates; obtaining a genealogical key for the query object based on entity words and equipment topology relationships in the standardized query information, where the genealogical key is a unique identifier for the query object information; performing intent recognition based on the standardized query information and the set of standard indicator candidates to obtain an intent recognition result, and then splitting the intent recognition result into logical subtasks based on the genealogical key, with each logical subtask corresponding to a genealogical key; generating a directed acyclic graph (DAG) of logical tasks based on the logical subtasks; and performing query processing based on the DAG. By preprocessing the query request, the method unifies indicator aliases and industry jargon in natural language, eliminating query ambiguity; generating a genealogical key as a unique identifier for the query object, achieving a strong binding between the query and the equipment genealogy, avoiding the same query from being mapped to different equipment levels or statistical calibers; and standardizing the query process and improving the accuracy of data queries by splitting logical subtasks and generating a DAG of logical tasks.

[0045] In some embodiments, the preprocessing result further includes: normalized time. Figure 2 This application provides a schematic diagram of the implementation process of step S105, as shown in the embodiment. Figure 2 As shown, step S105 can be achieved through the following steps: Step S1051: If the logical subtask includes a data query subtask, determine the query time window based on the standardized time and the reference time.

[0046] In this embodiment, standardized time refers to the unified conversion of users' colloquial and relative time expressions (such as yesterday, the last 7 days, last week, and the beginning of the month) into a standard time semantic that the system can recognize, aligns with time zones, and can be accurately stored in the database. Standardized time does not directly use fixed timestamps but can be dynamically mapped in conjunction with a reference time, which can solve the problems of ambiguity, inconsistent definitions, and cross-time zone errors in natural language time. The reference time is a time anchor point preset by the system, generally taken as a fixed reference time such as the current server time, business settlement time, or the hourly time of the site, used to convert standardized time into a precise start and end interval. The query time window is a continuous time interval consisting of a start time and an end time, which is the only time boundary for subsequent data retrieval, statistics, and aggregation, used to limit the time range of this data query. The data query subtask is the underlying basic task in the logical subtask that needs to retrieve raw values ​​from the database / data source, which is different from pure calculation, pure aggregation, and pure verification tasks.

[0047] In this embodiment, it is determined whether the current subtask is a data query task that requires raw data retrieval; if the logical subtask includes a data query subtask, the standardized time is converted using the base time as the anchor point, and the time zone, settlement caliber, and station statistical cycle are automatically aligned; finally, the precise, unique, and unambiguous start and end times are output to lock the data time boundary of this query and avoid time ranges that are too large or too small, or cross-cycle errors.

[0048] Step S1052: Match the preset indicator profile index based on the indicator items of the data query subtask.

[0049] In this embodiment, the indicator item is the specific business parameter to be obtained in this query, such as standard data items like power generation, load, power, electricity consumption, current, and voltage. The indicator profile index is a pre-built metadata configuration library used to permanently store profile information for each standard indicator, including the appropriate device level, supported query granularity (minutes / hours / days), default statistical rules, data source priority, and granular synthesizable attributes. It serves as the basis for data retrieval, granularity control, and calculation synthesis.

[0050] In this embodiment, the indicator items of the data query subtask can be extracted, the metadata information of the indicator can be accurately matched in the preset indicator profile index, and then bound to the current task.

[0051] Step S1053: Generate a logical query node based on the genealogical key of the query object of the data query subtask, the matching indicator profile index, and the query time window.

[0052] In this embodiment, the logical query node is the basic execution node in the DAG that carries "which genealogical key, which indicator, which time window, and which granularity of data retrieval", and is the smallest scheduling unit for reading raw data.

[0053] In this embodiment, the genealogy key, the matching indicator profile index, and the query time window can be bound to the same execution node. By binding the genealogy key, the matching indicator profile index, and the query time window to the execution node, a logical query node that can be directly scheduled, has complete parameters, and has clear boundaries can be generated.

[0054] Step S1054: Generate corresponding derived computation nodes and verification nodes based on the logical query nodes.

[0055] In this embodiment, the derived computing node is a task node that performs derivative calculations such as secondary summarization, summation, averaging, ratio conversion, and hierarchical aggregation based on the original basic data, and does not directly read the original database. The verification node is a task node specifically used for verification and judgment such as data compliance, consistency of standards, energy conservation comparison, and anomaly identification.

[0056] In this embodiment, for scenarios where summarization, summation, averaging, and hierarchical aggregation are required after basic data retrieval, derived calculation nodes are automatically generated, relying on the original data of the preceding logic query nodes; for scenarios requiring caliber verification, energy comparison, and anomaly checking, verification nodes are generated accordingly.

[0057] Step S1055: Generate a directed acyclic graph of logical tasks based on the dependencies between nodes.

[0058] In this embodiment of the application, the node dependency relationship is the sequential constraint of the tasks before and after. The sequential constraint is that the basic data retrieval must be completed before the derived calculation can be performed; the calculation summary must be completed before the compliance verification can be carried out.

[0059] In this embodiment, the sequential dependencies can be clearly defined. The dependency relationship includes: query node first, calculation node in the middle, and verification node last. This can sort out the data input and output relationship of all nodes and prohibit circular dependencies. The structured DAG is formed by arranging the dependency links. Through the DAG, the entire query process can be standardized, can be scheduled step by step, can be executed in parallel, and can be traced and decomposed.

[0060] The method provided in this application addresses the inaccuracy of query intervals caused by ambiguity in natural language time, cross-time zones, and cross-statistical periods by adding standardized time, ensuring that the data retrieval time boundary is unique and controllable. By matching the indicator profile index, the query granularity, statistical rules, and adaptation levels of the indicators are solidified, avoiding result deviations caused by chaotic rules for the same indicator. Logical query nodes are generated using phylogenetic keys, indicator profiles, and time windows to achieve full-dimensional locking of data retrieval objects, rules, and time, eliminating data mixing and inconsistent definitions. Derived calculation nodes and verification nodes are generated in conjunction to construct a pre-closed loop of "data retrieval - calculation - verification," providing architectural support for subsequent data error correction and anomaly rollback. By constructing a standard DAG through node dependencies, complex query tasks become structured, schedulable, and scalable, significantly improving process standardization, maintainability, and execution stability.

[0061] In energy management systems, data includes minute-level power, hourly / dayly energy, and half-hourly electricity prices, sourced from various data sources such as time-series databases, relational databases, caches, and real-time signals. Users frequently ask iterative questions, such as first querying "yesterday's power at station A" and then "last week's power and electricity price at station A." Existing systems typically re-fetch all data for the entire new time window and all indicators, lacking an "incremental differential plan" based on historical results. This leads to repeated database scans, amplified input / output (IO), and long tail response times. Therefore, to address this issue, in this embodiment, step S106 can be implemented through the following steps: Step S1061: For the logical query node in the directed acyclic graph of the logical task, determine whether there is a reusable historical query result corresponding to the logical query node.

[0062] In this embodiment of the application, reusable historical query results refer to historical data query results that have been executed in the past, have the same genealogical keys, indicator items, and statistical rules as the current logical query node, and whose time range can be superimposed on the current query window.

[0063] In this embodiment, for each logical query node in the directed acyclic graph of the logical task, the historical query results are matched and verified one by one. The core is to use the genealogical key corresponding to the logical query node as the unique matching benchmark, and at the same time check the key parameters such as indicator items, statistical granularity, and statistical rules to determine whether there are reusable historical query results.

[0064] Step S1062: If there are reusable historical query results corresponding to the logical query node, determine an incremental supplementary query task based on the historical query results and the logical query node; perform a data query based on the incremental supplementary query task to obtain an incremental query result; and concatenate, replace, and / or recalculate the incremental query result with the historical query result to obtain the concatenated query result of the logical query node.

[0065] In this embodiment, the incremental supplementary query task refers to a query task executed only for the differences between the current query and the historical reusable results (new time range, new indicator items), which is different from a full query. The incremental query result is the new data missing from the historical results obtained after executing the incremental supplementary query task. The splicing process refers to the operation of integrating the incremental query result and the historical query result into a complete data set according to time order and indicator dimensions; the replacement process refers to the operation of replacing the invalid part with the corresponding data from the incremental query result or the re-query when there is data deviation or invalidity in the historical query result; the recalculation process refers to the operation of recalculating and summarizing the data based on the incremental result and the historical result according to preset statistical rules to ensure the consistency of the overall data; the spliced ​​query result refers to the complete data result that covers the full requirements of the current query after splicing, replacement and / or recalculation processing.

[0066] In this embodiment, if reusable historical query results are confirmed, the time windows of the historical queries and the current query window, as well as the indicators of the historical queries and the current queries, are precisely compared based on the historical query results and the query requirements of the current logical query node. The differences between the two are identified, and the scope of the incremental query task is determined (only including newly added indicator data within the new time window). Subsequently, based on the determined incremental query task, a data query operation is scheduled and executed, retrieving only the newly added data from the data source to obtain the incremental query results. Then, according to the requirements of data integrity and consistency, the incremental query results and reusable historical query results are processed by concatenation, replacement, and / or recalculation. If the historical results are unbiased, only the concatenation operation is performed to integrate all the data; if the historical results contain some invalid data, a replacement operation is performed to update the invalid parts; if the concatenated data needs to be re-aggregated, recalculation is performed to ensure consistent statistical standards, ultimately obtaining the concatenated query results of the logical query node.

[0067] Step S1063: If there are no reusable historical query results corresponding to the logical query node, perform a data query based on the logical query node.

[0068] In this embodiment of the application, if it is verified that there are no reusable historical query results (i.e., no historical data matching the corresponding genealogy key and indicator item), then a full data query is performed directly based on the parameters (genealogy key, indicator profile, query time window) of the logical query node to ensure that complete data that meets the current query requirements is obtained.

[0069] The method provided in this application's embodiments achieves efficient reuse of historical data by verifying reusable historical query results, avoiding repeated queries on existing data, significantly reducing data source I / O overhead, shortening query response latency, and improving query efficiency. By accurately determining the scope of incremental supplementary query tasks, queries are only executed on the differing parts, further reducing the amount of data retrieved and balancing query efficiency and data integrity. Through flexible processing methods such as splicing, replacement, and / or recalculation, the consistency and coherence between incremental and historical results are ensured, avoiding data mixing or deviation. Incremental and full queries are executed according to different scenarios to adapt to different query scenario requirements, improving the flexibility and practicality of the query solution. The entire process uses the phylogenetic key as the matching benchmark to ensure the accuracy of historical result reuse, eliminating result deviations caused by reusing historical data across devices and calibers, and further ensuring the accuracy and consistency of query data.

[0070] In some embodiments, step S1062 may include the following steps: Step S621: Compare the historical time window of the historical query results with the query time window to obtain the new time window.

[0071] In this embodiment, the historical time window refers to the predetermined continuous time interval corresponding to the reusable historical query results, which is the time boundary of historical data; the query time window refers to the precise time interval corresponding to the current logical query node, which is the time boundary of the current query; the new time window refers to the difference between the query time window and the historical time window, that is, the time range in which the current query needs to supplement the data, and does not include the area already covered by the historical time window.

[0072] In this embodiment, the historical time window corresponding to the reusable historical query results can be extracted, and the query time window corresponding to the current logical query node can be retrieved. The two time windows are accurately compared to identify the part of the query time window that exceeds the coverage of the historical time window, thereby obtaining the new time window and locking the time interval for which the query data needs to be supplemented, ensuring that data is retrieved only for the uncovered time range.

[0073] Step S622: Determine new indicator items based on the indicator items of the logical query node and the indicator items in the historical query results.

[0074] In this embodiment of the application, the newly added indicator item refers to the indicator item required by the current logical query node that is not included in the reusable historical query results, that is, the indicator parameter that is missing in the historical data and needs to be supplemented for query.

[0075] In this embodiment, all preset indicator items of the current logical query node and the indicator items already included in the reusable historical query results can be extracted respectively. The two sets of indicator items are compared one by one to filter out the indicator items that the current logical query node needs but are missing in the historical results, and the new indicator items are determined.

[0076] Step S623: Determine the incremental supplementary investigation task based on the newly added time window and the newly added indicator item.

[0077] In this embodiment of the application, the incremental supplementary query task refers to the query task performed only for newly added time windows and newly added indicator items.

[0078] In this embodiment, the determined new time window can be bound to the new indicator item to define the unique scope of the incremental supplementary investigation task, ensuring that the incremental supplementary investigation task is executed only for the difference between time and indicator, without including any existing historical data, thus achieving accurate positioning of the incremental supplementary investigation task.

[0079] The method provided in this application, by accurately comparing historical time windows with the current query time window, clearly identifies the new time window, avoiding the inclusion of historically covered time ranges in incremental query tasks, eliminating redundant data retrieval, and further reducing data source IO overhead; by comparing the indicators of logical query nodes with those of historical results, it accurately determines the new indicator items, avoiding omission of indicator data that needs to be supplemented, while preventing duplicate queries of existing indicators, balancing query efficiency and data integrity; based on the new time window and the new indicator items, the incremental query task is determined, achieving dual precise locking of the incremental query scope, ensuring the relevance and efficiency of the incremental query task; further improving query efficiency and data accuracy.

[0080] In some embodiments, after step S1062, the method further includes: Step S1064: If an anomaly occurs during the query based on the incremental supplementary query task, increase the current data query granularity of the incremental supplementary query task and execute the data query with the increased data query granularity, or switch the data source currently queried by the incremental supplementary query task.

[0081] In this embodiment, the data query granularity is a preset time dimension (such as minute-level, hour-level, or day-level) in the indicator profile index, used to limit the accuracy of data queries. It is the basic accuracy standard for data retrieval and statistical aggregation. Query anomaly refers to data source access failures that occur when executing incremental supplementary query tasks, including but not limited to data source timeouts, data retrieval failures, data missing, connection interruptions, and other situations where data cannot be obtained normally. Increasing the data query granularity means adjusting the query accuracy of the current incremental supplementary query task from fine-grained (such as minute-level) to coarse-grained (such as hour-level or day-level) to reduce the query difficulty and achieve normal data retrieval. Data source switching means that when the main data source used for the current query becomes abnormal, it switches to the system's preset alternative data source to continue executing the incremental supplementary query task.

[0082] In this embodiment, the query execution status can be monitored in real time to determine whether query anomalies such as data source timeout or data retrieval failure occur. If a query anomaly is detected, an anomaly handling mechanism is activated, and the query is executed in one of the following two ways: The first way is to increase the current data query granularity of the incremental supplementary query task, adjusting the fine-grained query to coarse-grained, and re-execute the incremental supplementary query task based on the increased query granularity, thereby reducing the data source access pressure and ensuring successful data retrieval; The second way is to switch the data source used by the current incremental supplementary query task, abandoning the main data source that has an anomaly and switching to a backup data source pre-configured by the system, and re-execute the incremental supplementary query task based on the backup data source. The two anomaly handling methods can be flexibly selected according to the system's preset strategy to ensure that the incremental supplementary query task is not interrupted and is completed smoothly.

[0083] The method provided in this application clearly defines the data query granularity of the indicator profile index, providing a clear basis for the query accuracy of incremental supplementary query tasks and a foundation for granularity adjustment in case of anomalies. For query anomalies in incremental supplementary query tasks, two flexible anomaly handling schemes are provided to effectively avoid query interruptions and improve the stability and fault tolerance of the query process. By increasing the data query granularity, the pressure on the data source access can be reduced, quickly resolving timeout and failure issues caused by fine-grained data retrieval, and ensuring query continuity. By switching data sources, the impact of a single data source failure can be avoided, ensuring the reliability of data queries. The overall anomaly handling logic is simple and highly executable, requiring no termination of the entire query process, only adjustments are made to the incremental supplementary query task, balancing query efficiency and continuity, further improving the incremental query system of claim 3, and enhancing the practicality and stability of the entire data query method.

[0084] The industry requires clear physical constraints and statistical definitions (such as "power generation = Σ MPPT inflow" and "load = Σ from each source to the load"). However, after cross-granularity splicing and incremental merging, existing systems generally lack automated verification, threshold fault tolerance, and rollback expansion strategies, making it difficult to detect and correct errors in a timely manner.

[0085] To address this issue, the data query method in the energy system provided in this application embodiment further includes: Step S107: Based on the genealogical key corresponding to the logical query node, the splicing query result is verified for energy conservation rules and statistical whitelist.

[0086] In this embodiment, the energy conservation rule refers to the core rule preset in the energy system for verifying data consistency, namely, the generation, transmission, consumption, and storage of energy must satisfy the energy balance relationship (e.g., the deviation between photovoltaic power generation and the sum of the output power of each branch is within the preset tolerance); the statistical whitelist refers to the set of statistical rules preset by the system that are allowed, used to limit the unified standard of data statistics and avoid result deviations caused by inconsistent statistical standards; verification refers to the operation of checking and judging the accuracy and consistency of the spliced ​​query results based on the energy conservation rule and the statistical whitelist.

[0087] In this embodiment, after obtaining the splicing query result of the logical query node, the phylogenetic key corresponding to the logical query node is used as the unique verification benchmark to lock the verification object and avoid cross-device and cross-level verification distortion. Secondly, based on the system's preset energy conservation rules and statistical whitelist, the splicing query result is fully verified to check whether the data meets the energy balance relationship and whether it conforms to the unified statistical standard, and to determine whether the verification passes.

[0088] Step S108: If the verification fails, execute a preset rollback strategy, wherein the preset rollback strategy includes: supplementing the missing time window data, reducing the data query granularity and re-querying, or switching the data source and re-querying.

[0089] In this embodiment, a failed verification means that the concatenated query result does not conform to the energy conservation rule or exceeds the statistical whitelist range, indicating data bias, missing data, or incorrect definitions. The preset rollback strategy refers to a pre-configured remedial plan to correct verification biases, used to re-obtain compliant data when verification fails. "Supplementing missing time window data" means re-executing the query to complete the missing time interval data in the concatenated query result. "Reducing data query granularity" means adjusting the query precision from coarse-grained (e.g., daily, hourly) to fine-grained (e.g., minute-level) to improve data precision and correct biases. "Switching data source and re-querying" means abandoning the currently used data source, switching to a pre-selected data source, and re-executing the query to obtain compliant data.

[0090] In this embodiment, if the verification result fails, meaning the spliced ​​query result has deviations, omissions, or incorrect definitions, a preset rollback strategy is activated, selecting one or a combination of three pre-configured schemes for execution: The first scheme is to supplement the missing time window data, accurately locate the time interval of the missing data in the spliced ​​result, and re-execute the query to supplement the complete data; the second scheme is to reduce the data query granularity, adjust the current query precision to a finer granularity, and re-execute the query based on the fine granularity to improve data precision and correct deviations; the third scheme is to switch the data source and re-query, abandoning the current data source that is abnormal or non-compliant, switching to the system's pre-selected data source, and re-execute the query to obtain compliant data.

[0091] Step S109: After the preset rollback strategy is executed, the new query results are concatenated, replaced, and / or recalculated with the historical query results.

[0092] In this embodiment of the application, the new query result refers to the data that meets the verification requirements and is re-acquired after executing the preset rollback strategy; splicing, replacement and / or recalculation processing refers to the operation of integrating the new query result with the historical query result according to time and indicator dimensions, or replacing invalid data and recalculating the summary data to ensure data consistency.

[0093] In this embodiment of the application, after the preset rollback strategy is executed and new query results are obtained, the new query results are integrated with the original historical query results through splicing, replacement and / or recalculation processing to ensure the integrity and consistency of the final data and provide compliance support for the output of subsequent query results.

[0094] The method provided in this application uses spectral keys as the verification benchmark to ensure the uniqueness and specificity of the verification object, avoid cross-device and cross-caliber verification distortion, and ensure the accuracy of the verification results. Verification based on energy conservation rules and statistical caliber whitelists can promptly detect deviations, omissions, or caliber inconsistencies in the spliced ​​query results, improving the credibility of the query data from the source. Multiple preset rollback strategies provide flexible and executable remedial solutions for verification failures, effectively correcting data deviations and preventing the entire query process from terminating due to verification failure. Three rollback methods—supplementing missing data, reducing query granularity, and switching data sources—can be flexibly selected according to the type of deviation, balancing deviation correction efficiency and data accuracy. After rollback, splicing, replacement, and / or recalculation are re-executed to ensure the continuity and consistency of new and historical data, further improving the closed loop of the query process. The overall verification and rollback mechanism effectively solves the defects of existing query schemes, such as lack of data verification and inability to correct deviations, significantly improving the accuracy and compliance of the query data and ensuring the reliability of energy system operation and maintenance decisions.

[0095] In some embodiments, the priority of retrieving data within a missing time window is greater than the priority of reducing the data query granularity and re-querying, and the priority of reducing the data query granularity and re-querying is greater than the priority of switching the data source and re-querying.

[0096] In this embodiment, priority refers to the pre-defined execution order of each rollback scheme. Schemes with higher priority are selected for execution first, while schemes with lower priority are only activated when higher priority schemes cannot be implemented or can not correct deviations, thus ensuring the orderly and efficient execution of the rollback strategy.

[0097] In this embodiment, when the verification fails and a preset rollback strategy is initiated, the system calls the pre-configured rollback priority rules to clarify the execution order of the three rollback schemes. Secondly, the rollback operation is strictly executed according to the preset priority, with the priority order as follows: data missing in the time window has the highest priority, followed by reducing the data query granularity and re-querying, and then switching the data source and re-querying. Specifically, the data missing in the time window is checked first to accurately locate the time interval of the missing data in the spliced ​​query results, and then the missing data is re-queried and supplemented. After completion, the spliced ​​results are re-verified. If the data missing in the time window fails to be checked... If the validation still fails after missing data, or if the deviation cannot be corrected by supplementing the missing data, then the next priority step is to reduce the granularity of the data query and re-query, adjusting the query precision to a finer granularity and re-executing the query to obtain more accurate data for validation again. If the validation still fails after reducing the query granularity, or if the deviation cannot be corrected by this method, then the lowest priority step is to switch the data source and re-query, switching to the pre-selected data source and re-executing the query to obtain compliant data, until the validation passes. The entire rollback process strictly follows this priority order, without arbitrarily adjusting the execution order, to ensure that the rollback operation is orderly and efficient.

[0098] The method provided in this application clearly defines the execution priority of each scheme in the preset rollback strategy, avoiding chaotic and disorderly rollback operations and ensuring that the rollback process is standardized and controllable. It sets the highest priority for supplementing missing data within the time window, prioritizing the supplementation of missing data, maximizing the reuse of existing compliant data, reducing unnecessary query operations, lowering data source I / O overhead, and improving deviation correction efficiency. It sets the second priority for reducing data query granularity and re-querying, which can address deviation issues by improving data accuracy when supplementing data fails to correct the deviation, balancing deviation correction effectiveness and data accuracy. It sets the lowest priority for switching data sources and re-querying, avoiding increased query costs and cumbersome processes caused by blindly switching data sources, and only activating this method when the other two schemes are ineffective, thus making reasonable use of system resources. Through clear priority ranking, the execution of the rollback strategy becomes more targeted and efficient, further improving the success rate of deviation correction, shortening rollback time, improving the rollback mechanism, ensuring the continuity and stability of the query process, and further improving the accuracy and compliance of the queried data.

[0099] In related technologies, the natural language rewriting (alias → standard parameter), genealogical key location, and cache / incremental / full path decision-making processes are untraceable, lacking a chain of evidence for the final result. This makes it difficult for operations and maintenance personnel to replay the entire process of a query, hindering quality review and compliance. To address this issue, the method provided in this application embodiment further includes: Output the final results and generate a structured audit ledger of the entire query process.

[0100] In this embodiment, the final result refers to the complete query data that has passed verification (or re-verification after the rollback strategy is executed), conforms to the energy conservation rule and the statistical whitelist requirements, and is the final output content that meets the user's query needs; the entire query process refers to the entire data query process from obtaining and preprocessing the user's query request information to generating phylogenetic keys, splitting intent, constructing DAG, incremental querying, data splicing, verification, and rollback (if any); the structured audit ledger refers to a standardized data document preset by the system to record key information of the entire query process, which has the characteristics of traceability, auditability, and replayability, and is used to retain the query evidence chain and support subsequent review and optimization; generating the structured audit ledger refers to the operation of organizing and storing the key information of the entire query process in a preset format to form a standardized audit record.

[0101] In this embodiment, after the spliced ​​query result passes verification (or passes re-verification after executing a preset rollback strategy), the system confirms that the current query data conforms to the energy conservation rules and statistical whitelist requirements, and that the data is complete, consistent, and ready for output. Secondly, the system takes the verified complete query data as the final result, organizes it according to user interaction requirements or system preset formats (such as tables, reports, or structured data interfaces), and outputs it to the front-end interactive terminal, operation and maintenance platform, or designated data storage location for user viewing and use. Simultaneously, the system initiates a structured audit ledger generation process, comprehensively collecting key information throughout the query process, including but not limited to the user's original query request, preprocessed standardized query information, phylogenetic keys, logical subtasks, DAG node information, incremental supplementary query tasks (if any), verification results, rollback strategy execution records (if any), query time, and data source information. Finally, the collected key information is organized and archived according to a preset standardized format to generate a structured audit ledger, which is stored in the system's designated storage area, forming a complete query evidence chain to facilitate subsequent operation and maintenance review, problem localization, compliance review, and query process optimization.

[0102] The method provided in this application only outputs the final result after the query data has passed verification, ensuring the accuracy, compliance, and reliability of the output data and preventing unqualified data from misleading users' operation and maintenance decisions. It generates a structured audit ledger for the entire query process, enabling traceability, auditability, and replayability of the entire query process. This provides a complete chain of evidence for subsequent query problem localization and process review, reducing operation and maintenance troubleshooting costs. The query information retained in the structured audit ledger can be used to analyze weaknesses in the query process, providing data support for subsequent query scheduling optimization, data source selection optimization, and rollback strategy optimization. It improves the closed loop of the entire data query process, forming a complete standardized system from query request input to final result output and process recording, further enhancing the standardization, maintainability, and compliance of the entire data query method and meeting the core requirements of energy systems for traceable and auditable data queries.

[0103] In some embodiments, after obtaining the genealogical key of the query object based on the entity words and device topology relationships in the standardized query information, the method further includes: real-time acquisition of device topology change information of the integrated photovoltaic storage and charging system, wherein the device topology change information includes at least one of device addition, device removal, device hierarchy adjustment, and device affiliation change; when the device topology change information is detected, the genealogical key affected by the topology change is automatically identified, and the affected genealogical key is dynamically updated based on the changed device topology relationships. The updated genealogical key still retains the unique identification attribute of the query object information, while retaining the original genealogical key. Historical records and change trajectories are recorded, with change identifiers and timestamps. A genealogical key association mapping table is established to uniquely bind the genealogical key before and after the change, enabling the correlation and traceability of historical query results, audit records, and the changed genealogical key. This ensures that historical query data can be retrieved and verified normally after a device topology change, without any query object drift. When a user query request involves a query object corresponding to a historical device topology, the corresponding changed genealogical key is automatically matched based on the genealogical key association mapping table, and the device topology change and genealogical key update information are simultaneously fed back to the user, ensuring that the user's query intent is accurately bound to the changed device object.

[0104] In some embodiments, after performing query processing on the directed acyclic graph of the logical task and obtaining the query processing result, the method further includes: based on historical query data, statistically analyzing the time window patterns and query frequencies of user queries, and constructing a high-frequency query feature library based on the time window patterns and query frequencies of indicator items. The high-frequency query feature library includes high-spectrum keys, high-frequency standard indicators, and high-frequency time window combinations. Based on the high-frequency query feature library, during non-peak query periods, anticipating potential incremental supplementary query needs, pre-executing incremental supplementary query tasks corresponding to high-frequency combinations, and caching the pre-query results to temporary storage units. The temporary storage units correspond one-to-one with the spectrum keys to ensure the uniqueness and traceability of the cached data. When a user initiates a query request that matches the high-frequency query characteristics, the cached pre-executed incremental supplementary query results are retrieved first, and combined with the spectrum key and time window of the current query, data splicing and verification are completed without re-executing the full incremental supplementary query, further shortening the query response time and reducing the data source IO load.

[0105] In some embodiments, after determining the incremental supplementary query tasks based on the newly added time window and the newly added indicator items, the method further includes: real-time monitoring of the load status of each data source, the load status including data source response time, data retrieval success rate, and number of concurrent queries; prioritizing the incremental supplementary query tasks based on the data source load status, setting the incremental supplementary query tasks corresponding to high-frequency indicators and key equipment as high priority, and setting the incremental supplementary query tasks corresponding to ordinary indicators and non-key equipment as low priority; executing the incremental supplementary query tasks in priority order, with high-priority tasks scheduling data source resources first, and low-priority tasks executing asynchronously; if a query anomaly occurs in a high-priority task, an anomaly handling mechanism is initiated first, and low-priority tasks can be temporarily suspended and resumed after the high-priority tasks are completed, ensuring the timeliness and stability of key data queries.

[0106] In some embodiments, the splicing result is verified based on the phylogenetic key, including: Based on the device topology and statistical caliber corresponding to the spectral key, a preset energy conservation verification rule and statistical caliber whitelist are established for the spectral key. The energy conservation verification rule conforms to the energy flow law of the photovoltaic-storage-charging integrated machine, covering the energy balance relationship of photovoltaic power generation, energy storage charging and discharging, and load consumption. According to the energy conservation verification rule, energy balance calculation is performed on the data of each indicator in the splicing result to determine whether the deviation of each indicator data is within the preset tolerance range. At the same time, the statistical caliber of the splicing result is checked to see if it is consistent with the statistical caliber whitelist. An AI-assisted verification model is introduced. The AI-assisted verification model is trained and generated based on historical verification data, equipment operating parameters, and energy conservation laws. It is used to identify hidden non-obvious deviations in the splicing result, and to mark the deviation location, deviation type, and possible deviation causes. A verification report is generated. The verification report includes the verification result, deviation details (if any), deviation cause analysis, and rectification suggestions. The verification report is bound to the spectral key and query processing results to achieve traceability of the verification process.

[0107] In some embodiments, during the execution of the preset rollback strategy, the method further includes: real-time monitoring of the execution status of each rollback step, recording the time consumption, execution result, and data source call status of each rollback operation, generating a rollback process log, wherein the rollback process log is bound to the genealogy key and query processing result; if the deviation of the splicing result still exceeds the preset tolerance after the current rollback step is executed, or the execution time exceeds the preset threshold, the current rollback step is automatically interrupted, and the next priority rollback strategy is switched, while the interruption reason is marked; if the splicing result still fails the verification after all rollback strategies are executed, abnormal alarm information is automatically generated, abnormal genealogy key, abnormal indicator, and abnormal deviation value are marked, and pushed to the system administrator, while all abnormal information and rollback execution records are written into the structured audit ledger to provide a complete basis for subsequent problem investigation.

[0108] In some embodiments, generating a structured audit ledger for the entire query process further includes: The structured audit ledger is stored with hierarchical encryption. Core information (genealogical keys, verification results, and rollback records) is stored using symmetric encryption, while basic information (standard query information and standard indicator candidate sets) is stored using conventional encryption, ensuring the security and confidentiality of audit data. An audit ledger retrieval interface is established, supporting quick retrieval of corresponding audit records using keywords such as genealogical keys, query time, indicator items, and anomaly types, enabling precise location and efficient retrieval of audit data. The structured audit ledger is archived according to a preset period, and the archived data is bound to the corresponding query processing results and equipment topology change records, preserving a complete query-processing-verification-audit chain to meet the compliance audit requirements of integrated photovoltaic, energy storage, and charging systems. The structured audit ledger is integrated with the operation and maintenance management platform of integrated photovoltaic, energy storage, and charging systems, supporting batch export and printing of audit data, and adapting to the compliance review interface of the energy regulatory platform to achieve seamless reporting of audit data.

[0109] Based on the foregoing embodiments, this application provides a data query system for an energy system. Figure 3 This is a schematic diagram of the structure of a data query system provided in an embodiment of this application, such as... Figure 3 As shown, the system includes the following modules coupled in parallel or serial order: The Natural Language Rewriting and Standardization module is used to standardize and terminology of multilingual user input, and output standardized queries and time phrases (without specifying a time).

[0110] The Lineage Key Resolution module (Lineage Resolver) is used to bind a standard query to one or more LineageKeys based on the power plant / equipment topology, serving as a unified primary key for subsequent queries and statistics.

[0111] The Profile Index is used to maintain profile information for each standard indicator, including its level (station / device), queryable granularity (minute / hour / day), default time window, and default statistical window, for use in planning and incremental querying.

[0112] The intent recognition and planning module (Planner) is used to decompose queries into sub-tasks such as data queries, combine LineageKey and indicator profiles to generate a task DAG (Directed Acyclic Graph) and label dependencies, and clarify the required indicators, granularity and time window for each node.

[0113] The Incremental Planner is used to compare historical hits with current requests, generate a minimum replacement plan with a Δ time window / Δ metric, and make a granularity interchangeability determination.

[0114] The execution engine adaptation layer is used to retrieve data in parallel from multiple sources such as time series database, relational database, cache, and real-time signals according to the incremental query plan, and to execute degradation strategies when timeout or exception occurs.

[0115] The caliber / conservation verification module is used to perform conservation and caliber consistency verification on the splicing results according to whitelist rules (including tolerance ε and anomaly mask); when non-compliance occurs, it drives window expansion, granularity rollback, data source switching, and performs secondary merging and re-verification.

[0116] The cost-latency-risk scheduling module and the audit ledger module can optimize the "cached / incremental / full" path based on historical IO / latency statistics in some embodiments, and record information such as genealogy key, ΔW, and fallback path for auditing.

[0117] Based on the systems provided in the foregoing embodiments, Figure 4 This application provides a data query method for an energy system, such as... Figure 4 As shown, it includes: S1: Receives natural language queries and performs multilingual cleaning, terminology standardization, and relative time parsing.

[0118] In this embodiment, after receiving a user's natural language query, the system first performs multilingual cleaning, terminology normalization, alias mapping, and time phrase standardization to convert expressions such as "power / output / station power" and "yesterday / last week / last 7 days" into standard indicator candidates and standardized time expressions. Preferably, this step does not directly bind to the final execution timestamp, but rather forms a standardized query representation that can be subsequently combined with time zones and reference times.

[0119] S2: Parse the lineage key LineageKey and attach it to the query context.

[0120] In this embodiment, the system can identify the power station or equipment object corresponding to the user's intent based on the power station name, equipment alias, equipment number, and hierarchical prompts in the standard query, and generate one or more LineageKeys by combining the asset master data and equipment topology relationships. The LineageKey is used to uniformly identify the query object and its equipment hierarchy, affiliated site, and time zone information.

[0121] S3: Generate a task DAG based on LineageKey and indicator profile; retrieve metadata such as granularity / default window from the indicator profile index as needed for data query subtasks.

[0122] In this embodiment, based on the canonical query, LineageKey, and standard indicator set, the system identifies one or more user intents, including data query, knowledge retrieval, explanation, or composite intent, and breaks down the request into several logical sub-tasks. For data query sub-tasks, logical query nodes are formed according to the query object, indicator item, time window, and candidate data source. For scenarios requiring aggregation, comparison, or verification, derived calculation nodes and verification nodes are further generated. The dependencies between tasks are determined based on the pre-parsing relationship, the calculation relationship between basic and derived indicators, the granularity conversion relationship, and the verification / rollback trigger relationship, thus forming a directed acyclic graph.

[0123] S4: Compare historical results with current requirements, calculate the Δ time window and Δ indicator column; determine commutativity based on granular algebra (e.g., sum(day) = Σhour, avg needs to be weighted, max cannot be added).

[0124] In this embodiment, for data query nodes in the logical task DAG, the incremental query planner checks whether there are historical hit results. If so, it compares the historical window W_prev with the current window W_cur and identifies newly added indicator columns to obtain ΔW and the Δ indicator set; if there are no historical hits, the node degenerates into an initial complete query node within the current request range. Simultaneously, the incremental query planner expands each logical node at the execution layer based on the granularity set, default window, composable rules, and data source preferences in the indicator profile, forming execution plans such as cache hit nodes, incremental query nodes, granularity conversion nodes, and concatenation / recalculation nodes.

[0125] In this embodiment of the application, Δ time window: W = Wcur - Wprev; only for W and the newly added indicator column retrieve data.

[0126] S5: Parallel data retrieval; if timeout / failure occurs, switch data sources or roll back to coarser granularity according to the strategy.

[0127] In this embodiment, data is retrieved in parallel from multiple data sources, such as time-series databases, relational databases, caches, and real-time signal sources, according to the incremental data retrieval plan. Data format conversion, time alignment, unit normalization, and intermediate concatenation are performed as needed. If the main data source times out, malfunctions, or becomes too costly, the system can switch to an alternative data source, roll back to a coarser granularity, use cached results, or return partially identified results, according to the specified strategy.

[0128] S6: Perform conservation / caliber verification on the splicing results (e.g., solar_generation ≈ Σ solar_to_*± ε, load_consumption ≈ Σ *_to_load ± ε).

[0129] In this embodiment, the concatenated result is subjected to conservation rules and statistical whitelist verification at the LineageKey granularity. For example, it is determined whether the sum of solar_generation and each solar_to_* branch is within the tolerance ε, and whether load_consumption is consistent with the sum of each *_to_load branch. If necessary, fault tolerance judgment can be performed in conjunction with anomaly masks, missing identifiers, or data source trust levels.

[0130] In this embodiment of the application, the conservation / caliber whitelist (example) is: solar_generation ≈ solar_to_battery + solar_to_load + solar_to_grid + solar_to_ev* ± ε, load_consumption ≈ grid_to_load + battery_to_load + solar_to_load + third_party_to_load + generator_to_load ± ε; where ε is a configurable tolerance that can be set according to the granularity and the difference from the data source.

[0131] S7: If the verification fails, expand the ΔW check according to the configuration, roll back the granularity, switch the data source and merge it again, and then re-verify.

[0132] In this embodiment, if the verification fails or the deviation exceeds the tolerance ε, a rollback state machine is triggered. Rollback strategies may include: filling in missing time windows, rolling back to a finer-grained original granularity for re-statistical analysis, switching to another data source to retrieve data again, or outputting results with anomaly markers as configured. After rollback, the splicing and verification are re-executed until the conditions are met or the maximum number of rollbacks is reached.

[0133] S8: Output results and audit ledger; write back the profile and hit statistics to optimize subsequent cost scheduling.

[0134] In this embodiment, the system outputs the final query result and records the queryId, standard query, LineageKey, time window, indicator set, data source path, ΔW / Δ indicator, verification result, rollback steps, and final decision path in a structured manner. Simultaneously, statistical information such as hit rate, average latency, granular success rate, and data source priority is written back to the indicator profile index or associated metadata table to optimize subsequent cost-latency-risk scheduling.

[0135] The method provided in this application introduces a device lineage key (LineageKey = stationId / assetType / assetId / level / timezone, etc.) into the natural language parsing results and uses it throughout the RAG / template retrieval, historical result query, incremental supplementation query, statistics and verification processes as a unified primary key. This ensures that the same query is always bound to the same device chain and caliber during field mapping and aggregation, significantly reducing the risk of cross-device chain drift and caliber misuse. Based on the standardized query and indicator set generated by the natural language parsing module, an indicator profile (applicable level, available granularity set, default time window, etc.) is maintained for each standard indicator. When comparing the historical query window W_prev with the current query window W_cur, only the difference window ΔW and the newly added indicator column are used to generate an incremental supplementation plan, and granular algebra rules (such as sum(day) = Σ sum(hour), the average value needs to be weighted, and max / min cannot be synthesized) are used to guide the splicing and recalculation of historical and incremental results. While ensuring statistical accuracy, the system significantly reduces duplicate data retrieval, lowers I / O and tail latency, and adapts to mixed queries at multiple granularities, such as minute-level power, hourly energy, and half-hourly electricity price. After multi-source, multi-granularity incremental concatenation, energy conservation and statistical whitelist verification are performed using LineageKey as the dimension (e.g., whether the difference between photovoltaic power generation and the sum of each solar_to_* branch is within tolerance ε; whether load consumption is consistent with the sum of power from each power source to the load, etc.). If the deviation exceeds tolerance ε, the rollback state machine is activated, systematically expanding the query to a missing time window, rolling back to a finer granularity, or switching data sources, and then re-verifying after a second merging. Industry physical constraints are embedded in the query process, enabling the system to have self-checking and self-correcting capabilities, significantly improving the reliability and consistency of results, and providing a foundation for anomaly analysis and quality assurance. In this embodiment, a unique query identifier is generated for each natural language query and recorded in a structured log format: device lineage key; time window and indicator set; selected data source and incremental query plan; energy conservation and statistical verification results; triggered rollback steps and final decision path. Maintenance personnel can replay the entire process of a query based on the query identifier. The query results provide a complete chain of evidence, enabling traceability, auditability, and replayability. This facilitates problem localization, quality review, and compliance auditing in scenarios with high data quality and compliance requirements, such as integrated photovoltaic storage and charging systems.

[0136] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0137] According to the foregoing embodiments, this application provides a data query device for an energy system. The various modules and units included in the device can be implemented by a processor in a computer device; of course, they can also be implemented by specific logic circuits. In the implementation process, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.

[0138] This application provides a data query device for an energy system. Figure 5 A schematic diagram of the structure of a data query device in an energy system provided in this application embodiment is shown below. Figure 5 As shown, the data query device 500 in the energy system includes: Module 501 is used to obtain user query request information; Preprocessing module 502 is used to preprocess the query request information to obtain a preprocessing result, the preprocessing result including at least: standardized query information and a set of standard indicator candidates; The genealogy key parsing module 503 is used to obtain the genealogy key of the query object based on the entity words and device topology relationships in the standardized query information, wherein the genealogy key is a unique identifier of the query object information; The intent recognition module 504 is used to perform intent recognition based on the normative query information and the standard indicator candidate set, obtain intent recognition results, and split the intent recognition results into logical subtasks based on the genealogy key, with each logical subtask corresponding to a genealogy key; The planning and scheduling module 505 is used to generate a directed acyclic graph of logical tasks based on the logical subtasks; The query module 506 is used to perform a query based on the directed acyclic graph of the logical task.

[0139] In some embodiments, the preprocessing result further includes: a standardized time scheduling module, comprising: The first determining unit is configured to determine a query time window based on the standardized time and the reference time when the logical subtask includes a data query subtask. The matching unit is used to match the indicator items of the data query subtask with a preset indicator profile index. The first generation unit is used to generate logical query nodes based on the genealogical key of the query object of the data query subtask, the matching indicator profile index, and the query time window. The second generation unit is used to generate corresponding derived calculation nodes and verification nodes based on the logical query nodes; The third generation unit is used to generate a directed acyclic graph of logical tasks based on the dependencies between nodes.

[0140] In some embodiments, the query module includes: The second determining unit is used to determine whether there are reusable historical query results corresponding to the logical query nodes in the directed acyclic graph of the logical task. The first query unit is configured to, when there are reusable historical query results corresponding to the logical query node, determine an incremental supplementary query task based on the historical query results and the logical query node; perform a data query based on the incremental supplementary query task to obtain an incremental query result; and concatenate, replace, and / or recalculate the incremental query result with the historical query result to obtain the concatenated query result of the logical query node. The second query unit is used to perform a data query based on the logical query node when there are no reusable historical query results corresponding to the logical query node.

[0141] In some embodiments, the first query unit includes: The comparison subunit is used to compare the historical time window of the historical query results with the query time window to obtain the new time window; The first determining subunit is used to determine new indicator items based on the indicator items of the logical query node and the indicator items in the historical query results; The second determining subunit is used to determine the incremental supplementary investigation task based on the newly added time window and the newly added indicator item.

[0142] In some embodiments, the indicator profiling index includes: data query granularity, and the data query device 500 in the energy system further includes: The adjustment module is used to increase the current data query granularity of the incremental supplementary query task and execute the data query with the increased data query granularity when an anomaly occurs during the query based on the incremental supplementary query task, or to switch the data source currently queried by the incremental supplementary query task.

[0143] In some embodiments, the data query device 500 in the energy system further includes: The verification module is used to verify the spliced ​​query result based on the genealogy key corresponding to the logical query node, and to verify the energy conservation rules and statistical whitelist. The rollback module is used to execute a preset rollback strategy when the verification fails. The preset rollback strategy includes: supplementing the missing time window data, reducing the data query granularity and re-querying, or switching the data source and re-querying. After the preset rollback strategy is executed, the new query results are concatenated, replaced, and / or recalculated with the historical query results.

[0144] In some embodiments, the priority of retrieving data within a missing time window is greater than the priority of reducing the data query granularity and re-querying, and the priority of reducing the data query granularity and re-querying is greater than the priority of switching the data source and re-querying.

[0145] In some embodiments, the data query device 500 in the energy system further includes: The output module is used to output the final results and generate a structured audit ledger of the entire query process.

[0146] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0147] In addition, the data query device in the energy system described above can be a software unit, a hardware unit, or a combination of software and hardware. It can also be integrated into electronic devices as an independent component, or exist as an independent terminal device.

[0148] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0149] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 6 As shown, the electronic device of this embodiment may include: at least one processor 30 ( Figure 6Only one processor 30, memory 31, and computer program 32 stored in memory 31 and executable on at least one processor 30 are shown. When the processor 30 executes the computer program 32, it implements the steps in any of the above method embodiments, or the processor 30 executes the computer program 32 to implement the functions of each module / unit in the above device or system embodiments.

[0150] For example, computer program 32 may be divided into one or more modules / units, one or more of which are stored in memory 31 and executed by processor 30 to complete this application. One or more modules / units may be a series of computer program 32 instruction segments capable of performing a specific function, which describe the execution process of computer program 32 in an electronic device.

[0151] This application also provides a computer-readable storage medium storing a computer program 32, which, when executed by a processor 30, implements the steps described in the above-described method embodiments.

[0152] This application provides a computer program product that, when run on an electronic device, enables the electronic device to perform the steps described in the various method embodiments above.

[0153] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program 32 instructing related hardware. The computer program 32 can be stored in a computer-readable storage medium, and when executed by the processor 30, it can implement the steps of the various method embodiments described above. The computer program 32 includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a terminal, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), electrical carrier information, telecommunication information, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks.

[0154] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0155] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0156] In the embodiments provided in this application, it should be understood that the disclosed apparatus / network devices and methods can be implemented in other ways. For example, the apparatus / network device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0157] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0158] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A data query method in an energy system, characterized in that, include: Obtain the user's query request information; The query request information is preprocessed to obtain a preprocessing result, which includes at least: standardized query information and a set of candidate standard indicators; Based on the entity words and device topology relationships in the standardized query information, the genealogy key of the query object is obtained, and the genealogy key is a unique identifier for the query object information; Intent recognition is performed based on the specified query information and the standard indicator candidate set to obtain intent recognition results. The intent recognition results are then divided into logical subtasks based on the genealogy key, with each logical subtask corresponding to a genealogy key. Generate a directed acyclic graph of logical tasks based on the aforementioned logical subtasks; Query processing is performed based on the directed acyclic graph of the logical task.

2. The method according to claim 1, characterized in that, The preprocessing result also includes: standardized time; the generation of the directed acyclic graph of logical tasks based on the logical subtasks includes: When the logical subtask includes a data query subtask, the query time window is determined based on the standardized time and the baseline time. The indicator items of the data query subtask are matched with a preset indicator profile index. Logical query nodes are generated based on the genealogical key of the query object, the matching indicator profile index, and the query time window of the data query subtask. Based on the logical query node, corresponding derived calculation nodes and verification nodes are generated; A directed acyclic graph of logical tasks is generated based on the dependencies between nodes.

3. The method according to claim 2, characterized in that, The query processing based on the directed acyclic graph of the logical task includes: For each logical query node in the directed acyclic graph of the logical task, determine whether there are reusable historical query results corresponding to the logical query node. If reusable historical query results exist corresponding to the logical query node, an incremental supplementary query task is determined based on the historical query results and the logical query node; a data query is executed based on the incremental supplementary query task to obtain an incremental query result; the incremental query result is then concatenated, replaced, and / or recalculated with the historical query result to obtain the concatenated query result of the logical query node. If no reusable historical query results exist for the logical query node, a data query is performed based on the logical query node.

4. The method according to claim 3, characterized in that, The step of determining the incremental supplementary query task based on the historical query results and logical query nodes includes: The new time window is obtained by comparing the historical time window of the historical query results with the query time window; New indicator items are determined based on the indicator items of the logical query node and the indicator items in the historical query results; The incremental supplementary investigation task is determined based on the newly added time window and the newly added indicator items.

5. The method according to claim 3, characterized in that, The indicator profiling index includes: data query granularity, and the method further includes: If an anomaly occurs during the query based on the incremental supplementary query task, the current data query granularity of the incremental supplementary query task is increased, and the data query is executed with the increased data query granularity; or, the data source currently queried by the incremental supplementary query task is switched.

6. The method according to claim 3, characterized in that, The method further includes: The spliced ​​query results are verified based on the genealogical key corresponding to the logical query node, and the energy conservation rules and statistical whitelist are used for verification. If the verification fails, a preset rollback strategy is executed, wherein the preset rollback strategy includes: supplementing the missing time window data, reducing the data query granularity and re-querying, or switching the data source and re-querying; After the preset rollback strategy is executed, the new query results are concatenated, replaced, and / or recalculated with the historical query results.

7. The method according to claim 6, characterized in that, The priority of retrieving data within a missing time window is higher than the priority of reducing the data query granularity and re-querying, which in turn is higher than the priority of switching data sources and re-querying.

8. The method according to claim 6, characterized in that, The method further includes: Output the final results and generate a structured audit ledger of the entire query process.

9. A data query device in an energy system, characterized in that, include: The acquisition module is used to acquire user query request information; The preprocessing module is used to preprocess the query request information to obtain a preprocessing result, which includes at least: standardized query information and a set of standard indicator candidates. The genealogy key parsing module is used to obtain the genealogy key of the query object based on the entity words and device topology relationships in the standardized query information, wherein the genealogy key is a unique identifier of the query object information; The intent recognition module is used to perform intent recognition based on the normative query information and the standard indicator candidate set, obtain intent recognition results, and split the intent recognition results into logical subtasks based on the genealogy key, with each logical subtask corresponding to a genealogy key; The planning and scheduling module is used to generate a directed acyclic graph of logical tasks based on the logical subtasks; The query module is used to perform queries based on the directed acyclic graph of the logical task.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 8.