Dear Prof. Zimmerman,
I am about adding user-defined parts to my case, But I am facing some problems.
Could you please tell me what shall I do about this:
>> define_constants
>> mpc =
loadcase(case9);
>> mpopt =
mpoption('VERBOSE', 0, 'OUT_ALL', 0, 'PF_DC',1,'OPF_ALG_DC',100);
>> om =
opf_model(mpc)
>> get_mpc = (mpc)
>> mpc =
ext2int(mpc);
>> om = add_vars(om,
'Pg', 1, 100, -inf, inf);
>> om =
add_constraints(om, 'vl', [1], -10, 10, {'Pg'});
>> cp1 = struct('N',
[1], 'Cw', [1]);
>> om = add_costs(om,
'usr1', cp1, {'Pg'});
>> om
VARIABLES name i1 iN N
========= ------ ----- ----- ------
1: Pg 1 1 1
var.NS = 1 var.N = 1
NON-LINEAR CONSTRAINTS : <none>
LINEAR CONSTRAINTS name i1 iN N
================== ------ ----- ----- ------
1: vl 1 1 1
lin.NS = 1 lin.N = 1
COSTS name i1 iN N
===== ------ ----- ----- ------
1: usr1 1 1 1
cost.NS = 1 cost.N = 1
mpc =
version: '2'
baseMVA: 100
bus: [9x13 double]
gen: [3x21 double]
branch: [9x13 double]
areas: [1 5]
gencost: [3x7 double]
userdata = 1x1 struct array with no fields.
>> runopf(mpc)
MATPOWER Version 4.1,
14-Dec-2011 -- AC Optimal Power Flow
MATLAB Interior Point
Solver -- MIPS, Version 1.0, 07-Feb-2011
Converged!
Subscripted assignment
dimension mismatch.
Error in int2ext (line
106)
mpc.bus(o.bus.status.on, :) = o.int.bus;
Error in opf
(line 228)
results =
int2ext(results);
Error in runopf
(line 96)
[r, success] =
opf(casedata, mpopt);
Thank you so much.