Building energy consumption analysis method and system based on MCP service model and agent
By constructing standardized interfaces and intelligent agent scheduling based on the MCP business model and intelligent agent approach, the system achieves automatic generation of natural language reports and visualization charts from structured data, solving the data management and report generation challenges of building energy consumption analysis systems and improving the system's intelligence and adaptability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANDONG UNIV
- Filing Date
- 2026-03-11
- Publication Date
- 2026-05-19
AI Technical Summary
Existing building energy consumption analysis systems have significant shortcomings, such as complex data structures, query methods that are difficult to adapt to business topologies, lack of system-level modeling solutions, and reliance on templates for report output. These shortcomings lead to difficulties in data analysis and management, and a lack of intelligence and portability.
By adopting an approach based on the MCP business model and intelligent agents, a standardized function interface is constructed. Through intelligent agent process scheduling, the automatic generation of structured data into natural language reports and visualization charts is realized, including MCP business model encapsulation, equipment parameter preprocessing, multi-table query, aggregation calculation, structured energy consumption data acquisition, Markdown report generation, and visualization output.
It enables high-quality and intelligent analysis of building energy consumption data, improves the system's accuracy, versatility, and integration capabilities, solves the problem of unstable SQL generation in complex data environments, and has dynamic aggregation, anomaly detection, and adaptive optimization capabilities.
Smart Images

