Programming Shiftable Load Profile
7 views (last 30 days)
Show older comments
I want to program a Shiftable Load (SL) profile demand as a MILP.
I have a SL demand that I want to be done once a day. The SL demand has two intervals, so it has to turn on before hour 23 because, otherwise, it wouldn't do all the intervals.
I have programed the SL lit in constraint C1 defining that x_S binary variable just must be 1 once a day.
Now, I need to assign the consumption in each interval.
You have my code below:
case1=optimproblem;
%% Sets
T=[1:24]'; %Time set [h]
L=[1:2]'; %Intervals of shiftable load profile set [h]
%% Parameters
C_Ip=[0.079 0.065 0.05 0.037 0.033 0.035 0.037 0.043 0.05 0.063 0.075 0.076 0.075 0.075 0.076 0.065 0.063 0.061 0.065 0.075 0.087 0.093 0.09 0]'; %Day-ahead purchase spot price [€/kWh]
D_S=[2.3 1.9]'; %Shiftable load demand [kWh]
%% Variables
x_S=optimvar('x_S',length(T),'Type','integer','LowerBound',0,'UpperBound',1); %Interval where shiftable load begins to be supplied
d_S=optimvar('d_S',length(T),'Type','continuous','LowerBound',0); %Shiftable load [kWh]
c_T=optimvar('c_T',length(T),'Type','continuous','LowerBound',0); %Total cost [€/h]
%% Constraints
case1.Constraints.C1=optimconstr(length(T));
for i=1:length(T)
if T(i)>=1 & T(i)<=23
case1.Constraints.C1(i)=sum(x_S)==1;
else
case1.Constraints.C1(i)=sum(x_S(i))==0;
end
end
%% Objective function
case1.Constraints.COF=optimconstr(length(T));
for i=1:length(T)
case1.Constraints.COF(i)=c_T(i)==d_S(i).*C_Ip(i);
end
case1.Objective=sum(c_T);
options=optimoptions('intlinprog');
[solu,exitflag,output]=solve(case1,'Options',options);
0 Comments
Answers (1)
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!