Thanks Ray very much for your support! I greatly appreciate it
I will it give the code a go and come back to you with feedback Thanks and regards Mariusz From: bounce-124729090-81515...@list.cornell.edu <bounce-124729090-81515...@list.cornell.edu> On Behalf Of Ray Daniel Zimmerman Sent: Wednesday, June 24, 2020 4:10 PM To: MATPOWER-L <matpowe...@list.cornell.edu> Subject: Re: Extension to AC OPF - soft limits I don’t think there is a way to do this using the existing soft limits functionality in MATPOWER. However, it should be fairly straightforward to implement using user-defined linear constraints and costs, since all of your constraints and costs are linear. The simplest approach would probably be to use Direct Specification as described in Section 7.1 of the User’s Manual. Simply add A, l and u as extra fields in mpc to defined the constraints, with extra columns in A to define the s and T variables. Then add N and Cw as extras fields to define the cost on the new T variable (using the legacy cost format). I suppose you will also want to set the generator costs to zero in the gencost matrix. For example, A and N can be defined with 2*nb + 4*ng + 1 columns, corresponding to Va, Vm, Pg, Qg, sm, sp, T. The following (untested) code, should at least be close to what you want … nb = size(mpc.bus, 1); ng = size(mpc.gen, 1); I = speye(ng,ng); % ng x ng identity matrix Zb = sparse(ng, nb); % ng x nb zero matrix Zg = sparse(ng, ng); % ng x ng zero matrix % -Pg - sm <= -Plower A1 = [Zb Zb -I Zg -I Zg 0]; u1 = -Plower; % Pg - sp >= Pupper A2 = [Zb Zb I Zg -I Zg 0]; u2 = Pupper; % sm - T <= 0 A3 = [Zb Zb Zg Zg I Zg -1]; u3 = zeros(ng, 1); % sp - T <= 0 A4 = [Zb Zb Zg Zg Zg I -1]; u4 = zeros(ng, 1); mpc.A = [A1; A2; A3; A4]; mpc.u = [u1; u2; u3; u4]; mpc.N = [sparse(1, 2*nb+4*ng) 1]; % select T mpc.Cw = 1; Let me know how it works, Ray On Jun 23, 2020, at 2:58 PM, m.drabe...@onet.eu <mailto:m.drabe...@onet.eu> wrote: Dear community,, I am now working with soft limits on generation in AC-OPF. I know that these are natively supported by Matpower. However, I would like to change the formulation so to minimize the maximum value of limit violation on P_G , i.e. as in the model below: <image001.jpg> I would like to ask you all if this is anyhow supported by Matpower ? If yes, what would be the easiest way to do that? Thanks in advance and regards, Mariusz Drabecki, Operations and Systems Research Division Institute of Control and Computation Engineering Warsaw University of Technology