A user-side light storage capacity configuration and rolling demand defense method

CN122801360APending Publication Date: 2026-09-22HEXING ELECTRICAL CO LTD +4
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610793413.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-03
Publication Date
2026-09-22

AI Technical Summary

Technical Problem

一旦实际工况偏离训练分布,需量电费惩罚将以高斜率回落到目标函数中,从而出现“训练经济性最优、运行经济性恶化”的过拟合现象

Benefits of technology

[0059]1、显著提高极端工况下的容量配置鲁棒性与运行经济性。本发明通过条件扩散模型保留高维跨变量相关结构与长程依赖,使生成场景对真实联合分布的尾部覆盖能力大幅提升;再以Wasserstein球形模糊集承载分布偏移,使容量决策对训练样本未覆盖的极端工况依然保有可证明的成本上界。在工业用户实际运行中可避免"训练经济性最优、运行经济性恶化"的过拟合塌陷,预期降低需量越限罚款与电池过早衰减导致的隐性成本。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122801360A_ABST
    Figure CN122801360A_ABST
Patent Text Reader

Abstract

The application discloses a user-side light storage capacity configuration and rolling demand defense method, relates to the technical field of power system user-side energy management and comprehensive energy planning, and comprises the following steps: collecting historical data and constructing covariants, training a conditional diffusion model, generating online joint scenes, clustering the scenes and constructing a Wasserstein fuzzy set, cross-verification calibration of a Wasserstein radius, planning layer DRO capacity configuration SOCP, running layer Benders sub-problem iteration, event-triggered rolling demand defense MPC and carbon-electricity Pareto frontier generation. The user can obtain a robust capacity decision against extreme working conditions in the preliminary design and contract capacity resignation stage, can maintain the demand electricity charge within the contract capacity on an EMS edge controller with low computing power, and can simultaneously consider the whole life cycle economy and carbon emission constraints, so that the total cost of user-side power consumption and the risk of excess penalty are significantly reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power system user-side energy management and integrated energy planning technology, specifically a user-side photovoltaic and energy storage capacity configuration and rolling demand defense method. Background Technology

[0002] In recent years, with the continuous decline in the cost of distributed photovoltaic (PV) and lithium-ion battery energy storage, and the increasing proportion of demand charges in two-part tariffs, the capacity configuration and operation scheduling of user-side PV-storage systems have become a research hotspot in the interdisciplinary field of power engineering and operations research. Existing technical solutions to this problem can be mainly divided into the following three categories:

[0003] Option 1 introduces a battery life degradation model and combines kernel density estimation with Monte Carlo sampling to characterize source-load uncertainty, improving the practical applicability of economic dispatch. However, this kernel density estimation and Monte Carlo sampling method typically estimates the marginal distributions of variables such as load, photovoltaics, temperature, and electricity price independently before sampling independently. This makes it difficult to express cross-variable strongly correlated phenomena such as "summer high temperatures simultaneously increasing cooling load, suppressing photovoltaic module efficiency, and pushing up peak electricity prices," nor can it characterize long-term time-dependent events such as "continuous days of cloudy and rainy weather combined with high temperatures and high loads." When extreme operating conditions not present in the training samples occur within the planning period, the generated scenario has severely insufficient tail coverage of the real joint distribution. This leads to the capacity configuration obtained based on this scenario set easily triggering demand exceeding limits and battery overcharging and discharging during actual operation, resulting in significantly optimistic economic predictions.

[0004] Option 2 establishes a two-part tariff framework for electricity, employing a planning-scheduling dual-layer optimization model. It utilizes heuristic intelligent algorithms or quadratic programming to obtain a collaborative solution for capacity allocation and charging / discharging strategies. However, both the SA-PSO collaborative optimization in this option and the "probability-weighted typical scenario" stochastic programming common in Option 1 essentially assume that the sampled finite set of scenarios already well represents the future true distribution, lacking an explicit protection mechanism against distribution deviations beyond this assumption. Once actual operating conditions deviate from the training distribution, the demand charge penalty will fall back to the objective function at a high slope, resulting in an overfitting phenomenon where "training is economically optimal, but operational economics deteriorate." Furthermore, the randomness of heuristic algorithms leads to divergent results from multiple solutions to the same problem, lacking a provable robust lower bound, making it difficult to meet the robustness requirements of industrial users for contract capacity decisions.

[0005] Option 3 is geared towards regional energy autonomy networks, calculating and configuring capacity requirements separately for multiple benefit scenarios such as demand response, green energy consumption, and demand management. However, the two-layer quadratic planning of this type of option and the SA-PSO of Option 2 often solve the charge and discharge reference curves offline on a monthly or daily basis. During the operation phase, the reference curve is either directly tracked or MILP / QP is called again at a fixed 5 to 15 minute cycle. This is difficult to withstand the computational overhead of high-frequency re-optimization on ARM-based industrial edge controllers. At the same time, battery life is often linearly converted into "equivalent cycle count" and is not uniformly coupled with the convex structure of the objective function of the planning layer. The nonlinear erosion of deep discharge is seriously underestimated, resulting in the actual lifespan being much shorter than the design expectation, which in turn drags down the economic evaluation of the entire project life cycle. Summary of the Invention

[0006] This invention provides a user-side photovoltaic and energy storage capacity configuration and rolling demand defense method, enabling users to make robust capacity decisions against extreme operating conditions, while simultaneously taking into account life-cycle economics and carbon emission constraints, significantly reducing the total electricity cost and over-limit penalty risk for users.

[0007] This invention provides the following technical solution: a method for configuring user-side optical storage capacity and mitigating rolling demand, comprising the following steps:

[0008] S1. A conditional denoising diffusion probability model is adopted, which takes historical multivariate time series data and conditional tensors as inputs. The conditional tensors are embedded through a self-supervised masking mechanism, and a back diffusion process is performed to generate multiple multivariate joint scenarios that retain cross-variable correlations and long-term time dependencies.

