# EI论文联合复现：含分布式发电的微网/综合能源系统储能容量多时间尺度线性配置方法程序代码！

《含分布式发电的微电网中储能装置容量优化配置》-电力系统保护与控制

《基于机会约束规划的混合储能优化配置方法》-电网技术

《基于全寿命周期成本的配电网蓄电池储能系统的优化配置》-电网技术

《微电网复合储能多目标优化配置方法及评价指标》-电力系统自动化

1）利用线性规划方法对储能进行配置，更贴合实际工程需求

2）将储能配置精细化到分钟级别，进一步减小配置成本，模型普适性高；

``````battery_effic_disch=0.95; %it cant be 1. set 0.99
battery_effic_charge=0.95; %it cant be 1. set 0.99
%iNVERTER
%2D zero element matrix (time intervals*time intervals)
zeros_2D=zeros(num_of_hours,num_of_hours);
%Create the positive diagonal matrix with 1.
v = ones(1,num_of_hours);
Diag1_pos = diag(v);
%Create the negative diagonal matrix with -1.
%Create the negative diagonal battery efficiency.
Diag_neg_disch_eff=Diag1_neg*battery_effic_disch;  %is not implemented yet
Diag_pos_charge_eff=Diag1_pos*(1/battery_effic_charge);
%Create the  diagonal matrix OF THE first efficiency
Diag_eff1_pos =diag(v);
Diag_eff1_neg=-Diag_eff1_pos;
%Create the  diagonal matrix OF THE second efficiency
%create lower triangular matrix positive and negative
v=tril(ones(num_of_hours,num_of_hours),-1);
pos_triangular=v+Diag1_pos;
neg_triangular=-pos_triangular;
%Create the  diagonal matrix OF THE bounds efficiency
v = ones(1,num_of_hours);
v=v.*bounds_efficiency(1);
Diag_bounds_eff1 =diag(v);
%Create the  diagonal matrix OF THE bounds efficiency
v = ones(1,num_of_hours);
v=v.*bounds_efficiency(2);
Diag_bounds_eff2 =diag(v);
%Create the  diagonal matrix OF THE bounds efficiency
v = ones(1,num_of_hours);
v=v.*bounds_efficiency(3);
Diag_bounds_eff3 =diag(v);
%Create the  diagonal matrix OF THE bounds efficiency
v = ones(1,num_of_hours);
v=v.*bounds_efficiency(4);
Diag_bounds_eff4 =diag(v);
%create the upper bound value of y1 and y2
upper_y1=max_batt_discharge+max(PV);
upper_y2=max_batt_charge*(1/battery_effic_charge);
%Create the  diagonal matrix of upper bound value of y1
v = ones(1,num_of_hours);
v=v.*upper_y1; %very big value for ours values
Diag_upper_pos_y1 =diag(v);
Diag_upper_neg_y1 =-Diag_upper_pos_y1;
%Create the  diagonal matrix of upper bound value of y2
v = ones(1,num_of_hours);
v=v.*upper_y2; %very big value for ours values
Diag_upper_pos_y2 =diag(v);
Diag_upper_neg_y2 =-Diag_upper_pos_y2;``````

THE END