A Microgrid Intelligent Dispatch Method and System Based on AI Large Model

By adopting an AI-based large-scale model-based intelligent dispatching method for microgrids, and combining data acquisition, LoRA fine-tuning, and knowledge graph enhancement technologies, and utilizing Lyapunov function and control barrier function theories, a safety constraint and sparse matrix optimization algorithm is designed to solve the problems of low safety and efficiency in microgrid dispatching, and achieve fast and robust real-time dispatching.

CN121012127BActive Publication Date: 2026-03-06GUIZHOU ANRONG TECH DEV CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511535421.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-27
Publication Date
2026-03-06
Estimated Expiration
2045-10-27

AI Technical Summary

Technical Problem

Existing microgrid scheduling methods lack security guarantees for the scheduling process. In particular, they are unable to ensure the absolute safety of system operation when facing abnormal situations such as equipment failure and load changes. Furthermore, traditional optimization algorithms suffer from slow convergence speed and are prone to getting trapped in local optima, failing to meet the strict time requirements of real-time scheduling.

Method used

A microgrid intelligent scheduling method based on AI large model is adopted. By collecting and processing data from photovoltaic power plants, wind farms, loads and the environment, a standardized dataset is constructed. Combining LoRA fine-tuning and knowledge graph enhancement technology, safety constraints are designed using Lyapunov function and control barrier function theory. The extreme value control strategy of real-time scheduling parameters is generated by using sparse matrix binary decision and gradient-Newton hybrid optimization algorithm. Real-time monitoring and scheduling are carried out through edge computing.

Benefits of technology

It achieves robust scheduling in the face of uncertain interference, ensuring the absolute safety and rapid convergence of system operation, meeting the stringent requirements of real-time scheduling, and improving scheduling quality and response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121012127B_ABST
    Figure CN121012127B_ABST
Patent Text Reader

Abstract

This invention discloses a microgrid intelligent scheduling method and system based on an AI large-scale model, comprising: collecting and processing real-time output data from photovoltaic power plants and wind farms to obtain a standardized microgrid operation dataset; establishing a discrete-time microgrid dynamic model and using the recursive least squares method for online estimation of system parameters to obtain a robust scheduling scheme for uncertain disturbances; and combining real-time operation status monitoring with the deployment of edge computing nodes for real-time microgrid intelligent scheduling. This invention combines Lyapunov stability theory with control barrier functions to construct a secure reinforcement learning framework for microgrid scheduling, ensuring the absolute safety of system operation during the scheduling process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of power systems and artificial intelligence, and in particular to a microgrid intelligent dispatching method and system based on a large AI model. Background Technology

[0002] As a crucial component of distributed energy systems, microgrids integrate various energy sources, including photovoltaic power generation, wind power generation, energy storage devices, and combined heat and power (CHP) units, enabling autonomous management and optimized dispatch of local energy resources. With the increasing penetration rate of renewable energy and the ever-growing demands for power supply reliability from users, microgrid intelligent dispatch technology has become one of the key technologies for the development of modern power systems.

[0003] Existing microgrid scheduling methods mainly include scheduling techniques based on traditional optimization algorithms and scheduling techniques based on machine learning. While traditional methods such as linear programming and mixed-integer programming can handle multi-constraint optimization problems, they suffer from low solution efficiency and local optima issues when facing complex nonlinear constraints and multi-objective optimization. Scheduling methods based on heuristic algorithms such as genetic algorithms and particle swarm optimization can handle nonlinear problems, but their slow convergence speed makes them difficult to meet the requirements of real-time scheduling.

[0004] In recent years, deep learning-based microgrid scheduling methods have been developed, enabling faster scheduling decisions by learning patterns from historical scheduling data through neural networks. However, these methods rely heavily on historical data training, resulting in poor adaptability to new operating scenarios and a lack of stringent guarantees for scheduling safety. While existing reinforcement learning scheduling methods possess online learning capabilities, they may generate unsafe scheduling actions during the exploration process, leading to system operational risks.

[0005] The main problems with existing technologies are: first, they lack strict mathematical guarantees for the safety of the scheduling process, especially when facing abnormal situations such as equipment failure and sudden load changes, it is difficult to ensure the absolute safety of system operation; second, in high-dimensional scheduling parameter spaces, traditional optimization algorithms have the problems of slow convergence speed and easy to get trapped in local optima, which cannot meet the strict time requirements of real-time scheduling. Summary of the Invention

[0006] The purpose of this invention is to provide a microgrid intelligent scheduling method and system based on an AI large model, which aims to solve the problems of lack of security guarantee and low optimization efficiency in existing microgrid scheduling methods.

[0007] To achieve the above objectives, this invention provides a microgrid intelligent scheduling method based on an AI large model, comprising the following steps:

[0008] Real-time power output data from photovoltaic power plants and wind farms, real-time power data from residential, commercial, and industrial loads, energy storage device capacity and charging / discharging efficiency data, and environmental data are collected and processed to obtain a standardized microgrid operation dataset. Based on this standardized microgrid operation dataset and knowledge of microgrid scheduling, a pre-trained large-scale model is fine-tuned using LoRA fine-tuning technology, and expert knowledge is embedded into the model inference process using knowledge graph enhancement technology to obtain a suitable AI large-scale model scheduling engine. Using this AI large-scale model scheduling engine, combined with Lyapunov function and control barrier function theory, a safety constraint term is obtained by constructing Lyapunov candidate functions to describe the stability of the microgrid system, designing control barrier functions to constrain the system's operational safety boundary, and introducing safety constraints during the gradient update process of the reinforcement learning strategy. A scheduling strategy optimization method under security constraints is proposed. This method models a sparse matrix binary decision-making process, transforming the microgrid scheduling problem into a sparse matrix binary decision-making process. A gradient-Newton hybrid optimization algorithm is incorporated into this binary decision-making process, along with unit vector extreme value distance control technology, to generate an extreme value control strategy for real-time scheduling parameters. Based on this extreme value control strategy and a discrete-time control barrier function certificate, a robust scheduling scheme for uncertain disturbances is obtained by establishing a discrete-time microgrid dynamic model, designing a control barrier function certificate mechanism, using recursive least squares for online estimation of system parameters, and establishing a robust guarantee mechanism. Finally, based on this robust scheduling scheme and combined with real-time operational status monitoring, real-time intelligent microgrid scheduling is achieved by deploying edge computing nodes.

[0009] In one embodiment of the present invention, real-time power output data of photovoltaic power plants and wind farms, real-time power data of residential, commercial and industrial loads, capacity and charge / discharge efficiency data of energy storage devices, and environmental data are collected and processed to obtain a standardized microgrid operation dataset. This includes: deploying distributed data acquisition terminals to collect real-time power output data and 24-hour forecast data of photovoltaic power plants and wind farms at a frequency of once every 15 minutes to obtain renewable energy output data; collecting real-time power data of residential, commercial and industrial loads, capacity and charge / discharge efficiency of energy storage devices, and the heat-to-power ratio of combined heat and power units through a smart meter network and equipment monitoring system to obtain load and equipment parameter data; and storing the renewable energy output data, load and equipment parameter data, and environmental data collected by a meteorological station network using a distributed file system and removing missing and outlier values ​​through a data cleaning algorithm, converting data of different formats into a unified JSON standard format and performing spatiotemporal alignment based on timestamps to obtain the standardized microgrid operation dataset.

[0010] In one embodiment of the present invention, based on the standardized microgrid operation dataset and microgrid scheduling domain knowledge, a pre-trained large model is fine-tuned using LoRA fine-tuning technology and expert knowledge is embedded into the model inference process using knowledge graph enhancement technology to obtain a suitable AI large model scheduling engine. This includes: selecting a preset pre-trained large model as the base model; collecting professional corpora containing microgrid scheduling procedures, equipment technical manuals, and historical scheduling cases to construct a domain dataset, obtaining a microgrid scheduling professional corpus; using LoRA technology to freeze the main parameters of the model and train only the low-rank adaptation matrix to reduce the computational complexity of fine-tuning, obtaining a domain-adapted pre-trained model; and performing knowledge graph enhancement on the domain-adapted pre-trained model to construct a knowledge graph containing equipment constraint rules, safe operation criteria, and scheduling logical relationships, embedding domain knowledge into the model inference process using knowledge enhancement technology to obtain the suitable AI large model scheduling engine.

[0011] In one embodiment of the present invention, the AI ​​large-scale model scheduling engine is utilized, combined with Lyapunov function and control barrier function theory, to obtain a scheduling strategy optimization method under safety constraints by constructing Lyapunov candidate functions to describe the stability of the microgrid system, designing control barrier functions to constrain the system's operational safety boundary, and introducing safety constraint terms during the reinforcement learning strategy gradient update process. This includes: using the AI ​​large-scale model scheduling engine to construct a system state vector containing the output of each power generation unit, the state of charge of energy storage devices, and the voltage and frequency of key nodes; and using a quadratic function form to construct Lyapunov candidate functions to describe the stability of the microgrid system. The algorithm employs a positive definite matrix to ensure the positive definiteness of the function. A control barrier function is designed to constrain the system's operational safety boundary. The control barrier function is formed by subtracting the safety margin parameter from the safety constraint conditions. The safety boundary constraints are determined using the Lyapunov candidate function and the control barrier function. For the safety boundary constraints, a safety constraint term is introduced into the policy network parameter update within the Actor-Critic algorithm framework. This ensures that each policy update satisfies the stability diminishing condition and the safety boundary non-negativity condition. The safety constraints are integrated into the reward function using the Lagrange multiplier method, resulting in a scheduling policy optimization method under the safety constraints.

[0012] In one embodiment of the present invention, the scheduling strategy optimization method under security constraints includes: constructing an augmented reward function that combines the original economic reward with a security constraint penalty term, wherein the security constraint penalty term includes a control barrier function violation penalty and a Lyapunov stability violation penalty; establishing a set of safe actions, defining a set of all feasible control actions that satisfy the non-negativity condition of the control barrier function; if an unsafe action is attempted during the scheduling strategy process, a quadratic programming method is used to automatically correct it to the nearest safe action, ensuring that the Euclidean distance between the corrected action and the desired action is minimized; and establishing a security monitoring mechanism to monitor in real time whether the microgrid state is approaching the safety boundary, and triggering an emergency security control protocol when the microgrid state approaches the danger zone, forcibly pulling the microgrid state back to the safe zone through a preset security control law.

[0013] In one embodiment of the present invention, a sparse matrix binary decision-making process is modeled using the scheduling strategy optimization method under the aforementioned safety constraints. This involves modeling the microgrid scheduling problem as a sparse matrix binary decision-making process, combining a gradient-Newton hybrid optimization algorithm with unit vector extreme value distance control technology within this process, and generating an extreme value control strategy for real-time scheduling parameters. This includes: defining the scheduling variable matrix as a zero-one matrix, where the number of rows represents the number of scheduling periods and the number of columns represents the number of controllable devices; storing the scheduling variable matrix using a compressed sparse row storage format and establishing a sparse matrix operation library to obtain a sparse matrix binary decision-making model; for the sparse matrix binary decision-making model, using a gradient descent method with driving forces to approximate the first convergence speed; switching to the Newton method to approximate the second convergence speed when the gradient norm is less than a threshold; after completing the second-order convergence approximation, obtaining the optimal search direction on the unit constraint sphere by solving the constraint optimization problem; transforming the n-dimensional search problem into an n-1-dimensional angle optimization problem using a spherical coordinate parameterization method; establishing an adaptive step size adjustment strategy; and obtaining the extreme value control strategy for the real-time scheduling parameters.

[0014] In one embodiment of the present invention, after completing the second-order convergent approximation, the optimal search direction on the unit constraint sphere is obtained by solving the constraint optimization problem. The n-dimensional search problem is transformed into an n-1-dimensional angle optimization problem using the spherical coordinate parameterization method. An adaptive step size adjustment strategy is established to obtain the extreme value control strategy of the real-time scheduling parameters. This includes: constructing a unit constraint sphere, defining a constraint sphere composed of all direction vectors with a L2 norm equal to 1, and finding the search direction on the constraint sphere that minimizes the gradient projection of the objective function; using the spherical coordinate parameterization method, representing the n-dimensional unit vector in the Cartesian coordinate system as a combination of trigonometric functions of n-1 angle parameters, and automatically satisfying the unit constraint conditions through the optimization of the angle parameters; designing a step size control function, adopting an exponential decay step size adjustment strategy, wherein the initial step size is determined according to the local curvature characteristics of the objective function, and the decay factor and decay period are dynamically adjusted according to the convergence performance of the optimization process; and establishing a step size restart mechanism, whereby when the improvement of the objective function in multiple consecutive iterations is less than a preset threshold, the step size is reset to a preset proportion of the initial value, thus obtaining the extreme value control strategy of the real-time scheduling parameters.

[0015] In one embodiment of the present invention, based on the extreme value control strategy of the real-time scheduling parameters and the discrete-time control barrier function certificate, a robust scheduling scheme oriented towards uncertain disturbances is obtained by establishing a discrete-time microgrid dynamic model, designing a control barrier function certificate mechanism, using recursive least squares method for online estimation of system parameters, and establishing a robustness guarantee mechanism. This includes: establishing the discrete-time microgrid dynamic model, in which the state at the next time step equals the system matrix multiplied by the current state plus the control matrix multiplied by the control input parameters plus the external disturbance parameters, wherein the system matrix and control matrix contain uncertain parameters; defining a discrete-time control barrier function to describe the system's safe operation constraints and constructing a control barrier function certificate to obtain a discrete-time safety constraint model; for the discrete-time safety constraint model, using recursive least squares method for online estimation of system parameters, adjusting the forgetting factor to adapt to the time-varying characteristics of the parameters and establishing parameter estimation error boundaries to obtain an adaptive parameter estimation mechanism; based on the adaptive parameter estimation mechanism, setting a conservative margin to address model uncertainty, using a robust optimization method to transform the scheduling problem into minimax optimization, establishing a confidence mechanism, and designing an adaptive control law to realize real-time scheduling strategy adjustment to obtain the robust scheduling scheme oriented towards uncertain disturbances.

[0016] In one embodiment of the present invention, the method further includes: deploying edge computing nodes at key nodes of the microgrid, establishing a real-time monitoring mechanism with a 15-minute scheduling cycle to continuously collect actual operating data of the microgrid and obtain real-time operating status data; based on the real-time operating status data, designing a state deviation detection algorithm to calculate the deviation between the actual operating status and the planned scheduling scheme in real time, and triggering the AI ​​big model to quickly regenerate the scheduling scheme when the deviation exceeds a preset threshold, thereby obtaining a dynamic scheduling adjustment mechanism; for the dynamic scheduling adjustment mechanism, establishing a scheduling effect evaluation system to periodically evaluate the economic, environmental, and reliability indicators of the scheduling scheme, and inputting the evaluation results as feedback data into the continuous learning process of the AI ​​big model to continuously improve scheduling accuracy and adaptability through online fine-tuning, thereby obtaining a continuously improving intelligent scheduling system.

[0017] This invention also provides a microgrid intelligent scheduling system based on an AI large model, comprising: a data acquisition module for collecting and processing real-time output data from photovoltaic power plants and wind farms, real-time power data from residential, commercial, and industrial loads, energy storage device capacity and charging / discharging efficiency data, and environmental data to obtain a standardized microgrid operation dataset; a fine-tuning module for fine-tuning a pre-trained large model using LoRA fine-tuning technology based on the standardized microgrid operation dataset and microgrid scheduling domain knowledge, and embedding expert knowledge into the model inference process using knowledge graph enhancement technology to obtain a suitable AI large model scheduling engine; and a strategy optimization module for utilizing the AI ​​large model scheduling engine, combined with Lyapunov function and control barrier function theory, to construct Lyapunov candidate functions to describe the stability of the microgrid system, design control barrier functions to constrain the system's operational safety boundaries, and optimize the strategy gradient update process during reinforcement learning. The process introduces a safety constraint term to obtain a scheduling strategy optimization method under safety constraints; a modeling module is used to model the sparse matrix binary decision process using the scheduling strategy optimization method under safety constraints. By modeling the microgrid scheduling problem as a binary decision process in sparse matrix form, and combining the gradient-Newton hybrid optimization algorithm with the unit vector extreme value distance finding control technology in the binary decision process, an extreme value control strategy for real-time scheduling parameters is generated; a stable scheduling module is used to obtain a robust scheduling scheme for uncertain disturbances based on the extreme value control strategy of the real-time scheduling parameters and the discrete-time control barrier function certificate. This is achieved by establishing a discrete-time microgrid dynamic model, designing a control barrier function certificate mechanism, using the recursive least squares method for online estimation of system parameters, and establishing a robustness guarantee mechanism; and an operation module is used to perform real-time intelligent microgrid scheduling by deploying edge computing nodes based on the robust scheduling scheme and real-time operation status monitoring.

[0018] This invention employs an edge computing architecture to push computing power down to key nodes of the microgrid, equipped with a real-time operating system and hardware accelerators, enabling millisecond-level real-time control response times and providing a hardware foundation for rapid response. Furthermore, this invention designs a layered architecture decoupled from the control and scheduling layers. The real-time control layer performs equipment output tracking at a frequency of seconds / milliseconds, independent of the optimization calculations of the scheduling planning layer, ensuring rapid response to system disturbances. Next, this invention innovatively proposes a hierarchical scheduling update strategy, employing response schemes of varying complexity based on the severity of deviations. Minor deviation scenarios, which account for 70-80% of daily operations, require only a second-level response, significantly exceeding standard requirements. Finally, the advanced technologies employed in this invention, such as AI large-model inference, sparse matrix optimization, and gradient-Newton hybrid algorithms, significantly improve computational efficiency, reducing the solution time for complex scheduling optimization problems from several minutes in traditional methods to seconds. Through these multi-layered and multi-dimensional technological innovations, this invention, while employing complex algorithms to ensure scheduling quality, fully meets the stringent real-time requirements of industry standards, achieving a perfect balance between scheduling quality and response speed.

[0019] The beneficial effects of this invention are:

[0020] By combining Lyapunov stability theory with control barrier functions, a security reinforcement learning framework for microgrid scheduling is constructed to ensure the absolute security of system operation during the scheduling process.

[0021] A scheduling parameter optimization method based on sparse matrix binary decision process is proposed. Combined with the unit vector extreme value distance finding control technique of gradient and Newton's method, fast convergence of high-dimensional scheduling space is achieved.

[0022] This paper innovatively applies discrete-time control barrier function certificate to the field of microgrid dispatching, and establishes a robust adaptive control strategy for parameter uncertainty and external disturbances, which ensures the real-time performance and robustness of the dispatching scheme. Attached Figure Description

[0023] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.

[0024] Figure 1 This is a flowchart of a microgrid intelligent scheduling method based on an AI large model according to the present invention;

[0025] Figure 2 This is a diagram illustrating the architecture of a microgrid intelligent scheduling system based on an AI large model, as described in this invention. Detailed Implementation

[0026] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments.

[0027] like Figure 1 As shown in the figure, an embodiment of the present invention provides a microgrid intelligent scheduling method based on an AI large model, which includes the following steps:

[0028] Step S1: Collect and process real-time output data of photovoltaic power plants and wind farms, real-time power data of residential, commercial and industrial loads, energy storage equipment capacity and charging and discharging efficiency data, and environmental data to obtain a standardized microgrid operation dataset.

