clc;clear all;
P_Critic= [1.7 1.8 1.5 1.7 1.6 1.6 2.3 2.3 2.1 2.3 1.9 2 1.75 2.5 2.5 1.5 1.2 1.5 1.4 1.3 1 1.2 1.2 1.4];
P_Critic= reshape((P_Critic’ones(1,60))’,1,2460);
T=1440;
P_AC=zeros(1,1440);
P_AC(540:720)=1.5;
P_AC(1080:1260)=1.5;
P_WH=zeros(1,1440);
P_WH(420:600)=1.5;
P_WH(1200:1380)=1.5;
n = 4; % number of cars
Pmax = [6 6 2 2]; % generator capacities
Pmin = [0 0 0 0]; % generator capacities
R = [0.1 0.2 0.5 1.5]; % ramp-rate limits
alpha =[1 1 1 1]; % linear cost fct coeffs
beta = 0.1*ones(1,n); % quadratic cost fct coeffs
gamma = [3 0.5 0.5 0.1]; % power change cost fct coeffs
cvx_begin
variables p(n,T) P_Total(1,T) xa(1,T) % P_CD(1,T)
subject to
p <= (Pmax’)ones(1,T);
p >= Pmin’ones(1,T);
P_Total== 2(P_AC+P_WH+xa+P_Critic);
sum(p,1) == P_Total;
sum(xa(1:250))==90 * 3.5;
3.5>=xa>=0
power_cost= sum(alpha * p+beta(p.^2))
minimize (power_cost)
cvx_end
Hello everyone,
I have a small issue regarding of my code. I would like to optimize “p” that is based on some powers. Powers are constant except “xa”, I would like to get xa between some certain amount of time so it is kind of flexible. Algorithm is given me result but xa is fluctuating between limits however I want to get max. or 0 instead of various number. I dont know is there anyway that I can put into code and improve the results? Thanks