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 % $Id: runopf_w_res.m 1635 2010-04-26 19:45:26Z ray $ 0050 % by Ray Zimmerman, PSERC Cornell 0051 % Copyright (c) 2008-2010 by Power System Engineering Research Center (PSERC) 0052 % 0053 % This file is part of MATPOWER. 0054 % See http://www.pserc.cornell.edu/matpower/ for more info. 0055 % 0056 % MATPOWER is free software: you can redistribute it and/or modify 0057 % it under the terms of the GNU General Public License as published 0058 % by the Free Software Foundation, either version 3 of the License, 0059 % or (at your option) any later version. 0060 % 0061 % MATPOWER is distributed in the hope that it will be useful, 0062 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0063 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0064 % GNU General Public License for more details. 0065 % 0066 % You should have received a copy of the GNU General Public License 0067 % along with MATPOWER. If not, see <http://www.gnu.org/licenses/>. 0068 % 0069 % Additional permission under GNU GPL version 3 section 7 0070 % 0071 % If you modify MATPOWER, or any covered work, to interface with 0072 % other modules (such as MATLAB code and MEX-files) available in a 0073 % MATLAB(R) or comparable environment containing parts covered 0074 % under other licensing terms, the licensors of MATPOWER grant 0075 % you additional permission to convey the resulting work. 0076 0077 mpc = loadcase(varargin{1}); 0078 mpc = toggle_reserves(mpc, 'on'); 0079 [varargout{1:nargout}] = runopf(mpc, varargin{2:nargin}); 0080 0081 if nargout > 0 && isstruct(varargout{1}) 0082 varargout{1} = toggle_reserves(varargout{1}, 'off'); 0083 end