[0029] Specifically, in step S1, distributed data acquisition terminals are deployed to collect real-time output data and 24-hour forecast data from photovoltaic power plants and wind farms, with a collection frequency of once every 15 minutes; real-time power data and historical load curves of residential, commercial, and industrial loads are collected through a smart meter network; equipment parameters such as the capacity and charging / discharging efficiency of energy storage devices, the heat-to-power ratio of combined heat and power units, and the efficiency of electric boilers are collected through an equipment monitoring system; environmental data such as light intensity, wind speed, and temperature are collected through a meteorological station network; and time-specific fluctuation information of electricity and gas prices is collected through an electricity market information system. The massive amounts of data are stored using the Hadoop HDFS distributed file system. Missing and outlier values ​​are removed through data cleaning algorithms, and data of different formats are uniformly converted to the JSON standard format. Information from different data sources is spatiotemporally aligned according to timestamps, ultimately forming a standardized dataset containing complete microgrid operation information.

[0030] S1 also includes the following steps:

[0031] Step S1.1: Deploy distributed data acquisition terminals to collect real-time output data and 24-hour forecast data of photovoltaic power plants and wind farms. The acquisition frequency is once every 15 minutes to obtain renewable energy output data.

[0032] In step S1.1, this embodiment of the invention first deploys distributed data acquisition terminals in each photovoltaic power station and wind farm of the microgrid to achieve real-time monitoring of renewable energy power generation equipment. These acquisition terminals adopt industrial-grade embedded systems, possessing anti-interference capabilities and stable communication interfaces, supporting multiple communication protocols such as Modbus and IEC61850. The acquisition terminals, connected to the photovoltaic inverter and wind turbine control system, collect real-time output data every 15 minutes, including DC-side voltage, current, and power of the photovoltaic power station, as well as AC-side active power, reactive power, and power factor; and key operating parameters of the wind farm, such as wind turbine speed, pitch angle, generator torque, and output power. Simultaneously, the acquisition terminals also obtain power generation forecast data for the next 24 hours by accessing the power dispatching system's forecasting platform. This forecast data is generated based on weather forecasts, historical power generation patterns, and machine learning algorithms. The collected data is transmitted in real-time to the microgrid control center through an encrypted channel, forming a renewable energy output dataset, providing basic data support for subsequent dispatching decisions.

[0033] Step S1.2: Collect real-time power data of residential, commercial and industrial loads, capacity and charging and discharging efficiency of energy storage devices and heat-power ratio of cogeneration units through smart meter network and equipment monitoring system to obtain load and equipment parameter data;

[0034] In step S1.2, this embodiment of the invention constructs a multi-layered data acquisition network. Initially, a smart meter network is deployed to collect load data from various users within the microgrid. The smart meters employ high-precision energy metering chips, possessing 0.2S-level metering accuracy and supporting multi-rate metering and bidirectional communication functions. For residential users, total power, time-of-use electricity consumption, and power factor are collected; for commercial users, peak-valley electricity consumption ratio and maximum demand are added; for industrial users, production line-level electricity consumption data is further refined, including power curves and energy consumption characteristics of each process stage. Secondly, operating parameters of various energy devices are collected through an equipment monitoring system. For energy storage devices, parameters such as battery state of charge (SOC), state of health (SOH), charge / discharge power, charge / discharge efficiency, and cycle count are collected; for combined heat and power (CHP) units, parameters such as power generation, heat supply, fuel consumption rate, and heat-to-power ratio are collected; for electric boilers, parameters such as power, temperature, and efficiency are collected. These equipment monitoring systems adopt a layered distributed architecture. The bottom layer uses fieldbus technologies such as Profibus and CAN bus to connect various sensors and actuators. The middle layer uses industrial Ethernet to aggregate data, and the top layer integrates with the microgrid energy management system through standard interfaces such as OPC UA. Through this multi-layered data acquisition network, a comprehensive dataset of load and equipment parameters is formed, providing accurate real-time status information for microgrid dispatching.

[0035] Step S1.3: Based on the renewable energy output data, load and equipment parameter data, and environmental data collected by the meteorological station network, a distributed file system is used for storage, and missing and outlier values ​​are removed by data cleaning algorithms. Data of different formats are uniformly converted into the JSON standard format and spatiotemporally aligned according to timestamps to obtain the standardized microgrid operation dataset.

[0036] In step S1.3, this embodiment of the invention establishes a complete data processing flow to realize the transformation from raw data to a standardized dataset. First, a distributed file system based on Hadoop HDFS is deployed as the data storage infrastructure. This system adopts a master-slave architecture, containing one NameNode and multiple DataNodes, ensuring high availability and fault tolerance through data partitioning and multi-replica mechanisms. The system is configured with at least three data replicas, with a block size of 128MB, optimizing the storage efficiency of a large number of small files. Second, a multi-stage data cleaning process is implemented for the collected raw data: The first stage handles missing values. For missing points in time series data, different strategies are adopted according to the data type, such as linear interpolation for meteorological data, replacement with similar day patterns for load data, and preservation of previous values ​​for equipment parameters. The second stage detects and processes outliers, employing a hybrid method based on statistics and machine learning, including the 3σ criterion, box plot method, and isolated forest algorithm, to identify and mark outlier data points. Minor anomalies are corrected using median filtering, while severe anomalies are removed and replaced with interpolation. The third phase unifies the data format by converting heterogeneous data from different systems (such as CSV, XML, and relational database tables) into the JSON standard format. A unified data model is designed, including fields such as data source identifier, timestamp, measurement point ID, measured value, and quality code. Finally, all data is spatiotemporally aligned based on a unified time base (using UTC time and considering time zone conversion) to ensure consistency in the time dimension across different sources. A spatial location index is also established to support geographic location-based data querying and analysis. Through this series of processes, a standardized, high-quality microgrid operation dataset is ultimately formed, providing a reliable data foundation for subsequent AI model training and scheduling decisions.

[0037] Step S2: Based on the standardized microgrid operation dataset and microgrid scheduling domain knowledge, fine-tune the pre-trained large model using LoRA fine-tuning technology and embed expert knowledge into the model reasoning process using knowledge graph enhancement technology to obtain an adapted AI large model scheduling engine.

[0038] Specifically, in step S2, pre-trained large models such as GLM, Qwen, deepseek, GPT, or LLaMA are selected as the base model, and professional corpora such as microgrid dispatching procedures, equipment technical manuals, and historical dispatching cases are collected to construct a domain dataset; LoRA technology is used to freeze the main parameters of the model, and only the low-rank adaptation matrix is ​​trained to reduce the computational complexity of fine-tuning; a knowledge graph containing equipment constraint rules, safe operation criteria, and dispatching logic relationships is constructed to integrate expert knowledge with the large model in a structured form; and domain knowledge is embedded into the model reasoning process through knowledge augmentation technology, enabling the large model to have professional decision-making capabilities for microgrid dispatching.

[0039] LoRA (Low-Rank Adaptation) is an efficient method for fine-tuning neural network parameters. Its core idea is based on the observation that large pre-trained models, when adapting to specific tasks, typically exhibit low intrinsic dimensionality in parameter updates. The basic principle is to decompose the update process of the original weight matrix into the product of two smaller-dimensional matrices, thus significantly reducing the number of parameters that need to be trained. In traditional full-parameter fine-tuning, if the original weight matrix has a dimension of d×k, then d×k parameters need to be updated. LoRA, however, represents this update as the product of two matrices A and B, where A has a dimension of d×r and B has a dimension of r×k. Here, r is called the rank parameter, which is typically much smaller than the values ​​of d and k.

[0040] The working mechanism of the low-rank adaptation matrix is ​​reflected in the parameter update process. During the fine-tuning phase, the original pre-trained weight matrix remains frozen without any modification, while the newly added low-rank decomposition matrices A and B become the only trainable parameters. When the model performs forward propagation, the final weight matrix equals the original frozen matrix plus the matrix product of A and B. The mathematical basis of this design comes from matrix factorization theory, which states that many high-dimensional matrices can be approximated by combinations of lower-dimensional matrices. Especially in the weight update process of neural networks, what truly matters is often a relatively small subspace. In this way, LoRA technology reduces the number of trainable parameters by tens or even hundreds of times while maintaining the model's expressive power, and significantly reduces computational and storage requirements, making it feasible to fine-tune large models in resource-constrained environments.

[0041] Step S2.1: Select a pre-trained large model as the base model, collect professional corpus containing microgrid scheduling procedures, equipment technical manuals, and historical scheduling cases to construct a domain dataset and obtain a microgrid scheduling professional corpus;

[0042] In step S2.1, this embodiment of the invention first selects a pre-trained large model suitable for microgrid scheduling tasks as the foundation. After comparing and evaluating the capabilities of various large models such as GPT-4, LLaMA-2-70B, and Qwen-72B in terms of logical reasoning, numerical computation, and professional knowledge understanding, the LLaMA-2 model with 70 parameters was selected as the foundation model. This model achieves a good balance between reasoning ability and computational efficiency. Next, a comprehensive microgrid dispatching corpus was constructed, comprising four main categories: The first category is dispatching procedure documents, including authoritative documents such as the "Regulations on Distributed Power Generation Grid Connection Dispatch Management" and the "Microgrid Operation Control Specifications," as well as dispatching details and emergency plans from various regional power companies. The second category is equipment technical data, covering technical manuals, parameter specifications, and operation and maintenance guidelines for major microgrid equipment such as photovoltaic inverters, wind turbines, energy storage batteries, and combined heat and power (CHP) equipment. The third category is a historical dispatching case library, collecting over 5,000 real microgrid dispatching cases, including normal operation dispatching records, abnormal situation handling cases, and successful experiences in optimized dispatching. Each case includes initial conditions, dispatching decision-making process, execution results, and benefit assessment. The fourth category is expert knowledge summaries, extracted from in-depth interviews with over 30 senior dispatchers and energy management experts, highlighting key dispatching principles, rules of thumb, and tacit knowledge. These corpora have been reviewed and annotated by professionals, forming structured knowledge entries, including dispatching scenario descriptions, constraints, decision-making logic, and expected effects. The final professional corpus contains over 1 million structured knowledge entries, with a total text size exceeding 10GB. It covers various typical scenarios and special cases of microgrid scheduling, providing a high-quality domain knowledge foundation for fine-tuning large models.

[0043] Step S2.2: For the microgrid scheduling professional corpus, LoRA technology is used to freeze the main parameters of the model and train only the low-rank adaptation matrix to reduce the computational complexity of fine-tuning, thereby obtaining a domain-adapted pre-trained model.

[0044] In step S2.2, this embodiment of the invention employs Low-Rank Adaptation (LoRA) technology for efficient fine-tuning of large models. Traditional full-parameter fine-tuning requires updating all parameters of the model, which would require enormous computational resources and storage space for a base model with 70B parameters. To address this issue, this embodiment of the invention implements a LoRA fine-tuning strategy. The core idea of ​​this method is to decompose the original high-dimensional (greater than three dimensions) weight updates into the product of low-rank matrices. Specifically, firstly, all pre-trained parameters of the base model are frozen and kept unchanged; then, a trainable low-rank decomposition matrix ΔW=BA is added to each weight matrix W that needs to be updated, where the dimension of B is d×r, the dimension of A is r×k, and r is the rank parameter, much smaller than d and k. In this embodiment, different rank parameters are set for the characteristics of different layers: r=8 for the query and key matrices of the attention layer, r=16 for the value matrix, and r=32 for the feedforward network layer. This setting reduces the number of trainable parameters by approximately 99.9% while maintaining the model's adaptability, greatly reducing computational and storage requirements. The fine-tuning process employs a phased training strategy: the first phase uses a larger learning rate (5e). -4 The first phase involves 10 epochs of training, focusing on adapting to domain terminology and basic concepts; the second phase reduces the learning rate to 1 e^(-1 / 2). -4 The training process involves 30 epochs, focusing on learning complex scheduling logic and decision-making patterns; the third stage uses a smaller learning rate (5e). -5 The model underwent 10 epochs of fine-tuning, focusing on further improving its accuracy. The entire training process utilized an 8-node A100 GPU cluster, employing mixed-precision training and gradient accumulation techniques, with a batch size of 128. To prevent overfitting, weight decay (coefficient of 0.01) and an early stopping strategy were implemented (the model stopped if the validation loss showed no improvement for 5 consecutive epochs). Through this meticulously designed LoRA fine-tuning process, a pre-trained model highly adapted to the microgrid scheduling domain was ultimately obtained. This model, while maintaining the generality of the original large-scale model, demonstrates a deep understanding of microgrid terminology, equipment characteristics, and scheduling rules.

[0045] Step S2.3: Perform knowledge graph enhancement on the domain-adapted pre-trained model, construct a knowledge graph containing device constraint rules, safe operation criteria, and scheduling logic relationships, and embed domain knowledge into the model reasoning process through knowledge enhancement technology to obtain the adapted AI large model scheduling engine.

[0046] In step S2.3, this embodiment of the invention further enhances the model's professional capabilities through knowledge graph enhancement technology. First, a comprehensive knowledge graph for microgrid dispatching is constructed. This graph contains five main types of entities: equipment entities (such as photovoltaic arrays, wind turbines, and energy storage systems), parameter entities (such as power, voltage, and frequency), state entities (such as normal operation, fault, and maintenance), constraint entities (such as equipment capacity limits and ramp rate limits), and operation entities (such as power adjustment and switching modes). These entities are connected through various relationships, forming a complex knowledge network, such as relationship types like "equipment-has-parameters," "parameter-constrained by-constraints," and "state-allowed-operation." The knowledge graph contains over 10,000 entity nodes and 50,000 relationship edges, covering the core knowledge system of microgrid dispatching. Secondly, a multi-stage knowledge fusion method is adopted to combine knowledge graphs with language models: the first stage is preprocessing fusion, which converts the triples (head entity-relation-tail entity) in the knowledge graph into natural language statements as supplementary material for model training; the second stage is structured embedding, which converts knowledge graph entities and relations into vector representations and interacts with the model's hidden states through a special adaptation layer; the third stage is reasoning enhancement, which dynamically retrieves and integrates relevant knowledge through an attention mechanism when the model generates scheduling decisions, ensuring that the decisions comply with physical constraints and safety criteria. To achieve efficient knowledge retrieval, this embodiment of the invention designs a knowledge retrieval module based on graph neural networks. This module adopts a graph attention network (GAT) structure, which can quickly locate the most relevant knowledge subgraph based on the current microgrid state and query content. At the same time, a knowledge consistency verification mechanism is established, which checks whether the scheduling scheme output by the model conforms to the constraints in the knowledge graph through a rule-based reasoning engine. If there is a conflict, a correction process is triggered. Through this deep knowledge enhancement method, an AI large-scale model scheduling engine with professional knowledge reasoning capabilities is finally obtained. This engine can not only understand the complex operating mechanism of the microgrid, but also generate scheduling decisions that conform to physical constraints, are economical and efficient, and are safe and reliable.

[0047] Step S3: Using the AI ​​large model scheduling engine, combined with the Lyapunov function and control barrier function theory, a scheduling strategy optimization method under safety constraints is obtained by constructing Lyapunov candidate functions to describe the stability of the microgrid system, designing control barrier functions to constrain the system's operational safety boundary, and introducing safety constraint terms in the reinforcement learning strategy gradient update process.

[0048] The Lyapunov function is an important mathematical tool in control theory for analyzing the stability of dynamic systems. Its basic idea originates from the concept of energy in physics. For a dynamic system, the Lyapunov function is a scalar function that describes the "distance" or "energy" of the system state relative to the equilibrium point. This function must satisfy three fundamental conditions: first, positive definiteness, meaning the function value is positive in all states except the equilibrium point; second, radial unboundedness, meaning the function value increases as the system state deviates further from the equilibrium point; and finally, monotonically decreasing along the system's trajectory, meaning that if the system is stable, the Lyapunov function value should decrease monotonically with time. By constructing an appropriate Lyapunov function and verifying that it satisfies the above conditions, the stability of the system can be rigorously proven mathematically without solving complex systems of differential equations.

[0049] Control barrier function theory is an important method in modern control theory for ensuring the safe operation of systems. It defines the safe operating region of a system by constructing a special scalar function. The core concept of the control barrier function is to establish a "barrier" to prevent the system state from entering an unsafe region. This function is usually defined as the difference between the safety constraint and a certain safety margin parameter. When the function value is greater than zero, it indicates that the system is in a safe state; when the function value is equal to zero, it indicates that the system is on the safety boundary; and when the function value is less than zero, it indicates that the system has violated the safety constraints. The technical principle of the control barrier function is to ensure that the function value remains non-negative at every time step by controlling the input, thus mathematically guaranteeing that the system will never leave the safe region. The advantage of this method is that it provides proactive safety protection, that is, adjusting the control strategy before the system approaches the dangerous boundary, rather than passively correcting the situation after the constraints are violated.

[0050] When Lyapunov functions are combined with control barrier function theory, a robust control framework is formed that guarantees both system stability and operational safety. The technical principle behind this combination lies in the construction of the constrained optimization problem: the system needs to find control inputs that both decrease the Lyapunov function (ensuring stability) and maintain the non-negativity of the control barrier function (ensuring safety). In practical applications, this is typically transformed into a constrained optimization problem, where the decreasing condition of the Lyapunov function and the non-negativity condition of the control barrier function serve as optimization constraints, while performance objectives (such as economic indicators) serve as the objective function. This method mathematically guarantees the system stability and operational safety during microgrid dispatching, providing a theoretical foundation and practical guidance for the safe control of complex dynamic systems.

[0051] Specifically, in step S3, a Lyapunov candidate function is first constructed to describe the stability of the microgrid system. The system state vector includes state variables such as the output of each generator unit, the state of charge of the energy storage device, and the voltage and frequency of key nodes. This function must satisfy basic conditions such as positive definiteness and radial unboundedness, and is usually chosen as a quadratic form, where a positive definite matrix is ​​used to ensure the positive definiteness of the function.

[0052] Furthermore, a control barrier function is designed to constrain the safety boundaries of system operation, ensuring that key constraints such as voltage deviation limited to ±5% of the rated value, equipment capacity limitations, and frequency stability requirements are always met. The control barrier function is defined as the safety constraint condition minus the safety margin parameter. When the function value is greater than 0, the system is in a safe state; when the function value is less than or equal to 0, the system is close to or violates the safety boundary.

[0053] In the policy gradient update process of reinforcement learning, a safety constraint term is introduced to ensure that each policy update satisfies the stability decrease condition and the non-negativity of the safety boundary. Specifically, within the Actor-Critic algorithm framework, the parameter update of the policy network must simultaneously consider the performance optimization objective and the safety constraints, using an adaptive step size that satisfies the safety constraints in the update formula.

[0054] By integrating safety constraints into the reward function using the Lagrange multiplier method, an augmented reward function is constructed, combining the original economic reward with a safety constraint penalty term. This method ensures that the agent does not make scheduling actions that violate the safety boundary during the learning process, while maintaining its pursuit of economic goals.

[0055] A set of safe actions is established, defining the set of all feasible control actions that satisfy the non-negativity condition of the control barrier function. When an agent attempts to execute an unsafe action, a quadratic programming method is used to automatically correct it to the nearest safe action, ensuring that the Euclidean distance between the corrected action and the desired action is minimized, thus guaranteeing the absolute safety of the scheduling process. Simultaneously, a safety monitoring mechanism is established to monitor in real time whether the system state is approaching the safety boundary, triggering an emergency safety control protocol when necessary.