[0009] S2. Perform K-medoids clustering on the generated joint scenarios to obtain representative scenarios and their empirical weights. Construct a spherical fuzzy uncertainty set using sliced2-Wasserstein distance as a metric. Establish a sub-Bruker optimization model with the goal of minimizing the expected cost over the entire life cycle. Use Wolfe duality to transform the model into a solvable convex second-order cone programming problem and solve for the decision values ​​of photovoltaic installed capacity, rated power of energy storage, and rated capacity of energy storage.

[0010] S3. Based on the decision value, during the online operation phase, the Wasserstein distance between the actual load observation window and the median prediction generated online by the conditional diffusion model is used as the trigger residual. A trigger function is defined. When the trigger residual exceeds a preset threshold or the number of idle steps since the last optimization reaches the upper limit, the operation scheduling subproblem is solved, the energy storage charging and discharging instructions are updated and issued for execution; otherwise, the cached instructions are used for demand defense.

[0011] As a further improvement of the present invention, S1 includes:

[0012] Hourly data on active load, normalized photovoltaic output, ambient temperature, nodal electricity price, and regional real-time carbon emission factor from the user side are collected to form a training sample tensor; at the same time, a condition tensor is constructed, which splices seasonal identifiers, process type unique thermal codes, contract capacity, weather forecasts, and calendar features along the channel dimension.

[0013] A conditional denoising diffusion probability model is constructed, using a time-variable bidirectional Transformer scoring network. Forward diffusion is a Gaussian noise superposition process. The conditional tensor is embedded as the observation component through a self-supervised masking mechanism. With noise prediction loss as the objective, the model is trained to convergence using the Adam optimizer.

[0014] Input the target periodic condition tensor and the observed components, perform an inverse denoising chain starting from pure Gaussian noise, and repeatedly sample to generate N sets of load, photovoltaic normalized output, and electricity price joint scenarios that retain intervariate correlation and long-range time dependence.

[0015] As a further improvement to the present invention, in the conditional denoising diffusion probability model:

[0016] The multidimensional Gaussian conditional probability distribution function for forward diffusion is:

[0017] ; where t {1,2,...,T} represents the diffusion step number, and T=100 represents the total number of diffusion steps. It is the training sample tensor. It is the first Step-by-step noisy data, It is the identity matrix. For the variance table, , , ;

[0018] The noise prediction loss function is:

[0019] ;in, To observe the mask, , Standard Gaussian noise, This is a parameterized scoring network, consisting of stacked bidirectional Transformer encoding layers in both the time and variable dimensions, with a diffusion step. Injection via sinusoidal position encoding This indicates element-wise multiplication. It is a conditional tensor;

[0020] The calculation formula for performing the inverse denoising chain is:

[0021] ;in This is the intermediate result from the previous step obtained after denoising at step t. This is the input after mask injection. For the observed components, The random Gaussian perturbation injected at step t, ; Let be the target periodic conditional tensor.

[0022] As a further improvement of the present invention, S2 includes:

[0023] S21. Calculate the sliced2-Wasserstein distance for any two scenes, and use this distance to... K-medoids clustering is performed on each scene to obtain representative scenes and experience weights, and Wasserstein spherical fuzzy sets are constructed.

[0024] Execute on the candidate set Folded cross-validation: The historical samples are divided into training folds and validation folds. The SOCP of the planning layer is solved separately to obtain the decision. Then, the actual expected cost is evaluated on the validation fold to obtain the optimal radius of the spherical fuzzy set.

[0025] S22. Using photovoltaic installation capacity, energy storage power, and energy storage capacity as decision variables, construct an objective function that includes annualized equipment investment cost, degenerate bar dual terms, and upper bound terms of scenario operation cost; incorporate power balance, energy storage state of charge recursion, equipment output and capacity boundaries, peak demand and overcapacity constraints, and convex approximation constraints of battery life decay based on rainflow counting, transform the minimax robust optimization problem into a second-order cone programming solution to obtain the optimal photovoltaic-storage capacity configuration.

[0026] S23. With a fixed optimal optical storage capacity configuration, solve the linear subproblems for each representative scenario to obtain the capacity constraint dual variables. Construct the Benders optimal cut based on the dual values, and feed this optimal cut back to the planning layer to solve it again, iterating until the upper and lower bounds of the relative gap are reached. .

[0027] As a further improvement of the present invention, the formula for calculating the sliced2-Wasserstein distance is as follows:

[0028] ;in, For two scenarios, subscript This represents the first [time dimension] after sorting in ascending order. One value; Typical monthly hours Number of variables;

[0029] The formula for constructing Wasserstein spherical fuzzy sets is:

[0030] ;in For any candidate probability distribution, For Dirac measurement, Let the radius of the Wasserstein spherical fuzzy set be . For the reason Each representative scenario is weighted based on experience. Weighted construction of reference empirical distribution, It is the center of the k-th cluster after K-medoids clustering.

[0031] As a further improvement of this invention, the objective function is:

[0032] ;

[0033] in For the scene Charging power time series for all periods For the scene Discharge power time series for all periods, This is the capital recovery factor. For the discount rate, The project's economic life; , , These are the unit cost of photovoltaic installation, the unit cost of energy storage power, and the unit cost of energy storage capacity, respectively. These are photovoltaic installation capacity, energy storage power, and energy storage capacity, respectively. For its dual multiplier; For the scene Experience weights, Let this be the convex upper bound of the runtime cost in this scenario. This represents the number of clusters.

[0034] As a further improvement of the present invention, the upper bound constraint condition for the scene operation cost is: for each representative scene Upper bound variable It must be no less than the actual total operating cost of the scenario:

[0035] ;

[0036] in For the scene The corresponding time-of-use electricity price vector; To use the positive operator, it means that only positive power purchased from the grid is billed; For demand-based electricity pricing, This represents the maximum demand value in this scenario. The unit price will be charged as a penalty for exceeding the contracted capacity. To exceed contract capacity Part of it; The cost of convex approximation for battery life degradation;

