Unfortunately, the OPF routines in MATPOWER are not currently designed to 
handle integer variables. The integer variable capability indicated by 
add_vars() was added for MOST, where mixed integer solvers are explicitly 
called when integer variables are present.

If you are using DC OPF only, you may be able to easily modify dcopf_solver() 
to call miqps_matpower() instead of qps_matpower() when the problem has integer 
variables.
<< I'm working on a distribution network so I need an AC OPF.

I’m afraid for AC OPF there isn’t likely to be an easy workaround. My 
suggestion in that case is to see if you can find a formulation for your 
storage that doesn’t require integer variables. If it is related to avoiding 
simultaneous charge and discharge, you may not even need that constraint. It 
seems to me that simultaneous charge and discharge should never be optimal if 
there are charging/discharging inefficiencies.
<< In fact, without implementing the charge and downloading an integer variable 
to indicate the state of charge and discharge the results are good, I have 
charges and downloads in the same period but at least one of the two values is 
<10 ^ -4

Hope this helps,

    Ray


Diego

Da: Ray Zimmerman
Inviato: martedì 15 ottobre 2019 17:59
A: MATPOWER discussion forum
Oggetto: Re: Problems with add_vars function

Unfortunately, the OPF routines in MATPOWER are not currently designed to 
handle integer variables. The integer variable capability indicated by 
add_vars() was added for MOST, where mixed integer solvers are explicitly 
called when integer variables are present.

If you are using DC OPF only, you may be able to easily modify dcopf_solver() 
to call miqps_matpower() instead of qps_matpower() when the problem has integer 
variables.

I’m afraid for AC OPF there isn’t likely to be an easy workaround. My 
suggestion in that case is to see if you can find a formulation for your 
storage that doesn’t require integer variables. If it is related to avoiding 
simultaneous charge and discharge, you may not even need that constraint. It 
seems to me that simultaneous charge and discharge should never be optimal if 
there are charging/discharging inefficiencies.

Hope this helps,

    Ray



On Oct 9, 2019, at 2:20 PM, Diego Piserà <[email protected]> wrote:


Dear Dr. Zimmerman, Dear community
 
I am working on a multitemporal OPF with storage device using Matpower
 
To implement this problem I need to introduce new variables in the OPF 
formulation.
 
Two of these variables are integers, 'alphaCH'and 'alphaDS' .
 
using the runopf function the solution converges but unfortunately the 
variables 'alphaCH' 'alphaDS'are treated as continuous and not integer variables
 
 
Using Matpower 6.0 this is the code by which I add the function during the 
formulation:
 
function om = userfcn_multitemporalOPF_formulation(om, args)
 
global LoL LoI no_period no_SD SoCMax SoCmin SoC0;
 
define_constants;
% mpc = get_mpc(om);
no_SD = 1;
no_gen = 5;
no_ts = 24;
 
" OutmailID: 124021150, List: 'matpower-l', MemberID: 84819680 SCRIPT: "ADD 
Variable 
 
om = add_vars(om,'alphaCH', no_SD * no_ts, 0, zeros(no_SD * no_ts, 1), 
ones(no_SD * no_ts, 1), 'I');
om = add_vars(om,'alphaDS', no_SD * no_ts, 0, zeros(no_SD * no_ts, 1), 
ones(no_SD * no_ts, 1), 'I');
 
" TCL MERGE ERROR ( 10/15/2019 12:58:37 ): "extra characters after close-quote 
ADD Constrains
% contraints on State of Charge
A = args.Ar;
l = ones(args.no_period*args.no_SD,1).*(args.SoCmin-args.SoC0)/args.baseMVA;
u = ones(args.no_period*args.no_SD,1)*(args.SoCMax-args.SoC0)/args.baseMVA;
om = add_constraints(om, 'SoC', A, l, u,{'Pg'});
 
% constraint that avoid charge and discharge at the same time 
om = add_constraints(om, 'Pch_plus_aplha', args.Ar_CH, [], zeros(no_SD * 
no_ts,1), {'Pg','alphaCH'});
 
om = add_constraints(om, 'Pds_plus_aplha', args.Ar_DS, [], zeros(no_SD * 
no_ts,1), {'Pg','alphaDS'});
 
om = add_constraints(om, 'a_a',args.Ar_a_a, zeros(no_SD * no_ts, 1), ones(no_SD 
* no_ts, 1), {'alphaCH', 'alphaDS'} );
 
Who can tell me why matpower doesn't treat the two variables as whole numbers?
 
Diego Piserà


Reply via email to