[0056] The above process is explained in detail below:

[0057] Step S3.1: Construct a system state vector containing the output of each power generation unit, the state of charge of energy storage devices, the voltage and frequency of key nodes using the AI ​​large model scheduling engine. Construct a Lyapunov candidate function in the form of a quadratic function to describe the stability of the microgrid system, where a positive definite matrix is ​​used to ensure the positive definiteness of the function.

[0058] In step S3.1, this embodiment of the invention first utilizes an AI large-scale model scheduling engine to analyze the core operating characteristics of the microgrid and construct a comprehensive system state vector. This state vector integrates four types of key parameters: generation unit parameters, energy storage parameters, electrical parameters, and system parameters. Generation unit parameters include the real-time output, maximum adjustable power, and ramp rate limit of each photovoltaic array; the actual power, wind speed status, and adjustable range of wind turbines; and the output level and spinning reserve capacity of traditional generator sets. Energy storage parameters cover the state of charge (SOC), charging and discharging power, remaining available capacity, health status index, and expected lifespan impact factor of each energy storage device. Electrical parameters mainly include the voltage amplitude, phase angle, frequency deviation, and line power flow and impedance characteristics of key nodes. System parameters include state information such as microgrid operating mode (grid-connected / islanded), load forecasting error, and renewable energy forecasting deviation. These parameters are normalized to form a state vector x of dimension n, where n is typically between 50 and 200, depending on the scale and complexity of the microgrid. Based on the constructed state vector, this embodiment of the invention designs the Lyapunov candidate function V(x) in the form of a quadratic form function. This function can be intuitively understood as an "energy measure" of the system state's deviation from the stable equilibrium point. In specific implementation, the AI ​​large model analyzes historical stable operating data to identify the system's equilibrium point x*, and then constructs a quadratic form function centered on this equilibrium point. To ensure the positive definiteness of the function (i.e., for any non-zero state x≠0, the function value V(x)>0, and V(x)=0 only when x=x*), the system uses an iterative optimization method to construct a positive definite matrix P. The eigenvalue distribution of this matrix is ​​carefully designed so that the influence weight of the deviation of different state components on system stability is different. For example, frequency deviation is usually given a higher weight, while certain energy storage SOC deviations are relatively lower. In this way, the final Lyapunov function can accurately describe the stability characteristics of the microgrid system, providing a mathematical basis for subsequent safety control strategies.

[0059] Step S3.2: Design a control barrier function to constrain the system's operational safety boundary, wherein the control barrier function is formed by subtracting the safety margin parameter from the safety constraint conditions, and the safety boundary constraint conditions are determined by the Lyapunov candidate function and the control barrier function;

[0060] In step S3.2, based on the Lyapunov candidate function V(x) (i.e., the system stability description function) constructed in the previous step, this embodiment of the invention further designs a control barrier function (CBF) to ensure the safety of microgrid operation. The core idea of ​​the control barrier function is to create a mathematical "barrier" to prevent the system state from entering an unsafe region. This embodiment of the invention designs a multi-level safety constraint system tailored to the characteristics of microgrids, including device-level constraints, node-level constraints, and system-level constraints. Device-level constraints mainly focus on the operational limitations of each device, such as the power limit of photovoltaic inverters, the charging and discharging power limits and SOC safety range of energy storage systems (typically 20%-80%, to avoid overcharging and over-discharging), and the ramp rate limit of traditional generators (typically 3%-5% / minute of rated power). Node-level constraints focus on the safety range of electrical parameters, such as limiting bus voltage deviation to ±5% of the rated value, ensuring line power flow does not exceed the thermal stability limit, and maintaining the power factor above 0.95. System-level constraints consider overall operational safety, including frequency stability within ±0.2Hz of the rated value, system spinning reserve capacity not less than 10% of the maximum load, and power balance deviation not exceeding 2% of the total load. For each type of constraint, this embodiment of the invention designs a corresponding control barrier function h(x), such that h(x) ≥ 0 indicates the system is in a safe state, and h(x) < 0 indicates a violation of the safety constraint. To enhance system robustness, a safety margin parameter γ is introduced based on each constraint, forming the final control barrier function B(x) = h(x) - γ. The safety margin parameter is dynamically adjusted according to the importance of the constraint and the degree of system uncertainty. Critical safety constraints (such as frequency limits) adopt a larger margin (approximately 20%-30% of the constraint range), while general constraints adopt a smaller margin (approximately 5%-10% of the constraint range). Through this design, the control barrier function triggers the protection mechanism in advance when the system approaches the safety boundary, providing a buffer time for control actions and effectively preventing the system from exceeding the safety boundary. In addition, the embodiments of the present invention also design a constraint priority mechanism. In the case of multiple constraint conflicts, the system will prioritize satisfying high-priority constraints (such as equipment security restrictions), and then try to satisfy low-priority constraints (such as economic objectives) while satisfying these constraints.

[0061] The process of determining safety boundary constraints using the Lyapunov candidate function and the control barrier function is essentially a process of organically combining system stability constraints with safe operation constraints. Specifically, the Lyapunov candidate function V(x) describes the degree of deviation of the system state from the stable equilibrium point, and its decreasing condition ΔV(x)≤0 ensures that the system evolves in a stable direction; while the control barrier function B(x) defines the safe operation boundary that the system must always satisfy, and its non-negativity condition B(x)≥0 ensures that the system will not enter an unsafe region. Determining the safety boundary constraints requires satisfying both types of constraints simultaneously, that is, under any control action u, it must ensure that:

[0062] V(x+1)≤V(x)-α(||x||) (where α is a positive definite function to ensure stability), and also ensure that:

[0063] B(x+1)≥-γB(x) (where 0<γ<1 is the attenuation constant to ensure safety). By combining these two constraints, a composite constraint set is formed:

[0064] C = {u|V(x+1)-V(x)≤-α(||x||) ∧ B(x+1)≥-γB(x)} defines all feasible safety control actions in the current state x. When the Lyapunov function value is large, the system prioritizes stability constraints and converges quickly to the equilibrium point; when the control barrier function value is close to zero, safety constraints play a dominant role, preventing the system from exceeding the safety boundary. This dual constraint mechanism ensures that the microgrid scheduling process maintains both stable system operation and strict adherence to safety operation specifications, providing a clear feasible region boundary for subsequent optimization algorithms.

[0065] Step S3.3: For the aforementioned safety boundary constraints, a safety constraint term is introduced into the policy network parameter update under the Actor-Critic algorithm framework to ensure that each policy update satisfies the stability decrease condition and the safety boundary non-negativity condition. The safety constraint is integrated into the reward function using the Lagrange multiplier method to obtain the scheduling policy optimization method under the aforementioned safety constraints.

[0066] In step S3.3, this embodiment of the invention deeply integrates security constraints with reinforcement learning algorithms to construct a scheduling policy optimization method under security constraints. First, an Actor-Critic architecture is selected as the basic reinforcement learning framework, comprising a policy network (Actor) and a value network (Critic). The policy network uses a four-layer fully connected neural network structure. The input layer receives the system state vector, and the hidden layers contain 256, 128, and 64 neurons respectively, using the LeakyReLU activation function. The output layer uses the Tanh activation function to generate continuous control actions. The value network adopts a similar structure, but the output layer has only one neuron, used to estimate the state value. In the traditional Actor-Critic algorithm, the policy network parameter update is mainly based on the policy gradient, with the goal of maximizing the cumulative reward. The innovation of this embodiment lies in introducing two types of security constraints during the policy update process: a stability decrease condition and a non-negativity security boundary condition. The stability diminishing condition requires that the Lyapunov function value decreases after the system executes a control action, indicating that the system is approaching a stable equilibrium point. The non-negativity of the safety boundary condition requires that the control barrier function remain non-negative after the control action is executed, ensuring that the system always operates within the safe region. To integrate these constraints into the reinforcement learning framework, this embodiment of the invention employs the Lagrange multiplier method to construct an augmented reward function. This function combines the original economic rewards (such as minimizing operating costs, maximizing renewable energy utilization, etc.) with the penalty term for safety constraints. The Lagrange multiplier is dynamically adjusted: when a constraint is close to being violated, the corresponding multiplier value increases, enhancing the weight of the constraint; when the constraint satisfaction is high, the multiplier value decreases, allowing the algorithm to focus more on economic objectives. In addition, this embodiment of the invention also designs an adaptive learning rate mechanism, dynamically adjusting the policy update step size according to the constraint satisfaction status. When the system is in a safe state and far from the constraint boundary, a larger learning rate is used to accelerate convergence; when the system approaches the constraint boundary, the learning rate is automatically reduced for more cautious policy adjustments. Through this method, the reinforcement learning algorithm can gradually optimize the scheduling strategy while ensuring safety, achieving a balance between economy and safety.

[0067] The application of the Lagrange multiplier method in constructing augmented reward functions embodies a clever mathematical transformation, converting constrained optimization problems into unconstrained ones. This allows reinforcement learning algorithms to simultaneously address performance objectives and safety constraints. In traditional reinforcement learning frameworks, agents focus solely on maximizing cumulative rewards. However, in safety-critical applications like microgrid scheduling, it's crucial to ensure control actions do not violate system safety constraints. The Lagrange multiplier method, by introducing the Lagrange multiplier, integrates safety constraints into the objective function, forming a new augmented reward function. The mathematical basis of this transformation stems from the duality principle in constrained optimization theory, where the original constrained optimization problem can be equivalently represented as a saddle point problem, with the Lagrange multiplier acting as the "constraint price."

[0068] The construction process of the augmented reward function demonstrates the essence of multi-objective optimization. The original economic reward reflects the main objectives of microgrid operation, including minimizing operating costs, which covers various costs such as fuel consumption, equipment wear and tear, and start-up and shutdown losses; maximizing renewable energy utilization, reflecting the requirements of environmental protection and sustainable development; and optimizing system efficiency, among other dimensions. The safety constraint penalty term represents the "penalty" for violations of safety boundaries. These penalty terms are typically designed as nonlinear functions, imposing moderate penalties for minor violations and drastically increasing penalties for serious violations, forming a "soft constraint" mechanism. When these two types of objectives are weighted and combined using Lagrange multipliers, the resulting augmented reward function establishes a dynamic balance between economy and safety, ensuring that the agent maintains respect for safety constraints while pursuing economic benefits.

[0069] The core innovation of this method lies in the dynamic adjustment mechanism of the Lagrange multiplier, which enables adaptive changes in constraint weights. When the system's operating state is far from the safety boundary, the corresponding Lagrange multiplier value is small. At this time, the augmented reward function is mainly dominated by economic rewards, allowing the agent to focus more on cost optimization and efficiency improvement. Conversely, as the system state gradually approaches the boundary of a certain safety constraint, the corresponding Lagrange multiplier value automatically increases, and the weight of the safety constraint penalty term in the augmented reward function increases accordingly, guiding the agent's attention towards safety assurance. This dynamic adjustment is not manually set but automatically achieved through a multiplier update rule designed based on the degree of constraint violation: the better the constraint is satisfied, the more the multiplier value tends to decrease; the more severe the constraint violation, the faster the multiplier value increases. This adaptive mechanism ensures that the system maintains an appropriate safety-economic balance point under different operating conditions, avoiding both economic losses caused by excessive conservatism and safety risks caused by excessive aggressiveness, providing a safe and economical optimization framework for intelligent scheduling of microgrids.

[0070] Step S3.4: Construct an augmented reward function that combines the original economic reward with a security constraint penalty term, wherein the security constraint penalty term includes a control barrier function violation penalty and a Lyapunov stability violation penalty;

[0071] The augmented reward function consists of three parts: the original economic reward, the penalty for violating the control barrier function, and the penalty for violating Lyapunov stability. The original economic reward reflects the main optimization objectives of microgrid dispatch, including minimizing operating costs, maximizing renewable energy utilization, and minimizing carbon emissions. In its implementation, operating cost calculation considers fuel costs, start-up and shutdown costs, maintenance costs, and grid interaction costs (electricity purchase cost minus electricity sales revenue); the renewable energy utilization rate is calculated as the ratio of actual renewable energy generation to the theoretical maximum power generation; and carbon emissions are estimated based on the carbon emission factors of various power generation equipment and actual power generation. These economic indicators are weighted and summed to form a comprehensive economic reward, with the weighting coefficients dynamically adjusted according to the microgrid's operational objectives. The penalty for violating the control barrier function is used to ensure system operational safety. A penalty is triggered when the control barrier function value is less than zero (i.e., a safety constraint is violated). The penalty strength is designed non-linearly, with smaller penalties for minor violations and sharp increases in penalties for severe violations, creating a "soft wall" effect that guides the algorithm to quickly move away from unsafe areas. The Lyapunov stability violation penalty focuses on the dynamic stability of the system. A penalty is triggered when a change in the system state leads to an increase in the Lyapunov function value (indicating a deviation from the stable point). This penalty term is designed to consider the rate of change of the increment, imposing a more severe penalty on behaviors that rapidly deviate from the stable state, encouraging the system to remain in the stable region or smoothly transition to a new stable state. To handle trade-offs between multiple objectives, this embodiment of the invention employs an adaptive weighting mechanism, dynamically adjusting the weights of each penalty term based on the current system state. For example, when the system approaches the safety boundary, the weight of the safety constraint penalty term automatically increases; when the system is far from the safety boundary and has good stability, the weight of the economic reward increases accordingly. This dynamic weight adjustment ensures that the system maintains an appropriate optimization direction under different operating conditions, avoiding both excessive conservatism that affects economy and excessive aggressiveness that jeopardizes safety.

[0072] Step S3.5: Establish a set of safety actions, defining the set of all feasible control actions that satisfy the non-negativity condition of the control barrier function;

[0073] In step S3.5, this embodiment of the invention establishes a safe action set mechanism to ensure that the reinforcement learning algorithm only explores the safe control space. The safe action set is defined as the set of all feasible control actions that satisfy the non-negativity condition of the control barrier function; that is, for any action u ∈ the safe action set, the control barrier function value of the system state remains non-negative after executing the action. To efficiently construct and represent this set, this embodiment of the invention employs a multi-level safe action space construction method. First, through microgrid physical model analysis, the physical constraint range of each control variable is determined, such as the maximum and minimum output of generator sets, ramp rate limits, and charging and discharging power limits of energy storage systems, which constitute the outer boundary of the action space. Second, based on the current system state and the control barrier function, sensitivity analysis is used to determine the degree of influence of each control variable on the safety constraints, identifying key control variables and their safe adjustment ranges. In specific implementation, a linearization method is used to calculate the gradient of the control action with respect to the control barrier function. Based on the gradient direction and constraint margin, the safe adjustment direction and magnitude of each control variable are determined. For high-dimensional control spaces, directly calculating the precise boundary of the safe action set is computationally too complex; therefore, this embodiment of the invention employs a method combining internal approximation and sampling verification. First, an internal approximation of the safe action set is constructed, typically using a hyperrectangle or hyperellipsoid, ensuring that all actions within the approximate set satisfy safety constraints. Then, sampling is performed in the full action space, and the safe action set is expanded through rapid constraint checks. To improve computational efficiency, this embodiment also implements a caching and incremental update mechanism for the safe action set. When the system state changes little, the previously calculated safe action set can be reused, and local adjustments can be made based on state changes, significantly reducing computational overhead. Furthermore, this embodiment also designs a visualization tool for the safe action set, projecting the high-dimensional safe action space onto a two-dimensional or three-dimensional space composed of key control variables, intuitively displaying the safe operation area and assisting schedulers in understanding the system's safety boundaries and operational margins. In this way, reinforcement learning algorithms can efficiently explore optimal scheduling strategies while ensuring safety, avoiding the dangerous exploration problems that may occur in traditional reinforcement learning.

[0074] Step S3.6: If an unsafe action is attempted during the scheduling process, a quadratic programming method is used to automatically correct it to the nearest safe action, ensuring that the Euclidean distance between the corrected action and the desired action is minimized;

[0075] In step S3.6, this embodiment of the invention designs a safety action correction mechanism as a second line of defense for security. Although a set of safe actions is constructed through step S3.5, in actual operation, due to factors such as model approximation errors, the randomness of the reinforcement learning exploration process, or external interference, the algorithm may still generate control actions that do not meet safety constraints. To address this situation, this embodiment of the invention implements an action correction method based on quadratic programming, projecting unsafe actions onto the set of safe actions to ensure that the system always executes safe control commands. When the desired action u generated by the reinforcement learning algorithm is detected... desired When safety constraints are not met, the system immediately triggers an action correction process. The correction process is formalized as a quadratic programming problem, aiming to find the action in the set of safe actions that has the smallest Euclidean distance to the desired action. This design ensures that the corrected action is as close as possible to the original intention, minimizing the impact on the optimization objective while ensuring safety. To efficiently solve this quadratic programming problem, this embodiment of the invention employs an interior-point method combined with problem-specific structure optimization, achieving millisecond-level solution speeds and meeting the time requirements of real-time scheduling. In practical implementation, the action correction mechanism is divided into three levels: mild correction, moderate correction, and forced correction. Mild correction is suitable for minor violations of safety constraints, mainly by adjusting the control variables related to the violation while keeping other variables unchanged; moderate correction handles cases where multiple constraints are violated simultaneously, requiring comprehensive consideration of the importance and severity of each constraint, potentially involving adjustments to multiple control variables; forced correction is used for severe violations of safety constraints or emergency situations, where the system ignores the proximity to the desired action and directly switches to a preset safe operation mode, ensuring the system quickly returns to a safe state. During the action correction process, the system also records the correction frequency and magnitude as important feedback signals for the reinforcement learning algorithm. Control variables that frequently require significant corrections will be marked as high-risk areas. The reinforcement learning algorithm will adjust its exploration strategy, reducing attempts in these areas and gradually learning safer control strategies. Through this action correction mechanism, this embodiment of the invention achieves safe exploration in reinforcement learning, ensuring system operational safety without unduly limiting the algorithm's learning space.

[0076] Step S3.7: Establish a safety monitoring mechanism to monitor in real time whether the microgrid state is approaching the safety boundary. When the microgrid state approaches the danger zone, trigger an emergency safety control protocol and forcibly pull the microgrid state back to the safety zone through a preset safety control law.

[0077] In step S3.7, this embodiment of the invention establishes a comprehensive safety monitoring mechanism as the final guarantee for the safe operation of the microgrid. This mechanism is independent of the reinforcement learning control system, continuously monitors the operating status of the microgrid, promptly identifies potential risks, and takes over system control when necessary. The safety monitoring mechanism adopts a multi-level design, including an early warning layer, an intervention layer, and an emergency layer. The early warning layer is responsible for calculating the distance between the system state and the safety boundary in real time, defining three levels of safety margin: green zone (sufficient safety margin), yellow zone (decreased safety margin but still acceptable), and red zone (insufficient safety margin, approaching the danger boundary). When the system state moves from the green zone to the yellow zone, an early warning signal is triggered, reminding the scheduling system to pay more attention to relevant parameters; when the state moves from the yellow zone to the red zone, an intervention signal is triggered, and the safety monitoring mechanism begins to partially take over control, imposing stricter restrictions and corrections on the control actions of the reinforcement learning algorithm. The intervention layer adopts a model-based prediction-based safety assessment method, considering not only the safety of the current state but also predicting the state evolution trend over several future time steps. By forward simulating multiple time steps, it identifies control sequences that may lead to future constraint violations, triggering preventative intervention even if the current state appears safe. The emergency response layer incorporates a series of predefined safety control protocols to handle situations where the system approaches or has entered a hazardous area. These protocols are categorized according to different types of safety threats, including frequency deviation emergency protocols, voltage over-limit emergency protocols, and equipment overload emergency protocols. Each protocol defines specific triggering conditions and control action sequences to ensure the system can quickly and reliably recover to a safe state. For example, the frequency deviation emergency protocol activates when the frequency exceeds the safe range, responding in stages according to the degree of deviation: adjusting the output of controllable generators for minor deviations; activating the fast-response energy storage system for frequency regulation for moderate deviations; and executing load shedding or renewable energy curtailment for severe deviations. The safety control law is designed based on Lyapunov stability theory, ensuring that the system state always converges towards the safe region. The control law employs a piecewise design, using a larger control gain when approaching the safe boundary to quickly pull the system back to the safe region; as the system state gradually becomes safer, the control gain smoothly decreases to avoid oscillations caused by over-control. To ensure the reliability of the safety monitoring mechanism, the system adopts redundant design and fault detection mechanism, key components are configured with dual or triple backup, monitoring data undergoes consistency checks, and control commands are validated for rationality before execution, minimizing the risk of system failure.

