Dear MATPOWER-Team
Thanks for your reply!
I use direct specification and it works. I also want to ask if matrix U and
matrix L could be vector ? I want to limit some variables.
发件人: [email protected]
[mailto:[email protected]] 代表 Ray Zimmerman
发送时间: 2017年9月14日 22:27
收件人: MATPOWER discussion forum
主题: Re: Asking for help about Extended the OPF
As described in Chapter 7 in the User
<http://www.pserc.cornell.edu/matpower/docs/MATPOWER-manual-6.0.pdf> ’s Manual,
there are two approaches to extend the OPF.
The first is the direct specification method, where you supply the A, l, u (and
possibly cost parameters) directly as arguments to opf(), as done in the
example in
<http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/t/t_opf_mips.html>
t_opf_mips() starting at line 177, or even better by assigning A, l, u, etc.
directly as fields in mpc. For example, in your case, I think you meant to do …
mpc = loadcase('case14');
mpopt = mpoption;
nb = size(mpc.bus, 1);
ng = size(mpc.gen, 1);
mpc.A = sparse(1, 1:14, 1, 1, 2*nb+2*ng);
mpc.l = 0;
mpc.u = 20;
runopf(mpc, mpopt)
The other option is to use callbacks as described in Sections 7.2-7.4 and
illustrated in the examples described in Section 7.5. Examples of how to use
<http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/toggle_reserves.html>
toggle_reserves() and
<http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/toggle_iflims.html>
toggle_iflims() are found in
<http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/t/t_opf_userfcns.html>
t_opf_userfcns(). Similarly, examples for using
<http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/toggle_softlims.html>
toggle_softlims() are found in
<http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/t/t_opf_softlims.html>
t_opf_softlims().
Hope this helps,
Ray
mpc=loadcase(‘case14’);
mpopt = mpoption;
mpc = ext2int(mpc);
Then I try to add a simple constraints to test,
om = opf_setup(mpc, mpopt);
mpc = add_userfcn(mpc, ‘formulation’ , myfunction(om));
Here myfunction is define_constants;
Define_constants
A =ones(1,14);
L = zeros(1,14);
U= ones(1,14)*20,
Om = add_constraints(om, ‘Myconstraints’,A,L,U,{‘Va’});
On Sep 14, 2017, at 7:09 AM, 林巍 <[email protected]
<mailto:[email protected]> > wrote:
Dear MATPOWER-Team
I try to add some variables, constraints or cost function , but I can’t
understand the document about Extended OPF Formulation .
First I load a case like
mpc=loadcase(‘case14’);
mpopt = mpoption;
mpc = ext2int(mpc);
Then I try to add a simple constraints to test,
om = opf_setup(mpc, mpopt);
mpc = add_userfcn(mpc, ‘formulation’ , myfunction(om));
Here myfunction is define_constants;
Define_constants
A =ones(1,14);
L = zeros(1,14);
U= ones(1,14)*20,
Om = add_constraints(om, ‘Myconstraints’,A,L,U,{‘Va’});
But I can’t use runopf(mpc), I don’t know how to solve the case.
In the case14, there is no reserves, I don’t know what the reserves
means,
I ask for an example to show the process about how to extend something.
I hope you can help me.