13 lines
478 B
Matlab
13 lines
478 B
Matlab
function CalCost(GenC,PG,PGi)
|
|
cost=GenC(:,2).*PG(PGi).^2+GenC(:,3).*PG(PGi)+GenC(:,4);
|
|
% Org_PG=[5;
|
|
% 2.5794];
|
|
% book_PG=[5.5056;
|
|
% 2.1568];
|
|
% cost2=GenC(:,2).*Org_PG(1:2).^2+GenC(:,3).*Org_PG(1:2)+GenC(:,4);
|
|
% cost3=GenC(:,2).*book_PG(1:2).^2+GenC(:,3).*book_PG(1:2)+GenC(:,4);
|
|
fprintf('总花费为%f\n',sum(cost,1));
|
|
% fprintf('PF总花费为%f\n',sum(cost2,1));
|
|
% fprintf('书上OPF总花费为%f\n',sum(cost3,1));
|
|
% fprintf('较书上减少费用为为%f\n',sum(cost3,1)-sum(cost,1));
|
|
end |