[0078] Step S4: The sparse matrix binary decision process is modeled using the scheduling strategy optimization method under the security constraints. By modeling the microgrid scheduling problem as a binary decision process in sparse matrix form, the gradient-Newton hybrid optimization algorithm is combined with the unit vector extreme distance control technology in the binary decision process to generate an extreme control strategy for real-time scheduling parameters.

[0079] Specifically, in step S4, the microgrid scheduling problem is first modeled as a binary decision process in sparse matrix form. The scheduling variable matrix is ​​defined as a zero-one matrix, where the number of rows represents the number of scheduling periods, the number of columns represents the number of controllable devices, and the matrix elements represent the start / stop status of a specific device in binary form (0-1), where 1 indicates device startup and 0 indicates device shutdown. Considering that most devices in the microgrid are in a non-schedulable state during specific periods, the scheduling variable matrix naturally exhibits sparseness, typically reaching 70%-85%.

[0080] The scheduling variable matrix is ​​stored using a compressed sparse row storage format. Three one-dimensional arrays are used to store non-zero element values, column indices, and row pointers, respectively, reducing memory usage by 60%-80% compared to traditional dense matrix storage. A sparse matrix operation library is established to implement efficient matrix-vector multiplication and constraint checking operations, reducing the computational complexity of constraint verification from being dependent on matrix size to being dependent on the number of non-zero elements.

[0081] A gradient-Newton hybrid optimization algorithm is designed, employing a staged optimization strategy. In the initial optimization phase, gradient descent with momentum, including a learning rate and momentum coefficient, is used to quickly approach the optimal solution region. When the gradient norm is less than a preset threshold or the improvement rate of the objective function is less than a preset value, the algorithm switches to Newton's method, utilizing Hessian matrix information to achieve faster quadratic convergence.

[0082] A unit vector extremum distance control technique is introduced to construct the search direction on a unit constrained sphere. The optimal search direction, pointing to the unit direction of the fastest descent of the objective function, is obtained by solving the constrained optimization problem. A spherical coordinate parameterization method is used to transform the n-dimensional search problem into an n-1-dimensional angle optimization problem, ensuring the orthogonality and numerical stability of the search direction.

[0083] An adaptive step size adjustment strategy is established, and the step size control function adopts an exponential decay form, which includes an initial step size, a decay factor, and a decay period. Simultaneously, Armijo conditions are introduced for line search to ensure sufficient descent of the objective function in each iteration. When the improvement of the objective function in multiple consecutive iterations is less than a preset threshold, a step size restart mechanism is triggered, resetting the step size to a preset proportion of the initial value to prevent the algorithm from getting stuck in numerical oscillations. The convergence criterion for the entire optimization process is that the gradient norm is less than a preset value and the continuous change of the objective function is less than a preset tolerance.

[0084] The above process specifically includes:

[0085] Step S4.1: Define the scheduling variable matrix as a zero-one matrix, where the number of rows represents the number of scheduling periods and the number of columns represents the number of controllable devices. Store the scheduling variable matrix using a compressed sparse row storage format and establish a sparse matrix operation library to obtain a binary decision model in sparse matrix form.

[0086] In step S4.1, this embodiment of the invention innovatively models the microgrid scheduling problem as a binary decision process in sparse matrix form. First, a scheduling variable matrix X is defined, which is a zero-one matrix where the number of rows m represents the number of scheduling periods and the number of columns n represents the number of controllable devices. In a typical daytime scheduling scenario for a microgrid, if each scheduling period is 15 minutes, there are 96 periods per day, i.e., m=96. For a medium-sized microgrid containing equipment such as photovoltaic inverters, wind turbines, energy storage systems, diesel generators, and controllable loads, the number of controllable devices is typically between 30 and 50. Each element x in the matrix... ij The data is represented using binary values, where 1 indicates that the j-th device is started or invoked in the i-th time period, and 0 indicates that it is shut down or not invoked. This representation method intuitively reflects the start-up and shutdown status of the devices, facilitating model understanding and optimization. Through analysis of the microgrid operating characteristics, this embodiment of the invention found that the scheduling variable matrix has significant sparsity. This is because in most time periods, only some devices are in the start-up or scheduling state, especially when considering standby devices and peak-valley time-differentiated scheduling strategies, the sparsity of the matrix (the proportion of zero elements) usually reaches 70%-85%. To address this characteristic, this embodiment of the invention adopts a Compressed Sparse Row (CSR) storage format, which efficiently stores matrix information through three one-dimensional arrays: the data[] array stores the values ​​of all non-zero elements, the indices[] array stores the column indices of these non-zero elements, and the indptr[] array stores the position of the first non-zero element in each row in the data[]. This storage method compresses the dense matrix that originally required m×n storage units to approximately 2×nnz+m+1 storage units, where nnz is the number of non-zero elements, which can reduce memory usage by 60%-80% in typical microgrid scenarios. To support efficient matrix operations, this invention also establishes a dedicated sparse matrix operation library, optimizing common operations in microgrid scheduling problems such as matrix-vector multiplication and constraint checking. For example, when checking power balance constraints, traditional methods require traversing the entire matrix, resulting in a computational complexity of O(m×n); while the optimization algorithm based on sparse storage only needs to process non-zero elements, reducing the complexity to O(nnz), significantly improving computational efficiency. Furthermore, this invention also designs a sparse pattern prediction mechanism, which predicts the sparse structure of the future scheduling matrix by analyzing historical scheduling patterns, further optimizing storage and computation strategies. Through these techniques, an efficient sparse matrix-form binary decision model is ultimately obtained, providing a solid foundation for subsequent optimization algorithms.

[0087] Step S4.2: For the binary decision model in sparse matrix form, the gradient descent method with momentum is used to approximate the first convergence speed. When the gradient norm is less than the threshold, the method of Newton is switched to achieve the second convergence speed approximation.

[0088] In step S4.2, this embodiment of the invention designs a gradient-Newton hybrid optimization algorithm, which realizes efficient binary decision optimization solution.

[0089] The gradient-Newton hybrid optimization algorithm is an advanced optimization method that combines the stability of gradient descent with the fast convergence of Newton's method. The algorithm's design is based on the observation that different optimization methods have their own advantages and limitations at different stages of the optimization process. Gradient descent is stable far from the optimal solution, reliably moving in the correct direction, but its linear convergence speed becomes too slow as it approaches the optimal solution. Newton's method, utilizing second-order derivative information, achieves quadratic convergence and has extremely fast convergence near the optimal solution, but it may become unstable or even diverge when far from the optimal solution or when the objective function is not smooth. The hybrid algorithm dynamically switches between these two methods during the optimization process, fully leveraging their respective advantages while mitigating their limitations.

[0090] The algorithm's working principle is reflected in its phased execution strategy. In the early stages of optimization, when the system is far from the optimal solution and the local characteristics of the objective function are not clear, the algorithm uses gradient descent with momentum as the main search mechanism. Gradient descent, based on first-order derivative information, searches along the direction of the fastest descent of the objective function; its mathematical foundation is simple and computationally inexpensive. The introduction of the momentum term solves the problem of traditional gradient descent easily oscillating in canyon regions. By accumulating historical gradient information, an inertial effect is formed, allowing the algorithm to traverse complex terrain more smoothly. When optimization progresses to a certain extent, specifically when the gradient norm falls below a preset threshold or the improvement rate of the objective function repeatedly falls below a preset standard, the algorithm automatically triggers a switching mechanism, transitioning to the Newton method stage. The Newton method utilizes the second-order derivative information of the objective function, i.e., the Hessian matrix, to construct a local quadratic approximation model, and then searches for the optimal solution on this approximation model. This method can more accurately capture the local curvature characteristics of the objective function, achieving a faster convergence speed.

[0091] The core advantage of the hybrid algorithm lies in its adaptability and robustness. The switching conditions are not fixed but dynamically adjusted based on the characteristics of the optimization problem and the real-time optimization progress. For example, for complex optimization problems such as microgrid scheduling, the objective function often has multiple local optima and complex constraint structures, which traditional single optimization methods often struggle to handle effectively. The hybrid algorithm quickly locates the neighborhood of the optimal solution using the global search capability of gradient descent, and then uses the local fast convergence characteristic of Newton's method to solve it precisely. Simultaneously, the algorithm also has a backoff mechanism; when Newton's method performs poorly in certain situations, the system can automatically revert to gradient descent mode, ensuring the continuity and stability of the optimization process. This design allows the hybrid algorithm to significantly improve optimization efficiency while maintaining convergence, making it particularly suitable for real-time applications requiring high-quality solutions within a limited time.

[0092] Specifically, in this embodiment, the algorithm employs a phased strategy, combining the stability of gradient descent with the fast convergence of Newton's method. In the initial optimization phase, the system uses momentum-driven gradient descent to approximate the first convergence speed. Traditional gradient descent only considers the current gradient information in each iteration, easily leading to slow convergence in flat regions or oscillations in narrow regions. To overcome these problems, this embodiment introduces a momentum term, enabling the algorithm to "remember" the direction of previous iterations, creating an effect similar to inertia in physical systems. Specifically, the momentum coefficient β... k An adaptive design is employed, with an initial value of 0.9, dynamically adjusted during iterations: when multiple consecutive iterations proceed in the same direction, the momentum coefficient is increased (up to a maximum of 0.99) to accelerate progress towards the optimization direction; when the iteration direction changes frequently, the momentum coefficient is decreased (down to a minimum of 0.5) to enhance the algorithm's responsiveness to local features. The learning rate α... k Similarly, an adaptive strategy is adopted, with initial values ​​set according to the problem size (usually 0.01-0.1), and then dynamically adjusted according to the rate of change of the objective function. To handle common constraints in microgrid scheduling problems, this embodiment of the invention employs the projection gradient method, projecting the result onto the feasible region after each parameter update to ensure that intermediate results always satisfy physical constraints. The first stage of optimization typically accounts for 60%-70% of the total number of iterations, when the gradient norm ||▽f(θ) kWhen ||2 is less than the preset threshold ε1 (typically 0.01) or the improvement rate of the objective function is lower than δ1 (typically 0.001) for multiple consecutive times, the algorithm automatically switches to the second stage. In the second stage, the system uses Newton's method to accelerate convergence. Newton's method utilizes the second derivative information of the objective function (Hessian matrix) to more accurately capture the local curvature characteristics of the function, achieving a second convergence speed. Considering the high-dimensionality of the microgrid scheduling problem, directly calculating and storing the complete Hessian matrix is ​​too costly. This embodiment of the invention uses the L-BFGS (Limited-memory Broyden–Fletcher–Goldfarb–Shanno) algorithm, which indirectly constructs the approximate inverse of the Hessian matrix by storing the gradient difference information of the most recent m iterations, significantly reducing computation and storage overhead. To handle the case where the Newton direction may not be the descent direction, the algorithm introduces a correction mechanism to detect the positive definiteness of the Hessian approximation matrix and add a diagonal correction term when necessary to ensure the validity of the search direction. By employing this gradient-Newton hybrid optimization strategy, the embodiments of the present invention significantly improve the convergence speed while ensuring optimization stability. Experiments show that the solution time is reduced by an average of 65% compared to using the gradient descent method alone.

[0093] The L-BFGS algorithm is a memory-optimized version of the classic BFGS quasi-Newton method, specifically designed to address the difficulties of storing and computing the Hessian matrix in large-scale optimization problems. Traditional Newton's method requires computing and storing the complete Hessian matrix and its inverse. For high-dimensional optimization problems, this requirement leads to enormous computational overhead and memory consumption. For example, for an optimization problem with 10,000 variables, the complete Hessian matrix would require storing 100 million elements, which is often unacceptable in practical applications. The L-BFGS algorithm, through clever mathematical techniques, approximates the inverse of the Hessian matrix using only limited historical information, thus significantly reducing memory requirements and computational complexity while maintaining the excellent convergence of the quasi-Newton method.

[0094] The core principle of this algorithm is based on the rank-one update theory of the Hessian matrix and the Sherman-Morrison-Woodbury formula. The L-BFGS algorithm does not directly store the approximation of the Hessian matrix; instead, it stores the gradient difference vector and position difference vector from the most recent m iterations. Here, m is typically a small value, usually between 3 and 20. The algorithm utilizes this information from the vector pairs to efficiently calculate the product of the approximation of the Hessian matrix inverse and the gradient through a recursive two-step loop process. This product is precisely the quasi-Newton search direction. The first loop iterates backward from the latest vector pair, calculating a series of intermediate coefficients; the second loop iterates backward from the oldest vector pair, using these coefficients to gradually construct the final search direction. The mathematical basis of this design stems from the special structure of the BFGS update formula, which allows the approximation of the Hessian matrix inverse to be represented as a combination of a series of low-rank matrices, and the operations on low-rank matrices can be efficiently implemented through vector operations.

[0095] The practical advantages of the L-BFGS algorithm lie in its adaptability to large-scale problems and its numerical stability. Compared to the full Newton's method, which requires storing an n x n matrix, L-BFGS only needs to store 2^mn scalars, where n is the problem dimension and m is the number of historical information to retain. This memory saving allows the algorithm to handle large-scale optimization problems involving tens or even hundreds of thousands of variables. Furthermore, by avoiding matrix inversion operations, the L-BFGS algorithm exhibits better numerical stability and is less susceptible to the influence of ill-conditioned matrix numbers. In microgrid scheduling applications, optimization variables typically include control parameters for multiple time periods and multiple devices, with the problem dimension potentially reaching thousands. The computational overhead of the traditional Newton's method is unbearable, while the L-BFGS algorithm can provide high-quality optimization solutions within a reasonable computation time while maintaining the fast convergence characteristics of quasi-Newton methods, making it particularly suitable for real-time optimization applications.

[0096] Step S4.3: After completing the second-order convergent approximation, the optimal search direction on the unit constrained sphere is obtained by solving the constrained optimization problem. The n-dimensional search problem is transformed into an n-1-dimensional angle optimization problem by using the spherical coordinate parameterization method. An adaptive step size adjustment strategy is established to obtain the extreme value control strategy of the real-time scheduling parameters.

[0097] In step S4.3, after completing the second-order convergent approximation of gradient-Newton hybrid optimization, this embodiment of the invention introduces an innovative unit vector extremum distance control technique to further improve optimization efficiency and accuracy.

[0098] Unit vector extreme distance control is an advanced method specifically designed for determining search directions in high-dimensional optimization spaces. Its core idea is to find the optimal search direction on a unit constraint sphere, thereby standardizing the optimization process and improving search efficiency. Traditional optimization algorithms typically use the negative direction of the gradient or its variants to determine the search direction. However, this method can be inefficient in complex multidimensional optimization spaces, especially when the objective function has narrow contour lines, multiple saddle points, or complex constraint structures. Unit vector extreme distance control eliminates the influence of direction vector length by restricting the search direction to a unit sphere, ensuring that all possible search directions have the same "weight," thus enabling a fairer comparison and selection of the optimal direction.

[0099] The mathematical principles of this technique are based on geometric optimization and spherical geometry. A unit-constrained sphere is an n-1 dimensional hypersphere containing all possible unit-length direction vectors. The problem of finding the optimal search direction on this sphere can be formalized as a constrained optimization problem: finding the direction that minimizes the directional derivative of the objective function at the current point, while satisfying the constraint that the vector length equals 1. The analytical solution to this problem is actually the normalized vector of the objective function's gradient. However, in practical applications, by designing more complex objective functions, it is possible to obtain search directions that are superior to simple gradient directions. For example, factors such as weighted combinations of gradients, the incorporation of curvature information, or the inertia effect of historical search directions can be considered to find the comprehensively optimal search direction under the unit sphere constraint.

[0100] The technique of extreme distance control relies on a combination of spherical coordinate parameterization and constrained optimization methods. Spherical coordinate parameterization transforms a unit vector in n-dimensional Cartesian space into a function representation of n-1 angular parameters. The advantage of this transformation is that it automatically satisfies the unit length constraint, converting the constrained optimization problem into an unconstrained angle optimization problem. The parameterization process uses combinations of trigonometric functions to represent the components, ensuring that the transformed vector always lies on the unit sphere. In the angle parameter space, the optimization algorithm can search freely without worrying about constraint violations, and through appropriate objective function design, it can find the best search direction in the original optimization problem. Another important feature of this method is its dimensionality adaptability; regardless of the dimension of the original problem, the parameterized angle optimization problem has a relatively stable structure and complexity.

[0101] The value of unit vector extreme distance control technology in microgrid scheduling optimization lies in its ability to handle complex constraints and multiple objectives. Microgrid scheduling problems typically involve dozens or even hundreds of control variables. Traditional coordinate descent or gradient methods are prone to getting trapped in local optima or converging slowly in flat regions. Through unit vector technology, the algorithm can systematically consider all possible search directions in each iteration, selecting the most promising direction to explore under the current optimization landscape. Simultaneously, the extreme distance characteristic of this technology ensures the globality and systematicity of the search process, avoiding the blindness of random searches and the shortsightedness of greedy searches. In practical applications, this method often discovers high-quality solutions that are difficult to find using traditional methods, especially when dealing with microgrid scheduling problems with complex constraint structures and multiple local optima, demonstrating significant performance advantages.

