Yes, in general, u and l are vectors, of the same dimensions as the number of
rows in A. In your example, A was only a single row, hence the scalar values of
u and l.
Ray
> On Sep 15, 2017, at 2:05 AM, 林巍 <[email protected]> wrote:
>
> 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]>
> [mailto:[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’s Manual
> <http://www.pserc.cornell.edu/matpower/docs/MATPOWER-manual-6.0.pdf>, 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 t_opf_mips()
> <http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/t/t_opf_mips.html>
> 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
> toggle_reserves()
> <http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/toggle_reserves.html>
> and toggle_iflims()
> <http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/toggle_iflims.html>
> are found in t_opf_userfcns()
> <http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/t/t_opf_userfcns.html>.
> Similarly, examples for using toggle_softlims()
> <http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/toggle_softlims.html>
> are found in t_opf_softlims()
> <http://www.pserc.cornell.edu/matpower/docs/ref/matpower6.0/t/t_opf_softlims.html>.
>
> 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.