Solving economic dispatch problem

17 ビュー (過去 30 日間)
Hkl
Hkl 2023 年 3 月 19 日
移動済み: Torsten 2023 年 3 月 19 日
This code is about solving economic dispatch problem with constraints. (pmax,pmin, ramp rate, reserve power)
But solution dosen't match with demand. how can i fix this?
genp = [500 150 1 5 10 40 60
700 200 2 17 20 40 30
750 250 3 15 5 30 40
550 100 4 20 7 50 50
600 50 5 30 15 10 10
300 0 6 10 17 60 20];
Pmax = genp(:,1).*ones(6,24);
Pmin = genp(:,2).*ones(6,24);
a = genp(:,3).*ones(6,24);
b = genp(:,4).*ones(6,24);
c = genp(:,5).*ones(6,24);
RU = genp(:,6).*ones(6,24);
RD = genp(:,7).*ones(6,24);
Demand = [2000 1753 1521 1318 1159 1051 1003 1016 1091 1222 ...
1402 1618 1859 2108 2351 2572 2757 2895 2978 2999 ...
2959 2859 2706 2508];
Reserve = [263 282 125 283 227 119 155 209 292 293 131 295 ...
292 197 260 128 184 284 259 292 231 107 270 287];
p = optimvar('p',6,24,'LowerBound',0);
x0 = zeros(6*24,1);
opt = optimproblem;
opt.Objective = sum(sum(a.*p.*p) + sum(b.*p) + sum(c));
opt.Constraints.consmax = optimconstr(6,24);
opt.Constraints.consmin = optimconstr(6,24);
for g = 1:6
for t = 1:24
opt.Constraints.consmax(g,t) = Pmin(g,t) <= p(g,t);
opt.Constraints.consmin(g,t) = p(g,t) <= Pmax(g,t);
end
end
opt.Constraints.consG = optimconstr(24);
for t=1:24
opt.Constraints.consG(t) = sum(p(:,t)) == Demand(t) + Reserve(t);
end
opt.Constraints.consRU = optimconstr(6,24);
opt.Constraints.consRD = optimconstr(6,24);
for g = 1:6
for t = 2:24
opt.Constraints.consRU(g,t) = p(g,t) - p(g,t-1) <= RU(g,t);
opt.Constraints.consRD(g,t) = p(g,t-1) - p(g,t) <= RD(g,t);
end
end
problem = prob2struct(opt,'ObjectiveDerivative','finite-differences',...
'Solver','quadprog');
problem.x0 =x0;
[sol,fval,exitflag,output] = quadprog(problem);
The interior-point-convex algorithm does not accept an initial point. Ignoring X0. No feasible solution found. quadprog stopped because it was unable to find a point that satisfies the constraints within the value of the constraint tolerance.
fval;
g = zeros(6,24);
for t = 1:24
g(:,t) = sol(6*(t-1)+1:6*t);
end
plot(g');

採用された回答

Torsten
Torsten 2023 年 3 月 19 日
移動済み: Torsten 2023 年 3 月 19 日
The message from "quadprog" says that no feasible solution can be found. So you will have to reconsider your constraints - it seems they cannot be satisfied.
I think you will have to use
opt.Constraints.consG = optimconstr(24);
for t=1:24
opt.Constraints.consG(t) = sum(p(:,t)) >= Demand(t) + Reserve(t);
end
instead of
opt.Constraints.consG = optimconstr(24);
for t=1:24
opt.Constraints.consG(t) = sum(p(:,t)) == Demand(t) + Reserve(t);
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Problem-Based Optimization and Equations についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by