[0102] Returning to the embodiments of this application, specifically, traditional optimization methods often suffer from oscillations or slow convergence when approaching the optimal solution region due to improper selection of search direction and step size. To address this issue, this embodiment of the invention constructs a unit constraint sphere S, which is a set containing all direction vectors with a L2 norm equal to 1. Searching for the optimal search direction on this unit sphere can standardize the search process and avoid uncertainty in direction selection. In specific implementation, the constrained optimization problem is solved to find the unit direction vector that minimizes the gradient projection of the objective function. The geometric meaning of this problem is to find the unit vector closest to the gradient direction of the objective function, ensuring the effectiveness of the search direction. However, directly solving constrained optimization problems in n-dimensional space has high computational complexity and is easily affected by numerical problems. Therefore, this embodiment of the invention employs a spherical coordinate parameterization method, representing an n-dimensional unit vector as a function of n-1 angular parameters. The advantages of this parameterization method are: first, it automatically satisfies the unit length constraint, transforming the constrained optimization problem into an unconstrained one; second, it reduces the search space dimension from n to n-1, decreasing the number of optimization variables; and finally, it provides a more intuitive representation of the search direction, facilitating understanding and debugging. In the angle parameter optimization process, this embodiment of the invention employs the quasi-Newton method (BFGS algorithm), utilizing the gradient information of the objective function with respect to the angle parameters for efficient solution. To handle singularity issues that may occur in the spherical coordinate system (such as coordinate singularities at poles), the algorithm introduces an adaptive coordinate system selection mechanism, dynamically selecting the most suitable parameterization method based on the current search region. After obtaining the optimal search direction, this embodiment of the invention establishes an adaptive step size adjustment strategy to ensure significant progress in each iteration. The step size control function adopts an exponential decay form, with the initial step size α0 determined based on the local curvature characteristics of the objective function, typically set as the inverse of the gradient norm multiplied by a scaling factor (0.1-0.5). The decay factor ρ controls the rate at which the step size decreases, dynamically adjusted according to the optimization progress, typically within the range of 0.9-0.99. The decay period T determines the frequency of step size updates; a larger T value (e.g., 10-20) provides a smoother step size change. To ensure the effectiveness of each iteration, the algorithm introduces Armijo conditions for line search, finding the maximum feasible step size that satisfies the sufficient descent condition through backtracking. This adaptive step size strategy avoids both overshooting the optimal solution due to excessively large step sizes and slow convergence due to excessively small step sizes, significantly improving optimization efficiency.

[0103] Step S4.4: Construct a unit constraint sphere, define a constraint sphere consisting of all direction vectors with a L2 norm equal to 1, and search for the search direction on the constraint sphere that minimizes the gradient projection of the objective function;

[0104] In step S4.4, this embodiment of the invention further implements the construction of the unit constraint sphere and the determination of the optimal search direction. The unit constraint sphere is an important geometric structure in the optimization space; it consists of all vectors with a L2 norm equal to 1, forming an n-dimensional hypersphere. In n-dimensional Euclidean space, this sphere can be represented as the set of all vectors whose sum of the squares of their components equals 1. The purpose of constructing this constraint sphere is to normalize the search direction, ensuring that all possible search directions have the same "length," facilitating fair comparison and selection. In traditional optimization methods, the search direction is usually directly taken as the negative gradient direction or its variants. This method is inefficient in some cases, especially when the objective function has narrow contour lines or multiple local optima. The innovation of this embodiment of the invention lies in not simply searching along the negative gradient direction, but rather finding the optimal search direction on the unit constraint sphere. Specifically, the system searches for the direction vector on the unit sphere that minimizes the gradient projection of the objective function. Geometrically, this is equivalent to finding the unit vector with the smallest angle to the gradient direction of the objective function, ensuring that the search direction is as consistent as possible with the direction of the fastest descent of the function. To efficiently solve this problem, this invention proposes an analytical solution method based on the Lagrange multiplier method. First, a Lagrange function is constructed, including the gradient projection term of the objective function and a unit length constraint term. Then, the stationary point condition of the Lagrange function is solved to obtain candidate directions. Finally, the second-order condition of the candidate directions is verified to confirm them as the global optimum. In practical implementation, considering numerical stability, the system employs the Singular Value Decomposition (SVD) method to handle potential ill-conditioned situations, ensuring a stable search direction is obtained even when the gradient is close to zero or the direction is uncertain. Furthermore, this invention introduces a search direction smoothing mechanism, weighted and fused with historical directions to avoid drastic changes in the search direction and improve the stability of the optimization process. This search direction determination method based on a unit-constrained sphere exhibits significant advantages over traditional methods for complex objective functions, especially in handling non-convex, multimodal optimization objectives common in microgrid scheduling problems, where it can more effectively avoid local optima and find the global optimum.

[0105] Step S4.5: Using the spherical coordinate parameterization method, the n-dimensional unit vector in the Cartesian coordinate system is represented as a combination of trigonometric functions of n-1 angle parameters, and the unit constraint condition is automatically satisfied through the optimization of the angle parameters;

[0106] In step S4.5, the embodiment of the present invention adopts a spherical coordinate parameterization method, which ingeniously solves the problem of optimizing high-dimensional unit vectors. In the traditional Cartesian coordinate system, to maintain the unit length constraint of the vector, it is necessary to perform a normalization operation after each parameter update, which not only increases the computational overhead but may also lead to non-smooth optimization trajectories. The core idea of the spherical coordinate parameterization method is to transform the unit vector in the n-dimensional Cartesian space into a form represented by n-1 angular parameters, which can be freely optimized in an unconstrained space and automatically satisfy the unit length constraint after being transformed back to the Cartesian coordinates. In the specific implementation, the n-dimensional unit vector d is represented by n-1 angular parameters φ1, φ2, ..., φ n-1 where φ1, φ2, ..., φ n-2 range from [0, π], and φ n-1 range from [0, 2π]. The first component d1 is represented as cosφ1, the second component d2 is represented as sinφ1cosφ2, and so on. Generally, the i-th component d i (i < n) is represented as sinφ1, sinφ2...sinφ i-1 , cosφ i , and the last component dn is represented as sinφ1, sinφ2...sinφ n-2 , sinφ n-1 . The mathematical basis of this parameterization method is the standard parameter representation of the hypersphere, which establishes a one-to-one correspondence between the points on the unit sphere and the angular parameter space. To handle the possible numerical problems in the optimization of angular parameters, the embodiment of the present invention adopts several key technologies. First, to avoid the numerical instability near the poles (when some angles are close to 0 or π), a regularization term is introduced to make the algorithm tend to avoid these regions. Second, a periodic boundary handling mechanism is designed to ensure that the optimization process remains smooth and continuous when the angular parameters cross the periodic boundary (such as from 359° to 1°). Third, an adaptive precision control is implemented, using a lower-precision angular representation at the initial stage of optimization to accelerate the calculation and gradually increasing the precision as the optimization progresses to ensure the accuracy of the final solution. In practical applications, for typical microgrid scheduling problems, the dimension of the control variables is usually between 20 and 50. Directly optimizing in this dimension has a relatively high computational complexity. Through spherical coordinate parameterization, the optimization variables are reduced to 19 - 49 angular parameters, and at the same time, the unit length constraint is eliminated, significantly simplifying the problem structure. Experimental results show that compared with directly performing constrained optimization in the Cartesian coordinate system, the spherical coordinate parameterization method reduces the average computational time by 35%, while improving the accuracy and stability of the optimization results. In addition, this parameterization method also facilitates the visualization and understanding of the high-dimensional optimization process, and the optimization trajectory and the distribution of the objective function can be intuitively displayed through the slice maps of the two-dimensional or three-dimensional angular subspaces.

[0107] Step S4.6: Design a step size control function and adopt an exponential decay step size adjustment strategy, wherein the initial step size is determined according to the local curvature characteristics of the objective function, and the decay factor and decay period are dynamically adjusted according to the convergence performance of the optimization process.

[0108] After completing the spherical coordinate parameterization transformation in step S4.5, although the n-dimensional unit vector optimization problem is successfully transformed into an unconstrained optimization problem with n-1 angle parameters, the convergence speed and stability of the optimization algorithm still highly depend on the design of the step size control strategy. The spherical coordinate parameterization method provides theoretical convenience for optimization, but in actual execution, the objective function may exhibit complex nonlinear characteristics in the angle parameter space, making traditional fixed step size methods often unsuitable for this complexity. Especially in the spherical coordinate system, different angle parameters have vastly different sensitivities to the objective function; small changes in some angles can lead to significant changes in the search direction, while others are relatively insensitive. Therefore, designing the step size control function in step S4.6 becomes a crucial step in leveraging the results of spherical coordinate parameterization and ensuring the efficient and stable execution of the optimization algorithm.

[0109] Therefore, in step S4.6, this embodiment of the invention designs a fine-grained step size control function, which is one of the key factors in optimizing algorithm performance. An excessively large step size may cause the algorithm to skip the optimal solution without converging, while an excessively small step size will result in slow convergence and wasted computational resources. To address this issue, this embodiment of the invention employs an exponentially decaying step size adjustment strategy, dynamically adjusting the step size parameter based on the characteristics of the objective function and the optimization process. First, the setting of the initial step size α0 is crucial, as it directly affects the initial efficiency of the optimization. This embodiment of the invention adaptively determines the initial step size based on the local curvature characteristics of the objective function, rather than using a fixed value. Specifically, before optimization begins, the system performs sampling analysis on the objective function to estimate its local Lipschitz constant L, and then sets the initial step size to the reciprocal of L multiplied by a safety factor (typically 0.1-0.5). This method ensures that the initial step size is large enough to rapidly advance the optimization process without becoming too large and causing instability. For microgrid dispatching problems, due to the significant differences in sensitivity among different control variables (such as the varying impacts of generator output adjustment and energy storage charging / discharging power), this invention also introduces a variable-specific step scaling factor, applying different initial step sizes to different variables to improve optimization efficiency. Secondly, the attenuation factor ρ controls the rate of step size reduction and is a core parameter of the step size control function. Traditional methods typically use fixed attenuation factors, which are difficult to adapt to changes in the objective function characteristics during optimization. This invention designs an adaptive attenuation factor mechanism, dynamically adjusting the ρ value according to the optimization progress. When the objective function improvement rate remains stable after multiple iterations, the system increases the ρ value (close to 1) to slow down the step size attenuation rate; when the objective function improvement rate fluctuates significantly or oscillates, the system decreases the ρ value (usually to 0.8-0.9) to accelerate step size attenuation and stabilize the optimization process. Thirdly, the attenuation period T determines the frequency of step size updates, affecting the smoothness of step size changes. A larger T value provides smoother step size changes, suitable for situations where the objective function is relatively flat; a smaller T value makes step size adjustments more sensitive, suitable for regions where the objective function changes drastically. This invention dynamically adjusts the decay period based on the local variation characteristics of the objective function, using a larger period (15-20 iterations) in flat regions and a smaller period (5-10 iterations) in steep regions. Furthermore, this invention incorporates the Armijo condition to implement a backtracking search, verifying in each iteration whether the step size satisfies the sufficient descent condition; if not, the step size is reduced and the iteration is retried, ensuring that each iteration effectively reduces the objective function value. This multi-level step size control strategy enables the optimization algorithm to adapt to the complex and variable characteristics of the objective function in microgrid scheduling problems, maximizing convergence speed while ensuring convergence.

[0110] Step S4.7: Establish a step size restart mechanism. When the improvement of the objective function after multiple consecutive iterations is less than a preset threshold, reset the step size to a preset proportion of the initial value to obtain the extreme value control strategy of the real-time scheduling parameters.

[0111] In step S4.7, this embodiment of the invention establishes an innovative step-size restart mechanism, effectively solving the common problems of "getting stuck" or slow convergence during optimization. In complex microgrid scheduling optimization, the objective function often has multiple local optima, narrow canyon regions, or flat plateau regions. Traditional fixed decay step-size strategies are prone to getting stuck in these situations: the step size has decayed to a very small value, but the algorithm is still inefficiently lingering in local regions, making it difficult to break out of the current region to explore better solutions. The core idea of ​​the step-size restart mechanism is to actively reset the step size to a larger value when optimization progress is detected to have stalled, giving the algorithm a "second chance" to break out of the current region. In specific implementation, the system continuously monitors the improvement of the objective function for L consecutive iterations. When the improvement of the objective function for L consecutive iterations is less than a preset threshold ε2, the step-size restart mechanism is triggered. Here, L and ε2 are key parameters that need to be set carefully according to the characteristics of the problem: too small a L will lead to premature restart, interfering with normal convergence; too large a L may cause the algorithm to waste too much computational resources in inefficient regions. In typical microgrid scheduling optimization, L is usually set to 10-20, and ε2 is set to 1%-5% of the average improvement in the initial few iterations. Upon restart, the step size is not simply restored to the initial value, but rather reset to a preset proportion of the initial value, typically 30%-70%. This partial reset strategy balances the need to explore new regions with the consideration of maintaining a certain convergence progress. To avoid the algorithm getting stuck in an infinite restart loop, this embodiment of the invention also designs a restart count control and restart intensity decay mechanism. After each restart, the maximum allowed number of restarts decreases, and the restart step size proportion gradually decreases, ensuring that the algorithm eventually converges. Furthermore, the system records the optimal solution before each restart and selects the global optimal solution as the final output after multiple restarts to handle possible multimodal optimization situations. The step size restart mechanism, together with the aforementioned spherical coordinate parameterization and adaptive step size strategy, forms a powerful optimization framework. In practical application tests, this mechanism significantly improves the algorithm's ability to handle complex microgrid scheduling problems, reducing the average number of iterations by 25%-40%, while increasing the probability of finding the global optimal solution. Especially when dealing with large-scale microgrid scheduling problems involving multiple energy devices and multi-time-period linkage constraints, the advantages of the step-size restart mechanism are more obvious. It can effectively avoid the algorithm getting trapped in suboptimal solutions and discover more economical and efficient scheduling strategies. Through the comprehensive application of this series of optimization techniques, the embodiments of the present invention finally obtain an efficient and robust real-time scheduling parameter extreme value control strategy, which can provide optimal scheduling decisions for microgrids within milliseconds to seconds, meeting the strict time requirements of real-time scheduling.

[0112] Step S5: Based on the extreme value control strategy and discrete-time control barrier function certificate of the real-time scheduling parameters, a robust scheduling scheme for uncertain disturbances is obtained by establishing a discrete-time microgrid dynamic model, designing a control barrier function certificate mechanism, using the recursive least squares method to estimate system parameters online, and establishing a robust guarantee mechanism.

[0113] Specifically, in step S5, a discrete-time microgrid dynamic model is first established. The microgrid system is modeled as a discrete-time state-space system, where the state at the next time step equals the system matrix multiplied by the current state, plus the control matrix multiplied by the control input parameters, plus the external disturbance parameters. The system state vector includes state variables such as the output of each generator unit, the state of charge of energy storage, the voltage amplitude of nodes, and the phase angle; the control input vector includes controllable generator output commands, energy storage charging and discharging power, and load shedding amounts; the system matrix and control matrix contain uncertain parameters; and the external disturbance vector includes random disturbances such as renewable energy output fluctuations, load forecasting errors, and changes in ambient temperature. Considering parameter uncertainty, the parameters are assumed to belong to a known compact convex set, representing the range of parameter variation.

[0114] Secondly, a discrete-time control barrier function certificate mechanism is designed. A discrete-time control barrier function is defined to describe system safety constraints, such as voltage deviation constraints and equipment capacity constraints. A control barrier function certificate is constructed: for a given control input, if there exists a class function that makes the change of the control barrier function satisfy specific conditions, then the control input is said to satisfy the safety certificate conditions. A certificate verification algorithm is established to verify whether candidate control actions satisfy the certificate conditions in each scheduling cycle, allowing only verified safe control actions to be executed.

[0115] Third, recursive least squares is used for online estimation of system parameters. A parameter estimation model is established, including observed output, regression vector, and measurement noise. The recursive least squares estimation algorithm includes parameter updates, gain matrix calculation, and covariance matrix updates, which incorporate a forgetting factor. The forgetting factor is adjusted to adapt to the time-varying characteristics of the parameters: a value close to 1 is used when the system is stable to maintain estimation accuracy, and the value is reduced when parameter mutations are detected to improve tracking speed. A parameter estimation error boundary is established and dynamically calculated based on the estimated covariance matrix.

[0116] Fourth, establish a robustness guarantee mechanism. Set a conservative margin to address model uncertainties, tightening the original constraints into a form that includes a safety margin. Calculate the worst-case constraint violation risk based on the parameter uncertainty boundary and the upper bound of the disturbance. Employ a robust optimization method to transform the scheduling problem into a minimax optimization, ensuring that performance requirements are met even under the worst-case parameter and disturbance combinations. Establish a confidence mechanism to dynamically adjust the conservative margin based on the confidence interval of the parameter estimates, including the base margin and adjustment coefficient.

[0117] Fifth, an adaptive control law is designed to achieve real-time scheduling strategy adjustment. The adaptive control law is constructed, including a feedback gain matrix based on parameter estimation and a feedforward compensation term. A model reference adaptive control method is adopted, designing a reference model and defining the tracking error. An adaptive law is designed to converge the tracking error, including the gain matrix and the adaptive gain matrix. Stability analysis is established, and the asymptotic stability of the closed-loop system is proved using the Lyapunov method. A switching control strategy is designed, switching between a nominal controller, a robust controller, and an emergency controller based on the system's operating state: when the tracking error is less than a first threshold, the nominal controller is used to obtain optimal performance; when the tracking error is between the first and second thresholds, the robust controller is switched to ensure stability; when the tracking error is greater than or equal to the second threshold, the emergency controller is activated to ensure safety. The entire adaptive control system has guarantees of parameter convergence and closed-loop stability, ensuring the robustness and adaptability of the microgrid scheduling system under various uncertain disturbances.

[0118] Specifically, step S5 includes:

[0119] Step S5.1: Establish the discrete-time microgrid dynamic model. In the discrete-time microgrid dynamic model, the state at the next time step is equal to the system matrix multiplied by the current state, plus the control matrix multiplied by the control input parameters, plus the external disturbance parameters. The system matrix and control matrix contain uncertain parameters. Define a discrete-time control barrier function to describe the system's safe operation constraints and construct the control barrier function certificate to obtain the discrete-time safety constraint model.

[0120] In step S5.1, this embodiment of the invention establishes an accurate discrete-time microgrid dynamic model, providing a mathematical basis for robust scheduling schemes. Unlike traditional static optimization models, dynamic models can capture the characteristics of microgrid state evolution over time, more accurately describing system behavior. This embodiment of the invention uses state-space representation to construct the model, where the state at the next moment is jointly determined by the current state, control input, and external disturbances. The system state vector contains four types of key variables: energy variables (such as the state of charge of the energy storage system and the temperature of thermal energy storage), electrical variables (such as the amplitude and phase angle of the bus voltage and the line power flow), equipment variables (such as generator speed and cumulative operating time), and environmental variables (such as indoor temperature and building thermal inertia). The control input vector contains control commands for all controllable equipment, such as the power setpoint of the generator set, the charging and discharging power of the energy storage system, and the switching status of controllable loads. The external disturbance vector represents various uncertainties faced by the system, including fluctuations in renewable energy output (such as changes in photovoltaic output caused by sudden changes in light intensity), load forecasting errors (such as changes in electricity demand caused by sudden events), and changes in environmental conditions (such as temperature and humidity fluctuations affecting equipment efficiency).

[0121] The system matrix and control matrix are core components of the model, describing the interactions between state variables and the impact of control inputs on the state. Unlike traditional deterministic models, this invention considers the uncertainties in the parameters of these matrices. For example, the charging and discharging efficiency of an energy storage system varies with usage time and ambient temperature; the fuel conversion efficiency of a generator is affected by fuel quality and equipment wear; and grid impedance parameters are affected by temperature and load levels. These uncertain parameters are modeled as variables with known boundaries, forming a set of parameter uncertainties. In this way, the model can express the possible behavior of the system under various parameter variations, providing a foundation for robust control design.

[0122] Based on the established dynamic model, this invention defines a discrete-time control barrier function to describe the constraints on system safe operation. Unlike continuous-time systems, the state changes of discrete-time systems are abrupt, requiring a special form of control barrier function. The discrete-time control barrier function designed in this invention covers three types of key constraints: state constraints (such as maintaining the energy storage SOC within a safe range), rate-of-change constraints (such as the voltage change rate not exceeding a safe limit), and cumulative effect constraints (such as the limit on the cumulative number of equipment start-ups and shutdowns). Each type of constraint is represented as a function of the system state. A non-negative function value indicates that the constraint is satisfied, a function value of zero indicates that the system is on the constraint boundary, and a negative function value indicates that the constraint is violated.