[0037] The power balance constraint is: the grid-connected power is obtained by subtracting the net output of photovoltaic power and energy storage power from the load.

[0038] ;

[0039] in For the scene Grid-connected power time series for all time periods For the scene Load time series, For unit photovoltaic power output sequence, That is, the actual photovoltaic power generation; the energy storage absorbs power from the grid during charging and releases power to the load during discharging;

[0040] The recursive constraint for the state of charge (SOC) of energy storage is that the SOC between adjacent time periods follows a recursive relationship based on energy conservation.

[0041] ;

[0042] in and These refer to charging efficiency and discharging efficiency, respectively. For time period Initial energy storage charge For the scene No. Discharge power in each time period;

[0043] The boundary constraints for equipment output and capacity are as follows:

[0044] ;

[0045] The peak demand and overcapacity constraints are as follows: ;

[0046] in For the scene No. Power connected to the grid during each time period, The capacity stipulated in the contract between the user and the power supply company;

[0047] The convex approximation constraint for battery life degradation is expressed as:

[0048] ;

[0049] in For the scene The cost of convex approximation of battery life degradation, coefficient , , The results were obtained by least-squares fitting of the rainflow counts from the actual charge-discharge cycles using the Wöhler fatigue curves. Annualized cost of calendar decay, independent of the operating strategy.

[0050] As a further improvement to the present invention, various representative scenarios are addressed. Solving the linear running subproblem is as follows:

[0051] ;

[0052] Based on the dual value, the optimal Benders cut is constructed as follows:

[0053] ;in These are dual variables.

[0054] As a further improvement of the present invention, in S3, the formula for calculating the Wasserstein residual is:

[0055] ;

[0056] in, For the actual window, The median prediction is generated online for the diffusion model.

[0057] As a further improvement of the present invention, it also includes a carbon-electric Pareto front generation step: take a set of carbon price levels, convert each carbon price scanning level with the carbon emission factor and incorporate it into the electricity price channel, and re-execute steps S22~S23 to obtain multiple sets of annualized electricity cost and annual carbon emission data, and connect them to obtain the electricity cost-carbon emission Pareto front.

[0058] The present invention has the following beneficial effects:

[0059] 1. Significantly improves the robustness and operational economy of capacity configuration under extreme conditions. This invention preserves the high-dimensional intervariate correlation structure and long-range dependencies through a conditional diffusion model, greatly enhancing the tail coverage of the generated scenario to the real joint distribution. Furthermore, it uses a Wasserstein spherical fuzzy set to carry the distribution shift, ensuring that capacity decisions still maintain a provable upper bound on cost for extreme conditions not covered by the training samples. In actual operation by industrial users, this avoids the overfitting collapse where "training economy is optimal, but operational economy deteriorates," and is expected to reduce the implicit costs caused by over-limit penalties and premature battery degradation.

[0060] 2. Significantly reduces online computation and adapts to edge deployment. The event-triggered MPC of this invention only invokes short-term optimization when the Wasserstein residual exceeds the threshold or the idle step count reaches its limit. Compared to the traditional MPC with a fixed cycle of 5 to 15 minutes, this reduces the number of re-optimizations to 30%~40% within a typical monthly 720-hour window. This mechanism enables industrial-grade ARM edge controllers or EMS servers to complete a demand defense decision within seconds, without relying on high-performance cloud computing, and has significant disaster recovery value for network outages and local downtime scenarios.

[0061] 3. Achieving a unified trade-off between electricity costs and carbon emissions multi-objective coordination and lifecycle economics. This invention simultaneously embeds the quadratic term of battery lifespan based on the Rainflow convex approximation and the regional real-time carbon emission factor into the SOCP objective function. This allows for the optimization of electricity costs, battery asset depreciation, and carbon emission costs throughout the entire lifecycle, and outputs a continuous Pareto front through carbon price level scanning. Users can directly read the frontier curve for multi-objective decision-making when renewing annual contract capacity, participating in green electricity trading, or fulfilling carbon quotas. This avoids the loss of non-convex fronts caused by post-processing weighted methods and improves the engineering credibility of investment return assessment. Attached Figure Description

[0062] Figure 1 This is a flowchart of the method of the present invention.

[0063] Figure 2 This is a schematic diagram illustrating the end-to-end coupling process between the conditional probability diffusion model and Wasserstein DRO in this invention.

[0064] Figure 3 This is a schematic diagram of the unified SOCP embedding process of rainflow convex approximation and carbon-electric coupling in this invention.

[0065] Figure 4 This is a schematic diagram of the Wasserstein residual-driven event-triggered MPC process in this invention.

[0066] Figure 5 This is a diagram showing the result of the conditional DDPM joint scenario generation in this invention.

[0067] Figure 6 This is a diagram showing the adaptive calibration of K-medoids clustering and Wasserstein radius in this invention.

[0068] Figure 7 This is a comparison chart of the optimization frequency during the operation phase in this invention.

[0069] Figure 8 This is the runtime sequence diagram of the event-triggered rolling demand defense MPC in this invention.

[0070] Figure 9This is a carbon-electric Pareto front diagram in this invention.

[0071] Figure 10 This is a diagram of the end-to-end closed-loop architecture from offline planning to online defense in this invention. Detailed Implementation

[0072] The technical solutions of the embodiments of this specification will be explained and described below with reference to the accompanying drawings. However, the following embodiments are only preferred embodiments of this specification and not all of them. Other embodiments obtained by those skilled in the art based on the embodiments in the implementation methods without creative effort are all within the protection scope of this specification.

[0073] To facilitate understanding of this invention, the following terms are now explained:

[0074] Wasserstein DRO: Wasserstein Distributionally Robust Optimization, which is based on the Wasserstein distance.

[0075] SOCP: Second-Order Cone Programming, is a standard problem in convex optimization.

[0076] DDPM: Denoising Diffusion Probabilistic Models.

