【EI复现】梯级水光互补系统最大化可消纳电量期望短期优化调度模型(Matlab代码实现)

💥💥💞💞欢迎来到本博客❤️❤️💥💥

🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

⛳️座右铭:行百里者,半于九十。

📋📋📋本文目录如下:🎁🎁🎁

目录

💥1 概述

📚2 运行结果

🎉3 参考文献

🌈4 Matlab代码实现


💥1 概述

文献来源:

摘要:充分发挥流域梯级水电的调节作用,实现梯级水光系统的互补联合发电是促进清洁能源消纳的重要途径。文中考虑光伏出力不确定性,以整体可消纳电量期望最大为目标,提出了梯级水光互补系统的短期优化调度模型。该模型以机组为最小调度单位,精细化建模了电站约束、机组约束以及电网约束,通过梯级负荷在电站和时段间的合理调配,挖掘梯级水电的电网供电支撑和光伏互补协调双重作用,提升互补系统整体消纳水平。模型求解方面,采用分段线性逼近、引入0-1整数变量、发电水头离散等线性化方法和建模技巧处理模型中的非线性约束,将原模型转换为混合整数线性规划问题,并在Java环境中采用CPLEX工具实现求解。最后,以参考中国西南地区某流域梯级的4个水电站15台机组以及2个光伏群构建的互补系统为例,验证了所提模型和求解方法的有效性。

关键词:

梯级水电站;优化调度;多能互补系统;最大化可消纳电量期望;混合整数线性规划;

 

目前,关于水电与光伏等新能源的多能互补,除了互补系统的容量规划与设计[5-7] 之外,其运行调度也得到了广泛关注[8]。文献[9]分别以总出力波动性最小和整体平稳性最优为不同的控制策略,构建了水光互补系统调度模型;文献[10]考虑光伏出力随机性,提出了基于多项式混沌理论的概率配点算法的运行安全分析方法,为梯级水光互补系统安全稳定运行提供了理论支持;文献[11]考虑光伏的短期波动性,提出了嵌套短期弃电风险的水光互补中长期优化调度方法;文献[12]建立了龙羊峡水光互补短期优化调度模型,并分析了多种场景下的水光互补效果;文献[13]以光伏能量损失函数为基础建立短期与长期调度模型间的联系,提出了一种水光互补系统的自适应运行规则;文献[14]建立了兼顾发电量和出力波动的双目标调度模型,在保证发电量的前提下降低了光伏出力波动;文献[15]以梯级水电耗水量最小为目标,构建了梯级水光联合发电

系统短期优化调度模型。综合调研分析,水光互补的本质是发挥水电的良好调节能力以促进随机性光伏的消纳,研究主要集中在互补特性分析、出力波动平抑、运行安全分析等方面。现有模型大多以电站为最小调度单元,没有精细化考虑机组和电网的复杂运行约束,使得各电站在执行计划时存在偏差,甚至难以执行。例如,同一电站可能包含多台不同类型的机组,不同类型的机组具有不同的爬坡能力、振动区、启停次数等约束限制,不能一概而论;同一电站的不同机组、梯级上下游之间的不同电站可能通过不同的分区断面逐级并网,受到多级分区断面输送容量约束限制[16-17]。此外,平抑光伏的波动性可能导致水电出力频繁波动,给水电机组造成损耗和运行风险[18-19],如何在互补调度中避免水电出力的频繁波动也是需要重点考虑的问题。

为此,本文在已有研究的基础上,以机组为最小调度单位,采用模糊聚类方法构建出力场景描述光

伏不确定性,精细化考虑互补系统面临的电站约束、机组约束和电网约束,构建了梯级水光互补系统最大化可消纳电量期望短期优化调度模型。通过梯级负荷在电站和时段间的合理调配,挖掘梯级水电在电网供电支撑和光伏互补调节中的双重作用[20] ,提升互补系统的整体电量消纳水平。所提模型是一个高 维 的 多 变 量 、多 约 束 的 混 合 整 数 非 线 性 规 划 (MINLP)问题,已有研究多采用智能算法求解,求解结果优劣受初始解影响大且容易陷入局部最优解,难以保证收敛到全局最优解。伴随近些年商业求解工具的发展,混合整数线性规划(MILP)凭借算法成熟、求解效率高、结果稳定等优势,已在水电领域得到了广泛应用[21-24]。为实现模型的高效求

解,对于模型中涉及的非线性约束,采用分段线性逼近、引入 0-1 整数变量、发电水头离散等线性化方法和建模技巧,将原 MINLP 问题转化为 MILP 问题,并 在Matlab环 境 中 采 用 CPLEX 工 具 实 现 求 解 。 最后,以中国西南地区某流域梯级的 4 座水电站 15 台机组以及 2 个光伏群为参考所构建的互补系统为研究对象,验证了本文所提模型和求解方法的有效性。

📚2 运行结果

 

 

 

 

部分代码:

