RUNDCPF Runs a DC power flow. [RESULTS, SUCCESS] = RUNDCPF(CASEDATA, MPOPT, FNAME, SOLVEDCASE) Runs a DC power flow, 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 struct 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 SUCCESS : the success flag can additionally be returned as a second output argument Calling syntax options: results = rundcpf; results = rundcpf(casedata); results = rundcpf(casedata, mpopt); results = rundcpf(casedata, mpopt, fname); results = rundcpf(casedata, mpopt, fname, solvedcase); [results, success] = rundcpf(...); Alternatively, for compatibility with previous versions of MATPOWER, some of the results can be returned as individual output arguments: [baseMVA, bus, gen, branch, success, et] = rundcpf(...); Example: results = rundcpf('case30'); See also RUNPF.
0001 function varargout = rundcpf(casedata, mpopt, fname, solvedcase) 0002 %RUNDCPF Runs a DC power flow. 0003 % [RESULTS, SUCCESS] = RUNDCPF(CASEDATA, MPOPT, FNAME, SOLVEDCASE) 0004 % 0005 % Runs a DC power flow, optionally returning a RESULTS struct and 0006 % SUCCESS flag. 0007 % 0008 % Inputs (all are optional): 0009 % CASEDATA : either a MATPOWER case struct or a string containing 0010 % the name of the file with the case data (default is 'case9') 0011 % (see also CASEFORMAT and LOADCASE) 0012 % MPOPT : MATPOWER options struct to override default options 0013 % can be used to specify the solution algorithm, output options 0014 % termination tolerances, and more (see also MPOPTION). 0015 % FNAME : name of a file to which the pretty-printed output will 0016 % be appended 0017 % SOLVEDCASE : name of file to which the solved case will be saved 0018 % in MATPOWER case format (M-file will be assumed unless the 0019 % specified name ends with '.mat') 0020 % 0021 % Outputs (all are optional): 0022 % RESULTS : results struct, with the following fields: 0023 % (all fields from the input MATPOWER case, i.e. bus, branch, 0024 % gen, etc., but with solved voltages, power flows, etc.) 0025 % order - info used in external <-> internal data conversion 0026 % et - elapsed time in seconds 0027 % success - success flag, 1 = succeeded, 0 = failed 0028 % SUCCESS : the success flag can additionally be returned as 0029 % a second output argument 0030 % 0031 % Calling syntax options: 0032 % results = rundcpf; 0033 % results = rundcpf(casedata); 0034 % results = rundcpf(casedata, mpopt); 0035 % results = rundcpf(casedata, mpopt, fname); 0036 % results = rundcpf(casedata, mpopt, fname, solvedcase); 0037 % [results, success] = rundcpf(...); 0038 % 0039 % Alternatively, for compatibility with previous versions of MATPOWER, 0040 % some of the results can be returned as individual output arguments: 0041 % 0042 % [baseMVA, bus, gen, branch, success, et] = rundcpf(...); 0043 % 0044 % Example: 0045 % results = rundcpf('case30'); 0046 % 0047 % See also RUNPF. 0048 0049 % MATPOWER 0050 % Copyright (c) 1996-2016, Power Systems Engineering Research Center (PSERC) 0051 % by Ray Zimmerman, PSERC Cornell 0052 % 0053 % This file is part of MATPOWER. 0054 % Covered by the 3-clause BSD License (see LICENSE file for details). 0055 % See http://www.pserc.cornell.edu/matpower/ for more info. 0056 0057 %% default arguments 0058 if nargin < 4 0059 solvedcase = ''; %% don't save solved case 0060 if nargin < 3 0061 fname = ''; %% don't print results to a file 0062 if nargin < 2 0063 mpopt = mpoption; %% use default options 0064 if nargin < 1 0065 casedata = 'case9'; %% default data file is 'case9.m' 0066 end 0067 end 0068 end 0069 end 0070 0071 mpopt = mpoption(mpopt, 'model', 'DC'); 0072 [varargout{1:nargout}] = runpf(casedata, mpopt, fname, solvedcase);