[0077] Wasserstein, often referred to as bulldozer distance (EMD), is a distance metric between probability distributions / sample sets.

[0078] Mohajerin Esfahani-Kuhn: The full name usually refers to the sequence linearization / constraint optimization algorithm proposed by Mohajerin Esfahani & Kuhn, which is often used for nonlinear constrained optimization, variational inequalities, and equilibrium problems.

[0079] SOC: State of charge of the battery, representing the remaining amount of electricity.

[0080] Benders: Generally refers to Benders Decomposition, a classic hierarchical decomposition algorithm in mathematical programming / operations research, proposed by Jacques F. Benders.

[0081] MPC: Model Predictive Control.

[0082] To address the prominent issues faced by industrial parks and large commercial users in configuring photovoltaic and energy storage capacity and defending daily demand under the two-part tariff mechanism, such as high-dimensional joint uncertainty, poor robustness against extreme events outside the distribution, insufficient edge computing power, and insufficient coupling between battery life and capacity decisions, this invention provides an end-to-end method from offline scenario generation and robust optimization at the planning layer to online rolling scheduling. This method enables users to obtain robust capacity decisions against extreme operating conditions during the preliminary design and contract capacity renegotiation stages, and to maintain demand electricity costs within the contract capacity with lower computing power on the EMS edge controller. It also simultaneously considers the economics and carbon emission constraints throughout the entire life cycle, thereby significantly reducing the total electricity cost and the risk of over-limit penalties on the user side.

[0083] Example 1

[0084] Please see Figure 1-10 As shown, a user-side optical storage capacity configuration and rolling demand defense method includes:

[0085] S1. A conditional denoising diffusion probability model is adopted, which takes historical multivariate time series data and conditional tensors as inputs. The conditional tensors are embedded through a self-supervised masking mechanism, and a back diffusion process is performed to generate multiple multivariate joint scenarios that retain cross-variable correlations and long-term time dependencies.

[0086] S2. Perform K-medoids clustering on the generated joint scenarios to obtain representative scenarios and their empirical weights. Construct a spherical fuzzy uncertainty set using sliced2-Wasserstein distance as a metric. Establish a sub-Bruker optimization model with the goal of minimizing the expected cost over the entire life cycle. Use Wolfe duality to transform the model into a solvable convex second-order cone programming problem and solve for the decision values ​​of photovoltaic installed capacity, rated power of energy storage, and rated capacity of energy storage.

[0087] S3. Based on the decision value, during the online operation phase, the Wasserstein distance between the actual load observation window and the median prediction generated online by the conditional diffusion model is used as the trigger residual. A trigger function is defined. When the trigger residual exceeds a preset threshold or the number of idle steps since the last optimization reaches the upper limit, the operation scheduling subproblem is solved, the energy storage charging and discharging instructions are updated and issued for execution; otherwise, the cached instructions are used for demand defense.

[0088] Specifically, S1 includes steps 1 to 3.

[0089] Step 1: Historical Data Collection and Covariate Construction. Collect 1 to 3 years of historical hourly data from the user side, including active power load. Photovoltaic normalized output Ambient temperature Node electricity price Real-time carbon emission factor in the region , forming the training sample tensor ,in For the number of variables, This represents the typical number of hours per month. Simultaneously, a conditional tensor is constructed. Seasonal identifiers, unique thermal codes for process types, and contract capacity will be used. Future weather forecasts and calendar features are spliced ​​together along the channel dimension. For conditional embedding dimensions.

[0090] Step 2: Training the conditional diffusion model (i.e., the conditional denoising diffusion probability model). Let the number of diffusion steps be... Variance table Linearly increasing, defined , The multidimensional Gaussian conditional probability distribution function for forward diffusion is: , where t {1,2,...,T} represents the diffusion step number, and T=100 represents the total number of diffusion steps. It is the training sample tensor. It is the first Step-by-step noisy data, It is an identity matrix.

[0091] Set observation mask ,exist The truth value is retained as a condition at the point, in The noise prediction loss is used for the following:

[0092] ;

[0093] in, To observe the mask, , Standard Gaussian noise, This is a parameterized scoring network, consisting of stacked bidirectional Transformer encoding layers in both the time and variable dimensions, with a diffusion step. Injection via sinusoidal position encoding This indicates element-wise multiplication. It is a conditional tensor.

[0094] Step 3: Online Joint Scenario Generation. Given the conditional tensor of the next typical month. Compared with the observed components ,from Initiate execution of the reverse chain:

[0095] ;

[0096] in This is the intermediate result from the previous step obtained after denoising at step t. This is the input after mask injection. For the observed components, The random Gaussian perturbation injected at step t, (The final step is to set it to zero); Let be the target periodic conditional tensor.

[0097] Repeat sampling The second scene set .

[0098] like Figure 5 As shown, the results of the conditional DDPM joint scenario generation are as follows: The data displays the 5%–95% and 25%–75% quantiles and median curves for 2000 generated scenarios within the first 168 hours of a typical month, covering the variables of load, normalized photovoltaic output, and electricity price. The thin gray lines represent randomly selected single scenario trajectories. It is evident that the generated scenarios fully preserve the daily cycle pattern, weekday / weekend differences, and cross-variable synchronous fluctuation characteristics, with the tail quantiles covering extreme events such as process peaks.

[0099] S2 includes steps 4 through 7.

[0100] Step 4: Scene Clustering and Wasserstein Fuzzy Set Construction. For any two scenes... Calculate the sliced2-Wasserstein distance:

[0101] ;

[0102] Subscript This represents the first [time dimension] after sorting in ascending order. A value. Using this distance as a pair K-medoids clustering for each scene ( ), to obtain representative scenarios and experience weight Construct Wasserstein spherical fuzzy sets:

[0103] ;

[0104] in For any candidate probability distribution, For Dirac measurement, Let the radius of the Wasserstein spherical fuzzy set be . For the reason Each representative scenario is weighted based on experience. Weighted construction of reference empirical distribution, It is the center of the k-th cluster after K-medoids clustering.

