function fun = fun_objective(x)
%% 准备工作
parameter; %输入所有的数据
%% 各个决策变量的含义
Pfl = x(1:24); % 火电1
Pf2 = x(25:48); % 火电2
Pf3 = x(49:72); % 火电3
Pf4 = x(73:96); % 火电4
Pf5 = x(97:120);% 火电5
Pf6 = x(121:144);% 火电6
%水电1
Pc1=x(145:168);
% for t=1:24
% if Pc1(t)<0
% Pc1(t)=fix(Pc1(t))*50;
% end
% end
%% 峰:9/10/11/12/13/19/20/21
%% 谷:23/24/1/2/3/4/5
for t=1:24
if t>=9&&t<=13
if Pc1(t)<0
Pc1(t)=0;
end
elseif t>=19&&t<=21
if Pc1(t)<0
Pc1(t)=0;
end
elseif t>=1&&t<=5
if Pc1(t)>0
Pc1(t)=0;
end
elseif t>=23&&t<=24
if Pc1(t)>0
Pc1(t)=0;
end
% elseif t>=6&&t<=8
% Pc1(t)=0;
% elseif t>=14&&t<=18
% Pc1(t)=0;
% elseif t==22
% Pc1(t)=0;
end
end
%% 书写约束
% ******************* 等式约束****************************
h=[];
chou=zeros(1,24);
for t=1:24
chou(t)=Pc1(t);
end
for t=1:24 % (1) 电能平衡约束
if chou(t)>=0
h = [h, Pfl(t)+Pf2(t)+Pf3(t)+Pf4(t)+Pf5(t)+Pf6(t)+sum(P_shui(:))+chou(t)*0.9 - P_load(t)]; %=0
else
h = [h, Pfl(t)+Pf2(t)+Pf3(t)+Pf4(t)+Pf5(t)+Pf6(t)+sum(P_shui(:))+chou(t)/eta - P_load(t)]; %=0
end
end
%% 抽蓄初始相等
h = [h, sum(chou)]; %=0
% ******************* 不等式约束 ***************************
g=[];
%% (1) 火电爬坡约束
for t=2:24 % (1) 火电爬坡约束1,1-23
g=[g, Pfl(t)-Pfl(t-1)-delta_fire(1)] ; % <=0
g=[g, -( Pfl(t)-Pfl(t-1)+delta_fire(1) ) ] ; % <=0
end
for t=2:24 % (1) 火电爬坡约束2,24-46
g=[g, Pf2(t)-Pf2(t-1)-delta_fire(2)] ; % <=0
g=[g, -( Pf2(t)-Pf2(t-1)+delta_fire(2) ) ] ; % <=0
end
for t=2:24 % (1) 火电爬坡约束3,47-69
g=[g, Pf3(t)-Pf3(t-1)-delta_fire(3)] ; % <=0
g=[g, -( Pf3(t)-Pf3(t-1)+delta_fire(3) ) ] ; % <=0
end
for t=2:24 % (1) 火电爬坡约束4,70-92
g=[g, Pf4(t)-Pf4(t-1)-delta_fire(4)] ; % <=0
g=[g, -( Pf4(t)-Pf4(t-1)+delta_fire(4) ) ] ; % <=0
end
for t=2:24 % (1) 火电爬坡约束5,93-115
g=[g, Pf5(t)-Pf5(t-1)-delta_fire(5)] ; % <=0
g=[g, -( Pf5(t)-Pf5(t-1)+delta_fire(5) ) ] ; % <=0
end
for t=2:24 % (1) 火电爬坡约束6,116-138
g=[g, Pf6(t)-Pf6(t-1)-delta_fire(6)] ; % <=0
g=[g, -( Pf6(t)-Pf6(t-1)+delta_fire(6) ) ] ; % <=0
end
%% 出力上下限约束
for t=1:24
g=[g, Pfl(t)-P_maxfire(1)] ; % <=0 ,139-162
end
for t=1:24
g=[g, Pf2(t)-P_maxfire(2)] ; % <=0 ,163-186
end
for t=1:24
g=[g, Pf3(t)-P_maxfire(3)] ; % <=0 ,187-210
% g=[g, -( Pf3(t)-P_minfire(3) ) ] ; % <=0
end
for t=1:24
g=[g, Pf4(t)-P_maxfire(4)] ; % <=0 ,211-234
end
for t=1:24
g=[g, Pf5(t)-P_maxfire(5)] ; % <=0 ,235-258
end
for t=1:24
g=[g, Pf6(t)-P_maxfire(6)] ; % <=0 ,259-282
end
%% 备用约束, 283-306
for t=1:24
g=[g, -(sum(P_maxfire)-Pfl(t)-Pf2(t)-Pf3(t)-Pf4(t)-Pf5(t)-Pf6(t)-sum(P_maxfire)*bei)];
end
%% 抽蓄约束
g1=[];
for t=1:24
g1=[g1,V_0-sum(chou(1:t))-V_max];
g1=[g1,-(V_0-sum(chou(1:t))-V_min)];
end
% for t=1:24
% if Pc1(t)>0
% g1=[g1,300*0.1 - Pc1(t)];
% end
% end
%% 书写目标函数
fun =0;
%% 火电
for t=1:24
if Pfl(t)>=P_maxfire(1)*0.5
fun = fun + Pfl(t)*price_feng(1);%基础
else
fun = fun + (Pfl(t)-P_maxfire(1)*0.5)*price_bu(1)+P_maxfire(1)*0.5*price_feng(1);%深度
end
end
for t=1:24
if Pf2(t)>=P_maxfire(2)*0.5
fun = fun + Pf2(t)*price_feng(2);%基础
else
fun = fun + (Pf2(t)-P_maxfire(2)*0.5)*price_bu(2)+P_maxfire(2)*0.5*price_feng(2);%深度
end
end
for t=1:24
if Pf3(t)>=P_maxfire(3)*0.5
fun = fun + Pf3(t)*price_feng(3);%基础
else
fun = fun + (Pf3(t)-P_maxfire(3)*0.5)*price_bu(3)+P_maxfire(3)*0.5*price_feng(3);%深度
end
end
for t=1:24
if Pf4(t)>=P_maxfire(4)*0.5
fun = fun + Pf4(t)*price_feng(4);%基础
else
fun = fun + (Pf4(t)-P_maxfire(4)*0.5)*price_bu(4)+P_maxfire(4)*0.5*price_feng(4);%深度
end
end
for t=1:24
if Pf5(t)>=P_maxfire(5)*0.5
fun = fun + Pf5(t)*price_feng(5);%基础
else
fun = fun + (Pf5(t)-P_maxfire(5)*0.5)*price_bu(5)+P_maxfire(5)*0.5*price_feng(5);%深度
end
end
for t=1:24
if Pf6(t)>=P_maxfire(6)*0.5
fun = fun + Pf6(t)*price_feng(6);%基础
else
fun = fun + (Pf6(t)-P_maxfire(6)*0.5)*price_bu(6)+P_maxfire(6)*0.5*price_feng(6);%深度
end
end
%% 水电
for t=1:24
fun = fun+sum(P_shui.*Price_shui);
end
%% 抽蓄
for t=1:24
if Pc1(t)<0
fun = fun-chou(t)*Price_chou;
end
end
%**********************罚函数处理*************************
Big=10000000;%7
small=0.001;
N=length(g);
N1=length(g1);
M=length(h);
G=0;
for n=1:N
G=G+max(0, g(n))^2;
end
G1=0;
for n=1:N1
G1=G1+max(0, g1(n))^2;
end
H=0;
for m=1:M
H=H+max( 0, abs(h(m))-small )^2;
end
%*******************加入罚函数后的目标函数******************
% fun=fun+Big*(H*10+G+GG*1000000);
fun=fun+Big*(H*5+G+G1*200);
% fun=fun+Big*(H*10+G+GG*10000);
end
抽水蓄能电站的最佳调度方案研究
版权申诉
5星 · 超过95%的资源 189 浏览量
2022-04-28
15:43:43
上传
评论 5
收藏 4.05MB ZIP 举报
电磁MATLAB
- 粉丝: 4088
- 资源: 36
最新资源
- XILINXFPGA源码Xilinxspratan3xcs100E(VGAPS2)
- XILINXFPGA源码XilinxSPARTAN-3E入门开发板实例
- XILINXFPGA源码XilinxSdramVerilog和VHDL版本文档
- 物联网智能家居方案-基于Nucleo-STM32L073&机智云(大赛作品,文档齐全,可直接运行)(文档加Matlab源码)
- XILINXFPGA源码XilinxISE9.xFPGACPLD设计源码
- 成都市地图含高新区(高新南区,高新西区),天府新区,东部新区虚拟行政区划
- XILINXFPGA源码XilinxEDK设计试验
- XILINXFPGA源码XilinxEDKMicroBlaze内置USB固件程序
- 基于 django 的视频点播后台管理系统源代码+数据库
- 基于Java的网上医院预约挂号系统的设计与实现(部署视频)-kaic.mp4
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
- 1
- 2
- 3
前往页