-
Notifications
You must be signed in to change notification settings - Fork 1
/
runsdpopf.m
executable file
·74 lines (71 loc) · 3.07 KB
/
runsdpopf.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function varargout = runsdpopf(casedata, mpopt, fname, solvedcase)
%RUNSDPOPF Runs a semidefinite relaxation of the AC optimal power flow.
% [RESULTS, SUCCESS] = RUNSDPOPF(CASEDATA, MPOPT, FNAME, SOLVEDCASE)
%
% Runs a semidefinite programming relaxation of the AC optimal 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
% (additional OPF fields, see OPF for details)
% SUCCESS : the success flag can additionally be returned as
% a second output argument
%
% Calling syntax options:
% results = runsdpopf;
% results = runsdpopf(casedata);
% results = runsdpopf(casedata, mpopt);
% results = runsdpopf(casedata, mpopt, fname);
% results = runsdpopf(casedata, mpopt, fname, solvedcase);
% [results, success] = runsdpopf(...);
%
% 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] = runsdpopf(...);
%
% Example:
% results = runsdpopf('case30');
%
% See also RUNOPF.
% MATPOWER
% Copyright (c) 1996-2019, Power Systems Engineering Research Center (PSERC)
% by Ray Zimmerman, PSERC Cornell
% and Daniel Molzahn, PSERC U of Wisc, Madison
%
% This file is part of MATPOWER/mx-sdp_pf.
% Covered by the 3-clause BSD License (see LICENSE file for details).
% See https://github.com/MATPOWER/mx-sdp_pf/ for more info.
%% default arguments
if nargin < 4
solvedcase = ''; %% don't save solved case
if nargin < 3
fname = ''; %% don't print results to a file
if nargin < 2
mpopt = mpoption; %% use default options
if nargin < 1
casedata = 'case9'; %% default data file is 'case9.m'
end
end
end
end
mpopt = mpoption(mpopt, 'opf.ac.solver', 'SDPOPF');
[varargout{1:nargout}] = runopf(casedata, mpopt, fname, solvedcase);