RUNDUOPF Runs a DC optimal power flow with unit-decommitment heuristic. [RESULTS, SUCCESS] = RUNDUOPF(CASEDATA, MPOPT, FNAME, SOLVEDCASE) Runs a DC optimal power flow with a heuristic which allows it to shut down "expensive" generators optionally returning a RESULTS struct and SUCCESS flag. Inputs (all are optional): CASEDATA : either a MATPOWER case struct or a string containing the name of the file with the case data (default is 'case9') (see also CASEFORMAT and LOADCASE) MPOPT : MATPOWER options vector to override default options can be used to specify the solution algorithm, output options termination tolerances, and more (see also MPOPTION). FNAME : name of a file to which the pretty-printed output will be appended SOLVEDCASE : name of file to which the solved case will be saved in MATPOWER case format (M-file will be assumed unless the specified name ends with '.mat') Outputs (all are optional): RESULTS : results struct, with the following fields: (all fields from the input MATPOWER case, i.e. bus, branch, gen, etc., but with solved voltages, power flows, etc.) order - info used in external <-> internal data conversion et - elapsed time in seconds success - success flag, 1 = succeeded, 0 = failed (additional OPF fields, see OPF for details) SUCCESS : the success flag can additionally be returned as a second output argument Calling syntax options: results = runduopf; results = runduopf(casedata); results = runduopf(casedata, mpopt); results = runduopf(casedata, mpopt, fname); results = runduopf(casedata, mpopt, fname, solvedcase); [results, success] = runduopf(...); Alternatively, for compatibility with previous versions of MATPOWER, some of the results can be returned as individual output arguments: [baseMVA, bus, gen, gencost, branch, f, success, et] = runduopf(...); Example: results = runduopf('case30'); See also RUNDCOPF, RUNUOPF.
0001 function varargout = runduopf(casedata, mpopt, fname, solvedcase) 0002 %RUNDUOPF Runs a DC optimal power flow with unit-decommitment heuristic. 0003 % [RESULTS, SUCCESS] = RUNDUOPF(CASEDATA, MPOPT, FNAME, SOLVEDCASE) 0004 % 0005 % Runs a DC optimal power flow with a heuristic which allows it to shut 0006 % down "expensive" generators optionally returning a RESULTS struct and 0007 % SUCCESS flag. 0008 % 0009 % Inputs (all are optional): 0010 % CASEDATA : either a MATPOWER case struct or a string containing 0011 % the name of the file with the case data (default is 'case9') 0012 % (see also CASEFORMAT and LOADCASE) 0013 % MPOPT : MATPOWER options vector to override default options 0014 % can be used to specify the solution algorithm, output options 0015 % termination tolerances, and more (see also MPOPTION). 0016 % FNAME : name of a file to which the pretty-printed output will 0017 % be appended 0018 % SOLVEDCASE : name of file to which the solved case will be saved 0019 % in MATPOWER case format (M-file will be assumed unless the 0020 % specified name ends with '.mat') 0021 % 0022 % Outputs (all are optional): 0023 % RESULTS : results struct, with the following fields: 0024 % (all fields from the input MATPOWER case, i.e. bus, branch, 0025 % gen, etc., but with solved voltages, power flows, etc.) 0026 % order - info used in external <-> internal data conversion 0027 % et - elapsed time in seconds 0028 % success - success flag, 1 = succeeded, 0 = failed 0029 % (additional OPF fields, see OPF for details) 0030 % SUCCESS : the success flag can additionally be returned as 0031 % a second output argument 0032 % 0033 % Calling syntax options: 0034 % results = runduopf; 0035 % results = runduopf(casedata); 0036 % results = runduopf(casedata, mpopt); 0037 % results = runduopf(casedata, mpopt, fname); 0038 % results = runduopf(casedata, mpopt, fname, solvedcase); 0039 % [results, success] = runduopf(...); 0040 % 0041 % Alternatively, for compatibility with previous versions of MATPOWER, 0042 % some of the results can be returned as individual output arguments: 0043 % 0044 % [baseMVA, bus, gen, gencost, branch, f, success, et] = runduopf(...); 0045 % 0046 % Example: 0047 % results = runduopf('case30'); 0048 % 0049 % See also RUNDCOPF, RUNUOPF. 0050 0051 % MATPOWER 0052 % $Id: runduopf.m,v 1.12 2010/04/26 19:45:25 ray Exp $ 0053 % by Ray Zimmerman, PSERC Cornell 0054 % Copyright (c) 1996-2010 by Power System Engineering Research Center (PSERC) 0055 % 0056 % This file is part of MATPOWER. 0057 % See http://www.pserc.cornell.edu/matpower/ for more info. 0058 % 0059 % MATPOWER is free software: you can redistribute it and/or modify 0060 % it under the terms of the GNU General Public License as published 0061 % by the Free Software Foundation, either version 3 of the License, 0062 % or (at your option) any later version. 0063 % 0064 % MATPOWER is distributed in the hope that it will be useful, 0065 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0066 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0067 % GNU General Public License for more details. 0068 % 0069 % You should have received a copy of the GNU General Public License 0070 % along with MATPOWER. If not, see <http://www.gnu.org/licenses/>. 0071 % 0072 % Additional permission under GNU GPL version 3 section 7 0073 % 0074 % If you modify MATPOWER, or any covered work, to interface with 0075 % other modules (such as MATLAB code and MEX-files) available in a 0076 % MATLAB(R) or comparable environment containing parts covered 0077 % under other licensing terms, the licensors of MATPOWER grant 0078 % you additional permission to convey the resulting work. 0079 0080 %% default arguments 0081 if nargin < 4 0082 solvedcase = ''; %% don't save solved case 0083 if nargin < 3 0084 fname = ''; %% don't print results to a file 0085 if nargin < 2 0086 mpopt = mpoption; %% use default options 0087 if nargin < 1 0088 casedata = 'case9'; %% default data file is 'case9.m' 0089 end 0090 end 0091 end 0092 end 0093 0094 mpopt = mpoption(mpopt, 'PF_DC', 1); 0095 [varargout{1:nargout}] = runuopf(casedata, mpopt, fname, solvedcase);