RUNOPF_W_RES Runs an optimal power flow with fixed zonal reserves. RESULTS = RUNOPF_W_RES(CASEDATA, MPOPT, FNAME, SOLVEDCASE) [RESULTS, SUCCESS] = RUNOPF_W_RES(CASEDATA, MPOPT, FNAME, SOLVEDCASE) Runs an optimal power flow with the addition of reserve requirements specified as a set of fixed zonal reserves. See RUNOPF for a description of the input and output arguments, which are the same, with the exception that the case file or struct CASEDATA must define a 'reserves' field, which is a struct with the following fields: zones nrz x ng, zone(i, j) = 1, if gen j belongs to zone i 0, otherwise req nrz x 1, zonal reserve requirement in MW cost (ng or ngr) x 1, cost of reserves in $/MW qty (ng or ngr) x 1, max quantity of reserves in MW (optional) where nrz is the number of reserve zones and ngr is the number of generators belonging to at least one reserve zone and ng is the total number of generators. In addition to the normal OPF output, the RESULTS struct contains a new 'reserves' field with the following fields, in addition to those provided in the input: R - ng x 1, reserves provided by each gen in MW Rmin - ng x 1, lower limit on reserves provided by each gen, (MW) Rmax - ng x 1, upper limit on reserves provided by each gen, (MW) mu.l - ng x 1, shadow price on reserve lower limit, ($/MW) mu.u - ng x 1, shadow price on reserve upper limit, ($/MW) mu.Pmax - ng x 1, shadow price on Pg + R <= Pmax constraint, ($/MW) prc - ng x 1, reserve price for each gen equal to maximum of the shadow prices on the zonal requirement constraint for each zone the generator belongs to See T_CASE30_USERFCNS for an example case file with fixed reserves, and TOGGLE_RESERVES for the implementation. Calling syntax options: results = runopf_w_res(casedata); results = runopf_w_res(casedata, mpopt); results = runopf_w_res(casedata, mpopt, fname); results = runopf_w_res(casedata, mpopt, fname, solvedcase); [results, success] = runopf_w_res(...); Example: results = runopf_w_res('t_case30_userfcns'); See also RUNOPF, TOGGLE_RESERVES, T_CASE30_USERFCNS.
0001 function [varargout] = runopf_w_res(varargin) 0002 %RUNOPF_W_RES Runs an optimal power flow with fixed zonal reserves. 0003 % RESULTS = RUNOPF_W_RES(CASEDATA, MPOPT, FNAME, SOLVEDCASE) 0004 % [RESULTS, SUCCESS] = RUNOPF_W_RES(CASEDATA, MPOPT, FNAME, SOLVEDCASE) 0005 % 0006 % Runs an optimal power flow with the addition of reserve requirements 0007 % specified as a set of fixed zonal reserves. See RUNOPF for a 0008 % description of the input and output arguments, which are the same, 0009 % with the exception that the case file or struct CASEDATA must define 0010 % a 'reserves' field, which is a struct with the following fields: 0011 % zones nrz x ng, zone(i, j) = 1, if gen j belongs to zone i 0012 % 0, otherwise 0013 % req nrz x 1, zonal reserve requirement in MW 0014 % cost (ng or ngr) x 1, cost of reserves in $/MW 0015 % qty (ng or ngr) x 1, max quantity of reserves in MW (optional) 0016 % where nrz is the number of reserve zones and ngr is the number of 0017 % generators belonging to at least one reserve zone and ng is the total 0018 % number of generators. 0019 % 0020 % In addition to the normal OPF output, the RESULTS struct contains a 0021 % new 'reserves' field with the following fields, in addition to those 0022 % provided in the input: 0023 % R - ng x 1, reserves provided by each gen in MW 0024 % Rmin - ng x 1, lower limit on reserves provided by each gen, (MW) 0025 % Rmax - ng x 1, upper limit on reserves provided by each gen, (MW) 0026 % mu.l - ng x 1, shadow price on reserve lower limit, ($/MW) 0027 % mu.u - ng x 1, shadow price on reserve upper limit, ($/MW) 0028 % mu.Pmax - ng x 1, shadow price on Pg + R <= Pmax constraint, ($/MW) 0029 % prc - ng x 1, reserve price for each gen equal to maximum of the 0030 % shadow prices on the zonal requirement constraint 0031 % for each zone the generator belongs to 0032 % 0033 % See T_CASE30_USERFCNS for an example case file with fixed reserves, 0034 % and TOGGLE_RESERVES for the implementation. 0035 % 0036 % Calling syntax options: 0037 % results = runopf_w_res(casedata); 0038 % results = runopf_w_res(casedata, mpopt); 0039 % results = runopf_w_res(casedata, mpopt, fname); 0040 % results = runopf_w_res(casedata, mpopt, fname, solvedcase); 0041 % [results, success] = runopf_w_res(...); 0042 % 0043 % Example: 0044 % results = runopf_w_res('t_case30_userfcns'); 0045 % 0046 % See also RUNOPF, TOGGLE_RESERVES, T_CASE30_USERFCNS. 0047 0048 % MATPOWER 0049 % Copyright (c) 2008-2016, Power Systems Engineering Research Center (PSERC) 0050 % by Ray Zimmerman, PSERC Cornell 0051 % 0052 % This file is part of MATPOWER. 0053 % Covered by the 3-clause BSD License (see LICENSE file for details). 0054 % See http://www.pserc.cornell.edu/matpower/ for more info. 0055 0056 mpc = loadcase(varargin{1}); 0057 mpc = toggle_reserves(mpc, 'on'); 0058 [varargout{1:nargout}] = runopf(mpc, varargin{2:nargin}); 0059 0060 if nargout > 0 && isstruct(varargout{1}) 0061 varargout{1} = toggle_reserves(varargout{1}, 'off'); 0062 end