[0123] Based on the discrete-time control barrier function, this invention constructs a control barrier function certificate mechanism. The core of this mechanism is to ensure that after the system executes a control action, the change in the control barrier function value satisfies a specific condition, guaranteeing that the system always evolves in a direction that satisfies the constraints. Specifically, for a given control input, if there exists a class function (a strictly increasing function passing through the origin) such that the change in the control barrier function after one time step is greater than or equal to the negative value of the class function acting on the current control barrier function value, then the control input is said to satisfy the safety certificate condition. This condition ensures that even if the system approaches the constraint boundary, it will be "pushed back" to the safe region, rather than crossing the boundary into the unsafe region. In this way, this invention obtains a discrete-time microgrid dynamic model with safety guarantees, providing a theoretical basis for subsequent robust scheduling algorithms.

[0124] Step S5.2: For the discrete-time security constraint model, the recursive least squares method is used to estimate the system parameters online. By adjusting the forgetting factor to adapt to the time-varying characteristics of the parameters and establishing the parameter estimation error boundary, an adaptive parameter estimation mechanism is obtained.

[0125] In step S5.2, this embodiment of the invention designs an efficient online system parameter estimation method to address the challenges of parameter uncertainty in microgrids. Microgrid system parameters exhibit time-varying characteristics; for example, the capacity and efficiency of energy storage systems change with the usage cycle, the efficiency of power generation equipment is affected by ambient temperature and operating time, and load characteristics change with seasons and user behavior patterns. Static models cannot accurately capture these dynamic changes, while the recursive least squares method used in this embodiment can track and estimate system parameters in real time, providing more accurate model support for scheduling decisions.

[0126] The core idea of ​​recursive least squares estimation is to combine new observation data with historical estimation results to continuously update the parameter estimates. Compared with traditional batch least squares, the recursive method does not require storing and processing all historical data, resulting in higher computational efficiency, making it particularly suitable for real-time applications. In the implementation of this invention, the system first establishes a parameter estimation model, representing the system output as the inner product of a regression vector and the parameters to be estimated, plus measurement noise. The regression vector contains a function of the current system state and control input, while the parameters to be estimated correspond to unknown elements in the system matrix and control matrix.

[0127] To adapt to the time-varying characteristics of parameters, this invention introduces a recursive least squares algorithm with a forgetting factor. The forgetting factor controls the weight of historical data on the current estimate. A smaller forgetting factor allows the algorithm to "forget" old data more quickly, improving the response speed to new data; a larger forgetting factor retains more historical information, providing more stable estimation results. This invention innovatively designs an adaptive forgetting factor adjustment mechanism, dynamically adjusting the forgetting factor value according to the system's operating status. Specifically, the system identifies parameter change patterns by monitoring the statistical characteristics of the prediction error sequence: when the prediction error suddenly increases or shows a clear trend, it indicates that the system parameters may have changed. At this time, the forgetting factor is automatically reduced (usually to 0.90-0.95) to improve the algorithm's sensitivity to new data; when the prediction error remains at a stable low level, it indicates that the system parameters are relatively stable. At this time, the forgetting factor is increased (usually to 0.98-0.99) to enhance the smoothness and noise resistance of the estimation.

[0128] To assess the reliability of parameter estimation, this embodiment of the invention establishes a parameter estimation error boundary mechanism. This mechanism, based on the estimated covariance matrix, calculates the maximum possible deviation between the estimated and true parameter values. This error boundary not only provides a confidence interval for the estimation results but also provides a quantitative basis for uncertainty in subsequent robust control design. The calculation of the error boundary considers factors such as measurement noise characteristics, system excitation sufficiency, and parameter change rate, and is calibrated using a combination of theoretical analysis and Monte Carlo simulation to ensure its statistical validity.

[0129] Furthermore, this embodiment of the invention also includes an anomaly detection and handling mechanism for parameter estimation. When the estimated parameters suddenly change beyond a preset threshold, or the estimation result violates physical constraints (such as efficiency exceeding 100%), the system triggers an anomaly handling process: first, it verifies data quality to rule out the possibility of sensor failure or communication interruption; then, it checks whether the system operating mode has changed, such as switching from grid-connected mode to islanded mode; finally, it decides whether to accept the new estimation value or temporarily maintain the previous estimation result. This multi-level anomaly handling ensures the reliability and continuity of parameter estimation.

[0130] By comprehensively applying the above technologies, this invention achieves high-precision, real-time system parameter estimation, providing a dynamically adaptive model foundation for robust microgrid scheduling. Experimental results show that, compared with the static model, the dynamic model using adaptive parameter estimation reduces the system state prediction error by an average of over 40%, significantly improving the accuracy and adaptability of scheduling decisions.

[0131] Step S5.3: Based on the adaptive parameter estimation mechanism, a conservative margin is set to deal with model uncertainty. A robust optimization method is used to transform the scheduling problem into a minimax optimization. A confidence mechanism is established and an adaptive control law is designed to realize real-time scheduling strategy adjustment, thereby obtaining the robust scheduling scheme for uncertainty disturbances.

[0132] The system incorporates a conservative margin to address model uncertainties. Traditional optimization methods, typically based on deterministic models, struggle to handle parameter variations and external disturbances, often resulting in overly optimistic scheduling schemes that may violate system constraints in actual operation. The conservative margin strategy employed in this embodiment appropriately tightens the original constraints, reserving a safety margin for system operation. Specifically, differentiated margin settings are applied to different types of constraints: a larger margin, typically 15%-25% of the original constraint range, is set for safety-critical constraints (such as frequency stability and voltage limits); a smaller margin, typically 5%-10%, is set for economically relevant constraints (such as generation costs and energy storage utilization); and a dynamic margin is used for user experience-related constraints (such as indoor temperature comfort), adaptively adjusting based on user preferences and system status.

[0133] Based on a conservative margin, this invention employs a robust optimization method to transform the microgrid scheduling problem into a minimax optimization form. Traditional deterministic optimization pursues optimal performance under specific parameters, while robust optimization considers performance guarantees under worst-case conditions, ensuring the system can operate safely and reliably under various uncertain conditions. In the minimax optimization problem constructed in this invention, the inner maximization problem seeks the worst-case parameter and disturbance combination within the range of parameter uncertainty and disturbance upper bounds; the outer minimization problem seeks the control strategy that still performs best under worst-case conditions. This optimization structure is essentially a game, where the control strategy and uncertainty counteract each other, ultimately reaching a balance. To improve computational efficiency, this invention employs several techniques to optimize the solution process: First, convex relaxation techniques are used to transform the non-convex inner problem into an equivalent convex optimization problem, significantly reducing the solution difficulty; second, duality theory is used to transform the minimax problem into a single-layer optimization problem, avoiding the computational complexity of nested optimization; finally, a customized algorithm is designed for the specific structure of the microgrid, utilizing the problem's decomposition characteristics to achieve parallel computation, further improving the solution speed.

[0134] To balance robustness and performance, this invention establishes an adaptive mechanism based on confidence level. Pure worst-case optimization is often overly conservative, sacrificing system performance under most normal conditions. The confidence level mechanism in this invention dynamically adjusts the level of conservatism based on the uncertainty of parameter estimation: when parameter estimation accuracy is high (small estimation error boundary), the conservatism margin is reduced, allowing the system to pursue higher performance; when parameter estimation uncertainty is large, the conservatism margin is increased, prioritizing system safety. Confidence level calculation is based on the parameter estimation covariance matrix and historical prediction error statistics, comprehensively reflecting the reliability of the current estimation results.

[0135] Finally, this embodiment of the invention designs an adaptive control law to achieve real-time scheduling strategy adjustment. Unlike traditional open-loop optimization, the adaptive control law can dynamically adjust the control strategy based on the real-time observed system state, forming closed-loop feedback control. The control law consists of two parts: a feedback gain matrix based on the current parameter estimation and a feedforward compensation term. The feedback gain matrix generates a corrected control signal based on the system state deviation, while the feedforward compensation term handles known reference inputs and disturbances. To ensure control performance, this embodiment of the invention employs a model reference adaptive control method, designing an ideal reference model to describe the desired system behavior, and then using an adaptive law to make the actual system track the reference model. The design of the adaptive law is based on Lyapunov stability theory, ensuring that the tracking error asymptotically converges to zero, while satisfying the control barrier function certificate condition to guarantee system safety.

[0136] To address different operating conditions, this invention also incorporates a multi-mode switching control strategy. The system dynamically switches between three controllers based on its operating state: when the system state approaches the reference trajectory, the nominal controller is used to pursue optimal performance; when the state deviation increases but remains within a controllable range, the system switches to a robust controller to ensure stability; when the deviation further increases or approaches the safety boundary, the emergency controller is activated, employing a conservative strategy to pull the system back to a safe region. The mode switching utilizes a smooth transition mechanism to avoid system instability caused by sudden control jumps during switching.

[0137] By comprehensively applying the above technologies, the embodiments of the present invention ultimately obtain a robust scheduling scheme for uncertain disturbances, which can achieve a balance between economy and reliability while ensuring system safety. Experimental verification shows that, compared with traditional deterministic optimization, this scheme can still maintain stable operation when faced with 20% parameter changes and 30% disturbance fluctuations, while the average operating cost increases by only 7%, demonstrating excellent robustness and economy.

[0138] Step S6: Based on the robust scheduling scheme and combined with real-time operation status monitoring, real-time intelligent scheduling of the microgrid is performed by deploying edge computing nodes;

[0139] Specifically, in step S6, edge computing nodes are deployed at key nodes of the microgrid to perform real-time data processing and execute scheduling commands; a real-time monitoring mechanism with a 15-minute scheduling cycle is established to continuously collect actual operating data of the microgrid; a state deviation detection algorithm is designed to calculate the deviation between the actual operating state and the planned scheduling scheme in real time; when the deviation exceeds a preset threshold, the AI ​​large model is triggered to quickly regenerate the scheduling scheme; a scheduling effect evaluation system is established to regularly evaluate the economic, environmental, and reliability indicators of the scheduling scheme; the evaluation results are used as feedback data to input into the continuous learning process of the large model, and the scheduling accuracy and adaptability are continuously improved through online fine-tuning. The real-time scheduling system of this invention fully complies with the requirements of Article 7.2.1.4 of "T / CEC182—2018 Microgrid Grid-connected Scheduling Operation Specification", namely, "For microgrids connected to 10kV~35kV distribution networks, the active power control response time of the tie line should not exceed 10 seconds, and the adjustment time should not exceed 1 minute". Through the design of the edge computing architecture and hierarchical scheduling strategy, it is ensured that the system can meet the real-time indicators specified in the standard under various operating scenarios.

[0140] In an embodiment of the present invention, S6 further includes:

[0141] Step S6.1: Deploy edge computing nodes at key nodes of the microgrid, establish a real-time monitoring mechanism with a 15-minute scheduling cycle to continuously collect actual operating data of the microgrid and obtain real-time operating status data;

[0142] In step S6.1, this embodiment of the invention constructs a distributed edge computing architecture to realize real-time status monitoring and data processing of the microgrid. Traditional centralized monitoring systems suffer from problems such as large data transmission latency, heavy computational burden on central nodes, and system reliability relying on a single point, making it difficult to meet the rapid response requirements of modern microgrids. The edge computing architecture adopted in this embodiment of the invention pushes computing power down to a location closer to the data source, significantly improving system response speed and reliability.

[0143] In terms of physical deployment, this embodiment of the invention installs edge computing devices at key nodes of the microgrid, forming a multi-layered computing network. The first layer consists of device-level edge nodes, directly connected to key devices such as converters, energy storage systems, and smart switches, collecting raw data from the devices and performing preliminary processing. The second layer consists of region-level edge nodes, responsible for aggregating and coordinating multiple device-level nodes within a region, performing local optimization calculations. The third layer consists of system-level edge nodes, responsible for global coordination and optimization decisions, interacting with the upper-level cloud platform and dispatch center. The edge computing devices adopt an industrial-grade embedded computing platform, equipped with a multi-core processor (typically an 8-core ARM processor with a main frequency of 2.0GHz or higher), a dedicated DSP chip, and an FPGA accelerator, possessing powerful real-time computing capabilities. The operating system uses a real-time operating system such as real-time Linux or VxWorks, ensuring millisecond-level response times. To cope with harsh industrial environments, the devices adopt a fanless design, a wide operating temperature range (-40°C to 85°C), and a high protection rating (IP65 or higher), ensuring stable operation under various conditions.

[0144] In terms of data acquisition, this embodiment of the invention establishes a real-time monitoring mechanism with a 15-minute scheduling cycle. This cycle is set based on considerations of microgrid operating characteristics and computing resource balance: short enough to capture changes in renewable energy and load, yet long enough to complete necessary optimization calculations. Within each scheduling cycle, the system collects key parameters at a higher frequency (typically on the order of seconds or milliseconds) for real-time control and anomaly detection. The collected data is divided into four categories: electrical parameters (such as voltage, current, power, frequency, etc.), energy parameters (such as energy storage SOC, fuel consumption, etc.), equipment status parameters (such as operating mode, health status, etc.), and environmental parameters (such as temperature, illumination, wind speed, etc.). Data acquisition adopts a multi-protocol fusion scheme, supporting industry standard protocols such as Modbus, DNP3, IEC61850, and OPC UA to ensure compatibility with various types of equipment. To improve data quality, the system implements a multi-level data verification mechanism, including range checks, rate of change checks, consistency checks, and redundant sensor cross-validation, effectively filtering abnormal data.

[0145] In terms of data processing, edge nodes perform three layers of data processing: the first layer is real-time data cleaning and preprocessing, including missing value handling, outlier detection, signal filtering, and unit conversion, to ensure data quality; the second layer is feature extraction and state estimation, which extracts valuable features from the raw data and estimates the system state that cannot be directly measured through statistical analysis and model calculation; the third layer is predictive analysis, which predicts the system behavior in the short term (15 minutes to several hours) based on historical data and current trends, providing a basis for proactive control. The data processing algorithms are optimized for the edge computing environment, employing lightweight machine learning models and efficient numerical computation methods to achieve high-performance processing with limited computing resources.

[0146] To ensure system reliability, this invention implements several fault-tolerant mechanisms: First, critical nodes are redundantly designed, with primary and backup nodes operating simultaneously and maintaining data synchronization; second, a hierarchical autonomous mechanism is established, allowing lower-level nodes to operate autonomously and maintain basic functions when upper-level nodes fail; finally, a data caching and recovery mechanism is designed to locally store critical data during communication interruptions and automatically synchronize it upon recovery. Through these designs, even in the event of partial device or communication link failures, the system can still maintain basic monitoring and control functions, ensuring the continuous and safe operation of the microgrid.

[0147] By comprehensively applying the above technologies, this embodiment of the invention establishes an efficient and reliable real-time operational status monitoring system, providing accurate and timely data support for intelligent scheduling. Actual deployment results show that the system remains available 99.99% of the time, with a data acquisition success rate exceeding 99.9%, providing a solid foundation for subsequent scheduling optimization.

[0148] Step S6.2: Based on the real-time operating status data, design a status deviation detection algorithm to calculate the deviation between the actual operating status and the planned scheduling scheme in real time. When the deviation exceeds a preset threshold, trigger the AI ​​big model to quickly regenerate the scheduling scheme to obtain a dynamic scheduling adjustment mechanism.

[0149] In step S6.2, this embodiment of the invention designs a sophisticated state deviation detection and dynamic scheduling adjustment mechanism, enabling the microgrid scheduling system to flexibly respond to various changes and deviations in actual operation. Traditional static scheduling schemes are fixed once formulated and are difficult to adapt to real-time changes such as renewable energy output fluctuations and load surges. However, the dynamic adjustment mechanism of this embodiment can promptly identify deviations and trigger scheduling scheme updates, significantly improving the system's adaptability and economy.

[0150] The state deviation detection algorithm is a core component of the dynamic adjustment mechanism, responsible for real-time evaluation of the differences between the actual operating state and the planned scheduling scheme. The deviation detection algorithm designed in this embodiment of the invention employs a comprehensive evaluation method across multiple dimensions and time scales, focusing not only on single-point deviations but also on trend changes and cumulative effects. Spatially, the algorithm monitors four types of key deviations: energy balance deviations (such as power imbalance and frequency deviations), equipment operation deviations (such as generator output deviations and energy storage charging / discharging state deviations), economic deviations (such as the difference between actual and expected operating costs), and safety margin deviations (such as changes in the degree of constraint satisfaction). Temporally, the algorithm simultaneously evaluates instantaneous deviations, short-term cumulative deviations, and trend deviations, comprehensively capturing the dynamic changes in the system's operating state.

[0151] The deviation calculation employs a weighted Euclidean distance metric, assigning different weights to different state variables based on their importance and sensitivity. To handle scale differences among various physical quantities, all variables are standardized before calculation, converting them into dimensionless relative deviations. Furthermore, the algorithm incorporates an adaptive threshold mechanism, dynamically adjusting the trigger threshold based on system operating modes and external conditions: a higher threshold is used during normal operation to reduce unnecessary scheduling updates; under high-risk conditions such as extreme weather or equipment failure, the threshold is lowered to improve system response sensitivity.

[0152] When the detected state deviation exceeds a preset threshold, the system triggers the AI ​​large model to regenerate the scheduling scheme. To meet real-time response requirements, this embodiment of the invention designs a hierarchical scheduling update strategy: for minor deviations, only local parameters are adjusted, such as the output setting value of a single device, resulting in low computational complexity and a response time typically within seconds; for moderate deviations, the scheduling plan for the current period and several future periods is updated, involving the coordinated optimization of multiple devices, with a response time of approximately 10 seconds; for severe deviations, a global scheduling replanning is triggered, covering the entire scheduling cycle, with a response time between 30 seconds and 1 minute. This hierarchical strategy ensures that the system can respond appropriately according to the severity of the deviation, guaranteeing both timely adjustments and avoiding waste of computational resources.

[0153] The hierarchical scheduling update strategy designed in this embodiment of the invention fully meets the requirements of Article 7.2.1.4 of the "T / CEC 182—2018 Microgrid Grid-connected Scheduling Operation Specification". This standard clearly stipulates that "for microgrids connected to 10kV~35kV distribution networks, the active power control response time of the tie line should not exceed 10 seconds, and the adjustment time should not exceed 1 minute." In this embodiment of the invention, for the most common minor deviation scenarios in daily operation (accounting for approximately 70-80% of total scheduling adjustments), the system response time is within seconds, far exceeding the standard requirement of 10 seconds; for medium deviation scenarios requiring multi-device coordination, the system response time is approximately 10 seconds, precisely meeting the standard requirements; even in severe deviation scenarios requiring global scheduling replanning (occurring less than 5% of the time), the system response time is controlled within 1 minute, meeting the standard's adjustment time limit. Furthermore, the edge computing nodes in this embodiment of the invention employ a real-time operating system, with a response time in the millisecond range for its underlying real-time control loop. This ensures that real-time tracking and control of the active power of the tie line can be completed in less than 10 seconds, providing sufficient technical assurance to meet standard requirements. Through this layered design, this embodiment of the invention not only meets the stringent real-time requirements of industry standards but also fully leverages the advantages of advanced algorithms in improving scheduling quality and economy.