%% 决策变量
P_hydro = sdpvar(I,T);              % 水电站i在时段t的出力
P_w = sdpvar(G,T);                  % 第g个约束断面在时段 t 的弃电量
V_it = sdpvar(I,T);                 % 水电站 i 在时段 t 末的库容
I_it = sdpvar(I,T);                 % 水电站i在时段t的入库流量
Q_it = sdpvar(I,T);                 % 电站 i 在时段 t的出库流量
R_it = sdpvar(I,T);                 % 电站i - 1和电站i之间在时段t的区间流量
Q_p_it = sdpvar(I,T);               % 水电站i在时段t的发电流量
Q_d_it = sdpvar(I,T);               % 电站 i 在时段 t 的弃水流量
Z_up_it = sdpvar(I,T);              % 电站i所在水库在时段t的坝前水位
Z_down_it = sdpvar(I,T);            % 水电站i在时段t的入库流量
P_int = sdpvar(N,T);                % 第n台机组在时段t的出力
u_int = binvar(N,T);                % 第n台机组在时段t的开停机状态
Q_p_int = sdpvar(N,T);              % 第n台机组时段 t 的发电流量
y_on_int = binvar(N,T);             % 第n台机组在时段t的启动操作变量
y_off_int = binvar(N,T);            % 第n台机组在时段t的停机操作变量
H_int = sdpvar(N,T);                % 第 n 台机组在时段 t的发电水头
H_loss_int = sdpvar(N,T);           % 第 n 台机组在时段 t的水头损失
P_sgt = sdpvar(G,T);                % 约束断面g在t时段所有机组总出力
theta_1_3ntk = binvar(10,T,2);      % 水电站1-3的机组振动区指示变量
theta_4ntk = binvar(5,T,3);         % 水电站4的机组振动区指示变量
alpha_int = binvar(N,T);            % 1表示时段 t + 1 功率向下调节
beta_int = binvar(N,T);             % 1表示时段 t + 1 功率向上调节 

🎉3 参考文献

部分理论来源于网络,如有侵权请联系删除。

[1]罗彬,陈永灿,刘昭伟等.梯级水光互补系统最大化可消纳电量期望短期优化调度模型[J].电力系统自动化,2023,47(10):66-75.