[0105] Step 5: Wasserstein radius cross-validation calibration. In the candidate set... Execution Folded Cross-Validation: Divide historical samples into training folds and validation folds, and solve the planning layer SOCP in step 6 to obtain the decision. Then, evaluate the actual expected cost on the validation discount. ,Pick .

[0106] like Figure 6 As shown, K-medoids clustering and Wasserstein radius adaptive calibration are used. The left figure shows the two-dimensional scatter distribution of 2000 generated scenes after PCA dimensionality reduction, using K-medoids ( Clustering yielded 30 representative scenarios (marked with red asterisks), with red dashed circles indicating the Wasserstein sphere coverage of each cluster; the right figure shows the annualized total cost of the validation set under k-fold cross-validation. With Wasserstein radius Optimal radius for a changing U-shaped curve The U-shaped valley bottom balances conservatism and economy.

[0107] Step 6: Planning Layer DRO Capacity Configuration (SOCP). Define decision variables. These are photovoltaic installations, energy storage power, and energy storage capacity, respectively. For each representative scenario... Define runtime variable: charging power Discharge power State of charge trajectory With grid-connected power Introducing Wasserstein dual variables With scene upper bound variables The Mohajerin-Esfahani-Kuhn dual transforms the original infinite-dimensional worst-case distribution problem into a finite-dimensional equivalent convex programming problem. The overall optimization model is described below in terms of the objective function and constraints.

[0108] (6a) Objective function. The objective function consists of three parts: annualized equipment investment cost, the dual term of the split bar, and the upper bound term of the scenario operation cost:

[0109] ;

[0110] in For the scene Charging power time series for all periods For the scene Discharge power time series for all periods, This is the capital recovery factor. For the discount rate, The project's economic life; , , These are the unit cost of photovoltaic installation, the unit cost of energy storage power, and the unit cost of energy storage capacity, respectively. These are photovoltaic installation capacity, energy storage power, and energy storage capacity, respectively. The radius is the Wasserstein radius. For its dual multiplier; For the scene Experience weights, Let this be the convex upper bound of the runtime cost in this scenario. This represents the number of clusters.

[0111] (6b) Upper bound constraint on scenario execution cost. For each representative scenario Upper bound variable It must be no less than the actual total operating cost of the scenario:

[0112] ;

[0113] in For the scene The corresponding time-of-use electricity price vector; To use the positive operator, it means that only positive power purchased from the grid is billed; For demand-based electricity pricing, This represents the maximum demand value in this scenario. The unit price will be charged as a penalty for exceeding the contracted capacity. To exceed contract capacity Part of it; This is the cost of convex approximation for battery life degradation.

[0114] (6c) Power balance constraint. Grid-connected power is obtained by subtracting the net output of photovoltaic power and energy storage from the load:

[0115] ;

[0116] in For the scene Grid-connected power time series for all time periods For the scene Load time series, For unit photovoltaic power output sequence, That is, the actual photovoltaic power generation; the energy storage absorbs power from the grid during charging and releases power to the load during discharging.

[0117] (6d) Recursive constraints on the state of charge (SOC) of energy storage. The SOC between adjacent time periods follows a recursive relationship based on energy conservation:

[0118] ;

[0119] in and These refer to charging efficiency and discharging efficiency, respectively. For time period Initial energy storage charge For the scene No. The discharge power for each time period. The initial SOC is set to 50% of the capacity to ensure sufficient margin for both charging and discharging.

[0120] (6e) Equipment output and capacity boundary constraints. Charging and discharging power is limited by the rated power of the energy storage, and the State of Charge (SOC) is limited by the rated capacity of the energy storage.

[0121] ;

[0122] (6f) Peak Demand and Overcapacity Constraints. Peak demand is the maximum grid-connected power across all time periods, and overcapacity is the positive value of the peak demand exceeding the contracted capacity.

[0123] ;

[0124] in This refers to the contracted capacity between the user and the power supply company. Demand-based pricing is charged based on the maximum monthly demand; penalties are imposed for exceeding the contracted capacity.

[0125] (6g) Battery life degradation convex approximation. The combined degradation cost of battery cycle life and calendar life is expressed by the rainflow convex approximation as:

[0126] ;

[0127] Where the coefficient , , The results were obtained by least-squares fitting of rainflow counts from actual charge-discharge cycles using Wöhler fatigue curves. The first two terms penalize cycle aging caused by high-current charge-discharge, and the third term penalizes the additional degradation caused by deviating from a fully charged state (i.e., deep discharge). This is the calendar-decayed annualized cost, independent of the operating strategy. This quadratic term has a standard second-order cone form, preserving the SOCP structure of the overall problem, and can be solved using Mosek or Gurobi.

[0128] Step 7: Run the Benders subproblem iteration. Fix the capacity decision obtained in Step 6. For each representative scenario Solve the linear running subproblem:

[0129] ;

[0130] The constraints are the same as in step 6, and the dual variables of the capacity constraint are preserved. Constructing the Benders optimal cut based on duality:

[0131] ;

[0132] The above cut is sent back to the planning layer for re-solution, and the process is repeated until the relative gap between the upper and lower boundaries is reached. .

[0133] like Figure 7 As shown, the computational efficiency results of event-triggered MPC are as follows: Compared with the number of re-optimized calls of the event-triggered MPC of the present invention in a typical month of 720 hours, the present invention only requires 248 calls, which is 65.6% less than the 15-minute cycle.

[0134] like Figure 8 As shown, the runtime sequence diagram of the event-triggered rolling demand defense MPC is as follows (running online for 1 week): (a) Comparison of actual load and online median forecast of diffusion, with the red vertical line marking the moment of triggering re-optimization; (b) Wasserstein residual trigger function. With threshold (c) Grid-side power and contracted capacity. The relationship between kW is shown, with the red fill indicating the over-limit range; (d) Energy storage charging and discharging power command and SOC trajectory. It can be seen that the event triggering mechanism is promptly invoked for re-optimization during process peak disturbances, effectively suppressing demand over-limits.

[0135] like Figure 2 As shown, this invention is the first to use the conditional diffusion model as an empirical distribution generator for Wasserstein DRO. The large batch of scenes output by diffusion are directly fed into K-medoids+Wasserstein clustering and dualized SOCP, avoiding the drawback of traditional DRO relying on manually specifying typical scenes, and making the fuzzy set radius calibration have data-driven statistical significance. By explicitly controlling conservatism through radius parameterization, it has a provable lower bound against overfitting for out-of-distribution extreme events (such as continuous rainy weather combined with high temperature and high load).

[0136] like Figure 3 As shown, this invention approximates the non-convex cost of battery cycle-calendar life under the Wöhler curve as a quadratic term of charge-discharge power and a quadratic term of average discharge depth, and incorporates the regional real-time carbon emission factor into the electricity price channel, so that the three objectives of life decay, carbon emission and electricity price can be processed simultaneously in the same SOCP. Combined with carbon price scanning, it can output an electricity price-carbon emission Pareto solution set with a lower risk of losing the non-convex frontier.

[0137] S3 includes steps 8 to 9.

[0138] Step 8: Event-triggered scrolling demand defense MPC. Maintain the actual window during online operation. Median predictions generated online by the diffusion model Define the trigger function:

[0139] ;

[0140] when Or the number of idle steps since the last optimization If the condition is met, the running subproblem in step 7 is solved again; otherwise, the caching strategy is used. Take the Wasserstein radius Thresholds of the same scale This serves as a safety net to ensure that the strategy is not used indefinitely.

[0141] Step 9: Generation of the carbon-electric Pareto front. Take a set of carbon valence levels. For each After converting it with the carbon emission factor, it will be incorporated into the electricity price channel. Repeat steps 6-7 to obtain Yes, the connection yields the Pareto frontier of electricity costs and carbon emissions. Among them... For the first Each carbon price scan level. =1,2,..., ,common Individual carbon price levels; For carbon price The annualized electricity cost at that time (including electricity purchase cost, false data charge, and over-capacity penalty); For carbon price The total annual carbon emissions at that time.

[0142] Figure 9 This is a carbon-electricity Pareto frontier diagram. (Regarding carbon price...) The annualized electricity cost is obtained by re-executing the DRO capacity configuration under the condition of gradually increasing from ¥0 to ¥0.4 / kg. Annual carbon emissions The Pareto frontier shows that as carbon prices rise, optimization results tend to utilize more photovoltaic and energy storage for peak shaving, reducing carbon emissions from 520 tons to 280 tons, while annualized electricity costs rise from ¥1.42 million to ¥1.62 million. Users can then choose a configuration plan that suits their preferences when renewing contract capacity or fulfilling carbon trading obligations.

[0143] like Figure 4As shown, this invention uses sliced ​​2-Wasserstein distance as the prediction residual metric to replace the traditional L2 norm or single-point bias, so that the online triggering logic and the radius of the upper-layer DRO fuzzy set are kept consistent with the parameters; and with the maximum idle step fallback mechanism, it can still maintain an adjustable balance between the risk of exceeding the demand limit penalty and the consumption of computing resources in industrial scenarios where the edge computing power is insufficient to support high-frequency MILP solutions.

[0144] After the algorithm of this invention runs, it will output four types of core results at once: First, the photovoltaic-storage joint capacity decision triplet. And the corresponding lower bound of the worst-case distribution cost and out-of-sample validation cost over the entire lifecycle; second, 30 representative scenarios compressed by K-medoids and their empirical weights, along with adaptively calibrated Wasserstein radii. The first is a representative scenario library for downstream EMS; the second is the event-triggered MPC scheduling time series during the operation phase, which includes hourly charging and discharging instructions, SOC trajectories and demand over-limit flags. Compared with a fixed 15-minute cycle MPC, the number of re-optimizations in a typical month is reduced to 30%~40% of the original value; the third is the set of electricity cost-carbon emission Pareto frontier points obtained by scanning several carbon price levels, which allows users to make multi-objective trade-offs when renewing annual contract capacity or participating in carbon trading.

[0145] This invention provides an end-to-end closed-loop architecture from offline planning to online defense, as follows: Figure 10 As shown, the input layer provides historical multivariate data and conditional covariates. In the offline planning stage, scenarios are jointly generated by conditional DDPM and a Wasserstein fuzzy set is constructed by K-medoids clustering. Then, the planning layer DRO-SOCP and the operation layer LP converge through Benders decomposition. The resulting capacity decisions and representative scenario library are distributed to the online operation stage. In the online stage, the Wasserstein residual of the diffusion online median prediction and the real-time observation window are used as trigger functions. Event triggering MPC is only called when the limit is exceeded. Finally, the output layer summarizes the three types of decision results: photovoltaic storage capacity triplet, scheduling time series, and electricity cost-carbon emission Pareto frontier.

[0146] The algorithm proposed in this invention uses a three-stage pipeline as its framework: "Conditional Diffusion Model Joint Scenario Generation—Wasserstein Fuzzy Set Partition Optimization—Event-Triggered Rolling MPC," covering a complete closed loop from offline planning to online operation. At the functional level, the algorithm's inputs include the user's historical load, photovoltaic output, ambient temperature, time-of-use electricity price, real-time regional carbon emission factor, and conditional covariates such as season, process type, and contracted capacity. The outputs are the optimal photovoltaic installed capacity, energy storage power and energy configuration, monthly demand mitigation strategy, and the electricity cost-carbon emission Pareto front.

[0147] At the principle level, the first stage uses a conditional denoising diffusion probability model as a joint scene generator. Borrowing from the bidirectional Transformer scoring network structure of CSDI, attention is applied to the time and variable dimensions respectively. Through a self-supervised masking mechanism, exogenous covariates are embedded as observed components as conditions. Multivariate scenes that retain cross-variable correlation and long-range time dependence are generated by reverse denoising from pure Gaussian noise. The second stage uses K-medoids in combination with sliced2-Wasserstein distance to cluster the generated scenes to obtain representative scenes and empirical weights. Using Wasserstein spheres as the uncertainty set, the minimax problem of "minimizing the whole life cycle cost under the worst distribution" is transformed into a finite-dimensional convex SOCP through the Wolfe duality of MohajerinEsfahani-Kuhn. The third stage, after the capacity decision is fixed, adopts event-triggered MPC for online operation. Short-time optimization is only solved again when the Wasserstein residual between the actual load and the median prediction obtained by the online inference of the diffusion model exceeds a threshold.

[0148] At the operational level, the three stages are interconnected. The high-fidelity generation capability of the diffusion model provides a high-quality empirical distribution for the subsequent Wasserstein fuzzy set, making the calibration of the DRO radius no longer dependent on manually selected "typical scenarios." The SOCP form obtained by fuzzy set dualization is naturally compatible with the quadratic term of battery lifetime based on the rainflow convex approximation. The event-triggered MPC reuses the representative scenario library generated online by the diffusion model, enabling the edge controller to maintain robust demand defense even with low computing power. While maintaining a single convex solution pipeline, this algorithm simultaneously handles four types of constraints: high-dimensional joint uncertainty, battery lifetime nonlinearity, carbon-electric coupling, and edge deployment.

[0149] Example 2

[0150] Case Background: Suppose a semiconductor packaging park in East China has signed a contract for a certain capacity... Monthly electricity demand Over-capacity penalty The park's annual electricity consumption is approximately 8.5 million kWh, with a maximum active load of 1820 kW. It features continuous operation and significant temperature sensitivity. The project's maximum installed photovoltaic capacity is 5000 kW, maximum energy storage power is 3000 kW, and maximum energy storage capacity is 12000 kWh. The project's lifespan is also considered. Annual discount rate .

[0151] Input data. Collect hourly historical load data, normalized rooftop photovoltaic output, ambient temperature, nodal electricity price, and real-time carbon emission factors for the East China power grid region for 28 months from January 2023 to April 2025, totaling 5 variables. Conditional covariates include seasonal heat uniqueness, process type heat uniqueness, contracted capacity, 720-hour weather forecast, and calendar characteristics. Conditional embedding dimensions. .

[0152] Comparison of expected output and actual results. Under virtual operation, the optimal capacity decision output by this invention is approximately... , , The out-of-sample validation annualized total cost decreased by approximately 8.4% compared to Scheme 2 (SA-PSO plus KDE sampling), and the number of monthly demand exceedance events decreased from 4.7 to 0.6. Online MPC testing showed approximately 248 re-optimization calls per month (approximately 720 calls in a fixed 15-minute cycle), with a compression ratio of 65%; the average time for a single edge controller solution was approximately 1.3 seconds. The carbon-electric Pareto scan yielded 5 frontier points in the carbon price range of 0~0.4¥ / kg, allowing users to directly select the corresponding capacity configuration combination at different green electricity premium levels ranging from 80¥ / MWh to 240¥ / MWh.

[0153] The embodiments described above are merely preferred embodiments of this specification and are not intended to limit the scope of this specification. Any modifications and improvements made by those skilled in the art to the technical solutions of this specification without departing from the spirit of this specification should fall within the protection scope defined by the claims of this specification.

Claims

1. A method for configuring user-side optical storage capacity and mitigating rolling demand, characterized in that, Includes the following steps: S1. A conditional denoising diffusion probability model is adopted, which takes historical multivariate time series data and conditional tensors as inputs. The conditional tensors are embedded through a self-supervised masking mechanism, and a back diffusion process is performed to generate multiple multivariate joint scenarios that retain cross-variable correlations and long-term time dependencies. S2. Perform K-medoids clustering on the generated joint scenarios to obtain representative scenarios and their empirical weights. Construct a spherical fuzzy uncertainty set using sliced2-Wasserstein distance as a metric. Establish a sub-Bruker optimization model with the goal of minimizing the expected cost over the entire life cycle. Use Wolfe duality to transform the model into a solvable convex second-order cone programming problem and solve for the decision values ​​of photovoltaic installed capacity, rated power of energy storage, and rated capacity of energy storage. S3. Based on the decision value, during the online operation phase, the Wasserstein distance between the actual load observation window and the median prediction generated online by the conditional diffusion model is used as the trigger residual. A trigger function is defined. When the trigger residual exceeds a preset threshold or the number of idle steps since the last optimization reaches the upper limit, the operation scheduling subproblem is solved, the energy storage charging and discharging instructions are updated and issued for execution; otherwise, the cached instructions are used for demand defense.

2. The user-side optical storage capacity configuration and rolling demand defense method according to claim 1, characterized in that, S1 includes: The training sample tensor is composed of hourly data on active load, normalized photovoltaic output, ambient temperature, nodal electricity price, and regional real-time carbon emission factor collected from the user side. Simultaneously, a conditional tensor is constructed, and seasonal identifiers, process type unique thermal codes, contract capacity, weather forecasts, and calendar features are spliced ​​along the channel dimension. A conditional denoising diffusion probability model is constructed, using a time-variable bidirectional Transformer scoring network. Forward diffusion is a Gaussian noise superposition process. The conditional tensor is embedded as the observation component through a self-supervised masking mechanism. With noise prediction loss as the objective, the model is trained to convergence using the Adam optimizer. Input the target periodic condition tensor and the observed components, perform an inverse denoising chain starting from pure Gaussian noise, and repeatedly sample to generate N sets of load, photovoltaic normalized output, and electricity price joint scenarios that retain intervariate correlation and long-range time dependence.

3. The user-side optical storage capacity configuration and rolling demand defense method according to claim 2, characterized in that, In the conditional denoising diffusion probability model: The multidimensional Gaussian conditional probability distribution function for forward diffusion is: ; where t {1,2,...,T} represents the diffusion step number, and T=100 represents the total number of diffusion steps. It is the training sample tensor. It is the first Step-by-step noisy data, It is the identity matrix. For the variance table, , , ; The noise prediction loss function is: ;in, To observe the mask, , Standard Gaussian noise, This is a parameterized scoring network, consisting of stacked bidirectional Transformer encoding layers in both the time and variable dimensions, with a diffusion step. Injection via sinusoidal position encoding This indicates element-wise multiplication. It is a conditional tensor; The calculation formula for performing the inverse denoising chain is: ;in This is the intermediate result from the previous step obtained after denoising at step t. This is the input after mask injection. For the observed components, The random Gaussian perturbation injected at step t, ; Let be the target periodic conditional tensor.

4. The user-side optical storage capacity configuration and rolling demand defense method according to claim 1, characterized in that, S2 include: S21. Calculate the sliced2-Wasserstein distance for any two scenes, and use this distance to... K-medoids clustering is performed on each scene to obtain representative scenes and experience weights, and Wasserstein spherical fuzzy sets are constructed. Execute on the candidate set Folded cross-validation: The historical samples are divided into training folds and validation folds. The SOCP of the planning layer is solved separately to obtain the decision. Then, the actual expected cost is evaluated on the validation fold to obtain the optimal radius of the spherical fuzzy set. S22. Using photovoltaic installation capacity, energy storage power, and energy storage capacity as decision variables, construct an objective function that includes annualized equipment investment cost, degenerate bar dual terms, and upper bound terms of scenario operation cost; incorporate power balance, energy storage state of charge recursion, equipment output and capacity boundaries, peak demand and overcapacity constraints, and convex approximation constraints of battery life decay based on rainflow counting, transform the minimax robust optimization problem into a second-order cone programming solution to obtain the optimal photovoltaic-storage capacity configuration. S23. With a fixed optimal optical storage capacity configuration, solve the linear subproblems for each representative scenario to obtain the capacity constraint dual variables. Construct the Benders optimal cut based on the dual values, and feed this optimal cut back to the planning layer to solve it again, iterating until the upper and lower bounds of the relative gap are reached. .

5. The user-side optical storage capacity configuration and rolling demand defense method according to claim 4, characterized in that, The formula for calculating the sliced2-Wasserstein distance is: ;in, For two scenarios, subscript This represents the first [time dimension] after sorting in ascending order. One value; Typical monthly hours Number of variables; The formula for constructing Wasserstein's spherical fuzzy set is: ;in For any candidate probability distribution, For Dirac measurement, Let the radius of the Wasserstein spherical fuzzy set be . For the reason Each representative scenario is weighted based on experience. Weighted construction of reference empirical distribution, It is the center of the k-th cluster after K-medoids clustering.

6. The user-side optical storage capacity configuration and rolling demand defense method according to claim 5, characterized in that, The objective function is: ; in For the scene Charging power time series for all periods For the scene Discharge power time series for all periods, This is the capital recovery factor. For the discount rate, The project's economic life; , , These are the unit cost of photovoltaic installation, the unit cost of energy storage power, and the unit cost of energy storage capacity, respectively. These are photovoltaic installation capacity, energy storage power, and energy storage capacity, respectively. Its dual multiplier; For the scene Experience weights, Let this be the convex upper bound of the runtime cost in this scenario. This represents the number of clusters.

7. The user-side optical storage capacity configuration and rolling demand defense method according to claim 6, characterized in that, The upper bound constraint on the scenario execution cost is: for each representative scenario Upper bound variable It must be no less than the actual total operating cost of the scenario: ; in For the scene The corresponding time-of-use electricity price vector; To use the positive operator, it means that only positive power purchased from the grid is billed; For demand-based electricity pricing, This represents the maximum demand value in this scenario. The unit price will be charged as a penalty for exceeding the contracted capacity. To exceed the contract capacity Part of; The cost of convex approximation for battery life degradation; The power balance constraint is: the grid-connected power is obtained by subtracting the net output of photovoltaic power and energy storage power from the load. ; in For the scene Grid-connected power time series for all time periods For the scene Load time series, For unit photovoltaic power output sequence, That is, the actual photovoltaic power generation; the energy storage absorbs power from the grid during charging and releases power to the load during discharging; The recursive constraint for the state of charge (SOC) of energy storage is that the SOC between adjacent time periods follows a recursive relationship based on energy conservation. ; in and These are charging efficiency and discharging efficiency, respectively. For time period Initial energy storage charge For the scene No. Discharge power in each time period; The boundary constraints for equipment output and capacity are as follows: ; The peak demand and overcapacity constraints are as follows: ; in For the scene No. Power connected to the grid during each time period, The capacity stipulated in the contract between the user and the power supply company; The convex approximation constraint for battery life degradation is expressed as: ; in For the scene The cost of convex approximation of battery life degradation, coefficient , , The results were obtained by least-squares fitting of the rainflow counts from the actual charge-discharge cycles using the Wöhler fatigue curves. Annualized cost of calendar decay, independent of the operating strategy.

8. The user-side optical storage capacity configuration and rolling demand defense method according to claim 7, characterized in that, For each representative scenario Solving the linear running subproblem is as follows: ; Based on duality, the optimal Benders cut is constructed as follows: ;in These are dual variables.

9. The user-side optical storage capacity configuration and rolling demand defense method according to claim 1, characterized in that, In S3, the formula for calculating the Wasserstein residual is: ; in, For the actual window, The median prediction is generated online for the diffusion model.

10. The user-side optical storage capacity configuration and rolling demand defense method according to claim 1, characterized in that, It also includes the carbon-electricity Pareto frontier generation step: take a set of carbon price levels, scan each carbon price level and convert it with the carbon emission factor and then incorporate it into the electricity price channel, re-execute steps S22~S23 to obtain multiple sets of annualized electricity cost and annual carbon emission data, and connect them to obtain the electricity cost-carbon emission Pareto frontier.