[0154] The large AI model plays a crucial role in the scheduling regeneration process. Compared with traditional optimization algorithms, the domain-fine-tuned large AI model has three major advantages: First, it has a fast computation speed, generating preliminary scheduling schemes within milliseconds to seconds to meet real-time response requirements; second, it is highly adaptable, able to quickly adjust strategies based on the current system state and historical experience, without needing to optimize from scratch; and finally, it has good decision interpretability, providing reasons and evidence for scheduling suggestions, enhancing operators' trust and understanding. In practical implementation, the large AI model complements traditional optimization algorithms: the large model quickly generates preliminary schemes, while traditional algorithms perform fine-tuning and constraint verification, achieving a balance between speed and accuracy.

[0155] To ensure a smooth transition in scheduling adjustments, this embodiment of the invention also incorporates a gradual implementation mechanism. The newly generated scheduling scheme is not switched abruptly, but rather implemented gradually through a smooth transition function, avoiding any impact on equipment and the system from sudden changes in control commands. The transition function is designed to consider the dynamic characteristics and response capabilities of different devices, such as the ramp rate limit of generators and the power change rate of energy storage systems, ensuring that control changes remain within the safe response range of the equipment.

[0156] Furthermore, this embodiment of the invention establishes a learning and optimization mechanism for scheduling adjustments. The system records the triggering conditions, adjustment content, and implementation effects of each scheduling adjustment, and identifies adjustment patterns and effect regularities through statistical analysis, continuously optimizing the deviation detection algorithm and scheduling update strategy. For example, if a certain type of deviation frequently triggers scheduling updates but has limited actual effects, the system will automatically increase the trigger threshold for that type of deviation; if a certain scheduling adjustment pattern consistently performs well, the system will include it in a preset strategy library to accelerate the response to similar situations in the future.

[0157] Through the comprehensive application of the above technologies, this invention achieves an efficient and intelligent dynamic scheduling and adjustment mechanism, enabling the microgrid scheduling system to respond promptly to various operational changes and disturbances. Actual operational data shows that, compared to static scheduling schemes, the dynamic adjustment mechanism reduces operating cost deviation by an average of 15%, increases renewable energy absorption rate by 25%, and significantly enhances the economic and environmental performance of the microgrid.

[0158] Step S6.3: For the dynamic scheduling adjustment mechanism, establish a scheduling effect evaluation system to regularly evaluate the economic, environmental and reliability indicators of the scheduling scheme, and input the evaluation results as feedback data into the continuous learning process of the AI ​​big model. Through online fine-tuning, the scheduling accuracy and adaptability are continuously improved, and a continuously improving intelligent scheduling system is obtained.

[0159] In step S6.3, this embodiment of the invention establishes a comprehensive scheduling effect evaluation system and a continuous learning mechanism, realizing the self-optimization and evolution of the microgrid scheduling system. Unlike traditional static scheduling systems, the intelligent scheduling system of this embodiment can learn from operational experience, continuously improve the quality and adaptability of scheduling strategies, and form a closed-loop continuous improvement mechanism.

[0160] A dispatch performance evaluation system is the foundation of continuous learning, comprehensively assessing the performance of dispatch schemes from multiple dimensions. The evaluation system designed in this embodiment of the invention includes three main categories of indicators: economic indicators, environmental indicators, and reliability indicators. Economic indicators evaluate the cost-effectiveness of the dispatch scheme, including total operating costs (fuel costs, maintenance costs, start-up and shutdown costs, etc.), grid interaction costs (electricity purchase cost minus electricity sales revenue), equipment lifespan impact (such as energy storage cycle aging costs), and peak-valley electricity price arbitrage revenue. Environmental indicators focus on the environmental impact of the dispatch scheme, including carbon emissions, renewable energy absorption rate, wind and solar curtailment rate, and primary energy utilization efficiency. Reliability indicators evaluate the safety and stability of the dispatch scheme, including frequency stability, voltage qualification rate, reserve capacity margin, and fault recovery capability.

[0161] To ensure the comprehensiveness and objectivity of the assessment, this invention employs a multi-timescale assessment method: short-term assessments (15 minutes to several hours) focus on the immediate response and control accuracy of the scheduling scheme; medium-term assessments (days to weeks) analyze intraday load characteristics and resource allocation efficiency; and long-term assessments (months to years) examine long-term effects such as adaptability to seasonal changes and equipment lifespan. The assessment results are presented through a visual dashboard, intuitively displaying the current values, historical trends, and comparisons with the same period for each indicator, assisting operators in understanding system performance and identifying improvement opportunities.

[0162] Based on the evaluation results, this invention proposes a continuous learning mechanism for large-scale AI models. Traditional machine learning models typically have fixed parameters after initial training, making it difficult to adapt to dynamic changes in the environment and system. This invention employs online fine-tuning technology, enabling large-scale AI models to continuously learn and evolve from operational experience. The continuous learning process includes four key steps: data collection, experience screening, model updating, and performance validation.

[0163] During the data collection phase, the system records the initial state, scheduling decisions, actual execution results, and evaluation metrics for each scheduling cycle, forming a complete sample of scheduling experience. To ensure data quality, the system implements data integrity checks and anomaly labeling mechanisms to identify and handle abnormal data that may affect learning performance. In the experience screening phase, the system filters and weights the collected experience based on the evaluation results. High-performing scheduling schemes (such as low cost, high renewable energy integration rate, and good system stability) are given higher weights to enhance their impact on the learning process; poorly performing schemes are used as negative examples to help the model identify and avoid potential risks.

[0164] The model update phase is the core of continuous learning. Considering the high computational cost of fully retraining a large AI model, this embodiment of the invention employs incremental learning and parameter fine-tuning methods. Specifically, the system maintains the main structure of the large model unchanged, updating only the adaptation layer parameters directly related to microgrid scheduling. The fine-tuning process uses Low-Rank Adaptation (LoRA) technology, achieving efficient parameter updates by training a low-dimensional adaptation matrix. To prevent catastrophic forgetting (newly learned content overwriting already acquired knowledge), the system employs an experience replay mechanism, mixing newly collected data with historical key samples in each update. The fine-tuning frequency is dynamically adjusted according to the system's rate of change: increasing the fine-tuning frequency at critical points such as seasonal transitions, load characteristic changes, or equipment configuration updates; and decreasing the fine-tuning frequency during stable system operation to reduce computational resource consumption.

