A model predictive control method and apparatus for microgrid cost optimization
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-21
- Publication Date
- 2026-08-14
AI Technical Summary
以解决现有微电网控制中计算负荷大、经济韧性难以协同、抗干扰能力弱的问题,实现微电网的高效、经济、可靠运行
本发明全域建模维度显著压缩,计算复杂度由指数级降至多项式级,本发明通过构建建筑净功率动态模型,并采用变量聚合算子将多个建筑的储能功率变量映射为单一聚合优化变量,使原本涉及3N个连续控制变量的高维运行优化问题转化为3个全局控制变量的目标优化,显著降低求解规模,从而使成本优化问题可在线滚动求解,提高决策效率。通过对购售电功率进行Slack分解与二元变量决策,将依赖区间选择的非线性购售电目标函数线性化,使得问题能够被标准MILP求解器在有限时间内获得全局最优解,避免传统启发式算法存在的局部收敛问题。通过采用单时段最优聚合设定值广播机制,使上层优化按照固定时间窗口进行滚动迭代,仅执行第一时段最优解,避免预测序列全部提前锁死的问题,实现对PV波动、负荷突变等不确定因素的实时校准,从而提高发用平衡策略的鲁棒性和响应灵敏度。
Smart Images

Figure CN122577084A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of microgrid control technology, specifically relating to a model predictive control method and device for microgrid cost optimization. Background Technology
[0002] As the core carrier for the integration and efficient utilization of distributed energy resources, microgrids face significantly increased operational complexity and control challenges. Existing microgrid control technologies face three major bottlenecks: First, the computational load challenge of large-scale microgrids. Microgrids typically include multiple building units, distributed energy resources, and energy storage devices. Traditional centralized control methods need to handle a large number of dispersed optimization variables, leading to an exponential increase in computational complexity, making it difficult to meet real-time control requirements. While distributed control methods can reduce the computational load on individual nodes, they suffer from poor coordination and low optimization accuracy. Second, the conflict between economic operation and emergency resilience objectives. Third, insufficient resistance to random fluctuations. Traditional control methods often employ fixed-parameter PID control or simple rule-based control, resulting in slow response speeds, poor parameter adaptability, and difficulty in quickly compensating for random fluctuations, leading to low control accuracy and poor operational stability.
[0003] Chinese patent publication number CN120090295A, entitled "A Method and System for Optimized Scheduling of Distributed Power Sources Based on Demand-Side Response," describes a distributed power source prediction model built using a deep neural network to predict photovoltaic power generation, energy storage state of charge, and user load. It then constructs a robust optimization model, considering prediction errors and the nonlinear characteristics of energy storage, to generate optimal time-of-use load scheduling schemes and energy storage charging / discharging strategies. The schemes include interruptible load execution time series, and the strategies include energy storage charging / discharging power curves. Finally, a hierarchical optimization execution system based on model predictive control is established to monitor the system status in real time and correct control commands based on deviations to achieve optimized scheduling of distributed power sources. However, this patent application struggles to address the challenges of high load, economic coordination, and interference resistance in microgrid control processes. Summary of the Invention
[0004] To overcome the problems existing in the prior art, the present invention aims to provide a model predictive control method and apparatus for microgrid cost optimization. This method integrates dynamic aggregation optimization, resilient equilibrium de-aggregation, and adaptive rule-based control into a two-layer model predictive control approach. It is applicable to complex microgrid systems containing distributed energy sources, multi-element energy storage systems, and stochastic loads, and is particularly suitable for large-scale, highly volatile industrial park microgrids, urban community microgrids, and remote area microgrids with stringent requirements for both economic efficiency and resilience. This addresses the problems of high computational load, difficulty in coordinating economic resilience, and weak anti-interference capabilities in existing microgrid control systems, thereby achieving efficient, economical, and reliable operation of microgrids.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows: In a first aspect, the present invention provides a model predictive control method for microgrid cost optimization, comprising the following steps: A microgrid system model was constructed, and the total load demand power of each building unit, the charging and discharging power of the battery energy storage system of each building unit, and the actual power generation power of the PV array of each building unit were collected. A two-level hierarchical aggregation method was adopted, with the first level being aggregation within the building unit and the second level being system-level aggregation, to calculate the system-level aggregated value of the dynamic net power demand power of the microgrid. The binary decision-making method is adopted to divide electricity purchase and sales into binary variables, and the microgrid interaction power is decomposed into two independent continuous Slack variables: electricity purchase power and electricity sales power. Mutual exclusion constraints are set to obtain a linear cost function. A high-dimensional variable dynamic aggregation algorithm is employed to aggregate the charging and discharging power variables, PV array output prediction variables, and load prediction variables of multiple building units' battery energy storage systems into system-level variables. Using a rolling time-domain model predictive control method, the upper-level controller performs rolling window optimization in a first preset period to solve a mixed-integer linear programming model, obtaining the optimal aggregated power setpoint. This optimal setpoint is then sent to the lower-level controller in the form of an adaptive setpoint package, which includes a base setpoint, fluctuation range, and dynamic adjustment coefficient. Upon receiving the optimal aggregated power setpoint, the lower-level controller executes a power de-aggregation algorithm based on state-of-charge equilibrium. Through a hierarchical iterative mechanism, the aggregated power is decomposed into individual power commands for each energy storage unit, ensuring a consistent state of charge across all energy storage units. Finally, the lower-level controller executes adaptive rule control in a second preset period. A cross-layer closed-loop collaborative mechanism is constructed, in which the lower-level controller feeds back real-time operating status data to the upper-level controller at the third preset cycle. The upper-level controller corrects the constraint boundary of the next round of rolling optimization based on the feedback data, and triggers the emergency optimization process when the deviation exceeds the preset threshold.
[0006] Optionally, the mutual exclusion constraints include: aggregated BESS capacity elasticity constraints, dynamic update constraints of energy storage capacity, initial energy storage state constraints, and grid interaction power constraints.
[0007] Optionally, the nonlinear product terms existing in the purchased and sold power are transformed into linear constraints by introducing auxiliary variables and adding linear constraints through a combination of piecewise linearization and binary variable-assisted modeling. Time decay weights are assigned to the load, PV array, and electricity price forecast data.
[0008] Optionally, the second preset period is shorter than the first preset period; the third preset period is between the first preset period and the second preset period.
[0009] Optionally, the adaptive rule executed by the lower-level controller in the second preset cycle is as follows: based on individual power commands, a multi-level response system including fast fluctuation compensation rules, medium and low frequency fluctuation adjustment rules and equipment life protection rules is adopted to adjust the charging and discharging power of each energy storage unit in real time to compensate for random fluctuations.
[0010] Optionally, a de-aggregation algorithm based on state-of-charge equilibrium is executed, specifically including the following iterative steps: calculating the average target state of charge of all energy storage units; initially allocating individual power settings based on the difference between the current state of charge of each energy storage unit and the average target state of charge; clamping the power settings of energy storage units that exceed the dynamic correction power limit to the boundary value and calculating the remaining unallocated power difference; iteratively redistributing the remaining unallocated power difference among the energy storage units that have not exceeded the limit until the power settings of all energy storage units satisfy the constraints and the iteration converges.
[0011] Secondly, the present invention provides a model predictive control system for microgrid cost optimization, comprising: The model building module is used to build a microgrid system model, collect the total load demand power of each building unit, the charging and discharging power of the battery energy storage system of each building unit, and the actual power generation data of the PV array of each building unit; a two-level hierarchical aggregation method is adopted, with the first level being the aggregation within the building unit and the second level being the system-level aggregation, to calculate the system-level aggregated value of the dynamic net power demand power of the microgrid; The function building module is used to divide electricity purchase and sales into binary variables using a binary decision method, decompose the microgrid interaction power into two independent continuous Slack variables: electricity purchase power and electricity sales power, and set mutual exclusion constraints to obtain a linear cost function; The calculation module employs a high-dimensional variable dynamic aggregation algorithm to aggregate the charging and discharging power variables, PV array output prediction variables, and load prediction variables of multiple building units' battery energy storage systems into system-level variables. Using a rolling time-domain model predictive control method, the upper-level controller performs rolling window optimization for a first preset period to solve a mixed-integer linear programming model, obtaining the optimal aggregated power setpoint. This optimal setpoint is then sent to the lower-level controller in the form of an adaptive setpoint package, which includes a base setpoint, a fluctuation range, and a dynamic adjustment coefficient. Upon receiving the optimal aggregated power setpoint, the lower-level controller executes a power de-aggregation algorithm based on state-of-charge equilibrium. Through a hierarchical iterative mechanism, the aggregated power is decomposed into individual power commands for each energy storage unit, ensuring a consistent state of charge across all energy storage units. Finally, the lower-level controller executes adaptive rule control for a second preset period. The early warning module is used to build a cross-layer closed-loop collaborative mechanism. The lower-level controller feeds back real-time operating status data to the upper-level controller at the third preset cycle. The upper-level controller corrects the constraint boundary of the next round of rolling optimization based on the feedback data and triggers the emergency optimization process when the deviation exceeds the preset threshold.
[0012] Thirdly, the present invention provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the model predictive control method for microgrid cost optimization.
[0013] Fourthly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the model predictive control method for microgrid cost optimization.
[0014] Fifthly, the present invention provides a computer program product including a computer-readable medium, wherein computer-readable program code is included on the computer-readable medium, the program code executing the model predictive control method for microgrid cost optimization.
[0015] Compared with the prior art, the present invention has the following beneficial effects: This invention significantly compresses the global modeling dimension, reducing computational complexity from exponential to polynomial level. By constructing a dynamic model of building net power and employing a variable aggregation operator to map the energy storage power variables of multiple buildings into a single aggregated optimization variable, this invention transforms the high-dimensional optimization problem involving 3N continuous control variables into an objective optimization problem with 3 global control variables, significantly reducing the solution scale. This allows the cost optimization problem to be solved online in a rolling manner, improving decision-making efficiency. By performing Slack decomposition and binary variable decision on the purchased and sold power, the nonlinear purchased and sold power objective function dependent on interval selection is linearized, enabling the problem to obtain a globally optimal solution within a finite time by a standard MILP solver, avoiding the local convergence problem present in traditional heuristic algorithms. By adopting a single-period optimal aggregated setpoint broadcasting mechanism, the upper-level optimization is rolled over and iterated according to a fixed time window, executing only the optimal solution of the first period. This avoids the problem of the entire prediction sequence being locked prematurely, enabling real-time calibration of uncertainties such as PV fluctuations and load mutations, thereby improving the robustness and response sensitivity of the power generation and utilization balance strategy.
[0016] This invention employs a fusion of dynamic aggregation optimization, adaptive setpoint coordination, and resilience balancing mechanisms to achieve breakthroughs in solving core challenges of large-scale microgrid operation, such as surges in computational load, conflicts between economic and resilience objectives, and weak resistance to random fluctuations. The method constructs a hierarchical collaborative architecture between upper-level microgrid operators and lower-level building managers. The upper layer uses a dynamic aggregation-linearization optimization algorithm, which transforms the high-dimensional nonlinear optimization problem into an efficient and solvable mixed-integer linear programming problem through second-level variable aggregation and precise linearization of nonlinear terms, reducing computational complexity from exponential to polynomial level. The lower layer designs an adaptive rule-based control algorithm, integrating a three-level response mechanism and a parameter self-updating strategy to achieve minute-level precise compensation for random fluctuations.
[0017] This invention proposes a resilience-oriented balanced de-aggregation algorithm, which achieves balanced resource allocation in energy storage systems through a state of charge flattening strategy and a hierarchical iteration mechanism, thereby increasing the emergency islanding operation time by more than 20%. At the same time, it introduces a dynamic correction coefficient mechanism, a predicted data time decay weight mechanism, and a rolling window update strategy to achieve a dual improvement in optimization accuracy and real-time performance.
[0018] This invention can reduce computational load, improve the economy of normal operation of microgrids and the resilience of emergency scenarios, and is applicable to complex microgrid systems containing distributed photovoltaics, multiple energy storage and random loads. Attached Figure Description
[0019] The accompanying drawings described herein are for illustrative purposes only and are not intended to limit the scope of the invention in any way.
[0020] In the attached diagram: Figure 1 This is a general framework diagram of an embodiment of the present invention; Figure 2 This is a flowchart illustrating the operation of the upper and lower layers in an embodiment of the present invention. Figure 3 This is a dynamic model diagram of a microgrid according to an embodiment of the present invention; Figure 4 This is a flowchart illustrating the adaptive three-level response of an embodiment of the present invention; Figure 5 This is a flowchart of the cross-layer data fusion and deviation early warning mechanism according to an embodiment of the present invention. Detailed Implementation
[0021] To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this invention.
[0022] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0023] It should be noted that any reference signs placed between parentheses in the claims should not be construed as limiting the claims. The word "comprising" does not exclude the presence of components or steps not listed in the claims. The word "a" or "an" preceding a component does not exclude the presence of a plurality of such components. This application can be implemented by means of hardware comprising several different components and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.
[0024] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0025] The present invention will now be described in detail with reference to the accompanying drawings.
[0026] A model predictive control method for microgrid cost optimization, characterized by comprising the following steps: A microgrid system model was constructed, and the total load demand power of each building unit, the charging and discharging power of the battery energy storage system of each building unit, and the actual power generation power of the PV array of each building unit were collected. A two-level hierarchical aggregation method was adopted, with the first level being aggregation within the building unit and the second level being system-level aggregation, to calculate the system-level aggregated value of the dynamic net power demand power of the microgrid. The binary decision-making method is adopted to divide electricity purchase and sales into binary variables, and the microgrid interaction power is decomposed into two independent continuous Slack variables: electricity purchase power and electricity sales power. Mutual exclusion constraints are set to obtain a linear cost function. A high-dimensional variable dynamic aggregation algorithm is employed to aggregate the charging and discharging power variables, PV array output prediction variables, and load prediction variables of multiple building units' battery energy storage systems into system-level variables. Using a rolling time-domain model predictive control method, the upper-level controller performs rolling window optimization in a first preset period to solve a mixed-integer linear programming model, obtaining the optimal aggregated power setpoint. This optimal setpoint is then sent to the lower-level controller in the form of an adaptive setpoint package, which includes a base setpoint, fluctuation range, and dynamic adjustment coefficient. Upon receiving the optimal aggregated power setpoint, the lower-level controller executes a power de-aggregation algorithm based on state-of-charge equilibrium. Through a hierarchical iterative mechanism, the aggregated power is decomposed into individual power commands for each energy storage unit, ensuring a consistent state of charge across all energy storage units. Finally, the lower-level controller executes adaptive rule control in a second preset period. A cross-layer closed-loop collaborative mechanism is constructed, in which the lower-level controller feeds back real-time operating status data to the upper-level controller at the third preset cycle. The upper-level controller corrects the constraint boundary of the next round of rolling optimization based on the feedback data, and triggers the emergency optimization process when the deviation exceeds the preset threshold.
[0027] While existing Model Predictive Control (MPC) methods can handle multi-constraint optimization problems, they have significant limitations in large-scale microgrids: low efficiency in solving nonlinear optimization problems, making it difficult to adapt to real-time control requirements; a lack of effective aggregation-deaggregation mechanisms, failing to balance system-level optimization and unit-level control; and the prevalence of static strategies in resilience management, resulting in uneven energy storage resource allocation and insufficient power supply reliability in emergency situations. The control method of this invention achieves simultaneous improvements in computational efficiency, economic performance, and resilience through algorithmic optimization.
[0028] Example 1 Step 1: Construct a dynamic model of a multi-source heterogeneous microgrid based on building net power calculation and variable aggregation operators; A microgrid consists of multiple interconnected building units, each of which can be configured with photovoltaic arrays, battery energy storage systems, and diverse loads (such as electric vehicles, HVAC, lighting, and household appliances), supporting flexible adaptation between controllable and uncontrollable entities. A dynamic net electricity demand model for each building unit is defined, considering the fluctuations in distributed energy output and the randomness of loads. The expression is
[0029] in, For building units i At any moment tThe total load demand (kW) includes the real-time sum of fixed load and variable load; For building units i The charging and discharging power (kW) of the BESS (Battery Energy Storage System) is positive when charging and negative when discharging. For building units i The actual power generation (kW) of the PV array is calculated from real-time parameters such as the rated power of the photovoltaic panel, light intensity, and ambient temperature. The random disturbance term (kW) encompasses uncertainties such as sudden EV access or disconnection, sudden changes in PV output, load fluctuations, and grid voltage fluctuations. It is updated every minute using real-time monitoring data, and the update formula is as follows: ,in ξ t It is a random variable in the interval [-1, 1], which is obtained from the statistics of actual operating deviations.
[0030] A two-level hierarchical aggregation method is used to aggregate key parameters of all building units in stages: The first level is aggregation within the building unit, which summarizes the similar loads, PV output, and BESS power of the same building unit to obtain the unit-level aggregation value.
[0031] The second level is system-level aggregation, which globally summarizes the unit-level aggregation values of all building units to obtain the total net grid demand at the microgrid level:
[0032] in, The system-level aggregated value (kW) of the load power of all building units. N b This represents the total number of building units within the microgrid. The system-level aggregate value (kW) of BESS charge and discharge power for all controllable entities. N BESS This represents the total number of BESS. The system-level aggregate value (kW) of PV power generation from all building units. N PV This represents the total number of PV arrays. The system-level aggregate disturbance term (kW) is dynamically corrected using a probabilistic statistical method. The correction formula is as follows: ,in The weighting coefficient is assigned a value of 0.8 to 1.2 based on the importance of the building unit load, to ensure that the aggregation model can accurately reflect the overall fluctuation characteristics of the system.
[0033] Step 2: Optimize the linearized power purchase and sale cost (MILP) for binary decision-making and Slack decomposition.
[0034] A binary decision-slack variable decomposition linearization algorithm is adopted to address the nonlinear optimization problem caused by the two-way decision-making process of electricity purchase and sale. It transforms the nonlinear objective function containing the product of binary and continuous variables into a linear form, completely solving the problem of low efficiency in solving nonlinear terms in traditional MPC, and achieving a balance between computational efficiency and optimization accuracy.
[0035] in, h To predict the number of time steps in the time domain, each time step corresponds to 15 minutes, and the prediction time domain can be configured to 1-6 hours (i.e., h=4-24) according to actual needs. s t For binary power purchase and sale decision variables, s t =1 indicates that the microgrid is in a power purchase state. s t =0 indicates that the device is in a power sales state; c buy,t For a moment t The grid purchase price (RMB / kWh) supports input of multiple pricing modes such as time-of-use pricing and real-time pricing. c cell,t For a moment t The grid electricity sales price (yuan / kWh) can be dynamically adjusted according to grid policies. For a moment t The power purchase capacity slack variable (kW) has a value range of [0, P_grid_max], where P_grid_max is the maximum allowable power for the microgrid to connect to the main grid. For a moment t The power sales slack variable (kW) has a value range of [0, P_grid_max]. and Satisfying mutual exclusion constraints × =0, ensuring that electricity purchase and sale do not occur simultaneously.
[0036] To address situations where microgrids are prohibited from profiting from electricity sales, a negative electricity price incentive mechanism is designed and set up... in k The adjustment coefficient (0 < k ≤1), by using negative electricity price signals to guide the optimization algorithm to prioritize storing excess electrical energy in BESS (Balanced Energy Storage System) instead of selling it to the grid, thus achieving cascaded energy utilization and cost savings; when kWhen the value is 1, the revenue from electricity sales is negative, and the algorithm will completely avoid electricity sales, maximizing energy storage utilization efficiency. To further improve the comprehensiveness of cost optimization, the objective function can be extended to include BESS operating loss costs and maintenance costs. The extended objective function is as follows:
[0037] in, Cost per unit power loss of BESS (RMB / kWh). The unit maintenance cost for BESS (RMB / time). The BESS rated power (kW) is optimized across the board through this extension to achieve economic cost.
[0038] Construct a dynamic constraint system that combines rigid constraints with flexible adjustments to ensure the safe and stable operation of the microgrid while improving its adaptability to dynamic changes: Dynamic constraints on BESS charging and discharging power: An SoC (State of Charge) correction coefficient is introduced to adjust the upper limit of charging and discharging power in real time based on the current state of charge of the BESS, avoiding control failures caused by static constraints. The expression is:
[0039] Among them, for the formula , for the first i The dynamic correction maximum charging power (kW) of a BESS is given by the following correction formula: When the SoC approaches 90%, the upper limit of charging power gradually decreases; For the first i The dynamic correction maximum discharge power (kW) of a BESS is given by the following correction formula: When the SoC approaches 20%, the upper limit of discharge power gradually decreases, with a correction factor of 0.5, reducing the upper limit of discharge power to 50% of the rated value to avoid over-discharge.
[0040] Aggregated BESS capacity elasticity constraint: Set a basic capacity range of 20%-90%, and introduce an elasticity coefficient. γ t (0≤) γ t ≤0.1), dynamically adjust the boundary based on the confidence level of the predicted data: when the confidence level of the predicted data is ≥90%, γ t Using a value between 0 and 0.03 provides a stricter constraint; when the confidence level of the predicted data is <70%, γ t Using a value between 0.07 and 0.1 improves system flexibility; the expression is:
[0041] in, The total capacity of all BESS (kWh). For the first i The rated capacity (kWh) of each BESS.
[0042] Energy storage capacity dynamic update constraints: Considering factors such as charge / discharge efficiency and temperature loss, the capacity update formula is optimized by introducing a comprehensive charge / discharge efficiency coefficient η (0 < 0). η ≤1), this coefficient is dynamically calibrated based on the BESS operating temperature: when the temperature is 25±5℃, η =0.92-0.95; when the temperature exceeds 35℃ or falls below 0℃, η =0.85-0.90, the expression is:
[0043] in, ΔT =15min=1 / 4 hr A fixed time interval controlled by a set value. η t For a moment t The dynamic efficiency coefficient.
[0044] Initial energy storage state constraint: The initial energy storage capacity for each optimization run is determined by the actual state of charge of each BESS, expressed as:
[0045] In the formula, t start For the first k The start time of the next optimized run of the moving window. For the first i The state of charge of each BESS at the initial moment is normalized to the range of 0-1 and collected in real time by the BESS management system.
[0046] Power grid interaction constraint: The power interaction between the microgrid and the main grid must not exceed the rated capacity of the connection point, expressed as:
[0047] in, The rated power (kW) at the connection point with the microgrid and the main grid is determined by the grid planning.
[0048] Step 3: Propose a higher-level dynamic optimization method for solving rolling time-domain MPC (Model Predictive Control) and broadcasting the optimal aggregate setpoint for a single time period.
[0049] A high-dimensional variable dynamic aggregation algorithm is adopted to address the problem of the surge in the dimensionality of optimization variables in large-scale microgrids. It aggregates 3N dispersed variables, including BESS power variables, PV output prediction variables, and load prediction variables of N building units, into a system-level aggregated BESS power. Aggregated PV output Aggregate load With 3 aggregate variables, the variable dimension is reduced from O(N) to O(1), and the computational complexity is reduced from exponential O(2^N) to polynomial O(h^3), thus improving the efficiency of optimization.
[0050] Linearization of linear terms is applied to the power purchase and sale decision variables. s t With power variables , To address the nonlinearity caused by the product term, a method combining piecewise linearization and binary variable-assisted modeling is employed to transform the nonlinear term into a linear constraint: auxiliary variables are introduced. and add constraints This solves the problem of solving nonlinear terms in traditional MPC, enabling optimization problems to be solved efficiently using the Mixed Integer Linear Programming (MILP) algorithm.
[0051] A dynamic weighting mechanism for forecast data is introduced to improve the optimization's adaptability to short-term fluctuations. Time-decay weights are assigned to the load, PV output, and electricity price forecast data. The weighting formula is as follows:
[0052] in α The attenuation coefficient is (0.05-0.2). t To predict the time step in the time domain ( t =1,2,..., h ), t start This is the starting time step; recent data ( t Smaller data has a higher weight (close to 1), while longer-term data ( t Larger weights have lower weights (closer to 0), making the optimization results more consistent with the actual short-term operation. The weight coefficients can be dynamically adjusted according to the credibility of the prediction data. The higher the credibility, the smaller the decay coefficient and the closer the weight is to 1.
[0053] The upper layer uses a rolling window optimization, performing optimization calculations every 15 minutes: first, updating forecast data, including load forecast, PV output forecast, electricity price data, and weather forecast data.
[0054] Then, the latest BESS state of charge, actual operating power, and disturbance data are read from the lower layer, the constraints are adjusted and optimized, and the MILP optimization problem is solved again.
[0055] The issued settings are in the form of adaptive setting packages, rather than fixed values, and include basic settings. This includes the target net electricity demand of each building unit, the fluctuation range, ±5% of the basic set value, providing adjustment flexibility for lower floors, and a dynamic adjustment coefficient. κ t The fluctuation intensity is calculated in real time based on the current fluctuation intensity of the system. When <0.05, κ t =0.8 when 0.05 < When <0.1, κ t =1.0; when When >0.1, κ t =1.2, The system then predicts fluctuation trends, including the predicted direction and magnitude of changes in load and PV output within the next 15 minutes, providing a reference for lower-level control strategies to be adjusted in advance.
[0056] Step 4: Equal Increment λ Criteria and out-of-bounds correction iterative energy storage SoC equalization power de-aggregation algorithm; The SoC flattening and equalization de-aggregation objective is adopted. The de-aggregation algorithm aims to make the state of charge of all BESS (Battery Elementary Systems) converge, forming a flat SoC distribution. This avoids situations where some BESS are overcharged / discharged while others are idle, maximizing the microgrid's emergency islanding operation time. The de-aggregation process must meet the following constraints:
[0057] in, For the first i The change in the state of charge (0-1) of a BESS at the initial moment. For the first i Energy storage capacity (kWh) of a BESS at the start time For the first i Individual power setting (kW) for each BESS No. i The dynamic correction maximum charge / discharge power (kW) of each BESS.
[0058] Design a hierarchical iterative de-aggregation mechanism to ensure the feasibility and balance of the de-aggregation results: The first step is to initialize the de-aggregation parameters: read the current parameters of each BESS. , Rated capacity Dynamically corrected charge and discharge power limits .
[0059] The second step is to calculate the target SoC based on the balancing target, and then calculate the target state of charge (SPO) for all BESS. .
[0060] The third step is preliminary de-aggregation: For each BESS, calculate the required change in state of charge. Then calculate the corresponding change in electricity. Ultimately, preliminary individual power setpoints were obtained. .
[0061] Step 4, Constraint Verification: Check the initial power setting value for each BESS. Does it meet the charging and discharging power constraints?
[0062] Step 5, Violation Handling: For BESS that exceeds the constraints, set its power to the corresponding limit value and record the actual change in the amount of electricity it can provide. .
[0063] Step 6, Residual Power Re-depolymerization: Calculate the difference in power change between the violation BESS and the initial depolymerization. The remaining power change will be re-aggregated in the non-violation BESS according to the SoC equalization target.
[0064] Step 7, Iterative Convergence: Repeat steps 4 to 6 until all BESS power settings meet the constraints and the power settings deviation between two iterations is less than 1%, at which point the depolymerization process terminates.
[0065] Introducing a resilience priority adjustment coefficient to support adjusting the de-aggregation weight in special scenarios: by setting the priority coefficient. λ i ( λ i ≥1), high-priority buildings λ i =1.2-1.5, for ordinary buildings λ i =1.0, at which point the equilibrium target is corrected to This allows high-priority buildings to achieve higher SoC target values for BESS, balancing versatility with special emergency needs.
[0066] Step 5: Lower-level fast adaptive execution control algorithm with 5% tracking band and minute-level power compensation; A three-tiered response rule system is established to achieve precise compensation and rapid response for fluctuations of different types and frequencies.
[0067] Rapid fluctuation compensation rule: For high-frequency fluctuations (fluctuation frequency ≥ 0.1Hz) such as sudden engagement or disengagement of EVs (Electric Vehicles) and sudden changes in PV output, a control strategy combining proportional-integral (PI) correction and feedforward compensation is adopted to adjust the BESS charging and discharging power in real time. The correction formula is as follows:
[0068] in, The BESS base power setting (kW) obtained from depolymerization; These are the proportional coefficient (0.5-2.0) and the integral coefficient (0.01-0.1), respectively. The deviation between the actual net electricity demand and the set value (kW); The feedforward coefficient (0.3-0.8) is used to offset the effects of known disturbances in advance through feedforward compensation, thereby improving the response speed.
[0069] Adjustment rules for low- and medium-frequency fluctuations: For low- and medium-frequency fluctuations (fluctuation frequency < 0.1Hz) such as slow load changes and gradual changes in PV output, model predictive feedforward control is adopted. Based on the predicted data for the next 5 minutes, the BESS charging and discharging power is adjusted in advance. The adjustment formula is as follows:
[0070] in, This is the net electricity demand forecast (kW) for the next 5 minutes. These are the feedforward coefficients for MPC.
[0071] Device lifespan protection rules; charge / discharge switching delay mechanism and SoC elastic boundary protection to extend BESS lifespan: prohibit BESS from continuous m minute( m =2-5) Frequent switching between charge and discharge states, when the BESS switches from charging to discharging or vice versa, the current state must be maintained for at least m The system adjusts its power based on the set value and the required parameters over time. An elastic protection boundary is set outside the basic boundary. When the SoC enters the elastic boundary, the charging and discharging power is gradually reduced to avoid frequent adjustments under extreme conditions and extend the battery cycle life.
[0072] EV access adaptive rules; a BESS (Balanced Streamlined Variable Controller) regulation capacity prediction and dynamic access mechanism is proposed. By calculating the matching degree between the remaining BESS regulation capacity and the compensation power required for EV access in real time, the mechanism determines whether EV access is immediate, delayed, or restricted. The matching degree calculation formula is as follows:
[0073] in, BESS's current maximum adjustable power (kW) This represents the current actual power output (kW) of BESS. The charging power (kW) required for EV connection, when When ≥1.2, the BESS regulation capability is sufficient, allowing the EV to be connected at full power immediately; when 1.0 < When the power rating is less than 1.2, EVs are allowed to connect immediately, but the charging power is limited to [specific value]. , When the value is less than 1.0, EVs are denied immediate access and are guided to wait until the next setting update cycle before attempting to access again.
[0074] The design rules and parameters are adaptively updated, and the PI coefficient and switching delay are periodically optimized based on historical operating data and deviation statistics. m The parameters, such as feedforward coefficients, are determined through the following steps: data acquisition, collecting deviation data, BESS operating status data, and fluctuation disturbance data from the past 24 hours; deviation analysis, calculating statistical indicators such as the mean, variance, and maximum deviation of the deviation; parameter optimization, using the least squares method to fit historical deviation data, with the goal of minimizing the sum of squared deviations to obtain the optimal parameter combination; and parameter updating, updating the parameters every 24 hours to ensure the robustness and adaptability of the control algorithm, maintaining good control performance under different operating scenarios.
[0075] Step Six: A two-layer MPC dynamic feedback closed-loop collaborative mechanism with a 15-1-5 time rhythm rolling window.
[0076] Build a closed-loop mechanism for the entire process to achieve deep collaboration between upper-level optimization and lower-level control.
[0077] The rolling window collaboration mechanism employs a 15-minute cycle for upper-layer optimization, updating forecast data, solving optimization problems, and issuing setpoints every 15 minutes. The lower-layer uses a 1-minute cycle for rule-based control, performing status monitoring, fluctuation compensation, and power adjustment every minute. Simultaneously, the lower-layer feeds back key status data to the upper-layer every 5 minutes, including the real-time SoC of each BESS, actual charging and discharging power, actual net power demand of building units, EV access or disconnection status, actual PV output, actual load consumption, and disturbance deviation data, forming a collaborative mode that balances real-time performance and optimization accuracy.
[0078] The deviation warning and dynamic adjustment mechanism employs a three-level deviation warning system. Based on the magnitude and duration of the deviation between the actual value and the setpoint, different levels of adjustment actions are triggered. Level 1 warnings occur when the deviation is ≤±3% and the duration is ≤2 minutes: only the lower layer compensates through the PI correction mechanism, requiring no upper-layer intervention. Level 2 warnings occur when the deviation is ±3% < ±5% and the duration is 3 minutes: the lower layer strengthens the compensation while simultaneously sending a deviation warning signal to the upper layer. Level 3 warnings occur when the deviation is >±5% and the duration is ≥2 minutes: the upper layer triggers an emergency optimization process, updating the setpoint in advance and shortening the 15-minute optimization cycle to 5 minutes to prevent deviation accumulation. The emergency optimization process uses a simplified optimization model, reducing the number of constraints and shortening the prediction time domain length. h Reducing the time from 24 to 8 shortens the solution time to 50% of conventional optimization, ensuring a fast response.
[0079] The cross-layer data fusion mechanism introduces a two-way data fusion strategy to achieve deep collaboration between the two layers. The lower layer uploads data to the upper layer: in addition to regular status data, it also uploads disturbance feature extraction results, load, and actual fluctuation trends of PV output, providing more accurate constraints and prediction data for upper-layer optimization. The upper layer sends data to the lower layer: in addition to adaptive setpoint packages, it also sends information such as the predicted fluctuation range for the next 15 minutes and emergency backup capacity requirements, providing a reference for the lower layer to adjust the BESS operating status and reserve backup capacity in advance.
[0080] For the emergency switching coordination mechanism, when the microgrid detects a fault in the main grid or an emergency scenario such as extreme weather, it triggers the emergency switching process. The two-layer coordination ensures resilience. The upper layer quickly calculates the aggregated power optimization target in the islanded operation mode, prioritizes the power supply of critical loads, and adjusts the deaggregation strategy to enable the BESS of high-priority buildings to obtain more energy storage resources. The lower layer immediately executes the emergency control rules, cuts off non-critical loads, adjusts the charging and discharging power of the BESS, maintains the power balance inside the microgrid, and extends the islanded operation time.
[0081] By establishing a multi-dimensional emergency detection system, scenarios such as large power grid failures and extreme weather can be identified in real time. After an emergency is triggered, the upper layer switches to islanding mode within 1 minute, prioritizing critical loads and adjusting de-aggregation strategies; the lower layer disconnects non-critical loads, adjusts energy storage power, and shuts down non-emergency EV charging interfaces within 30 seconds. During an emergency, the upper layer updates and optimizes targets every 5 minutes, and the lower layer provides status feedback every minute; upon recovery, the upper layer calculates a smooth grid connection strategy, and the lower layer gradually restores loads and energy storage calibrations to avoid impact.
[0082] This invention constructs a dynamic model of building net power in step one and uses a variable aggregation operator to map the energy storage power variables of multiple buildings into a single aggregated optimization variable. This transforms the original high-dimensional optimization problem involving 3N continuous control variables into an objective optimization problem with 3 global control variables, significantly reducing the solution scale. This allows the cost optimization problem to be solved online in a rolling manner, improving decision-making efficiency. Step two performs Slack decomposition and binary variable decision-making on the purchased and sold electricity power, linearizing the nonlinear purchased and sold electricity objective function that depends on interval selection. This enables the problem to obtain a globally optimal solution within a finite time by a standard MILP solver, avoiding the local convergence problem present in traditional heuristic algorithms. Step three employs a single-period optimal aggregated setpoint broadcasting mechanism, allowing the upper-level optimization to iterate in a fixed time window, executing only the optimal solution of the first period. This avoids the problem of the entire prediction sequence being locked prematurely, enabling real-time calibration of uncertainties such as PV fluctuations and load surges, thereby improving the robustness and response sensitivity of the power generation and utilization balance strategy. The SoC-balanced power de-aggregation algorithm implemented in step four enables the state of charge (SBC) of the multi-energy storage system to gradually converge towards the mean during iterations. This avoids the bottleneck effect of traditional scheduling where low-SoC units fail first, thus significantly extending the islanding operation time of the microgrid during external power outages and improving energy resilience. Step five introduces a minute-level power compensation mechanism with a ±5% tracking band, eliminating the need for repeated optimization problems at the building-side execution layer. Instead, error correction is sufficient to maintain converter balance, achieving rapid response with low computational load. This approach reduces the computing power requirements of the local controller, is compatible with commercial energy storage BMS, and reduces system deployment costs. Step six constructs a two-layer rolling closed-loop mechanism: 15 minutes of upper-level optimization, 1 minute of local execution, and 5 minutes of state feedback. This allows the upper-level optimization to absorb feedback from the lower-level execution and update state variables in real time, maintaining stable system operation under disturbances such as photovoltaic prediction errors, load surges, and electric vehicle access, achieving simultaneous optimization of cost and stability.
[0083] Example 2 Based on the model predictive control method for microgrid cost optimization in Example 1, a model predictive control system for microgrid cost optimization is disclosed, comprising: The model building module is used to build a microgrid system model, collect the total load demand power of each building unit, the charging and discharging power of the battery energy storage system of each building unit, and the actual power generation data of the PV array of each building unit; a two-level hierarchical aggregation method is adopted, with the first level being the aggregation within the building unit and the second level being the system-level aggregation, to calculate the system-level aggregated value of the dynamic net power demand power of the microgrid; The function building module is used to divide electricity purchase and sales into binary variables using a binary decision method, decompose the microgrid interaction power into two independent continuous Slack variables: electricity purchase power and electricity sales power, and set mutual exclusion constraints to obtain a linear cost function; The calculation module employs a high-dimensional variable dynamic aggregation algorithm to aggregate the charging and discharging power variables, PV array output prediction variables, and load prediction variables of multiple building units' battery energy storage systems into system-level variables. Using a rolling time-domain model predictive control method, the upper-level controller performs rolling window optimization for a first preset period to solve a mixed-integer linear programming model, obtaining the optimal aggregated power setpoint. This optimal setpoint is then sent to the lower-level controller in the form of an adaptive setpoint package, which includes a base setpoint, a fluctuation range, and a dynamic adjustment coefficient. Upon receiving the optimal aggregated power setpoint, the lower-level controller executes a power de-aggregation algorithm based on state-of-charge equilibrium. Through a hierarchical iterative mechanism, the aggregated power is decomposed into individual power commands for each energy storage unit, ensuring a consistent state of charge across all energy storage units. Finally, the lower-level controller executes adaptive rule control for a second preset period. The early warning module is used to build a cross-layer closed-loop collaborative mechanism. The lower-level controller feeds back real-time operating status data to the upper-level controller at the third preset cycle. The upper-level controller corrects the constraint boundary of the next round of rolling optimization based on the feedback data and triggers the emergency optimization process when the deviation exceeds the preset threshold.
[0084] Example 3 The purpose of this embodiment is to provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the model predictive control method for microgrid cost optimization.
[0085] Example 4 The purpose of this embodiment is to provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the model predictive control method for microgrid cost optimization.
[0086] Example 5 The purpose of this embodiment is to provide a computer program product including a computer-readable medium, wherein the computer-readable medium contains computer-readable program code that executes the model predictive control method for microgrid cost optimization.
[0087] The steps and methods involved in the apparatus of the above embodiments 2, 3, 4 and 5 correspond to those in embodiment 1. For specific implementation methods, please refer to the relevant description section of embodiment 1.
[0088] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0089] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0090] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0091] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0092] Unless otherwise specified, the working methods or control methods involved in the above embodiments are conventional working methods or control methods in the art.
[0093] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0094] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Any other modifications or equivalent substitutions made by those skilled in the art to the technical solutions of the present invention, as long as they do not depart from the spirit and scope of the technical solutions of the present invention, should be covered within the scope of the claims of the present invention.
Claims
1. A model predictive control method for microgrid cost optimization, characterized in that, Includes the following steps: A microgrid system model was constructed, and the total load demand power of each building unit, the charging and discharging power of the battery energy storage system of each building unit, and the actual power generation power of the PV array of each building unit were collected. A two-level hierarchical aggregation method was adopted, with the first level being aggregation within the building unit and the second level being system-level aggregation, to calculate the system-level aggregated value of the dynamic net power demand power of the microgrid. The binary decision-making method is adopted to divide electricity purchase and sales into binary variables, and the microgrid interaction power is decomposed into two independent continuous Slack variables: electricity purchase power and electricity sales power. Mutual exclusion constraints are set to obtain a linear cost function. A high-dimensional variable dynamic aggregation algorithm is employed to aggregate the charging and discharging power variables, PV array output prediction variables, and load prediction variables of multiple building units' battery energy storage systems into system-level variables. Using a rolling time-domain model predictive control method, the upper-level controller performs rolling window optimization in a first preset period to solve a mixed-integer linear programming model, obtaining the optimal aggregated power setpoint. This optimal setpoint is then sent to the lower-level controller in the form of an adaptive setpoint package, which includes a base setpoint, fluctuation range, and dynamic adjustment coefficient. Upon receiving the optimal aggregated power setpoint, the lower-level controller executes a power de-aggregation algorithm based on state-of-charge equilibrium. Through a hierarchical iterative mechanism, the aggregated power is decomposed into individual power commands for each energy storage unit, ensuring a consistent state of charge across all energy storage units. Finally, the lower-level controller executes adaptive rule control in a second preset period. A cross-layer closed-loop collaborative mechanism is constructed, in which the lower-level controller feeds back real-time operating status data to the upper-level controller at the third preset cycle. The upper-level controller corrects the constraint boundary of the next round of rolling optimization based on the feedback data, and triggers the emergency optimization process when the deviation exceeds the preset threshold.
2. The model predictive control method for microgrid cost optimization according to claim 1, characterized in that, Mutually exclusive constraints include: aggregated BESS capacity elasticity constraints, dynamic update constraints of energy storage capacity, initial energy storage state constraints, and grid interaction power constraints.
3. The model predictive control method for microgrid cost optimization according to claim 1, characterized in that, The nonlinear product terms in the purchased and sold power are transformed into linear constraints by combining piecewise linearization with binary variable-assisted modeling. Auxiliary variables are introduced and linear constraints are added. Time decay weights are assigned to the load, PV array, and electricity price forecast data.
4. The model predictive control method for microgrid cost optimization according to claim 1, characterized in that, The second preset period is shorter than the first preset period; the third preset period is between the first preset period and the second preset period.
5. The model predictive control method for microgrid cost optimization according to claim 1, characterized in that, The adaptive rule executed by the lower-level controller in the second preset cycle is as follows: based on individual power commands, a multi-level response system including fast fluctuation compensation rules, medium and low frequency fluctuation adjustment rules and equipment life protection rules is adopted to adjust the charging and discharging power of each energy storage unit in real time to compensate for random fluctuations.
6. The model predictive control method for microgrid cost optimization according to claim 1, characterized in that, The de-aggregation algorithm based on state-of-charge equilibrium is implemented, specifically including the following iterative steps: calculating the average target state of charge of all energy storage units; initially allocating individual power setpoints based on the difference between the current state of charge of each energy storage unit and the average target state of charge; clamping the power setpoints of energy storage units that exceed the dynamic correction power limit to the boundary value and calculating the remaining unallocated power difference; iteratively redistributing the remaining unallocated power difference among the energy storage units that have not exceeded the limit until the power setpoints of all energy storage units satisfy the constraints and the iteration converges.
7. A model predictive control system for microgrid cost optimization, characterized in that, include: The model building module is used to build a microgrid system model, collect the total load demand power of each building unit, the charging and discharging power of the battery energy storage system of each building unit, and the actual power generation data of the PV array of each building unit; a two-level hierarchical aggregation method is adopted, with the first level being the aggregation within the building unit and the second level being the system-level aggregation, to calculate the system-level aggregated value of the dynamic net power demand power of the microgrid; The function building module is used to divide electricity purchase and sales into binary variables using a binary decision method, decompose the microgrid interaction power into two independent continuous Slack variables: electricity purchase power and electricity sales power, and set mutual exclusion constraints to obtain a linear cost function; The calculation module employs a high-dimensional variable dynamic aggregation algorithm to aggregate the charging and discharging power variables, PV array output prediction variables, and load prediction variables of multiple building units' battery energy storage systems into system-level variables. Using a rolling time-domain model predictive control method, the upper-level controller performs rolling window optimization for a first preset period to solve a mixed-integer linear programming model, obtaining the optimal aggregated power setpoint. This optimal setpoint is then sent to the lower-level controller in the form of an adaptive setpoint package, which includes a base setpoint, a fluctuation range, and a dynamic adjustment coefficient. Upon receiving the optimal aggregated power setpoint, the lower-level controller executes a power de-aggregation algorithm based on state-of-charge equilibrium. Through a hierarchical iterative mechanism, the aggregated power is decomposed into individual power commands for each energy storage unit, ensuring a consistent state of charge across all energy storage units. Finally, the lower-level controller executes adaptive rule control for a second preset period. The early warning module is used to build a cross-layer closed-loop collaborative mechanism. The lower-level controller feeds back real-time operating status data to the upper-level controller at the third preset cycle. The upper-level controller corrects the constraint boundary of the next round of rolling optimization based on the feedback data and triggers the emergency optimization process when the deviation exceeds the preset threshold.
8. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the model predictive control method for microgrid cost optimization as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the model predictive control method for microgrid cost optimization as described in any one of claims 1-6.
10. A computer program product comprising a computer-readable medium, characterized in that, The computer-readable medium contains computer-readable program code that performs the model predictive control method for microgrid cost optimization as described in any one of claims 1-6.
Citation Information
Patent Citations
Distributed power supply optimization scheduling method and system based on demand side response
CN120090295A