🌈4 Matlab代码实现

  • 20
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个使用贝叶斯优化的示例函数的Matlab代码: ```matlab function [xopt,fopt] = bayesopt_fun(f,x0,lb,ub,opts) % BAYESOPT_FUN: Bayesian optimization of a function % [XOPT,FOPT] = BAYESOPT_FUN(F,X0,LB,UB,OPTS) finds the minimum of a % function F using Bayesian optimization. X0 is the initial guess, % LB and UB are the lower and upper bounds of the variables, and OPTS % is an options structure created using BAYESOPT_OPTIONS. The function % F should take a vector of variables as input and return a scalar % output. % % Example usage: % f = @(x) sin(3*x) + x.^2 - 0.7*x; % opts = bayesopt_options('AcquisitionFunctionName','expected-improvement-plus'); % [xopt,fopt] = bayesopt_fun(f,0,0,1,opts); % % See also BAYESOPT_OPTIONS. % Check inputs narginchk(4,5); if nargin < 5, opts = bayesopt_options(); end assert(isa(f,'function_handle'),'F must be a function handle'); assert(isvector(x0) && isnumeric(x0),'X0 must be a numeric vector'); assert(isvector(lb) && isnumeric(lb),'LB must be a numeric vector'); assert(isvector(ub) && isnumeric(ub),'UB must be a numeric vector'); assert(all(size(x0)==size(lb)) && all(size(x0)==size(ub)), ... 'X0, LB, and UB must have the same size'); opts = bayesopt_options(opts); % ensure opts has all fields % Initialize X = x0(:); % column vector Y = f(X); n = numel(X); Xbest = X; Ybest = Y; fmin = min(Y); fmax = max(Y); % Loop over iterations for i = 1:opts.MaxIterations % Train surrogate model model = fitrgp(X,Y,'Basis','linear','FitMethod','exact', ... 'PredictMethod','exact','Standardize',true, ... 'KernelFunction',opts.KernelFunction,'KernelParameters',opts.KernelParameters); % Find next point to evaluate if strcmp(opts.AcquisitionFunctionName,'expected-improvement-plus') % Use expected improvement with small positive improvement threshold impThreshold = 0.01*(fmax-fmin); acqFcn = @(x) expected_improvement_plus(x,model,fmin,impThreshold); else % Use acquisition function specified in options acqFcn = str2func(opts.AcquisitionFunctionName); end xnext = bayesopt_acq(acqFcn,model,lb,ub,opts.AcquisitionSamples); % Evaluate function at next point ynext = f(xnext); % Update data X = [X; xnext(:)]; Y = [Y; ynext]; if ynext < Ybest Xbest = xnext; Ybest = ynext; end fmin = min(Y); fmax = max(Y); % Check stopping criterion if i >= opts.MaxIterations || (i > 1 && abs(Y(end)-Y(end-1))/Ybest <= opts.TolFun) break; end end % Return best point found xopt = Xbest; fopt = Ybest; end function EI = expected_improvement_plus(X,model,fmin,impThreshold) % EXPECTED_IMPROVEMENT_PLUS: Expected improvement with small positive improvement threshold % EI = EXPECTED_IMPROVEMENT_PLUS(X,MODEL,FMIN,IMPTHRESHOLD) computes % the expected improvement (EI) of a surrogate model at the point X. % The input MODEL is a regression model, FMIN is the current minimum % value of the function being modeled, and IMPTHRESHOLD is a small % positive improvement threshold. % % The expected improvement is defined as: % EI = E[max(FMIN - Y, 0)] % where Y is the predicted value of the surrogate model at X. % The expected value is taken over the posterior distribution of Y. % % However, if the predicted value Y is within IMPTHRESHOLD of FMIN, % then EI is set to IMPTHRESHOLD instead. This is done to encourage % exploration of the search space, even if the expected improvement % is very small. % % See also BAYESOPT_ACQ. % Check inputs narginchk(4,4); % Compute predicted value and variance at X [Y,~,sigma] = predict(model,X); % Compute expected improvement z = (fmin - Y - impThreshold)/sigma; EI = (fmin - Y - impThreshold)*normcdf(z) + sigma*normpdf(z); EI(sigma==0) = 0; % avoid division by zero % Check if improvement is small if Y >= fmin - impThreshold EI = impThreshold; end end function opts = bayesopt_options(varargin) % BAYESOPT_OPTIONS: Create options structure for Bayesian optimization % OPTS = BAYESOPT_OPTIONS() creates an options structure with default % values for all parameters. % % OPTS = BAYESOPT_OPTIONS(P1,V1,P2,V2,...) creates an options structure % with parameter names and values specified in pairs. Any unspecified % parameters will take on their default values. % % OPTS = BAYESOPT_OPTIONS(OLDOPTS,P1,V1,P2,V2,...) creates a copy of % the OLDOPTS structure, with any parameters specified in pairs % overwriting the corresponding values. % % Available parameters: % MaxIterations - Maximum number of iterations (default 100) % TolFun - Tolerance on function value improvement (default 1e-6) % KernelFunction - Name of kernel function for Gaussian process % regression (default 'squaredexponential') % KernelParameters - Parameters of kernel function (default []) % AcquisitionFunctionName - Name of acquisition function for deciding % which point to evaluate next (default % 'expected-improvement-plus') % AcquisitionSamples - Number of samples to use when evaluating the % acquisition function (default 1000) % % See also BAYESOPT_FUN, BAYESOPT_ACQ. % Define default options opts = struct('MaxIterations',100,'TolFun',1e-6, ... 'KernelFunction','squaredexponential','KernelParameters',[], ... 'AcquisitionFunctionName','expected-improvement-plus','AcquisitionSamples',1000); % Overwrite default options with user-specified options if nargin > 0 if isstruct(varargin{1}) % Copy old options structure and overwrite fields with new values oldopts = varargin{1}; for i = 2:2:nargin fieldname = validatestring(varargin{i},fieldnames(opts)); oldopts.(fieldname) = varargin{i+1}; end opts = oldopts; else % Overwrite fields of default options with new values for i = 1:2:nargin fieldname = validatestring(varargin{i},fieldnames(opts)); opts.(fieldname) = varargin{i+1}; end end end end function xnext = bayesopt_acq(acqFcn,model,lb,ub,nSamples) % BAYESOPT_ACQ: Find next point to evaluate using an acquisition function % XNEXT = BAYESOPT_ACQ(ACQFCN,MODEL,LB,UB,NSAMPLES) finds the next point % to evaluate using the acquisition function ACQFCN and the regression % model MODEL. LB and UB are the lower and upper bounds of the variables, % and NSAMPLES is the number of random samples to use when maximizing % the acquisition function. % % The input ACQFCN should be a function handle that takes a regression % model and a set of input points as inputs, and returns a vector of % acquisition function values. The set of input points is a matrix with % one row per point and one column per variable. % % The output XNEXT is a vector containing the next point to evaluate. % % See also BAYESOPT_FUN, EXPECTED_IMPROVEMENT_PLUS. % Check inputs narginchk(4,5); assert(isa(acqFcn,'function_handle'),'ACQFCN must be a function handle'); assert(isa(model,'RegressionGP'),'MODEL must be a regressionGP object'); assert(isvector(lb) && isnumeric(lb),'LB must be a numeric vector'); assert(isvector(ub) && isnumeric(ub),'UB must be a numeric vector'); assert(all(size(lb)==size(ub)),'LB and UB must have the same size'); if nargin < 5, nSamples = 1000; end % Generate random samples X = bsxfun(@plus,lb,bsxfun(@times,rand(nSamples,numel(lb)),ub-lb)); % Evaluate acquisition function acq = acqFcn(model,X); % Find maximum of acquisition function [~,imax] = max(acq); xnext = X(imax,:); end ``` 该示例代码实现了一个使用贝叶斯优化的函数优化器。该优化器使用高斯过程回归模型来近似目标函数,并使用期望改进加上(EI+)作为获取函数。您可以将此代码用作自己的优化问题的起点,并根据需要进行修改。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值