[0165] The performance validation phase ensures that the model update truly delivers a performance improvement. The system tests the updated model in a sandbox environment using historical data, comparing the quality of scheduling schemes before and after the update. Only after verifying and confirming the performance improvement will the updated model be deployed to the production environment. Validation metrics include prediction accuracy (the model's accuracy in predicting system state evolution), decision quality (the economy and reliability of the generated scheduling schemes), and generalization ability (performance in unseen scenarios).

[0166] To enhance the effectiveness of continuous learning, this invention also incorporates several auxiliary mechanisms. First, an active learning strategy is introduced, where the system proactively identifies knowledge blind spots (areas where the model performs poorly) and collects relevant data, accelerating the improvement of capabilities in weak areas. Second, knowledge distillation technology is implemented, fusing knowledge from multiple expert models (such as models optimized for different seasons or operating modes) into a unified model, improving the model's comprehensiveness. Finally, a human-machine collaboration mechanism is established, allowing experts to review and correct the AI ​​model's decisions, implicitly incorporating expert knowledge into the learning process.

[0167] Through this closed-loop evaluation and learning mechanism, this embodiment of the invention achieves continuous self-optimization of the microgrid dispatching system. With the accumulation of operational experience, the system continuously improves its understanding and adaptability to specific microgrid characteristics, resulting in continuous improvement in the quality and accuracy of dispatching decisions. Actual operational data shows that after 3-6 months of continuous learning, the system's dispatching performance significantly improves: operating costs decrease by an average of 12%, renewable energy absorption rate increases by 18%, and system stability indicators improve by 25%, fully demonstrating the value and potential of the continuous learning mechanism.

[0168] The following practical case illustrates the application process and effects of the AI-based large-scale model-based intelligent dispatching method for microgrids according to this invention. This case is based on a microgrid system in an industrial park in a prefecture-level city. The microgrid includes a 2MW photovoltaic power generation system, a 1MW wind turbine generator set, a 3MWh energy storage system, a 1.5MW gas turbine combined heat and power system, and various types of loads (industrial production equipment, office buildings, employee dormitories, etc.). This microgrid can operate in grid-connected mode or switch to islanded mode in emergencies.

[0169] Data acquisition and processing stage:

[0170] In implementing step S1, distributed data acquisition terminals were first deployed at key nodes of the microgrid. In the photovoltaic power station area, 10 high-precision acquisition terminals were installed, connected to each inverter and combiner box, collecting parameters such as DC-side voltage, current, power, and AC-side active and reactive power every 15 minutes. Simultaneously, data such as sunlight intensity, temperature, and cloud cover from the weather station were accessed for short-term power generation forecasting. In the wind farm area, 5 acquisition terminals were connected to the wind turbine control system, collecting parameters such as wind speed, wind direction, pitch angle, generator speed, and output power.

[0171] For load monitoring, the system deploys a tiered smart meter network: 30 high-precision meters are installed on the industrial production line to monitor electricity consumption at each stage of production; 45 smart meters are installed in the office and living areas to monitor power data for lighting, air conditioning, elevators, and other electrical equipment in different areas. The energy storage system is equipped with a dedicated battery management system (BMS) to monitor key parameters of the battery pack in real time, such as state of charge (SOC), state of health (SOH), charge / discharge power, and efficiency.

[0172] On a typical workday in July 2024, raw data collected by the system showed significant fluctuations in photovoltaic system output between 10:00 and 14:00, dropping abruptly from 1.8MW to 0.9MW before recovering to 1.6MW. This was attributed to frequent cloud cover changes that day. Simultaneously, industrial load experienced a jump of approximately 20% during shift changes, increasing from 1.2MW to 1.45MW. These raw data also contained some outliers, such as wind turbine power readings that deviated significantly from the normal range at a certain moment, possibly due to momentary sensor malfunctions.

[0173] The system uses the Hadoop HDFS distributed file system to store this massive amount of data and processes outliers through data cleaning algorithms. For example, for abnormal wind turbine power readings, the system identifies them as outliers using box plots and replaces them with the average of the preceding and following time points. For sudden changes in photovoltaic output, the system confirms by comparing meteorological data that this is a genuine environmental change rather than a data anomaly, and therefore retains it. After processing, all data is uniformly converted to the JSON standard format and aligned according to timestamps to form a complete and standardized microgrid operation dataset.

[0174] AI large-scale model fine-tuning and knowledge enhancement stage:

[0175] In step S2, the system selected LLaMA-2-70B as the basic large model and collected a wealth of microgrid dispatching corpus for fine-tuning. This corpus included dispatching records from the industrial park over the past two years, equipment technical manuals, State Grid dispatching specifications, and experience summaries from five senior dispatchers. It particularly focused on the park's unique load characteristics (e.g., a production line generating three times the steady-state instantaneous power demand during startup) and equipment constraints (e.g., energy storage systems are not recommended to be deeply discharged below 30% SOC).

[0176] When using LoRA technology for fine-tuning, the system froze the main parameters of the LLaMA-2 model and trained only the low-rank adaptation matrix. The fine-tuning process was carried out in three stages: the first stage used a learning rate of 5e-4 to train for 10 epochs, focusing on adapting to microgrid terminology and basic concepts; the second stage reduced the learning rate to 1e-4 and trained for 30 epochs, focusing on learning complex scheduling logic; the third stage further reduced the learning rate to 5e-5 and performed 10 epochs of fine-tuning. The entire fine-tuning process was completed on an 8-node A100 GPU cluster and took approximately 48 hours.

[0177] After fine-tuning, the system constructed a knowledge graph containing approximately 8,000 entity nodes and 40,000 relational edges, covering all equipment characteristics, operational constraints, and scheduling rules of the microgrid. For example, the knowledge graph contains key knowledge such as "energy storage system - has - charge / discharge efficiency of 90%" and "photovoltaic inverter - limited by - ramp rate limit of 20% / minute". Through knowledge augmentation technology, this expertise was embedded into the model's reasoning process.

[0178] The finely tuned and knowledge-enhanced AI model demonstrated outstanding professional capabilities in testing. For example, when a query such as "PV output suddenly drops by 50%, energy storage SOC is 40%, how to adjust?" is entered, the model can provide professional advice tailored to the actual situation of the park, including detailed guidance on energy storage discharge rate control, non-critical load adjustment sequence, and gas turbine start-up timing.

[0179] Safety constraint scheduling strategy optimization phase:

[0180] In step S3, the system uses the fine-tuned AI large model to construct a system state vector containing 52 state variables, covering the operating status and electrical parameters of all key equipment. Based on these state variables, a Lyapunov candidate function in quadratic form is constructed to describe system stability. For example, when the microgrid frequency deviates from its nominal value, the Lyapunov function value increases, reflecting the degree to which the system deviates from its steady state.

[0181] To address the specific needs of this industrial park, the system is designed with multi-layered safety constraints: electrical safety constraints (such as maintaining bus voltage within 380V ± 5%), equipment safety constraints (such as maintaining energy storage SOC within 30%-85%), and system safety constraints (such as maintaining frequency within 50Hz ± 0.2Hz). These constraints are translated into control barrier functions. When the system approaches the constraint boundaries, the control barrier function value approaches zero, triggering the protection mechanism.

[0182] During a real-world operation in August 2023, the system encountered a typical safety challenge: at 2:30 PM, due to a sudden change in cloud cover, the photovoltaic output dropped from 1.7MW to 0.8MW within 3 minutes, coinciding with a peak industrial load period. Traditional dispatching methods might immediately start the gas turbines at full power, but this would lead to a surge in fuel costs. The safety-constrained dispatching strategy optimization method of this embodiment first assesses the system state: the energy storage SOC is 65%, indicating sufficient capacity; approximately 0.3MW of non-critical loads are adjustable; and the frequency has decreased but remains within safe limits.

[0183] Based on this assessment, the system generated a multi-step scheduling strategy within the Actor-Critic reinforcement learning framework: First, the energy storage system discharges at a power of 0.6MW to quickly supplement part of the photovoltaic deficit; simultaneously, non-critical air conditioning loads are reduced by 15%, decreasing demand by approximately 0.1MW; finally, the gas turbine only needs to be started up to 0.2MW as a supplement. Throughout the process, the system state consistently meets safety constraints, with the lowest frequency dropping to only 49.85Hz and voltage fluctuations controlled within ±3%.

[0184] When the system attempts to execute this strategy, the safety verification mechanism automatically checks whether each control action meets safety constraints. For example, the energy storage discharge power is verified to not cause excessively low SOC, and the gas turbine start-up rate is confirmed to meet equipment specifications. During execution, the system continuously monitors the microgrid status. When it detects that energy storage discharge has caused the load on a certain distribution line to approach 90% of its rated value, the safety monitoring mechanism automatically adjusts the strategy, transferring some of the discharge power to other lines to ensure system safety.

[0185] Sparse matrix decision and optimization stage:

[0186] In step S4, the system models the microgrid scheduling problem as a binary decision process in sparse matrix form. For the microgrid in this industrial park, the system defines a 96×42 scheduling variable matrix, where 96 rows represent 15-minute scheduling periods per day, and 42 columns represent controllable equipment (including 10 control points for photovoltaic inverters, 5 control points for wind turbines, charging and discharging control of energy storage systems, start-up, shutdown, and output control of gas turbines, 20 controllable loads, etc.).

[0187] In actual operation, this matrix exhibits significant sparsity, with approximately 78% of its elements being zero, because most of the time only a portion of the devices require scheduling. The system employs a compressed sparse row storage format, compressing the matrix, which originally required 4032 storage units, into approximately 900 storage units, significantly reducing storage and computational overhead.

[0188] For the scheduling optimization on August 15, 2023, the system first used gradient descent with momentum for initial optimization. The initial learning rate was set to 0.05, and the momentum coefficient was 0.9. After approximately 200 iterations, the gradient norm dropped to 0.008, below the preset threshold of 0.01, and the system automatically switched to Newton's method for fine-tuning. In the Newton's method stage, the system used the L-BFGS algorithm to approximate the inverse of the Hessian matrix, avoiding the high computational cost of directly calculating and storing the complete Hessian matrix.

[0189] During the optimization process, the system encountered a typical local optimum trap: the algorithm tended to overuse photovoltaic power generation during peak daytime sunlight hours, neglecting the time-transfer value of energy storage charging and discharging. By employing unit vector extremum distance control technology, the system successfully escaped local optima by finding the optimal search direction on a unit constrained sphere. Specifically, the system used a spherical coordinate parameterization method to transform the 41-dimensional search problem (corresponding to 42 devices minus 1 reference device) into an optimization problem with 40 angular parameters, significantly simplifying the search space.

[0190] When the optimization approached convergence but progressed slowly, the system triggered a step-size restart mechanism. When the objective function improvement was less than 0.001% for 15 consecutive iterations, the system reset the step size to 50% of the initial value, allowing the algorithm to explore new solution space regions. Through this mechanism, the system discovered a better scheduling strategy: during the morning when sunlight is abundant, not only is the immediate load met, but excess electricity is also stored in the energy storage system; during the afternoon when sunlight is weak but load is high, the stored electricity is released rationally, reducing the use of gas turbines. The final optimization results show that, compared with traditional methods, this scheduling strategy can save approximately 12% of daily operating costs while increasing renewable energy utilization by approximately 15%.

[0191] Robust scheduling and parameter adaptation phase:

[0192] In step S5, the system establishes a discrete-time microgrid dynamic model, taking into account various uncertainties. For this industrial park, the main sources of uncertainty include: weather dependence of photovoltaic power generation (prediction error of approximately ±20%), changes in industrial load production plans (fluctuations of approximately ±15%), and temperature sensitivity of energy storage system efficiency (efficiency decreases by approximately 5% in high-temperature weather).

[0193] Uncertain parameters in the system and control matrices are modeled as variables with known boundaries. For example, the energy storage charging and discharging efficiency is set to vary within the range of 85%-95%, and the maximum output of the photovoltaic inverter may decrease to 90% of its rated value when the ambient temperature exceeds 35°C. Based on these uncertainties, a discrete-time control barrier function is defined to ensure that safety constraints are met even in the worst-case scenario.

[0194] During an actual operation in August 2023, the system encountered typical parameter changes: due to sustained high temperatures, the actual efficiency of the energy storage system dropped to 87%, below the rated value of 92%; simultaneously, a production line temporarily adjusted its schedule, resulting in an afternoon load increase of approximately 10% compared to expectations. Traditional deterministic optimization methods might generate unexecutable scheduling schemes under such circumstances, leading to system constraint violations or the need for frequent adjustments.

[0195] This invention employs recursive least squares method for online estimation of system parameters. The system updates the parameter estimates every 15 minutes, continuously adjusting the model parameters by comparing predicted values ​​with actual observed values. For example, when the actual discharge of the energy storage system is detected to be lower than the model prediction, the system automatically reduces the estimated value of the efficiency parameter; when the load continues to be higher than expected, the system adjusts the load model parameters to improve the predicted values ​​for future periods.

[0196] To address these uncertainties, the system incorporates a conservative margin, appropriately tightening the original constraints. For example, the safety lower limit of energy storage SOC is increased from the theoretical 20% to 30%, reserving room for efficiency reduction; the line power limit is set at 90% of the rated value to handle sudden load increases. Through robust optimization methods, the system generates scheduling schemes that remain feasible under various uncertain conditions.

[0197] Specifically, this scheme proactively reduces the usage intensity of the energy storage system during hot weather, limiting the maximum discharge power to no more than 85% of the rated value to avoid overheating risks. Simultaneously, approximately 15% of the gas turbine capacity is reserved as a backup to cope with potential load increases. When the actual load does increase, the system adjusts its scheduling strategy in real time through an adaptive control law, increasing gas turbine output while slightly reducing non-critical loads to ensure stable system operation.

[0198] Throughout the process, the accuracy of system parameter estimation continuously improved. In the initial stage, the energy storage efficiency estimation error was approximately ±5%. After 4 hours of operation and learning, the error decreased to ±2%, making dispatch decisions more precise. Similarly, the average error of load forecasting decreased from the initial 12% to 6%, significantly improving the feasibility and economy of the dispatch scheme.

[0199] Through this robust scheduling and parameter adaptation method, the microgrid maintained stable operation even under various uncertainties, without triggering any safety protection mechanisms, while keeping the increase in operating costs to a minimum (only about 5% higher than in ideal conditions). This result fully demonstrates the effectiveness and robustness of the method in real-world complex environments.

[0200] Specifically, addressing the real-time requirement stipulated in Article 7.2.1.4 of the "T / CEC 182—2018 Microgrid Grid-Connected Dispatch and Operation Specification" that "for microgrids connected to 10kV~35kV distribution networks, the active power control response time of the tie line should not exceed 10 seconds, and the adjustment time should not exceed 1 minute," this invention achieves full compliance with the standard through multi-level technological innovation. The core technical approach of this invention is to decouple real-time control and dispatch optimization in both spatiotemporal dimensions, and to ensure rapid response at each level through edge computing architecture and algorithm optimization technology. Specifically, this invention employs an edge computing architecture to push computing power down to key nodes of the microgrid, equipped with a real-time operating system and FPGA hardware accelerators. This enables the real-time control response time of device-level edge nodes to reach millisecond levels, and the local optimization response time of regional-level edge nodes to be controlled within the range of 1-3 seconds. This fundamentally eliminates the communication delays (typically accumulating to more than 1 second) and computational waiting delays (reaching several seconds when multiple tasks are concurrent) caused by data uploading, queuing, and command issuance in traditional centralized architectures. In terms of architecture design, this invention completely decouples the real-time control layer from the scheduling planning layer. The real-time control layer continuously executes tracking control of the active power of the tie line with a control cycle of 100 milliseconds, independent of the optimization calculation of the scheduling planning layer, ensuring that the rapid response to system disturbances always meets the standard requirements. The scheduling planning layer performs global optimization with a cycle of 15 minutes, and the two do not interfere with each other. In terms of scheduling strategy, this invention innovatively designs a hierarchical scheduling update strategy: for the most common minor deviation scenarios in daily operation (accounting for about 70-80% of total scheduling adjustments), only local parameters need to be adjusted, and the response time is within seconds, far better than the 10-second standard; for medium deviation scenarios that require coordination of multiple devices (accounting for about 20%), the system uses AI large model for rapid inference and regional optimization, with a response time of about 10 seconds, which just meets the standard requirements; even for severe deviation scenarios that require global replanning (occurring less than 5% of the time), the response time is controlled within 30 seconds to 1 minute, meeting the standard adjustment time requirements. At the algorithm level, the AI ​​large model inference technology used in this invention reduces the scheduling scheme generation time from 3-8 minutes in the traditional mixed integer programming method to 2-5 seconds (40-150 times faster), the sparse matrix technology reduces the computational load to 22% of the original (from about 800 milliseconds to about 180 milliseconds), and the gradient-Newton hybrid optimization algorithm reduces the convergence time from 8-15 seconds to 3-4 seconds (3-4 times faster). The comprehensive application of these innovative algorithms controls the computation time of medium-complexity scheduling problems within the range of 8-12 seconds, fully meeting the 10-second response time requirement.Actual deployment verification shows that during six months of continuous operation, the system handled over 8,000 scheduling adjustment events. The average response time was 2.3 seconds for minor deviation scenarios, 9.2 seconds for moderate deviation scenarios, and 48 seconds for severe deviation scenarios. The response times for all scenarios met the requirements of the T / CEC 182-2018 standard, and no safety violations occurred. Taking a real-world operation case in August 2023 as an example, when the photovoltaic output suddenly dropped from 1.7MW to 0.8MW within 3 minutes, the system completed anomaly detection within 2 seconds, triggered coordination optimization within 3 seconds, generated a solution through an AI large-scale model within 4-8 seconds, completed safety verification and issued control commands within 9 seconds. The entire decision-making process met the 10-second response time requirement. Subsequently, the energy storage system and adjustable load completed execution within 5 seconds, and the system power basically balanced within 10 seconds, fully demonstrating the effectiveness of the technical solution of this invention. By comprehensively applying the aforementioned edge computing architecture, layered decoupling design, hierarchical scheduling strategy, and algorithm optimization techniques, this invention achieves comprehensive optimization of response speed, computational efficiency, scheduling quality, and security. While employing complex algorithms to ensure scheduling quality, it fully meets the stringent real-time requirements of industry standards.

[0201] This invention also provides a microgrid intelligent scheduling system based on an AI large model, such as... Figure 2As shown, the system includes: a data acquisition module for collecting and processing real-time power output data from photovoltaic power plants and wind farms, real-time power data from residential, commercial, and industrial loads, energy storage device capacity and charging / discharging efficiency data, and environmental data to obtain a standardized microgrid operation dataset; a fine-tuning module for fine-tuning a pre-trained large model using LoRA fine-tuning technology based on the standardized microgrid operation dataset and microgrid scheduling domain knowledge, and embedding expert knowledge into the model inference process using knowledge graph enhancement technology to obtain an adapted AI large model scheduling engine; and a policy optimization module for using the AI ​​large model scheduling engine, combined with Lyapunov function and control barrier function theory, to construct Lyapunov candidate functions to describe the stability of the microgrid system, design control barrier functions to constrain the system's operational safety boundary, and introduce safety constraint terms during the reinforcement learning policy gradient update process to obtain a standardized microgrid operation dataset; The system includes: a scheduling strategy optimization method under security constraints; a modeling module for modeling a sparse matrix binary decision process using the aforementioned optimization method; a stable scheduling module for generating a robust scheduling scheme for uncertain disturbances; and an operation module for real-time intelligent scheduling of the microgrid by deploying edge computing nodes based on the robust scheduling scheme and real-time operation status monitoring. The module employs a gradient-Newton hybrid optimization algorithm and introduces unit vector extreme value distance control technology within the binary decision process. This module generates an extreme value control strategy for real-time scheduling parameters by establishing a discrete-time microgrid dynamic model, designing a control barrier function certificate mechanism, using recursive least squares for online estimation of system parameters, and establishing a robustness guarantee mechanism.

[0202] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

[0203] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure; and these modifications, changes, 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 disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.

Claims

1. An AI large model-based microgrid intelligent scheduling method, characterized in that, The method comprises the following steps: Collecting and processing real-time output data of photovoltaic power stations and wind farms, real-time power data of residential, commercial and industrial loads, capacity and charging / discharging efficiency data of energy storage devices, and environmental data to obtain a standardized microgrid operation data set; According to the standardized microgrid operation data set and the knowledge in the field of microgrid scheduling, the pre-trained large model is fine-tuned through the LoRA fine-tuning technology, and the expert knowledge is embedded into the model inference process through the knowledge graph enhancement technology to obtain an adapted AI large model scheduling engine; Using the AI large model scheduling engine, combining Lyapunov function and control barrier function theory, constructing Lyapunov candidate function to describe the stability of the microgrid system, designing control barrier function to constrain the safety boundary of system operation, and introducing safety constraint items in the process of reinforcement learning strategy gradient update to obtain a scheduling strategy optimization method under safety constraints; Using the scheduling strategy optimization method under safety constraints to model the sparse matrix binary decision process, modeling the microgrid scheduling problem as a binary decision process in the form of a sparse matrix, combining the gradient-Newton hybrid optimization algorithm in the binary decision process, and introducing the unit vector extreme distance control technology to generate an extreme control strategy of real-time scheduling parameters; According to the extreme control strategy of real-time scheduling parameters and the discrete-time control barrier function certificate, a robust scheduling scheme for uncertain interference is obtained by establishing a discrete-time microgrid dynamic model, designing a control barrier function certificate mechanism, using recursive least squares to estimate system parameters online, and establishing a robustness guarantee mechanism; According to the robust scheduling scheme, combining real-time operation state monitoring, deploying edge computing nodes for real-time microgrid intelligent scheduling.

2. The method of claim 1, wherein, Collecting and processing real-time output data of photovoltaic power stations and wind farms, real-time power data of residential, commercial and industrial loads, capacity and charging / discharging efficiency data of energy storage devices, and environmental data to obtain a standardized microgrid operation data set, including: Deploying distributed data collection terminals to collect real-time output data and 24-hour prediction data of photovoltaic power stations and wind farms, with a collection frequency of every 15 minutes to obtain renewable energy output data; Through the intelligent meter network and the device monitoring system, the real-time power data of residential, commercial and industrial loads, the capacity and charging / discharging efficiency of energy storage devices, and the heat-to-power ratio of combined heat and power units are collected to obtain load and device parameter data; According to the renewable energy output data, load and device parameter data, and environmental data collected by the weather station network, use the distributed file system to store and remove missing values and outliers through data cleaning algorithms, convert different formats of data to JSON standard format, and align them in time and space according to the timestamp to obtain the standardized microgrid operation data set.

3. The method of claim 1, wherein, According to the standardized microgrid operation data set and the knowledge in the field of microgrid scheduling, the pre-trained large model is fine-tuned through the LoRA fine-tuning technology, and the expert knowledge is embedded into the model inference process through the knowledge graph enhancement technology to obtain an adapted AI large model scheduling engine, including: A preset pre-training large model is selected as a base model, a professional corpus containing micro-grid scheduling regulations, equipment technical manuals, and historical scheduling cases is collected to construct a domain data set, and a micro-grid scheduling professional corpus is obtained; For the micro-grid scheduling professional corpus, a LoRA technology is used to freeze the model main body parameters and only train a low-rank adaptive matrix to reduce the fine-tuning calculation complexity, and a domain-adapted pre-training model is obtained; The domain-adapted pre-training model is enhanced by a knowledge graph, a knowledge graph containing device constraint rules, safe operation criteria, and scheduling logic relationships is constructed, and domain knowledge is embedded into the model inference process through a knowledge enhancement technology, and an adapted AI large model scheduling engine is obtained.

4. The method of claim 1, wherein, Using the AI large model scheduling engine, combining Lyapunov function and control barrier function theory, by constructing Lyapunov candidate function to describe the stability of the micro-grid system, designing control barrier function to constrain the safety boundary of system operation, and introducing safety constraint term in the process of reinforcement learning strategy gradient update, a scheduling strategy optimization method under safety constraint is obtained, including: Using the AI large model scheduling engine to construct a system state vector containing the output of each power generation unit, the state of charge of energy storage devices, the voltage and frequency of key nodes, and using a quadratic function form to construct the Lyapunov candidate function for describing the stability of the micro-grid system, wherein a positive definite matrix is used to ensure the positive definiteness of the Lyapunov candidate function; Designing a control barrier function to constrain the safety boundary of system operation, wherein the safety constraint condition minus the safety margin parameter forms the control barrier function, and the safety boundary constraint condition is determined by the Lyapunov candidate function and the control barrier function; For the safety boundary constraint condition, introduce safety constraint term in the parameter update of the policy network under the Actor-Critic algorithm framework, so that each policy update satisfies the stability decreasing condition and the safety boundary non-negative condition, and integrate the safety constraint into the reward function by the Lagrange multiplier method, to obtain the scheduling strategy optimization method under safety constraint.

5. The method of claim 4, wherein, The scheduling strategy optimization method under safety constraint includes: Constructing an augmented reward function, combining the original economic reward with the safety constraint penalty term, wherein the safety constraint penalty term includes the violation penalty of the control barrier function and the Lyapunov stability violation penalty; Establishing a safe action set, which includes a set of all feasible control actions that satisfy the non-negative condition of the control barrier function; If an unsafe action is attempted to be executed in the scheduling strategy process, a quadratic programming method is used to automatically correct it to the nearest safe action, ensuring that the Euclidean distance between the corrected action and the expected action is minimized; Establishing a safety supervision mechanism to monitor whether the micro-grid state is approaching the safety boundary in real time, triggering an emergency safety control protocol when the micro-grid state is close to the dangerous area, and forcibly pulling the micro-grid state back to the safe area through a preset safety control law.

6. The method of claim 1, wherein, The scheduling strategy optimization method under the safety constraint is used for sparse matrix binary decision process modeling, the microgrid scheduling problem is modeled as a binary decision process in the form of a sparse matrix, a gradient-Newton hybrid optimization algorithm is combined in the binary decision process, and a unit vector extreme search control technology is introduced to generate an extreme control strategy of real-time scheduling parameters, including: a scheduling variable matrix is defined as a zero-one matrix, the number of rows represents the scheduling period, the number of columns represents the number of controllable devices, the scheduling variable matrix is stored in a compressed sparse row storage format, and a sparse matrix operation library is established, and a binary decision model in the form of a sparse matrix is obtained; for the binary decision model in the form of a sparse matrix, a gradient descent method with momentum is used for first convergence speed approximation, and when the gradient norm is less than a threshold value, the Newton method is switched to realize second convergence speed approximation; after completing the second-order convergence approximation, an optimal search direction on a unit constraint sphere is obtained by solving a constrained optimization problem, an n-dimensional search problem is converted into an n-1-dimensional angle optimization problem by using a spherical coordinate parameterization method, an adaptive step size adjustment strategy is established, and the extreme control strategy of the real-time scheduling parameters is obtained.

7. The method of claim 6, wherein, after completing the second-order convergence approximation, an optimal search direction on a unit constraint sphere is obtained by solving a constrained optimization problem, an n-dimensional search problem is converted into an n-1-dimensional angle optimization problem by using a spherical coordinate parameterization method, an adaptive step size adjustment strategy is established, and the extreme control strategy of the real-time scheduling parameters is obtained, including: a unit constraint sphere is constructed, a constraint sphere composed of all direction vectors with a two-norm equal to 1 is defined, and a search direction that minimizes the gradient projection of an objective function on the constraint sphere is found; a spherical coordinate parameterization method is used to express an n-dimensional unit vector in a Cartesian coordinate system as a combination of trigonometric functions of n-1 angle parameters, and the unit constraint condition is automatically satisfied through optimization of the angle parameters; a step size control function is designed, an exponential decay form step size adjustment strategy is used, wherein an initial step size is determined according to local curvature characteristics of the objective function, and a decay factor and a decay period are dynamically adjusted according to convergence performance of the optimization process; a step size restart mechanism is established, when the objective function improvement of continuous multiple iterations is less than a preset threshold value, the step size is reset to a preset proportion of the initial value, and the extreme control strategy of the real-time scheduling parameters is obtained.

8. The method of claim 1, wherein, according to the extreme control strategy of the real-time scheduling parameters and a discrete-time control barrier function certificate, a discrete-time microgrid dynamic model is established, a control barrier function certificate mechanism is designed, system parameters are estimated online by using a recursive least squares method, and a robustness guarantee mechanism is established, and a robust scheduling scheme facing uncertain disturbances is obtained, including: the discrete-time microgrid dynamic model is established, in the discrete-time microgrid dynamic model, the next time state is equal to the system matrix multiplied by the current state plus the control matrix multiplied by the control input parameter plus the external disturbance parameter, wherein the system matrix and the control matrix contain uncertain parameters, a discrete-time control barrier function is defined to describe the safety operation constraints of the system, and a control barrier function certificate is constructed, and a discrete-time safety constraint model is obtained; For the discrete-time safety constraint model, a recursive least squares method is used for online estimation of system parameters, a forgetting factor is adjusted to adapt to the time-varying characteristics of the parameters, and a parameter estimation error boundary is established to obtain an adaptive parameter estimation mechanism; According to the adaptive parameter estimation mechanism, a conservative margin is set to cope with the uncertainty of the discrete-time safety constraint model, a robust optimization method is used to convert the scheduling problem into a minimax optimization, a confidence mechanism is established, and an adaptive control law is designed to realize real-time scheduling strategy adjustment, and a robust scheduling scheme for uncertain disturbances is obtained.

9. The method of claim 1, wherein, The method further comprises: Deploying edge computing nodes at key nodes of the microgrid to establish a real-time monitoring mechanism with a 15-minute scheduling cycle to continuously collect actual operation data of the microgrid and obtain real-time operation state data; According to the real-time operation state data, a state deviation detection algorithm is designed to calculate the deviation between the actual operation state and the planned scheduling scheme in real time, and when the deviation exceeds a preset threshold, the AI large model is triggered to regenerate the scheduling scheme, and a dynamic scheduling adjustment mechanism is obtained; For the dynamic scheduling adjustment mechanism, a scheduling effect evaluation system is established to evaluate the economic, environmental and reliability indicators of the scheduling scheme, and the evaluation results are input into the continuous learning process of the AI large model to continuously improve the scheduling accuracy and adaptability through online fine-tuning, and a continuously improved intelligent scheduling system is obtained.

10. An AI large model-based microgrid intelligent scheduling system, characterized in that, The method comprises the following steps: A collection module is used to collect and process real-time output data of photovoltaic power stations and wind farms, real-time power data of residential, commercial and industrial loads, storage device capacity and charge-discharge efficiency data, and environmental data to obtain a standardized microgrid operation data set; A fine-tuning module is used to fine-tune a pre-trained large model based on the standardized microgrid operation data set and microgrid scheduling domain knowledge, and to embed expert knowledge into the model inference process through LoRA fine-tuning technology and knowledge graph enhancement technology to obtain an adapted AI large model scheduling engine; A strategy optimization module is used to utilize the AI large model scheduling engine, combine Lyapunov function and control barrier function theory, describe the stability of the microgrid system by constructing Lyapunov candidate function, design control barrier function to constrain the safety boundary of system operation, and introduce safety constraint items in the process of reinforcement learning strategy gradient update to obtain a scheduling strategy optimization method under safety constraints; A modeling module is used to model the sparse matrix binary decision process using the scheduling strategy optimization method under safety constraints, to model the microgrid scheduling problem as a binary decision process in the form of a sparse matrix, and to generate an extreme value control strategy for real-time scheduling parameters by combining gradient-Newton hybrid optimization algorithm and introducing unit vector extreme distance control technology in the binary decision process. The stable scheduling module is used for obtaining a robust scheduling scheme for uncertain interference by establishing a discrete-time micro-grid dynamic model, designing a control barrier function certificate mechanism, performing online estimation of system parameters by using a recursive least square method, and establishing a robustness guarantee mechanism according to an extreme value control strategy and a discrete-time control barrier function certificate of the real-time scheduling parameter; The running module is used for performing real-time micro-grid intelligent scheduling by deploying an edge computing node according to the robust scheduling scheme and in combination with real-time running state monitoring.

Citation Information

Patent Citations

  • Multi-layer distributed micro-grid control system and method based on edge cloud collaborative lightweight reinforcement learning

    CN120073869A

  • Virtual power plant resource optimization scheduling system based on multi-head self-calibration tensor factorization

    CN120542867A