El programa nos sirve para determinar cuándo, qué y dónde se requieren las plantas de
generación para que las cargas se suministren adecuadamente para un sistema en
proyecto futuro. En el programa de MATLAB mostramos el código siguiente:
Se inicia con el siguiente código mostrado.
En estos códigos nos pide introducción de los datos de la subestación que lo
tenemos en la siguiente tabla:
Con el siguiente código recuperamos los datos de entrada.
Costo de inversión de la planta.
Costo de Operación y mantenimiento de la planta.
Coeficiente de interés anual.
Costo de combustible.
Con la siguiente función se muestra los datos en pantalla.
FUNCION: fprintf(formatSpec,A1,...,An) da formato a los datos y muestra los resultados en la pantalla.
En nuestro programa son los siguientes códigos:
if isempty(Capaci_Gen) fprintf('Input argument "Capaci_Gen" determining'); fprintf(' capacity type plants.\n'); error('"Capaci_Gen" is undefined and must be determined.'); end if isempty(Invest_Gen) fprintf('Input argument "Invest_Gen" determining'); fprintf(' investment cost type plants.\n'); error('"Invest_Gen" is undefined and must be determined.'); end if isempty(Life_Gen) fprintf('Input argument "Life_Gen" determining'); fprintf(' life type plants.\n'); error('"Life_Gen" is undefined and must be determined.'); end if isempty(FuelCost_Gen) fprintf('Input argument "FuelCost_Gen" determining'); fprintf('fuel cost type plants.\n'); error('"FuelCost_Gen" is undefined and must be determined.'); end if isempty(O_MCost_Gen) fprintf('Input argument "O_MCost_Gen" determining'); fprintf(' operation and maintenance cost type plants.\n'); error('"O_MCost_Gen" is undefined and must be determined.'); end if isempty(Load) fprintf('Input argument "Load" determining'); fprintf(' maximum network load(MW).\n'); error('"Load" is undefined and must be determined.'); end if isempty(Reserv) fprintf('Input argument "Reserv" determining'); fprintf(' reserve ratio.\n'); error('"Reserv" is undefined and must be determined.'); end if isempty(Interest_rate) fprintf('Input argument "Interest_rate" determining'); fprintf(' coefficient of annual interest.\n'); error('"Interest_rate" is undefined & must be determined.'); end if isempty(Exist_Cap) fprintf('Input argument "Exist_Cap" determining'); fprintf(' capacity of existing plants.\n'); error('"Exist_Cap" is undefined and must be determined.'); end if isempty(Exist_FuelCost) fprintf('Input argument "Exist_FuelCost" determining'); fprintf(' existing power plants, fuel costs.\n'); error('"Exist_FuelCost" is undefined & must be determined'); end % if (Capaci_Gen==0) fprintf('Input argument "Capaci_Gen" determining'); fprintf(' capacity type plants.\n'); error('"Capaci_Gen" should not be zero.'); end if (find(Life_Gen==0)) fprintf('Input argument "Life_Gen" determining'); fprintf(' life type plants.\n'); error('"Life_Gen" should not be zero.'); end if (Load==0) fprintf('Input argument "Load" determining'); fprintf(' maximum network load(MW).\n'); error('"Load" should not be zero.'); end if (Reserv<0) fprintf('Input argument "Reserv" determining'); fprintf(' reserve ratio.\n'); error('"Reserv" should not be less than zero.'); end if (Interest_rate<=0) fprintf('Input argument "Interest_rate" determining'); fprintf(' coefficient of annual interest.\n'); error('"Interest_rate" should be greater than zero.'); end
La siguiente programación es para escoger los mejores datos de la planta a
proyecto futuro.
Cheap Fuel = FuelCost_Gen;
Cheap Fuel(4) = Exist_FuelCost; [heap Fuel,ICheapFuel] = sort('Cheap Fuel'); A = (1+Interest_rate); for i = 1:3 A_P(i) = (A^Life_Gen(i,1))*Interest_rate; A_P(i) = A_P(i)/(A^Life_Gen(i,1)-1); end B = zeros (3,1331); m = 0; %Create all the solution space for i = 0:10 for j = 0:10 for k = 0:10 m = m+1; B(1,m) = i; B(2,m) = j; B(3,m) = k; end end end %Calculate the cost of each choice for i = 1:1331 Total_Cap = Exist_Cap+B(1,i)*Capaci_Gen(1)+B(2,i)*... Capaci_Gen(2)+B(3,i)*Capaci_Gen(3); if Total_Cap < Load*(1+Reserv) Total_Cost(i) = 1.0e12; else Total_Cost(i) = 0.0; %Calculate the energy production plant Energy = Load*8760; Energy1 = Energy; for j = 1:3 Energy_Gen(j) = B(j,i) * Capaci_Gen(j) * 8760; end Energy_Gen(4)=Exist_Cap*8760; for j = 1:4 ii = ICheapFuel(j); Energy1 = Energy1-Energy_Gen(ii); if Energy1<0.0 Energy_Gen(ii) = Energy1+Energy_Gen(ii); if Energy_Gen(ii)<0.0 Energy_Gen(ii) = 0.0; end end end if Energy1<=0.0 for j = 1:3 Total_Cost(i) = Total_Cost(i)+... B(j,i)*Capaci_Gen(j)*... (Invest_Gen(j)*A_P(j)+O_MCost_Gen(j))... +FuelCost_Gen(j)*Energy_Gen(j); end Total_Cost(i) = Total_Cost(i)+... Exist_FuelCost*Energy_Gen(4); else Total_Cost(i) = 1.0e12; end end end %Choose the best option [Solution,II] = min(Total_Cost); Best_Gen(1) = B(1,II); Best_Gen(2) = B(2,II); Best_Gen(3) = B(3,II); Energy1 = Energy; for j = 1:3 Energy_Gen(j) = Best_Gen(j)*Capaci_Gen(j)*8760; end Energy_Gen(4) = Exist_Cap*8760; for j = 1:4 ii = ICheapFuel(j); Energy1 = Energy1-Energy_Gen(ii); if Energy1<0.0 Energy_Gen(ii) = Energy1+Energy_Gen(ii); if Energy_Gen(ii)<0.0 Energy_Gen(ii) = 0.0; end end end
Obtendremos resultados como la siguiente tabla.
Con la siguiente programación optimizamos los datos de la planta para el suministro a bajo precio.
%% Print different costs and optimal capacity of each plant