Figure CN121809861B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the fields of building energy conservation and artificial intelligence technology, specifically to a building energy consumption analysis method and system based on the MCP business model and intelligent agents. Background Technology
[0002] The statements in this section are merely background information relating to this disclosure and do not necessarily constitute prior art.
[0003] With the advancement of energy conservation and emission reduction and the development of smart buildings, building energy consumption monitoring has become an important part of energy management. Various types of energy data (such as cold and heat sources, circulating pumps, electricity meters, air conditioning subsystems, etc.) are constantly being collected. However, these data often come from heterogeneous equipment systems, distributed platforms, and complex topologies. Their complex structures, inconsistent semantics, and inconsistent dimensions pose significant challenges to analysis and management.
[0004] Currently, existing building energy consumption analysis systems generally have the following limitations:
[0005] (i) The data structure is complex, and traditional query methods are difficult to adapt to the business topology. The building system involves a large number of table structures (equipment, stations, subsystems, collection points, etc.), especially among energy subsystems, there are complex topological mappings and logical relationships. Traditional BI reporting tools or fixed SQL query methods are difficult to cover scenarios such as multi-table unions, conditional filtering, and topological reasoning in actual business.
[0006] (ii) When faced with dozens of tables and complex multi-level relational structures, the Text-to-SQL model has difficulty generating correct SQL stably; the retrieval context is disconnected from the SQL template, and it is impossible to maintain consistent structured semantics.
[0007] (iii) Lack of system-level modeling solutions for energy consumption analysis scenarios. Most current platforms lack a systematic modeling mechanism for the highly complex and dynamic structural scenario of "building energy consumption analysis". The main problems are: (1) Inconsistent data interface granularity, making it difficult to directly support chart generation and analysis report generation; (2) Lack of a dedicated knowledge encapsulation layer for energy consumption scenarios, resulting in a lack of stable semantic anchors for agent invocation or model inference; (3) Inability to be universal across buildings and structures, resulting in high reconstruction costs.
[0008] (iv) Report output relies on templates and lacks intelligence and portability. Current analysis reports generally rely on manual templates or pre-set sentence structures, which have the following disadvantages: (1) lack of contextual understanding and inability to generate differentiated recommendations for different building structures or energy strategies; (2) weak chart generation capabilities, only able to provide static reports and lacking the ability to combine multiple charts and perform dynamic visualizations; (3) does not support structured result output, such as Markdown or front-end rendering formats, which makes platform integration difficult.
[0009] In summary, existing building energy consumption analysis systems have significant shortcomings in data access and modeling, chart and report generation, intelligent reasoning access, and system integration capabilities. Summary of the Invention
[0010] To address the aforementioned issues, this disclosure proposes a building energy consumption analysis method and system based on the MCP business model and intelligent agents. It designs an interface mechanism for modeling building energy consumption business characteristics and combines it with the intelligent agent's process scheduling capabilities to achieve an automatic generation path from structured data to high-quality natural language reports and visualization charts, thereby improving the system's accuracy, versatility, and intelligence level.
[0011] According to some embodiments, the present disclosure adopts the following technical solutions:
[0012] Building energy consumption analysis methods based on MCP business models and intelligent agents include:
[0013] Build and encapsulate the MCP business model, and then abstract it into a standardized function interface.
[0014] Acquire the operating equipment and its operating parameters in the building, and preprocess them; input the preprocessed operating parameters into the MCP business model storage;
[0015] The Agent component obtains user input requests, identifies the task intent in the input requests, and converts the task intent into specific API calls. The API calls the MCP function interface to trigger the MCP business model to perform multi-table queries and aggregation calculations on device operating parameters as needed, and obtains the corresponding structured energy consumption data.
[0016] The Agent component combines the structured energy consumption data returned by MCP with the prompt word template, and then passes the combined data to the large language model to output a Markdown report.
[0017] Visualize or export Markdown reports directly to a web page to perform building energy consumption analysis.
[0018] According to some embodiments, the present disclosure adopts the following technical solutions:
[0019] A building energy consumption analysis system based on the MCP business model and intelligent agents includes:
[0020] The MCP business capability layer module is used to build and encapsulate the MCP business model, and then abstract it into a standardized function interface.
[0021] The storage module is used to acquire the operating equipment and its operating parameters in the building, and to preprocess them; the preprocessed operating parameters are then input into the MCP business model storage.
[0022] The intelligent agent scheduling and computing module is used by the Agent component to obtain user input requests, identify the task intent in the input requests, and convert the task intent into specific API calls. The API calls the MCP function interface to trigger the MCP business model to perform multi-table queries and aggregation calculations on device operating parameters as needed, and obtain the corresponding structured energy consumption data.
[0023] The large language model module is used by the Agent component to combine the structured energy consumption data returned by MCP with the prompt word template, and then pass the combined data to the large language model to output a Markdown report.
[0024] The visualization report generation module is used to visualize or export Markdown reports directly on a web page, enabling the building energy consumption analysis process.
[0025] According to some embodiments, the present disclosure adopts the following technical solutions:
[0026] A computer program product includes a computer program that, when executed by a processor, implements the building energy consumption analysis method based on the MCP business model and intelligent agent.
[0027] According to some embodiments, the present disclosure adopts the following technical solutions:
[0028] A non-transitory computer-readable storage medium is provided for storing computer instructions, which, when executed by a processor, implement the building energy consumption analysis method based on the MCP business model and intelligent agent.
[0029] According to some embodiments, the present disclosure adopts the following technical solutions:
[0030] An electronic device includes a processor, a memory, and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory to enable the electronic device to implement the building energy consumption analysis method based on the MCP business model and intelligent agent.
[0031] Compared with the prior art, the beneficial effects of this disclosure are as follows:
[0032] This disclosure presents a building energy consumption analysis method based on the MCP business model and intelligent agents, constructing a business modeling mechanism for building energy systems. It encapsulates typical analysis scenarios, unifies interface semantics and data call methods, designs multiple agent workflows to adapt to different types of energy consumption analysis tasks, and achieves automatic scheduling of the entire process of task parsing, data call, and model inference. It also enables automatic report and chart generation capabilities driven by structured data, outputting Markdown format mixed text and graphics documents, improving the system's intelligence, adaptability, and integration capabilities, and achieving fully automatic generation from structured energy consumption data to natural language text reports and charts (Mermaid, ECharts).
[0033] This disclosure presents a building energy consumption analysis method based on the MCP business model and intelligent agents. It abstracts typical business requirements and data query processes in building energy consumption scenarios, and encapsulates and implements multiple function-level service interfaces for energy consumption analysis based on the MCP interface protocol. Each function corresponds to a high-frequency energy consumption query or control scenario, exhibiting high domain adaptability. These interfaces are not simple data queries, but rather encapsulate complex multi-table relationships and business logic (such as energy efficiency calculation and anomaly diagnosis) into atomic business capabilities. These interfaces and algorithms together constitute a semantically stable "business capability layer" strongly correlated with building topology, providing reliable semantic anchors for upper-layer applications and solving the instability problem when large models directly generate SQL in complex heterogeneous data environments.
[0034] This disclosure presents a building energy consumption analysis method based on the MCP business model and intelligent agents. It introduces an energy consumption data semantic aggregation algorithm to automatically identify building topological relationships, achieving dynamic aggregation, unit unification, and outlier correction of energy consumption data, providing high-confidence input for subsequent analysis. Furthermore, it introduces a model result feedback learning mechanism. This mechanism comprehensively scores the report and chart results output by the large language model based on structural integrity, semantic consistency, and visualization correctness, achieving adaptive optimization based on result feedback. When the generated result score is below a threshold, the system automatically adjusts the prompt word parameters and triggers secondary generation, thus forming a closed-loop learning system of "generation—evaluation—optimization," continuously improving the accuracy, logic, and domain relevance of the report content. Attached Figure Description
[0035] The accompanying drawings, which form part of this disclosure, are used to provide a further understanding of this disclosure. The illustrative embodiments of this disclosure and their descriptions are used to explain this disclosure and do not constitute an undue limitation of this disclosure.
[0036] Figure 1 This is an implementation architecture diagram of the building energy consumption analysis method based on the MCP business model and intelligent agent according to an embodiment of this disclosure;
[0037] Figure 2This is a schematic diagram of the system architecture of an embodiment of this disclosure;
[0038] Figure 3 This is a flowchart illustrating the calling process of an embodiment of this disclosure;
[0039] Figure 4 This is a business process diagram of an embodiment of the present disclosure;
[0040] Figure 5 This is a flowchart of the Agent process according to an embodiment of this disclosure;
[0041] Figure 6 Flowchart of a self-correcting algorithm for generating graphs according to embodiments of this disclosure
[0042] Figure 7 This is an overall flowchart of the building energy consumption analysis method based on the MCP business model and intelligent agent according to an embodiment of the present disclosure;
[0043] Figure 8 This is a diagram of the energy consumption data semantic aggregation algorithm in an embodiment of this disclosure;
[0044] Figure 9 This is a sequence diagram of the collaboration between the agent and the large language model (LLM) in an embodiment of this disclosure;
[0045] Figure 10 This is a diagram of the model result feedback learning mechanism in an embodiment of this disclosure. Detailed Implementation
[0046] The present disclosure will be further described below with reference to the accompanying drawings and embodiments.
[0047] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of this disclosure. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure pertains.
[0048] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this disclosure. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms “comprising” and / or “including” are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0049] Example 1
[0050] One embodiment of this disclosure provides a building energy consumption analysis method based on an MCP business model and intelligent agents, the method steps of which include:
[0051] Step 1: Build and encapsulate the MCP business model, and then abstract it into a standardized function interface;
[0052] Step 2: Obtain the operating equipment and its operating parameters in the building, and preprocess them; input the preprocessed equipment operating parameters into the MCP business model storage;
[0053] Step 3: The Agent component obtains user input requests, identifies the task intent in the input requests, and converts the task intent into specific API calls. The API calls the MCP function interface to trigger the MCP business model to perform multi-table queries and aggregation calculations on device operating parameters as needed, and obtains the corresponding structured energy consumption data.
[0054] Step 4: The Agent component combines the structured energy consumption data returned by MCP with the prompt word template, and then passes the combined data to the large language model to output a Markdown report.
[0055] Step 5: Visualize or export the Markdown report directly on a web page to complete the building energy consumption analysis process.
[0056] As one embodiment, this disclosure presents a building energy consumption analysis method based on an MCP business model and intelligent agents. Specifically, it involves a method and system for automatically generating building energy consumption analysis reports by combining Model Context Protocol (MCP), intelligent agents, and Large Language Model (LLM). By constructing a domain-specific business capability interface layer and an intelligent process scheduling layer, it achieves fully automated generation of structured reports containing natural language analysis and visualization charts from complex building energy consumption data. The specific implementation process is as follows:
[0057] Step 1: Build and encapsulate the MCP business model, and then abstract it into a standardized function interface;
[0058] This disclosure abstracts typical business requirements and data query processes in building energy consumption scenarios. Based on the MCP interface protocol, it encapsulates complex database table structures and topological logic to construct an MCP business model and implements multiple function-level service interfaces for energy consumption analysis. Each function corresponds to a high-frequency energy consumption query or control scenario, exhibiting high domain adaptability. These interfaces are not simple data queries, but rather encapsulate complex multi-table relationships and business logic (such as energy efficiency calculation and anomaly diagnosis) into atomic business capabilities.
[0059] Specifically, this disclosure encapsulates and designs multiple standardized MCP function interfaces around key query requirements in building energy consumption scenarios. Each interface corresponds to an analysis dimension or topology level, including but not limited to: plant query interface (selectChangZhanList), equipment type and equipment list interface (selectDeviceTypeList, selectDeviceList), equipment parameter query interface (selectDevicePramList), time series data query interface (selectProcessDataList), and high-level business capability interfaces (such as getTemperatureDiff, queryBranchEnergy, getDeviceStatus, getTopoStructure).
[0060] Among them, the plant / site query interface (selectChangZhanList) takes optional query conditions (such as region or name) as input and outputs a set of plant / site / building identifiers and names;
[0061] The device type and device list interfaces (selectDeviceTypeList, selectDeviceList) take plant or device type identifiers as inputs and output the corresponding device type and device list information.
[0062] Device parameter query interface (selectDevicePramList): The input is the device type or device identifier, and the output is a list of parameters for the device (including parameter identifier, semantic name and data type).
[0063] Time series data query interface (selectProcessDataList): The input is a time range and a parameter list, and the output is an aligned array of time series data;
[0064] Advanced business capability interfaces (such as getTemperatureDiff, queryBranchEnergy, getDeviceStatus, getTopoStructure): The input is the building / equipment identifier and time range, and the output is the statistical energy consumption difference, branch energy consumption sequence, operating status or topology information.
[0065] This public interface system abstracts energy consumption scenarios into function-level call semantics. After the standardized function interface is called, the MCP business model is used to complete multi-table queries, aggregations and calculations internally, converting the input device operating parameters into semantically clear structured energy consumption data, providing a stable structured input for subsequent model inference and visualization output.
[0066] Step 2: Obtain the operating equipment and its operating parameters in the building, and preprocess them; input the preprocessed equipment operating parameters into the MCP business model storage;
[0067] Specifically, during building operation, energy consumption data collection devices such as chiller / heater units, circulating pumps, electricity meters, and air conditioning subsystems generate operating parameters (temperature, flow rate, electricity metering, start / stop signals, etc.) in real time, and these data are first stored in a database.
[0068] The MCP server encapsulates complex database table structures and topological logic, abstracting them into standardized function interfaces such as selectChangZhanList, selectDeviceList, getTemperatureDiff, and queryBranchEnergy. These interfaces internally perform multi-table queries, aggregations, and calculations, transforming the input raw energy consumption data collection points into semantically clear structured results (such as plant / station lists, branch energy consumption curves, and equipment operating status).
[0069] Step 3: The Agent component obtains the user input request, identifies the task intent in the input request, and converts it into a specific API call based on the task intent. The API calls the MCP function interface to trigger the MCP business model to perform multi-table queries and aggregation calculations on the device operating parameters as needed, and obtains the corresponding structured energy consumption data.
[0070] The MCP-encapsulated functionality is exposed via an HTTP service, forming a RESTful API. Agent components can call these interfaces via standard HTTP requests to retrieve energy consumption data for a specific building, device, or time period as needed. The HTTP service also serves as a secure relay and decoupling mechanism.
[0071] The MCP-encapsulated interfaces provide services externally via HTTP / REST style. Agents or external business systems can call these APIs to obtain energy consumption data. The HTTP service's responsibility is to receive request parameters (such as building identifier, equipment type, and time range), call the MCP layer to complete aggregation and calculation data processing, and return structured JSON results in a unified format. Service functions cover "plant / building information query," "equipment and parameter retrieval," "energy consumption time series data acquisition," and "topology and operation status query," but are not limited to specific path formats. The HTTP client component has the ability to perform HTTP communication. As an HTTP client, it can actively initiate data requests to the HTTP service and receive the returned result data from the HTTP server. The HTTP client component requires configuration of the HTTP service address, HTTP operation type, and timeout duration. The parameters passed to this communication node are custom prompt words and specific query statements.
[0072] Specifically, the Agent component internally implements an HTTP client component for communicating with the API exposed by the MCP. The Agent component receives input request parameters from users or business systems, identifies the task intent in the input request, and converts it into a specific API call.
[0073] Furthermore, the Agent component is the core of intelligent scheduling. Upon receiving natural language input or business instructions, the Agent component first identifies the task intent:
[0074] The task intents include energy consumption analysis report type and chart generation type. When it is an energy consumption analysis report type task intent, the Agent component calls the MCP function interface to obtain topology and energy consumption data in batches; when it is a chart generation type task intent, the Agent component calls the MCP function interface to obtain comparison type or time series type data.
[0075] Subsequently, the Agent component binds the query results with the prompt word template to generate input suitable for passing to the large language model.
[0076] As one embodiment, the Agent component receives input request parameters from users or business systems, identifies the task intent in the input request, and converts it into a specific API call. The specific process includes:
[0077] From system startup, the system first displays prompts to guide the user through a dialogue. Based on the user's input, a pre-trained large model determines the question type. If the question concerns chart generation, the system proceeds to the chart data query step, sending an HTTP request to the specified data source via the Agent component's communication node to retrieve the required chart data. Similarly, if the question concerns data analysis needs, the system proceeds to the analysis data query step, where the Agent communication node also queries and receives the necessary data. Once the data is returned, if it's a chart generation task, a chart is generated based on the retrieved data; if it's a data analysis task, a report is generated based on the queried data. Finally, both the generated chart and the report are displayed to the user through the interface, completing the entire interaction process, and then the process ends. Throughout this process, the Agent component's communication node exchanges information with the HTTP service to ensure that the data needed to generate the chart or report is obtained.
[0078] Furthermore, when the business model is called by the API / Agent, it triggers the aggregation calculation of runtime parameters on demand. When the Agent initiates an API call based on the user's task intent, the standardized function interface of the MCP layer will perform multi-table queries, topology parsing, and aggregation calculations during the call phase to generate structured energy consumption data.
[0079] Specifically, an energy consumption data semantic aggregation algorithm is introduced into the business model. Using building topology as the core, a data semantic graph is constructed. By automatically identifying the hierarchical relationships between power plants, equipment, branches, and measuring points, dynamic aggregation and unit-normalized calculation of energy consumption data are achieved. The algorithm also includes anomaly detection and interpolation repair modules, which can automatically discover and repair missing or abrupt values in multi-source heterogeneous sampling data, thereby generating high-confidence structured energy consumption data results.
[0080] As one example, the energy consumption data semantic aggregation algorithm aims to solve problems such as diverse sources of building energy consumption data, complex topological relationships, and semantic inconsistencies. By automatically identifying the hierarchical relationships of building systems, it achieves unified modeling and dynamic aggregation of energy consumption data.
[0081] The core idea of this algorithm is to construct a graph structure model based on building topology, where entities such as plants, equipment, branches, and measuring points are represented. Nodes represent energy-consuming equipment, and edges represent energy flow directions and logical connections. The algorithm first automatically extracts the hierarchical dependencies between entities from the metadata tables of equipment and measuring points in the database, constructing a topology hierarchy mapping table. Then, for different query intentions (such as aggregation by branch, by building, or by equipment), the algorithm adaptively determines the aggregation granularity and aggregation path, automatically generating the corresponding aggregation expression.
[0082] During the aggregation process, the algorithm performs semantic normalization on various energy consumption data (electricity, heating / cooling, flow, pressure, etc.), and standardizes calculations for different units, sampling periods, and time series resolutions to ensure that data from different sources can be measured uniformly. Simultaneously, to guarantee data reliability, the algorithm introduces an anomaly detection mechanism, smoothing, interpolating, or removing missing or abrupt values, thereby outputting high-confidence structured energy consumption indicators.
[0083] Through this semantic aggregation algorithm, the MCP layer can automatically identify the energy consumption hierarchy relationship based on the topology, generate semantically consistent and aggregable energy consumption data, and provide stable and consistent data input for the upper-layer Agent module and large model inference, fundamentally solving the problems of structural coupling, semantic ambiguity and unstable aggregation in the traditional SQL query mode.
[0084] Step 4: The Agent component combines the structured energy consumption data returned by MCP with the prompt word template, and then passes the combined data to the large language model to output a Markdown report.
[0085] Specifically, after obtaining the structured energy consumption data returned by MCP, the Agent assembles prompt words according to the task type and calls the Large Language Model (LLM):
[0086] For reporting tasks, prompt words guide the Large Language Model (LLM) to generate report text that includes building identifiers, time ranges, trend summaries, and control recommendations.
[0087] For charting tasks, the cue words require the Large Language Model (LLM) to output chart configurations that conform to ECharts or Mermaid syntax.
[0088] As one example, a key step in generating charts using a large language model is designing appropriate prompts to enable the pre-trained large language model to generate energy consumption analysis charts and reports in the required format. Specific prompts have been designed for generating charts and reports in ECharts and Mermaid formats. The requirements for prompts and chart generation include:
[0089] 1. When configuring chart generation for large models, the following constraints must be met: the output should be in standard JSON or Mermaid format, conform to the corresponding rendering syntax, and have no comments or non-standard fields.
[0090] 2. All values must be presented in full, without using scientific notation or arbitrary rounding, and must be consistent with the original data.
[0091] 3. Charts must include all necessary elements: title, legend, x / y axis, data series, and data labels if necessary.
[0092] 4. For cases with a large number of data points, the prompt should require automatic rotation or compression of the labels to ensure readability.
[0093] 5. Embed these chart configurations in the output Markdown document so that they can be displayed directly on the front end or in the renderer.
[0094] Furthermore, examples of the designed prompts are as follows:
[0095] ECharts format energy consumption analysis chart prompts:
[0096] Please generate a JSON configuration that fully conforms to the ECharts specification. Requirements:
[0097] 1. Formatting Guidelines:
[0098] (1) Strictly valid JSON format;
[0099] (2) All key names should be enclosed in double quotes;
[0100] (3) Comments / functions / non-JSON content are prohibited;
[0101] 2. Data Representation:
[0102] (1) Display all data points completely;
[0103] (2) Number format requirements;
[0104] (3) Scientific notation (such as 0.1 instead of 1e-1) is prohibited.
[0105] (4) The complete value must be displayed (e.g., 422194.78).
[0106] (5) There must be digits before and after the decimal point (0.78, not 0.78). );
[0107] (6) The original data must be presented accurately, and no modification or rounding is allowed;
[0108] 3. Dynamic configuration:
[0109] (1) xAxis automatic detection:
[0110] (2) When there are ≥10 data points, add "axisLabel": {"rotate": 30}
[0111] (3) This configuration is omitted if there are less than 10 data points.
[0112] 4. A complete structure that must be included;
[0113] Furthermore, to address potential issues such as grammatical errors, structural omissions, and chart type mismatches that may exist when large language models generate energy consumption chart configurations (ECharts / Mermaid), this disclosure proposes a self-correcting chart generation algorithm module. This algorithm, serving as a post-processing step after the model output, ensures that the generated visualization configuration can be directly rendered in terms of both syntax and semantics. The algorithm comprises three main steps:
[0114] Step 1: Syntax Structure Detection. The algorithm performs step-by-step validation on the JSON or Mermaid structure output by the LLM, including quotation mark matching, key-value pair integrity, bracket closure, etc. When format abnormalities are detected, it automatically corrects or completes missing fields, such as completing key nodes like title.text, xAxis.type, and series.data.
[0115] Step 2: Chart semantic consistency verification. The algorithm determines whether the chart type matches the data structure (time series or categorical series) returned by MCP. When a data type is found to be inconsistent with the chart configuration (e.g., time series data corresponds to a pie chart), it is automatically replaced with the optimal chart type (e.g., line chart or bar chart).
[0116] Step 3: Self-feedback secondary generation mechanism. If rendering errors still exist after correction, the system automatically triggers a secondary prompt word generation process, feeding back the detected anomalies to the Agent module and dynamically adjusting the prompt word template (such as "Please output a standard JSON format line chart configuration") to ensure that the final output meets the rendering specifications.
[0117] Through the above three-step process, the chart generation self-correction algorithm achieves automatic detection and self-repair of model output without manual intervention, enabling the generated charts to have stable and reliable performance in terms of format correctness and content rationality, significantly improving the automation level of the system and the professional level of report generation.
[0118] Step 5: Visualize or export the Markdown report directly on a web page to complete the building energy consumption analysis process.
[0119] The report results generated by the large language model are output in Markdown document format, which includes natural language analysis and chart configurations. The final results can be displayed directly on the front end or exported as PDF / Word reports. The system supports local or cloud deployment and can be integrated with external business platforms via API.
[0120] Furthermore, this disclosure can be deployed on a local server or in a private cloud environment, and is divided into an MCP data access layer, an HTTP relay layer, an Agent scheduling layer, a large language model generation layer, and a visualization report layer. Each module can be implemented using common backend languages and database technologies, but the specific implementation language and framework are engineering details and are not intended to limit the invention.
[0121] To achieve self-optimization and continuous learning in the energy consumption analysis report generation process, this disclosure proposes a model result feedback learning mechanism for automatic quality assessment and adaptive optimization of reports and charts generated by a large language model. This mechanism constitutes a closed-loop intelligent learning system from "data input—model generation—result feedback—prompt word update".
[0122] The mechanism consists of three core components:
[0123] First, the system outputs a quality assessment model. It performs structured parsing of the Markdown report output by the LLM (Local Management Module) and calculates a comprehensive score based on four dimensions: report completeness (whether it includes architectural identifiers, timeframes, trend summaries, and control recommendations), language standardization, data citation consistency, and visualization accuracy.
[0124] Secondly, the feedback optimization strategy automatically records the error type and context parameters when the evaluation score falls below a set threshold, forming a "generated feedback sample." This sample is used to update the prompt word template and task parameters, such as strengthening the timing description, correcting the unit expression, or optimizing the control suggestion logic.
[0125] Finally, there is multi-round adaptive generation. For low-scoring tasks, the system automatically triggers a secondary generation process. The new round of prompts will refer to the correction information in the feedback samples and adjust the generation strategy, thereby continuously improving the generation quality.
[0126] This feedback learning mechanism enables the system to self-evolve. As task samples accumulate, the reports generated by the model gradually improve in terms of structural completeness, semantic accuracy, and business relevance. This mechanism not only enhances the intelligence level of report generation but also forms a continuously optimizing knowledge loop at the system level, significantly strengthening the intelligent collaborative features and algorithmic innovation of the invention.
[0127] As one embodiment, the execution flow of the building energy consumption analysis method based on the MCP business model and intelligent agent disclosed herein includes:
[0128] 1. A user or business system initiates a building energy consumption analysis request, such as "Generate an energy consumption trend report for XX Building over the past month";
[0129] 2. Upon receiving the request, the Agent automatically identifies the intent (such as a report or chart) and extracts parameters such as building number and time range;
[0130] 3. The Agent calls the MCP interface via an HTTP request. The MCP encapsulates complex database queries and returns structured energy consumption data.
[0131] 4. The agent combines the data returned by the MCP with the prompt word template and then passes it to the large language model;
[0132] 5. The large language model generates a Markdown report based on the input, which includes natural language analysis and ECharts / Mermaid chart configuration;
[0133] 6. The generated Markdown document can be displayed directly on a web page or exported as a PDF / Word report, achieving complete delivery.
[0134] Example 2
[0135] One embodiment of this disclosure provides a building energy consumption analysis system based on an MCP business model and intelligent agents, including:
[0136] The MCP business capability layer module is used to build and encapsulate the MCP business model, and then abstract it into a standardized function interface.
[0137] The storage module is used to acquire the operating equipment and its operating parameters in the building, and to preprocess them; the preprocessed operating parameters are then input into the MCP business model storage.
[0138] The intelligent agent scheduling and computing module is used by the Agent component to obtain user input requests, identify the task intent in the input requests, and convert the task intent into specific API calls. The API calls the MCP function interface to trigger the MCP business model to perform multi-table queries and aggregation calculations on device operating parameters as needed, and obtain the corresponding structured energy consumption data.
[0139] The large language model module is used by the Agent component to combine the structured energy consumption data returned by MCP with the prompt word template, and then pass the combined data to the large language model to output a Markdown report.
[0140] The visualization report generation module is used to visualize or export Markdown reports directly on a web page, enabling the building energy consumption analysis process.
[0141] Example 3
[0142] One embodiment of this disclosure provides a computer program product, including a computer program that, when executed by a processor, implements the building energy consumption analysis method based on the MCP business model and intelligent agent.
[0143] Example 4
[0144] One embodiment of this disclosure provides a non-transitory computer-readable storage medium for storing computer instructions. When these computer instructions are executed by a processor, they implement the building energy consumption analysis method based on the MCP business model and intelligent agent.
[0145] Example 5
[0146] One embodiment of this disclosure provides an electronic device, including: a processor, a memory, and a computer program; wherein the processor is connected to the memory, and the computer program is stored in the memory. When the electronic device is running, the processor executes the computer program stored in the memory to enable the electronic device to implement the building energy consumption analysis method based on the MCP business model and intelligent agent.
[0147] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0148] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0149] While the specific embodiments of this disclosure have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of this disclosure. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of this disclosure are still within the scope of protection of this disclosure.
Claims
1. A building energy consumption analysis method based on MCP business model and intelligent agent, characterized in that, include: Build and encapsulate the MCP business model, and then abstract it into a standardized function interface. The process of constructing and encapsulating the MCP business model, and then abstracting it into a standardized function interface, includes: The MCP layer encapsulates complex database table structures and topological logic to build the MCP business model, and abstracts it into standardized function interfaces. The standardized function interfaces include plant query interfaces, equipment type and equipment list interfaces, equipment parameter query interfaces, time series data query interfaces, and high-level business capability interfaces. After the standardized function interface is called, the MCP business model is used to perform multi-table queries, aggregations and calculations internally, and convert the input device operating parameters into semantically clear structured energy consumption data. Acquire the operating equipment and its operating parameters in the building, and preprocess them; input the preprocessed operating parameters into the MCP business model storage; The Agent component obtains user input requests, identifies the task intent in the input requests, and converts the task intent into specific API calls. The API calls the MCP function interface to trigger the MCP business model to perform multi-table queries and aggregation calculations on device operating parameters as needed, and obtains the corresponding structured energy consumption data. An energy consumption data semantic aggregation algorithm is introduced to complete multi-table queries and aggregation calculations, resulting in structured energy consumption data, which is then stored. Based on the building topology, the entities of plant, equipment, branch road, and measuring point are constructed into a graph structure model. Nodes represent energy-consuming equipment, and edges represent energy flow direction and logical association. First, based on the metadata table of equipment and measuring points in the database, the hierarchical dependency relationship between entities is automatically extracted to construct a topology hierarchy mapping table. For different query intentions, the aggregation granularity and aggregation path are determined, and the corresponding aggregation expression is automatically generated. During the aggregation process, semantic normalization is performed on various types of energy consumption data, and standardized calculations are performed on different units, sampling periods, and time series resolutions to ensure that data from different sources are uniformly measured and to output high-confidence structured energy consumption data. The Agent component combines the structured energy consumption data returned by MCP with the prompt word template, and then passes the combined data to the large language model to output a Markdown report. Visualize or export Markdown reports directly to a web page to perform building energy consumption analysis.
2. The building energy consumption analysis method based on MCP business model and intelligent agent as described in claim 1, characterized in that, The Agent component acquires user input requests, identifies the task intent in the input requests, and converts the task intent into specific API calls, including: The Agent component internally implements an HTTP client component for communicating with the API exposed by the MCP. The Agent component receives input request parameters from users or business systems, identifies the task intent in the input request, and converts it into a specific API call. The task intents include energy consumption analysis report type and chart generation type. When it is an energy consumption analysis report type task intent, the Agent component calls the MCP function interface to obtain topology and energy consumption data in batches; when it is a chart generation type task intent, the Agent component calls the MCP function interface to obtain comparison type or time series type data.
3. The building energy consumption analysis method based on MCP business model and intelligent agent as described in claim 1, characterized in that, The Agent component combines the structured energy consumption data returned by MCP with the prompt word template, including: After obtaining the data returned by the MCP layer, the Agent component assembles prompt words according to the task type; For the reporting task, the prompt words guide the Large Language Model (LLM) to generate report text that includes building identifiers, time ranges, trend summaries, and control recommendations. For charting tasks, the prompts require the Large Language Model (LLM) to output chart configurations that conform to ECharts or Mermaid syntax.
4. The building energy consumption analysis method based on MCP business model and intelligent agent as described in claim 1, characterized in that, The structured energy consumption data and prompt word templates are combined and fed into a large language model, outputting a Markdown report, including: The large language model analyzes structured energy consumption data and prompt word templates, and generates natural language and visualization configurations, outputting report text and chart configurations. Among them, the chart generation self-correction algorithm is used to correct the grammatical errors, structural omissions and chart type mismatches in the large language model when generating energy consumption chart configurations. This includes grammatical structure detection, chart semantic consistency verification and a self-feedback secondary generation mechanism.
5. A building energy consumption analysis system based on MCP business model and intelligent agent, using the building energy consumption analysis method based on MCP business model and intelligent agent as described in any one of claims 1-4, characterized in that, include: The MCP business capability layer module is used to build and encapsulate the MCP business model, and then abstract it into a standardized function interface. The storage module is used to retrieve the operating equipment and its operating parameters in the building, and to preprocess them. Input the preprocessed equipment operating parameters into the MCP business model storage; The intelligent agent scheduling and computing module is used by the Agent component to obtain user input requests, identify the task intent in the input requests, and convert the task intent into specific API calls. The API calls the MCP function interface to trigger the MCP business model to perform multi-table queries and aggregation calculations on device operating parameters as needed, and obtain the corresponding structured energy consumption data. The large language model module is used by the Agent component to combine the structured energy consumption data returned by MCP with the prompt word template, and then pass the combined data to the large language model to output a Markdown report. The visualization report generation module is used to visualize or export Markdown reports directly on a web page, enabling the building energy consumption analysis process.
6. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the building energy consumption analysis method based on the MCP business model and intelligent agent as described in any one of claims 1-4.
7. A non-transitory computer-readable storage medium, characterized in that, The non-transitory computer-readable storage medium is used to store computer instructions, which, when executed by a processor, implement the building energy consumption analysis method based on the MCP business model and intelligent agent as described in any one of claims 1-4.
8. An electronic device, characterized in that, include: The device includes a processor, a memory, and a computer program; wherein the processor is connected to the memory, the computer program is stored in the memory, and when the electronic device is running, the processor executes the computer program stored in the memory to enable the electronic device to perform the building energy consumption analysis method based on the MCP business model and intelligent agent as described in any one of claims 1-4.