Created
November 22, 2018 04:01
-
-
Save swanav/5d22c00ecd0952aab6a646ddf4c708c1 to your computer and use it in GitHub Desktop.
Economical Optimization w/o G limits.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clc; clearvars; | |
lambda = 6; | |
a = [0.004 0.006 0.009]; | |
b = [5.3 5.5 5.8]; | |
c = [500 400 200]; | |
Pd = 800; | |
error = 100; | |
tolerance = 0.001; | |
k = 0; | |
while(error > tolerance) | |
k = k + 1; | |
P(k,:) = (lambda - b)./(2*a); | |
error = abs(sum(P(k,:))-Pd); | |
deltaLambda = error/sum(1./(2*a)); | |
lambda = lambda + deltaLambda; | |
end | |
Ci = sum(a.*P(k,:).^2+b.*P(k,:)+c); | |
fprintf('Total load: \t\t%.3f MW\n', Pd); | |
disp('Load shared by each unit (in MW): '); | |
disp(P(k,:)); | |
fprintf('Incremental cost: \t$ %.3f \n', lambda); | |
fprintf('Total cost: \t\t$ %.3f /h\n', Ci); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment