Micro-grid ems adaptive control method based on large language model
Patent Information
- Application Number
- CN202610981601.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-02
- Publication Date
- 2026-10-16
AI Technical Summary
[0004]针对现有技术的不足,本发明提供了基于大语言模型的微电网EMS自适应控制方法,解决了现有基于大语言模型的微电网控制方案缺乏物理安全约束与闭环纠偏机制,导致越限调度参数直接下发引发底层设备运行失稳的问题
1、本发明通过在模型输出端与底层执行模块之间设置物理硬约束不等式组进行校验,当大语言模型生成的参数设定值未通过校验时,提取超出边界的绝对偏差数值并组装为自然语言报错文本,将其追加至提示词序列尾部触发模型重新推理,使大语言模型能够直接依据具体的越限偏差数值进行自动纠偏,避免不符合物理边界条件的控制指令直接下发,保证微电网底层设备运行的安全性。
Smart Images

Figure CN122931968A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of microgrid technology, specifically to a microgrid EMS adaptive control method based on a large language model. Background Technology
[0002] Microgrid energy management systems are mainly used to realize the scheduling and control of power generation, energy storage and power load within a microgrid. Traditional microgrid control methods mostly rely on deterministic mathematical models or preset static rules for parameter calculation. When faced with unstructured natural language operation and maintenance instructions and multi-source heterogeneous data, it is difficult to achieve information fusion.
[0003] Currently, some studies have attempted to introduce large language models into the dispatching scenarios of power systems. However, the reasoning process of large language models is mainly based on probability distribution to generate text, and the output control parameters lack the boundary constraints of the physical system. The underlying power electronic equipment of the microgrid has strict restrictions on the safety boundaries of the operating parameters. Existing control schemes extract the parameters output by the model in one direction and use them directly for the underlying control. They lack physical hard constraint interception before the command is issued. Once the parameter set value generated by the model exceeds the limit power or inertia adjustment range of the microgrid, the system cannot intercept the abnormal command, nor can it feed back the deviation of exceeding the limit to the large language model for correction. This causes unsafe parameters to directly act on the underlying execution module, which may cause equipment damage or system instability. In addition, the existing control architecture lacks a control degradation mechanism that automatically switches to the basic safe operating state when the model continuously outputs abnormal parameters or encounters computational deadlock. It cannot guarantee the continuous operation requirements of the microgrid under abnormal operating conditions. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this invention provides a microgrid EMS adaptive control method based on a large language model. This method solves the problem that existing microgrid control schemes based on large language models lack physical safety constraints and closed-loop correction mechanisms, leading to the instability of underlying equipment caused by the direct issuance of out-of-limit scheduling parameters.
[0005] To achieve the above objectives, the present invention provides the following technical solution: This invention provides an adaptive control method for microgrid EMS based on a large language model, the method comprising the following steps: Real-time acquisition of multi-dimensional physical state data of microgrids, synchronous acquisition of operation and maintenance instructions in natural language form, and construction of multi-dimensional situation input features; Based on the multidimensional physical state data, a similarity search is performed in the local operating memory to extract historical operating experience. The multidimensional situation input features, the historical operating experience, and the preset power field knowledge are concatenated and mapped into a prompt word sequence. The prompt word sequence is input into a preset large language model for inference operations, and the output includes parameter setting values containing global scheduling information and anomaly judgment text for the current microgrid state. According to the physical safety boundary set in the microgrid operation specification, the parameter setting value is constrained and verified. If the verification fails, a feedback feature containing the limit violation index information is generated and added to the prompt word sequence and re-inputted into the large language model for parameter recalculation. If the judgment condition of continuous recalculation failure is met, the system control is transferred to the standby static rule table. The parameter settings that have passed the constraint verification are sent to the underlying execution module for high-frequency closed-loop control. After the current control cycle ends, the comprehensive scheduling benefit is calculated, and the physical operating status, parameter settings and comprehensive scheduling benefit of the current cycle are converted into text vectors and updated in the local runtime memory.
[0006] This solution extracts historical interaction tuple data to form prior input, constraining the solution space of the large language model. At the same time, it adds physical hard constraint verification between the model output and the underlying control end, intercepts out-of-limit scheduling parameters and converts them into feedback features for recalculation, and establishes a data interaction closed loop between the upper-level language model and the lower-level physical control to ensure that the parameters sent to the lower-level execution module meet the safety requirements of system operation.
[0007] In a preferred embodiment of the present invention, the steps of real-time acquisition of multi-dimensional physical state data of microgrid, synchronous acquisition of operation and maintenance instructions in natural language form, and construction of multi-dimensional situation input features include: establishing a discrete time step model of microgrid system, and dividing the overall operating time of control system into slow loop period and fast loop period with time spans that are multiples of each other; At the beginning of the current slow loop cycle, multidimensional running state data is acquired synchronously. After normalization preprocessing of the numerical data in the discrete state of the multidimensional running state data, the matrix is spliced and merged according to the preset fixed dimension order to construct a structured physical state vector for subsequent spatial vector similarity calculation as the multidimensional physical state data. At the same time, the original values of the real physical measurement of the corresponding dimension are cached locally. The system continuously monitors the natural language text input from the operation terminal to receive unstructured operation and maintenance instructions. The received natural language text is encapsulated into an unstructured semantic feature string according to the UTF-8 encoding rule, and then aligned and synchronized with the physical state vector based on the absolute timestamp. The system outputs a multi-dimensional situational input feature containing the physical state vector and the semantic feature string.
[0008] A multi-timescale configuration combining slow and fast loops is adopted. The slow loop period is used to complete the temporal alignment of physical state values and unstructured natural language instructions, providing unified multimodal input features for subsequent operations.
[0009] In a preferred embodiment of the present invention, the step of extracting historical operating experience by performing similarity retrieval in a local operating memory based on the multidimensional physical state data includes: reading the local operating memory, which stores interactive tuple data of past operating cycles of the microgrid in a time-series structure. The interactive tuple data consists of a multidimensional feature vector of physical state at a historical moment, a combination vector of numerical control strategy setpoints at the corresponding moment, and a comprehensive scheduling benefit score obtained through closed-loop calculation; using the physical state vector as a benchmark query feature, and employing a cosine similarity algorithm to traverse and calculate the cosine value of the spatial geometric angle between the benchmark query feature and each historical physical state vector in the local operating memory, and introducing a preset small positive constant in the denominator of the calculation formula to avoid the dead zone of zero calculation caused by zero vector input; arranging the calculated cosine similarity values in descending order, and extracting a preset number of interactive tuple data from the top positions to form a subset of historical experience as the historical operating experience.
[0010] This step uses a cosine similarity algorithm to quantify the matching degree between the current operating conditions and historical operating states. Small positive numbers are introduced into the calculation to prevent the denominator from being zero. By selecting historical data with high similarity as prior conditions for reasoning, the amount of invalid calculations in the online reasoning process of the model is reduced.
[0011] In a preferred embodiment of the present invention, the step of concatenating and mapping the multi-dimensional situational input features, the historical operational experience, and the preset power domain knowledge into a prompt word sequence includes: calling a preset feature mapping operator to perform textual alignment and concatenation assembly on the multimodal heterogeneous data; the feature mapping operator converts the original physical measurement values corresponding to the physical state vector into key-value pair description text with corresponding physical quantity name tags, and converts each interaction tuple in the historical experience subset into scene state and strategy behavior description text arranged in chronological order; the physical state vector, the extracted semantic feature strings, the historical experience subset, and the pre-configured power domain knowledge are uniformly converted into natural language text format of the same dimension; and the string concatenation operation is performed according to the preset system prompt word template structure to generate a prompt word sequence that conforms to the input specification of a large language model based on the Transformer architecture.
[0012] Feature mapping transforms multi-source heterogeneous data into natural language text in the form of key-value pairs and scene descriptions, making it conform to the standard input format requirements of large language models and avoiding information parsing errors caused by directly inputting heterogeneous data.
[0013] In a preferred embodiment of the present invention, the step of inputting the prompt word sequence into a preset large language model for inference operations and outputting parameter setting values containing global scheduling information and anomaly judgment text for the current microgrid state includes: The large language model is deployed in a mode where the weight parameters are fixed and it does not participate in backpropagation; the prompt word sequence is received and encoded by the built-in word segmenter and input into the word embedding layer; the large language model performs spatial dimensionality reduction and feature extraction on the multimodal information contained in the prompt word sequence based on the fixed weight matrix; the predicted text tag sequence is output through the soft maximization activation function configured at the end of the feedforward neural network layer; the regular expression parsing library is called to extract the numerical strings in the text tag sequence; the extracted discrete values are combined in a preset dimension order to form a dimensionality-reduced control strategy setting value vector as the parameter setting value; the control strategy setting value vector consists of the target charging and discharging power setting value, the virtual inertia setting value, and the damping coefficient setting value in the data dimension; A dual-output data branch is formed, which includes the control strategy setpoint vector and the text-based anomaly assessment report, wherein the text-based anomaly assessment report serves as the anomaly assessment text.
[0014] This step deploys a large language model with fixed weight parameters to reduce system computing power consumption, and uses regular expressions to extract specific values from the text output results, completing the parsing process from natural language to numerical control parameters, thus meeting the data dimension requirements of the underlying control of power equipment.
[0015] In a preferred embodiment of the present invention, the steps of inputting the prompt word sequence into a preset large language model for inference operations and outputting parameter setting values containing global scheduling information and anomaly judgment text for the current microgrid state further include: performing differential operations based on the physical state vector of adjacent slow loop cycles to extract the first-order time derivative of the physical temperature of the energy storage battery and the first-order time derivative of the microgrid system frequency as time-series rate of change index data; comparing the time-series rate of change index data with the safety limit rate of change threshold configured in the preset power field knowledge text; and when it is determined that the time-series rate of change value of any single physical state index exceeds the set safety limit rate of change threshold, forcibly inserting the over-limit flag into the head of the current prompt word sequence through a built-in soft interrupt mechanism, thereby activating the generation trigger condition of the text-type anomaly judgment report in the output branch of the large language model.
[0016] The first-order time derivatives of temperature and frequency are calculated to identify dynamic out-of-limit behaviors in the operating state. The out-of-limit flag is pre-input into the model using a soft interrupt to speed up the model's response to sudden changes in system state.
[0017] In a preferred embodiment of the present invention, the step of constraining and verifying the parameter setting value according to the physical safety boundary set in the microgrid operation specification, and generating a feedback feature containing over-limit index information and appending it to the prompt word sequence and re-inputting it to the large language model for parameter recalculation includes: establishing a set of physical hard constraint inequalities containing the limit power, capacity integral boundary and inertia adjustment range; substituting the values of each dimension in the control strategy setting value vector into the set of physical hard constraint inequalities and performing Boolean logic judgment operation; If the condition is not met, the path of the control command is intercepted and blocked. The name label of the out-of-limit parameter and the absolute deviation value of the boundary are extracted. The extracted out-of-limit information is spliced and assembled into a natural language error text as the feedback feature according to the preset error correction syntax template. The natural language error text is appended to the end of the output original prompt word sequence through the internal loopback communication link to form a reflection prompt word sequence. The large language model is triggered to re-execute the forward inference operation process based on the reflection prompt word sequence and output the updated control strategy setting value vector.
[0018] When the control strategy setpoint is detected to violate the limit power or inertia boundary, the absolute deviation value is extracted to construct an error text, which is then input to the large language model via the loopback link to trigger secondary inference, thereby realizing automatic correction of out-of-bounds parameters and preventing the issuance of commands that have not passed the verification.
[0019] In a preferred embodiment of the present invention, if the condition of continuous recalculation failure is met, the step of transferring system control to the backup static rule table includes: if the updated control strategy setting value vector continuously fails the physical hard constraint inequality group verification, and the cumulative value of the internal counter variable recording the frequency of recalculation cycles reaches the maximum retry threshold, then the system control degradation logic is triggered; the data output bus is blocked, and the real-time control of the microgrid system is forcibly transferred to the built-in backup static rule table, which directly calculates conservative operating parameters based on the pre-fixed piecewise droop control equations and sends them to the underlying execution module; at the synchronous moment of activating the system control degradation logic, the internally configured model cooling timer is started, and before the preset overflow time is reached, the computing power call request is continuously blocked and the basic system operation is maintained by relying on the backup static rule table; when the recorded running time reaches the overflow time, the blocking state of the data output bus is released and the scheduling control authority of the large language model is restored.
[0020] To prevent the large language model from continuously outputting parameters that fail validation, this step introduces control transfer logic. When the maximum number of retries is reached, the system switches to a backup static rule table, blocking the model's computing power call until the cooling timer ends, thus ensuring the basic operation of the microgrid system during periods of abnormal model calculation.
[0021] In a preferred embodiment of the present invention, the step of sending the parameter setting value verified by the constraint to the underlying execution module for high-frequency closed-loop control includes: the underlying execution module receiving the numerical control strategy setting value vector that has been verified by safety and executing the underlying algorithm iteration with a preset fast loop period as the calculation step size; The virtual inertia setpoint and damping coefficient setpoint are extracted and substituted into the built-in second-order differential rotor motion equation. The backward Euler method is called to perform differential expansion of the second-order differential rotor motion equation in the discrete time domain, and the angular frequency deviation value within the current control step size is calculated. The angular frequency deviation value is added to the rated angular frequency and then time integration is performed to solve the reference internal potential phase angle of the microgrid inverter. Based on the reference internal potential phase angle and frequency command, a high-frequency pulse width modulation signal is generated and the underlying power electronic switching device is driven to perform the given target charging and discharging power setpoint.
[0022] By solving the second-order differential rotor motion equation using the backward Euler method, the verified setpoint is converted into the system angular frequency deviation, which in turn generates a high-frequency pulse width modulation signal to complete the specific implementation of the scheduling command to the physical switching action of the underlying inverter.
[0023] In a preferred embodiment of the present invention, the steps of calculating the comprehensive scheduling benefit after the current control cycle ends, and converting the physical operating condition, parameter settings, and comprehensive scheduling benefit of the current cycle into text vectors to update the local runtime memory include: At the end of the current slow loop cycle, the actual physical state trajectory of the microgrid transmitted back by the bottom sensor is extracted as the physical operating condition state. The actual energy storage charging and discharging power and real-time electricity price data of the current control cycle are extracted to calculate the scalar of electricity price arbitrage economic benefits of microgrid operation. At the same time, the absolute value of the deviation between the actual frequency of the microgrid system and the rated reference frequency is extracted to calculate the safety penalty scalar of the system dynamic stability. Based on preset weighting coefficients, the scalar of the electricity price arbitrage economic benefit and the scalar of the safety penalty are linearly weighted and fused to generate the comprehensive scheduling benefit score at the current moment as the comprehensive scheduling benefit; before encapsulation, the operation mode is verified. If the current period is in the model cooling timer state where the system control degradation logic is activated, the storage request of the current interactive tuple data is intercepted. If the system is in normal scheduling mode for large models, before appending a write operation, the total number of storage entries in the local runtime memory is read and compared with the pre-configured upper limit threshold for storage capacity. When the total number of storage entries reaches the upper limit threshold for storage capacity, the built-in first-in-first-out (FIFO) elimination mechanism is activated to perform memory erasure on interactive tuple data with timestamps in the furthest historical interval. The local runtime memory, after capacity trimming, is then reallocated according to the absolute time series and appended.
[0024] At the end of the control cycle, the economic benefit scalar and the safety penalty scalar are extracted and weighted and fused to quantify the actual execution effect of the scheduling instruction. During storage, invalid data in the model cooling state is intercepted, and the amount of data in the local runtime memory is controlled in conjunction with the first-in-first-out mechanism to maintain the efficiency of subsequent data retrieval.
[0025] This invention provides an adaptive control method for microgrid EMS based on a large language model. It has the following beneficial effects: 1. This invention verifies the parameters by setting up a set of physical hard constraint inequalities between the model output and the underlying execution module. When the parameter setting value generated by the large language model fails the verification, the absolute deviation value exceeding the boundary is extracted and assembled into a natural language error message. This message is then appended to the end of the prompt word sequence to trigger the model to re-infer. This allows the large language model to automatically correct the deviation based on the specific deviation value, avoiding the direct issuance of control commands that do not meet the physical boundary conditions and ensuring the safety of the microgrid's underlying equipment operation.
[0026] 2. This invention extracts historical interaction tuple data similar to the current operating conditions from the local runtime memory based on the cosine similarity algorithm, and converts it into corresponding descriptive text. This text is then concatenated with the current multidimensional situation input features to form a prompt word sequence. In the model input stage, scheduling experience under historical operating conditions is introduced as a priori reference, which limits the optimization space of large language models during online inference, reduces the amount of invalid computation caused by the lack of boundary references, and improves the rationality of parameter setting value generation.
[0027] 3. When the parameters are continuously recalculated to the maximum retry threshold, the present invention triggers the system control degradation logic, forcibly transfers the real-time control to the built-in backup static rule table and starts the model cooling timer. At the same time, after the control cycle ends, it intercepts the data storage requests in the cooling state and relies on the first-in-first-out mechanism to control the memory bank capacity, preventing the control system from falling into a deadlock state when the model calculation is abnormal or the parameters are continuously output beyond the limit, maintaining the basic continuous operation of the microgrid, and ensuring the effectiveness of the data stored in the local memory bank. Attached Figure Description
[0028] Figure 1 This is a schematic diagram of the system architecture of the present invention; Figure 2 This is a schematic diagram of the method flow of the present invention; Figure 3 This is a schematic diagram of the integrated process of multidimensional situational awareness, historical experience retrieval, and model reasoning in this invention. Figure 4 This is a schematic diagram of the physical constraint verification and reflection / correction process of the present invention; Figure 5 This is a comparison curve of the system frequency transient response under different control methods of the present invention; Figure 6 This is a graph showing the relationship between the 30-day continuous operation economic arbitrage profit and the frequency of abnormal instruction interception in this invention.
[0029] Among them, 10 is the situation awareness module; 20 is the experience memory module; 30 is the prompt word generation module; 40 is the model reasoning module; 50 is the security verification module; and 60 is the underlying execution module. Detailed Implementation
[0030] The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0031] See attached document Figure 1 The present invention provides an adaptive control system for microgrid EMS based on a large language model, the system comprising: The situational awareness module 10 is configured to collect multi-dimensional operating status data of the microgrid system in real time and receive operation commands input from the human-machine interface.
[0032] The experience memory module 20 is equipped with a local vector database to store the operating characteristics, execution strategies and comprehensive benefit evaluation results of the microgrid's historical operating cycles, thereby constructing a local operating memory library.
[0033] The prompt word generation module 30 is configured to receive and parse the data and instructions obtained by the situation awareness module 10, and generate a prompt word sequence by combining the search results output by the experience memory module 20 and preset power field knowledge.
[0034] The model inference module 40 is configured to receive a sequence of prompt words, perform calculations, and output the parameter settings for the target control cycle and anomaly judgment text.
[0035] The safety verification module 50 is configured to receive parameter settings, perform numerical constraint verification based on preset microgrid physical boundary conditions, and generate feedback features or trigger control degradation logic based on the verification results.
[0036] The underlying execution module 60 is configured to receive parameter setting values that have been verified by the security verification module 50, calculate the underlying control signal based on the calculus control equation, and send the control signal to the hardware execution mechanism.
[0037] In the actual hardware deployment structure of this invention, the situational awareness module 10, experience memory module 20, prompt word generation module 30, model inference module 40, and security verification module 50 are integrated and deployed in the edge computing gateway device of the microgrid control layer. The model inference module 40 is configured in the edge computing gateway device in the form of weight freezing. The large language model is pre-processed with knowledge distillation and low bit quantization compression to adapt to the memory capacity limitations of the edge hardware. The system does not involve backpropagation updates of model parameters during operation. The underlying execution module 60 is deployed in the lower-level controller of the microgrid device layer. The edge computing gateway device and the lower-level controller are connected via an industrial communication bus. The hardware deployment structure decouples the macro-scheduling decision of the microgrid from the underlying physical control. The physical computing power provided by the tensor processing unit or neural processing unit built into the edge computing gateway device supports the complete operation of the method of this invention.
[0038] See attached document Figure 2 This invention provides an adaptive control method for microgrid EMS based on a large language model, the method comprising the following steps: S1, the situational awareness module 10 collects multi-dimensional physical state data of the microgrid in real time, and simultaneously acquires operation and maintenance instructions in natural language form to construct multi-dimensional situational input features; S2, the prompt word generation module 30 performs similarity retrieval in the experience memory module 20 based on multi-dimensional physical state data, extracts historical operating experience, and splices and maps multi-dimensional situation input features, historical operating experience and preset power field knowledge into a prompt word sequence; S3, the model inference module 40 performs inference operations based on the received prompt word sequence and outputs parameter setting values containing global scheduling information and anomaly judgment text for the current microgrid state; S4, the safety verification module 50 performs constraint verification on the parameter setting value according to the physical safety boundary set in the microgrid operation specification. If the verification fails, a feedback feature containing over-limit index information is generated and re-input to the model inference module 40 for parameter recalculation. If the judgment condition of continuous recalculation failure is met, the system control is transferred to the standby static rule table. S5 sends the parameter setting values verified by constraints to the underlying execution module 60 for high-frequency closed-loop control. After the current control cycle ends, it calculates the comprehensive scheduling benefit and converts the physical operating condition, parameter setting values and comprehensive scheduling benefit of the current cycle into text vectors to update the experience memory module 20.
[0039] See attached document Figure 3 The S1 provided by the present invention may include the following steps in a specific implementation: S11, the situational awareness module 10 establishes a discrete time step model of the microgrid system, and divides the overall operating time of the control system into slow loop cycles and fast loop cycles with time spans that are multiples of each other. The time span of the slow loop cycle is set to a range of 500 milliseconds to 2 seconds, and the time span of the fast loop cycle is set to a range of 1 millisecond to 10 milliseconds. The situational awareness module 10 uses the slow loop cycle as the reference time step for data updates and periodically triggers physical state perception tasks for the underlying microgrid hardware devices through a timer interrupt mechanism.
[0040] S12, at the beginning of the current slow loop cycle, the situational awareness module 10 synchronously acquires multi-dimensional operating status data from the underlying sensor network of the microgrid through the field industrial communication bus. The multi-dimensional operating status data specifically includes the state of charge of the energy storage battery, the active power of the photovoltaic system, the load power of the microgrid, the frequency of the microgrid system, the physical temperature of the energy storage battery, and the real-time electricity price data representing the external market environment, which characterize the internal operating conditions of the microgrid. After normalizing and preprocessing the above-mentioned discrete numerical data, the situational awareness module 10 performs matrix splicing and merging according to the preset fixed dimension order to construct a structured physical state vector for subsequent spatial vector similarity calculation. At the same time, it caches the original values of the real physical measurements of the corresponding dimension locally for text parsing.
[0041] The mathematical expression for the physical state vector is defined as follows: ; In the formula, The physical state multidimensional feature vector constructed at the current moment; This is the discrete-time index subscript for the current scheduling period; This represents the percentage of remaining state of charge of the energy storage battery at the current scheduling cycle. This represents the active power output measurement value of the distributed photovoltaic units at the current scheduling cycle. This represents the active power consumption of the loads within the microgrid at the current scheduling cycle. The actual instantaneous frequency value of the microgrid bus system collected at the current scheduling cycle; This refers to the real-time electricity price value of the public power grid obtained at the current scheduling cycle. The internal physical operating temperature of the energy storage battery pack measured at the current scheduling cycle. This is a matrix transpose operator that transforms a one-dimensional row vector into a column vector.
[0042] In S13, the communication port of the situation awareness module 10 continuously listens to the natural language text input by the operation terminal and receives unstructured operation and maintenance instructions from the human-machine interface. The situation awareness module 10 encapsulates the received natural language text into an unstructured semantic feature string according to the UTF-8 encoding rule, and aligns and synchronizes it with the physical state vector generated in S12 based on the absolute timestamp. If no new human input text is detected within the current slow loop cycle, the situation awareness module 10 sets the semantic feature string to a default null value, and then outputs a multi-dimensional situation input feature containing the physical state vector and the semantic feature string and sends it to the prompt word generation module 30.
[0043] See attached document Figure 3 The S2 provided by the present invention may include the following steps in a specific implementation: S21, the prompt word generation module 30 reads the local vector database configured inside the experience memory module 20. The local vector database stores the interactive tuple data of the microgrid's past operating cycles in a time-series structure. The interactive tuple data consists of the physical state vector at the historical moment, the control strategy vector executed at the corresponding moment, and the comprehensive scheduling benefit score obtained by closed-loop calculation after the strategy is executed. The set of all interactive tuple data is defined as the local operating memory. The system extracts the high-yield control actions in the local operating memory as the reference benchmark for adaptive optimization without changing the edge model network parameters.
[0044] The mathematical expression for interactive tuple data is defined as follows: ; In the formula, For the first record in the local runtime memory Interactive tuple data for each historical control cycle; This is the addressing index parameter for the natural number arrangement in the local runtime memory of the historical interactive tuple; For the first A multidimensional feature vector of the physical state of each historical control cycle; In the first A vector of numerical control strategy setpoints actually issued by the system to the underlying actuators in each historical control cycle; For the first The scalarized comprehensive scheduling benefit score is calculated after each historical control cycle is completed at the bottom layer.
[0045] S22, the prompt word generation module 30 receives the multi-dimensional situational input features output by the situational awareness module 10, uses the current physical state vector as the benchmark query feature, and uses a cosine similarity algorithm to calculate the cosine value of the spatial geometric angle between the benchmark query feature and each historical physical state vector in the local runtime memory. During the calculation, a preset small normal number is introduced into the denominator of the formula to avoid the dead zone of zero calculation caused by zero vector input. In this embodiment, the value range of the small normal number is set to 10. -6 Up to 10 -4 The prompt word generation module 30 arranges the calculated cosine similarity values in descending order and extracts a preset number of interactive tuples from the top-ranked ones to form a subset of historical experience.
[0046] In response to the cold start condition caused by the initial operation of the system, if the prompt word generation module 30 detects that the total number of interactive tuple data in the local runtime memory is less than the preset number, it directly extracts all interactive tuple data in the local runtime memory to form a historical experience subset. If it detects that there is no data in the local runtime memory, it configures the historical experience subset as an empty set vector, wherein the preset number of interactive tuple data with the highest ranking is set to a range of 3 to 5.
[0047] The mathematical expression for calculating the cosine of a spatial geometric angle is defined as follows: ; In the formula, The physical state characteristics at the current moment and the first Numerical calculation of cosine similarity between physical state features of each historical cycle; This is the discrete-time index subscript for the current scheduling period; This is the addressing index parameter for the natural number arrangement in the local runtime memory of the historical interactive tuple; The physical state multidimensional feature vector constructed at the current moment; For the first A multidimensional feature vector of the physical state of each historical control cycle; In this embodiment, a tiny normal number parameter is embedded in the algorithm's underlying layer to prevent overflow anomalies caused by dividing a floating-point number by zero. The value range is set to 10. -6 Up to 10 -4 .
[0048] S23, the prompt word generation module 30 calls the preset feature mapping operator to perform textual alignment and splicing assembly on the multimodal heterogeneous data. The feature mapping operator converts the original values of the real physical measurements corresponding to the physical state vector into key-value pair description text with corresponding physical quantity name labels. At the same time, it converts each interaction tuple in the historical experience subset into scene state and policy behavior description text arranged in chronological order. The prompt word generation module 30 unifies the physical state vector at the current moment, the extracted semantic feature string, the historical experience subset, and the pre-configured power field knowledge into a natural language text format of the same dimension.
[0049] The prompt word generation module 30 performs string concatenation operations according to the preset system prompt word template structure to generate a prompt word sequence that conforms to the input specifications of the large language model based on the Transformer architecture. This prompt word sequence is then encoded into word embedding feature vectors by the system's built-in word segmenter and passed into the attention mechanism layer of the large language model as a comprehensive contextual input environment for performing logical reasoning operations.
[0050] The formula for the concatenation mapping of the generated prompt word sequence is defined as follows: ; In the formula, To generate and input the natural language formatted comprehensive prompt word sequence of the underlying layer of the large language model at the current moment; This is the discrete-time index subscript for the current scheduling period; To parse multi-source heterogeneous numerical and structured tensors into natural language text format feature mapping operators; The physical state multidimensional feature vector constructed at the current moment; This is a semantic feature string extracted from the natural language commands of the operations and maintenance personnel at the current scheduling cycle. This is a subset of high-value historical experience interaction tuple data obtained based on similarity retrieval. This is a pre-embedded set of power sector rules, constraints, and scheduling knowledge texts within the system.
[0051] See attached document Figure 3 In a specific implementation, S3 provided by the present invention may include the following steps: S31, the model inference module 40 has a built-in large language model based on a multi-layer self-attention mechanism transformer architecture. This large language model adopts an open-source pre-trained base model that has been fine-tuned with corpus data from the power industry. Its internal network layer structure is configured as a word embedding layer, a masked multi-head attention layer, and a feedforward neural network layer connected in sequence. The model inference module 40 deploys the large language model in a mode where the weight parameters are fixed and do not participate in backpropagation. The model inference module 40 receives the prompt word sequence from the prompt word generation module 30 and encodes it into the word embedding layer through the built-in word segmenter. The large language model performs spatial dimensionality reduction and feature extraction on the multimodal information contained in the prompt word sequence based on the fixed weight matrix. The feedforward neural network layer of the large language model is configured with a soft maximization activation function at the end and outputs the predicted text tag sequence. After being decomposed by the format extraction engine, the text tag sequence forms a dual-output data branch consisting of a numerical control strategy setpoint vector and a text-based anomaly judgment report.
[0052] The mathematical mapping operator formula for dual-output logic is defined as follows: ; In the formula, A combination vector of numerical control strategy setting values generated for the output branches of the large language model and sent down to the underlying execution stage; The text-based anomaly analysis report string generated by the output branch of the large language model is sent to the upper-level monitoring interface. This is the discrete-time index subscript for the current scheduling period; A mathematical mapping operator for performing forward inference based on a multilayer self-attention transformer network architecture; To generate and input a natural language formatted sequence of prompt words into a large language model at the current moment; This is the pre-trained network weight parameter matrix that is fixed within the large language model and does not participate in gradient updates during real-time inference.
[0053] S32, the numerical control strategy setpoint vector is configured as a slow-loop scheduling instruction sent to the underlying execution module 60. The text tag sequence generated by the large language model contains key-value pairs of numerical strings encapsulated in a standard lightweight data exchange format. The model inference module 40 calls the regular expression parsing library to perform floating-point extraction on the numerical strings. The model inference module 40 combines the extracted discrete values in a preset dimension order to form a dimension-reduced control strategy setpoint vector. The control strategy setpoint vector consists of the target charging and discharging power setpoint, the virtual inertia setpoint, and the damping coefficient setpoint in the data dimension. This vector is configured to provide the underlying execution algorithm with the physical operating boundary constraints and dynamic response inertia reference within the control cycle. The large language model itself does not directly participate in the generation and calculation of the high-frequency pulse width modulation control signal of the underlying hardware device.
[0054] The mathematical structure expression for the control strategy setpoint vector is configured as follows: ; In the formula, A vector of setpoints for the numerical control strategy generated at the current moment; This is the discrete-time index subscript for the current scheduling period; The target charging and discharging active power setpoint received for the physical verification to be performed in the current scheduling cycle; The virtual inertia setting value for the physical verification to be performed received in the current scheduling cycle; The damping coefficient setpoint generated for the current scheduling cycle; This is a matrix transpose operator that transforms a one-dimensional row vector into a column vector.
[0055] S33, when the model inference module 40 receives the physical state vector sent by the situation awareness module 10, it simultaneously performs differential operation. The model inference module 40 extracts the first-order time derivative of the physical temperature of the energy storage battery and the first-order time derivative of the microgrid system frequency based on the physical state vector of adjacent slow loop cycles. The model inference module 40 compares the above-mentioned time-series change rate index data with the safety limit change rate threshold configured in the preset power field knowledge text. The safety limit change rate threshold configured for system frequency is set to a range of 0.2 Hz to 0.5 Hz, and the safety limit change rate threshold configured for physical temperature is set to a range of 1°C to 2°C. When it is determined that the time-series change rate value of any single physical state index exceeds the set safety limit change rate threshold, the system forcibly inserts the over-limit flag into the head of the current prompt word sequence through the built-in soft interrupt mechanism, thereby activating the generation trigger condition of the text-type anomaly judgment report in the output branch of the large language model.
[0056] After receiving a sequence of prompt words with an out-of-limit flag, the large language model combines the historical experience subset contained in the prompt word sequence to generate an analysis result text. The anomaly analysis text sequentially includes the absolute timestamp of occurrence, the name of the out-of-limit physical indicator, the severity level of the out-of-limit, and a continuous natural language string of fault cause analysis. The analysis result text is pushed to the upper monitoring terminal for display via the uplink communication port of the model inference module 40, and a local hard disk archiving operation is performed simultaneously. If none of the time series change rates touch the threshold, the large language model uniformly assigns the output character set of this path to a preset system safety identifier constant. The system safety identifier constant is configured as a default string representing stable system operation and avoids parsing dead zone blocking caused by empty data packets. The calculation matrix construction and weight allocation logic configuration of the underlying multi-head attention mechanism are based on the existing standard converter network forward propagation methods.
[0057] This embodiment describes the specific technical means by which the security verification module 50 intercepts the control strategy setpoint vector generated by the large language model and performs closed-loop autonomous reflection and correction. By substituting the numerical control strategy setpoint vector into the rigid defense logic containing the multi-dimensional physical boundary conditions of the microgrid for Boolean logic judgment, it is possible to avoid safety over-limit accidents caused by the direct issuance of uncertain random scheduling instructions to the underlying hardware devices of the microgrid. In specific implementation, S4 provided by this invention includes the construction of a set of physical hard constraint inequalities, the dynamic splicing and assembly of the reflection prompt word sequence, and the smooth degradation switching action of control rights based on counters and cooling timers. The sub-steps are closely connected through loopback data links to achieve full-time microgrid security defense.
[0058] See attached document Figure 4 In a specific implementation, S4 provided by the present invention may include the following steps: S41, the safety verification module 50 extracts the numerical control strategy setpoint vector issued by the model inference module 40 and simultaneously parses the underlying multi-dimensional physical state data. The safety verification module 50 reads the rated operating parameter table of the microgrid equipment and establishes a set of physical hard constraint inequalities including the limit power, capacity integral boundary and inertia adjustment range. The safety verification module 50 substitutes the values of each dimension in the control strategy setpoint vector into the set of physical hard constraint inequalities and performs Boolean logic judgment operation.
[0059] The mathematical expression for the system of physical hard constraint inequalities is defined as follows: ; In the formula, The maximum active power limit for charging that can be injected into the underlying hardware of microgrid energy storage batteries; The target charging and discharging active power setpoints for the physical verification to be performed received in the current scheduling cycle are strictly defined in the system operation logic as positive for discharging power and negative for charging power. This is the discrete-time index subscript for the current scheduling period; The maximum allowable discharge active power limit for the underlying hardware of microgrid energy storage batteries; The lower limit threshold of the state of charge is configured to ensure the healthy operation of energy storage batteries; This represents the percentage of remaining state of charge of the energy storage battery at the current scheduling cycle. The discrete fixed time step parameter between two adjacent cycles is used to issue the slow loop control command to the system. The physical specifications of the rated total capacity of the microgrid energy storage battery system as specified at the factory. The upper limit threshold of the state of charge safety is configured to prevent the risk of overcharging of energy storage batteries; The minimum physical lower limit value of the inertia coefficient configured for the underlying virtual synchronous generator algorithm; The virtual inertia setting value for the physical verification to be performed received in the current scheduling cycle; The maximum physical upper limit value of the inertia coefficient configured for the underlying virtual synchronous generator algorithm.
[0060] S42, if the numerical control strategy setpoint vector simultaneously satisfies all the conditions in the above physical hard constraint inequality group, the safety verification module 50 directly releases the control command and sends it to the underlying execution module 60. If it is determined that the conditions are not met, the safety verification module 50 intercepts and blocks the sending path of the control command. The safety verification module 50 extracts the name label of the over-limit parameter and the absolute deviation value of the boundary. The safety verification module 50 splices and assembles the extracted over-limit information into a natural language error text according to the preset error correction syntax template. The safety verification module 50 appends the natural language error text to the end of the original prompt word sequence output by the prompt word generation module 30 through the internal loopback communication link to form a reflection prompt word sequence. The safety verification module 50 triggers the model inference module 40 to re-execute the forward inference operation process based on the reflection prompt word sequence and outputs the updated control strategy setpoint vector.
[0061] S43, the safety verification module 50 is internally configured with a counter variable for recording the frequency of recalculation cycles. The maximum retry threshold of this counter variable is configured to be 3 to 5 times. When the instruction verification passes or a new slow loop cycle is entered, the safety verification module 50 resets the value of the counter variable to zero. During the operation of the retrial mechanism, if the updated control strategy setpoint vector continuously fails the physical hard constraint inequality group verification and the cumulative value of the counter variable reaches the maximum retry threshold, the safety verification module 50 triggers the system control degradation logic. The safety verification module 50 blocks the data output bus of the model inference module 40 and forcibly transfers the real-time control of the microgrid system to the built-in backup static rule table. The backup static rule table directly calculates the conservative operating parameters based on the pre-fixed segmented droop control equations and sends them to the underlying execution module 60.
[0062] S44, the security verification module 50 starts the internally configured model cooling timer at the synchronization moment of activating the system control degradation logic. The security verification module 50 configures the overflow time of the model cooling timer to be 10 to 20 consecutive slow loop cycles. Before the overflow time is reached, the security verification module 50 continuously blocks the computing power call request of the model inference module 40 and relies on the backup static rule table to maintain the basic operation of the system. When the running time recorded by the model cooling timer reaches the preset overflow time, the security verification module 50 releases the blocking state of the data output bus and restores the scheduling control authority of the large language model. The coefficient configuration and calculation operation of the segmented droop control equation inside the backup static rule table are performed according to the existing standard droop control methods.
[0063] In a specific implementation, S5 provided by the present invention may include the following steps: S51, the underlying execution module 60 receives the numerical control strategy setpoint vector released by the safety verification module 50 and executes the underlying algorithm iteration with a preset fast loop period as the calculation step size. The underlying execution module 60 extracts the virtual inertia setpoint and damping coefficient setpoint and substitutes them into the built-in second-order differential rotor motion equation. The underlying execution module 60 calls the Euler method to perform differential expansion of the second-order differential rotor motion equation in the discrete time domain and calculates the angular frequency deviation value within the current control step size. The underlying execution module 60 adds the angular frequency deviation value to the rated angular frequency and performs time integration to solve the reference internal potential phase angle of the microgrid inverter. The underlying execution module 60 generates a high-frequency pulse width modulation signal based on the reference internal potential phase angle and frequency command and drives the underlying power electronic switching device to execute the given target charging and discharging power setpoint.
[0064] The mathematical expression of the calculus governing equation is configured as follows: ; In the formula, The target charging and discharging active power setpoint that has been verified and released for safety and is actually sent to the underlying inverter controller; This is the discrete-time index subscript for the current scheduling period; This is the measured feedback value of the electromagnetic power actually output from the microgrid inverter port to the bus at the current scheduling cycle. The virtual inertia setting value actually allocated to the execution of the underlying algorithm logic; For the continuous physical running time parameter in the control loop of the differential equation; This represents the real-time physical deviation between the actual angular frequency of the underlying virtual generator rotor and the rated standard angular frequency of the public power grid. This is the first-order differential derivative term obtained by calculating the numerical value of angular frequency deviation with respect to continuous physical running time; This is the damping coefficient setting value actually allocated to the underlying algorithm logic execution.
[0065] The proportional-integral parameter tuning of the voltage and current dual closed-loop controller of the underlying inverter and the logic for generating high-frequency pulse width modulation signals are based on existing space vector pulse width modulation methods.
[0066] S52, at the end of the current slow loop cycle, the experience memory module 20 extracts the actual physical state trajectory of the microgrid transmitted back by the underlying sensors and performs mathematical operations of the closed-loop evaluation operator. The experience memory module 20 extracts the actual energy storage charging and discharging power and real-time electricity price data of the current control cycle to calculate the scalar of electricity price arbitrage economic benefit of the microgrid operation. This scalar of economic benefit represents the instantaneous arbitrage rate level within a unit slow loop cycle. The experience memory module 20 simultaneously extracts the absolute value of the deviation between the actual frequency of the microgrid system and the rated reference frequency to calculate the safety penalty scalar of the system's dynamic stability. Based on the preset weight coefficient, the experience memory module 20 performs linear weighted fusion calculation of the economic benefit scalar and the safety penalty scalar to generate the comprehensive scheduling benefit score at the current moment.
[0067] The mathematical expression for the comprehensive scheduling benefit function is defined as follows: ; In the formula, This is a scalarized comprehensive scheduling benefit score calculated based on the actual physical feedback trajectory at the underlying level after the current scheduling cycle is completed. This is the discrete-time index subscript for the current scheduling period; In this embodiment, the constant weighting coefficient parameter configured internally for evaluating the economic arbitrage of electricity prices is used. The value range is configured to be from 0.4 to 0.6; This represents the measured average charge and discharge active power of the energy storage battery under controlled operation during the current historical control cycle. The superscript is used to characterize the physical quantity as a variable representing the actual physical operation feedback state transmitted back from the underlying sensor; This refers to the real-time electricity price value of the public power grid obtained at the current scheduling cycle. In this embodiment, the constant weighting coefficient parameter configured internally for the frequency deviation penalty dimension of the bus system is used. The value range is configured to be from 0.4 to 0.6, and the system internally will... and The sum of the values of is a hard constraint that is a constant 1. This is the measured value of the actual average operating frequency of the microgrid bus system within the current historical control cycle. This refers to the rigid rated operating reference frequency parameter followed in the original design specifications of microgrid systems.
[0068] S53, the experience memory module 20 extracts the physical state vector at the start of the current cycle and the actual control strategy setpoint vector and encapsulates it with the comprehensive scheduling benefit score in a data structure. Before encapsulation, the system performs a running mode verification. If the current cycle is in the model cooling timer state activated by the system control degradation logic, the storage request of the current interactive tuple data is intercepted to prevent the conservative strategy from polluting the experience pool. If in the normal scheduling mode of the large model, the experience memory module 20 will append timestamps to the encapsulated interactive tuple data according to the time series and write them to the bottom index node of the local runtime memory. Before the append operation, the experience memory module 20 reads the total storage entry count of the local runtime memory and compares it with the pre-configured storage capacity upper limit threshold of five thousand to ten thousand entries. When it is determined that the total storage entry count has reached the storage capacity upper limit threshold, the experience memory module 20 activates the built-in first-in-first-out elimination mechanism to perform memory erasure operation on the interactive tuple data with the timestamp in the farthest historical interval. The experience memory module 20 will reallocate the internal addressing index of the local runtime memory after capacity trimming according to the absolute time series and synchronize it to the shared memory area of the prompt word generation module 30 through the cache bus.
[0069] To aid in understanding the technical solution of this invention, the following provides an application example and test example of a microgrid system based on a large language model under peak daytime electricity consumption conditions in summer; In this application embodiment, the time scale of system control is divided into a slow loop period of 1 second and a fast loop period of 5 milliseconds. The situational awareness module 10 performs system status awareness and command reception operations with the slow loop period as the reference step size.
[0070] At the start of the current slow cycle, the situational awareness module 10 acquires physical state data from the microgrid's underlying sensors. At this time, the measured remaining state of charge of the energy storage battery is 45.3%, the active power output of the distributed photovoltaic unit is 121.2 kW, the active power of the load inside the microgrid is 178.6 kW, the actual operating frequency of the system is 49.93 Hz, the real-time trading price of the public grid is 1.22 yuan / kWh, and the internal physical temperature of the energy storage battery is 33.1 degrees Celsius. At the same time, the situational awareness module 10 receives the operation and maintenance scheduling instruction text that prioritizes the load of the park and executes the discharge scheduling in the high-price range. The situational awareness module 10 normalizes the above values to obtain the physical state vector and caches the original physical measurement values locally.
[0071] The prompt word generation module 30 reads the local vector database and uses the current physical state vector as a benchmark to retrieve historical operating experience using the cosine similarity algorithm. The system extracts the top 3 interactive tuple data with the highest similarity ranking to form a subset of historical experience. Subsequently, the feature mapping operator converts the original physical measurement values into key-value pair text and, together with the scheduling instruction text, the historical experience subset description text, and the system's preset power field knowledge text, splices and maps them into a prompt word sequence in natural language format according to the preset template.
[0072] The large language model inside the model inference module 40 receives the prompt word sequence and performs forward inference based on the fixed weight matrix to output a text tag sequence. The parsing engine extracts a combination vector of numerical control strategy setting values from the text tag sequence. According to the system's internal logic that the discharge power direction is positive and the charging power direction is negative, the target charging and discharging power setting value output by the large language model is +58.4 kW, the virtual inertia setting value is 1.55, and the damping coefficient setting value is 12.8. The model inference module 40 simultaneously calculates that the physical temperature change rate is 0.015 degrees Celsius per second and the frequency change rate is 0.008 Hz per second. The above time-series change rates do not exceed the set safety limit change rate threshold. The corresponding value of the anomaly judgment output branch of the large language model is assigned to the default system safety identifier constant.
[0073] The safety verification module 50 reads the above control strategy setting value and substitutes it into a set of physical hard constraint inequalities containing the limit charge and discharge power of the energy storage system and the state of charge boundary. Under the conditions of the current state of charge of 45.3% and the target charge and discharge power setting value of +58.4 kW, the Boolean logic judgment result is a pass state. The safety verification module 50 directly allows the set of control strategy setting value vectors and sends them to the underlying execution module 60.
[0074] The underlying execution module 60 receives the setpoint vector and substitutes the virtual inertia of 1.55 and the damping coefficient of 12.8 into the second-order differential rotor motion equation within a 5-millisecond fast loop cycle. The underlying execution module 60 calculates the angular frequency deviation and generates the corresponding high-frequency pulse width modulation signal to drive the underlying inverter to control the energy storage hardware to discharge. After a 1-second slow loop cycle, the experience memory module 20 extracts the actual average discharge power of 58.1 kW and the actual operating frequency value that rises to 49.97 Hz from the sensor feedback. The experience memory module 20 calculates the economic benefit scalar and the safety penalty scalar through linear weighted fusion to obtain the comprehensive scheduling benefit score of 85.6 points for the current control cycle.
[0075] The system determines that it is not currently in a model cooling and degradation state. The experience memory module 20 encapsulates the current physical state vector, the actual issued control strategy setting value vector, and the comprehensive scheduling benefit score of 85.6 points into an interactive tuple and adds an absolute timestamp to it, then appends it to the bottom index node of the local runtime memory.
[0076] Test Example: To verify the implementation effect of the technical solution of the present invention, the following experimental verification data of a microgrid system built on a semi-physical real-time simulation platform are provided. The experimental hardware parameters include a photovoltaic array with a rated output of 250 kW, a battery energy storage system with a capacity of 500 kWh and a maximum charge and discharge power of 250 kW, and a campus load equipment with a peak power of 350 kW.
[0077] The experiment setup used a static rule-based control system method A, a conventional reinforcement learning control system method B, and the control method of this invention method C for comparative testing. The experiment performed transient disturbance tests with a 115 kW step change load during stable system operation and long-cycle continuous operation tests with continuous simulation of 30 days of multi-dimensional power grid data. The economic benefits and hardware risk over-limit records were also statistically analyzed.
[0078] Table 1: Statistical Table of Transient Response Indicators of Microgrid Systems under Sudden Load Impact Conditions
[0079] Table 2: Statistical Table of Macroeconomic Indicators of Long-Term Multidimensional Power Grid Operation Conditions over 30 Continuous Days
[0080] From Table 1 and Appendix Figure 5 It can be seen that in the transient test with a 115 kW step change load, the maximum frequency drop deviation of the system using method C is 0.31 Hz, the time for the frequency to recover to the steady state range is 4.38 seconds, and the highest measured temperature of the energy storage battery during the disturbance is 35.8 degrees Celsius. Compared with the maximum frequency drop deviation of 0.82 Hz using method A and 0.49 Hz using method B, method C relies on the large language model to output the target charging and discharging power setting value and simultaneously outputs the dynamic virtual inertia and damping coefficient setting values adapted to the transient requirements of the microgrid. These values are then sent to the underlying execution module 60 to perform high-frequency closed-loop adjustment operation of the second-order differential rotor motion equation. The system reduces the differential derivative term of the bus angular frequency deviation with respect to the continuous physical running time and achieves multi-dimensional reduction of the system frequency drop amplitude and recovery time.
[0081] From Table 2 and Appendix Figure 6It can be seen that: in the continuous 30-day long-cycle multi-dimensional power grid operation condition test, the cumulative net arbitrage profit of the system using method C is RMB 19286.30, the number of times the underlying hardware dangerous over-limit protection action is triggered is 0, and the frequency of interception and correction of the internal mechanism of the algorithm is 38 times. Compared with the cumulative net arbitrage profit of RMB 11845.20 of the system using method A and the 14 dangerous over-limit protection actions generated by method B, method C, through the physical hard constraint inequality group built into the safety verification module 50, performs data transmission path blocking and error text splicing and back transmission operations on parameters that exceed the physical boundary of energy storage. The system maintains the absolute physical boundary compliance setting of the target parameter transmission on the basis of guiding the large language model to re-execute the forward inference operation and completing 38 internal instruction recalculation and correction.
[0082] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A microgrid EMS adaptive control method based on a large language model, characterized in that, The method includes the following steps: Real-time acquisition of multi-dimensional physical state data of microgrids, synchronous acquisition of operation and maintenance instructions in natural language form, and construction of multi-dimensional situation input features; Based on the multidimensional physical state data, a similarity search is performed in a pre-built local operating memory to extract historical operating experience. The multidimensional situation input features, the historical operating experience, and the preset power field knowledge are then concatenated and mapped into a prompt word sequence. The prompt word sequence is input into a preset large language model for inference calculation, and the parameter setting value containing global scheduling information is output. At the same time, the abnormal judgment text for the current microgrid state is output, and the abnormal judgment text is pushed to the upper monitoring terminal for display and archiving. According to the physical safety boundary set in the microgrid operation specification, the parameter setting value is constrained and verified: if the verification fails, a feedback feature containing over-limit index information is generated and appended to the prompt word sequence and re-inputted into the large language model for parameter recalculation; if the judgment condition of continuous recalculation failure is met, the system control is transferred to the standby static rule table, which calculates and outputs the degradation parameter setting value. The parameter setting values verified by constraints or the downgraded parameter setting values are sent to the underlying execution module for high-frequency closed-loop control. After the current control cycle ends, the comprehensive scheduling benefit is calculated, and the physical operating condition status of the current cycle, the actual parameter setting values sent, and the comprehensive scheduling benefit are converted into text vectors and updated and appended to the local runtime memory to achieve experience-based iterative closed-loop control.
2. The microgrid EMS adaptive control method based on a large language model according to claim 1, characterized in that, The steps of real-time acquisition of multi-dimensional physical state data of the microgrid, synchronous acquisition of operation and maintenance instructions in natural language form, and construction of multi-dimensional situational input features include: A discrete time step model of the microgrid system is established, and the overall operating time of the control system is divided into slow loop period and fast loop period with time spans that are multiples of each other. At the beginning of the current slow loop cycle, multidimensional running state data is acquired synchronously. After normalization preprocessing of the numerical data in the discrete state of the multidimensional running state data, the matrix is spliced and merged according to the preset fixed dimension order to construct a structured physical state vector for subsequent spatial vector similarity calculation as the multidimensional physical state data. At the same time, the original values of the real physical measurement of the corresponding dimension are cached locally. The system continuously monitors the natural language text input from the operation terminal to receive unstructured operation and maintenance instructions. The received natural language text is encapsulated into an unstructured semantic feature string according to the UTF-8 encoding rule. The semantic feature string is then aligned and synchronized with the physical state vector based on an absolute timestamp. Finally, a multi-dimensional situational input feature containing the physical state vector and the semantic feature string is output.
3. The microgrid EMS adaptive control method based on a large language model according to claim 2, characterized in that, The steps for performing similarity retrieval in the local runtime memory based on the multidimensional physical state data and extracting historical runtime experience include: The local operating memory is read. The local operating memory stores interactive tuple data of the microgrid's past operating cycles in a time-series structure. The interactive tuple data consists of a multi-dimensional feature vector of the physical state at a historical moment, a combination vector of numerical control strategy setpoints at the corresponding moment, and a comprehensive scheduling benefit score obtained through closed-loop calculation. The physical state vector is used as the reference query feature. The cosine similarity algorithm is used to traverse and calculate the cosine value of the spatial geometric angle between the reference query feature and each historical physical state vector in the local runtime memory. A preset small positive constant is introduced into the denominator of the calculation formula to avoid the dead zone of zero calculation caused by zero vector input. Based on the calculated cosine similarity values, the data are sorted in descending order, and a predetermined number of interactive tuples at the top of the ranking are selected to form a subset of historical experience as the historical operating experience.
4. The microgrid EMS adaptive control method based on a large language model according to claim 3, characterized in that, The steps of concatenating and mapping the multi-dimensional situational input features, historical operational experience, and preset power sector knowledge into a sequence of prompt words include: The preset feature mapping operator is invoked to perform textual alignment and splicing assembly on multimodal heterogeneous data. The feature mapping operator transforms the original values of the real physical measurements corresponding to the physical state vector into key-value pair description text with corresponding physical quantity name labels, and transforms each interaction tuple in the historical experience subset into scene state and strategy behavior description text arranged in chronological order. The physical state vector, the extracted semantic feature string, the historical experience subset, and the pre-configured power field knowledge are uniformly transformed into a natural language text format of the same dimension. The system concatenates strings according to the preset system prompt word template structure to generate a prompt word sequence that conforms to the input specifications of a large language model based on the Transformer architecture.
5. The microgrid EMS adaptive control method based on a large language model according to claim 4, characterized in that, The steps of inputting the prompt word sequence into a preset large language model for inference operations and outputting parameter setting values containing global scheduling information and anomaly judgment text for the current microgrid state include: The large language model is deployed with fixed weight parameters and does not participate in backpropagation; The system receives the prompt word sequence and encodes it through a built-in word segmenter before inputting it into the word embedding layer. The large language model performs spatial dimensionality reduction and feature extraction on the multimodal information contained in the prompt word sequence based on a fixed weight matrix. The predicted text tag sequence is output through a soft maximization activation function configured at the end of the feedforward neural network layer. The regular expression parsing library is called to extract the numerical strings in the text tag sequence. The extracted discrete values are combined in a preset dimension order to form a dimension-reduced control strategy setting value vector as the parameter setting value. The control strategy setting value vector consists of the target charging and discharging power setting value, the virtual inertia setting value, and the damping coefficient setting value in the data dimension. A dual-output data branch is formed, which includes the control strategy setpoint vector and a text-based anomaly assessment report, with the text-based anomaly assessment report serving as the anomaly assessment text.
6. The microgrid EMS adaptive control method based on a large language model according to claim 5, characterized in that, The steps of inputting the prompt word sequence into a preset large language model for inference operations and outputting parameter settings containing global scheduling information and anomaly judgment text for the current microgrid state also include: Based on the physical state vector of adjacent slow loop cycles, perform differential operation to extract the first-order time derivative of the physical temperature of the energy storage battery and the first-order time derivative of the frequency of the microgrid system as time-series rate of change index data. The time-series rate of change index data is compared with the safety limit rate of change threshold configured in the preset power field knowledge text. When the time-series change rate of any single physical state indicator exceeds the set safety limit change rate threshold, the over-limit flag is forcibly inserted into the head of the current prompt word sequence through the built-in soft interrupt mechanism, thereby activating the generation trigger condition of the text-type anomaly judgment report in the output branch of the large language model.
7. The microgrid EMS adaptive control method based on a large language model according to claim 5, characterized in that, According to the physical safety boundaries set in the microgrid operation specifications, the parameter settings are constrained and verified. If the verification fails, a feedback feature containing over-limit index information is generated and appended to the prompt word sequence. The process of re-inputting the feedback feature into the large language model for parameter recalculation includes: Establish a set of physical hard constraint inequalities that include the limiting power, capacity integral boundary, and inertia adjustment range; Substitute the values of each dimension in the control strategy setpoint vector into the physical hard constraint inequality set and perform a Boolean logic judgment operation. If the condition is not met, the path of the control command is intercepted and blocked, the name label of the out-of-limit parameter and the absolute deviation value of the boundary are extracted, and the extracted out-of-limit information is spliced and assembled into a natural language error text as the feedback feature according to the preset error correction syntax template. The natural language error text is appended to the end of the original output prompt word sequence through the internal loopback communication link to form a reflection prompt word sequence. This triggers the large language model to re-execute the forward inference operation process based on the reflection prompt word sequence and output the updated control policy setting value vector.
8. The microgrid EMS adaptive control method based on a large language model according to claim 1, characterized in that, If the criteria for failing consecutive recalculations are met, the steps for transferring system control to the standby static rule table include: If the updated control strategy setpoint vector continues to fail the physical hard constraint inequality check, and the cumulative value of the counter variable that records the frequency of recalculation loops reaches the maximum retry threshold, then the system control degradation logic is triggered. By blocking the data output bus, the real-time control of the microgrid system is forcibly transferred to the built-in backup static rule table. The backup static rule table directly calculates conservative operating parameters based on the pre-fixed segmented droop control equations and sends them to the underlying execution module. At the synchronous moment when the system control degradation logic is activated, the internally configured model cooling timer is started. Before the preset overflow time is reached, the computing power call request is continuously blocked and the basic operation of the system is maintained by relying on the backup static rule table. When the recorded running time reaches the overflow time, the blocking state of the data output bus is released and the scheduling control authority of the large language model is restored.
9. The microgrid EMS adaptive control method based on a large language model according to claim 7, characterized in that, The steps for sending the parameter setting values that have passed the constraint verification to the underlying execution module for high-frequency closed-loop control include: The underlying execution module receives the numerical control strategy setting value vector that has been verified and released by security, and executes the underlying algorithm iteration with a preset fast loop period as the calculation step size. Extract the virtual inertia setpoint and damping coefficient setpoint and substitute them into the built-in second-order differential rotor motion equation. Call the backward Euler method to perform differential expansion of the second-order differential rotor motion equation in the discrete time domain and calculate the angular frequency deviation value within the current control step. After adding the angular frequency deviation value to the rated angular frequency, a time integration operation is performed to solve for the reference internal potential phase angle of the microgrid inverter. Based on the reference internal potential phase angle and frequency command, a high-frequency pulse width modulation signal is generated and the underlying power electronic switching device is driven to perform the given target charging and discharging power setting value.
10. The microgrid EMS adaptive control method based on a large language model according to claim 9, characterized in that, The steps for calculating the comprehensive scheduling benefit after the current control cycle ends, and converting the physical operating status, parameter settings, and comprehensive scheduling benefit of the current cycle into text vectors to update the local runtime memory include: At the end of the current slow loop cycle, the actual physical state trajectory of the microgrid transmitted back by the bottom sensor is extracted as the physical operating condition state. The actual energy storage charging and discharging power and real-time electricity price data of the current control cycle are extracted to calculate the scalar of electricity price arbitrage economic benefits of microgrid operation. At the same time, the absolute value of the deviation between the actual frequency of the microgrid system and the rated reference frequency is extracted to calculate the safety penalty scalar of the system dynamic stability. Based on preset weighting coefficients, the scalar of economic benefits from electricity price arbitrage and the scalar of safety penalties are linearly weighted and fused to generate a comprehensive scheduling benefit score for the current moment, which is then used as the comprehensive scheduling benefit. Before encapsulation, the running mode is verified. If the current cycle is in the model cooling timer state where the system control degradation logic is activated, the storage request for the current interactive tuple data is intercepted. If the system is in normal scheduling mode for large models, before appending a write operation, the total number of storage entries in the local runtime memory is read and compared with the pre-configured upper limit threshold for storage capacity. When the total number of storage entries reaches the upper limit threshold for storage capacity, the built-in first-in-first-out (FIFO) elimination mechanism is activated to perform memory erasure on interactive tuple data with timestamps in the furthest historical interval. The local runtime memory, after capacity trimming, is then reallocated according to the absolute time series and appended.