Home > matpower4.0 > update_mupq.m

update_mupq

PURPOSE ^

UPDATE_MUPQ Updates values of generator limit shadow prices.

SYNOPSIS ^

function gen = update_mupq(baseMVA, gen, mu_PQh, mu_PQl, data)

DESCRIPTION ^

UPDATE_MUPQ  Updates values of generator limit shadow prices.
   GEN = UPDATE_MUPQ(BASEMVA, GEN, MU_PQH, MU_PQL, DATA)

   Updates the values of MU_PMIN, MU_PMAX, MU_QMIN, MU_QMAX based
   on any shadow prices on the sloped portions of the generator
   capability curve constraints.

   MU_PQH - shadow prices on upper sloped portion of capability curves
   MU_PQL - shadow prices on lower sloped portion of capability curves
   DATA   - "data" struct returned by MAKEAPQ

   See also MAKEAPQ.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function gen = update_mupq(baseMVA, gen, mu_PQh, mu_PQl, data)
0002 %UPDATE_MUPQ  Updates values of generator limit shadow prices.
0003 %   GEN = UPDATE_MUPQ(BASEMVA, GEN, MU_PQH, MU_PQL, DATA)
0004 %
0005 %   Updates the values of MU_PMIN, MU_PMAX, MU_QMIN, MU_QMAX based
0006 %   on any shadow prices on the sloped portions of the generator
0007 %   capability curve constraints.
0008 %
0009 %   MU_PQH - shadow prices on upper sloped portion of capability curves
0010 %   MU_PQL - shadow prices on lower sloped portion of capability curves
0011 %   DATA   - "data" struct returned by MAKEAPQ
0012 %
0013 %   See also MAKEAPQ.
0014 
0015 %   MATPOWER
0016 %   $Id: update_mupq.m,v 1.8 2010/04/26 19:45:25 ray Exp $
0017 %   by Ray Zimmerman, PSERC Cornell
0018 %   and Carlos E. Murillo-Sanchez, PSERC Cornell & Universidad Autonoma de Manizales
0019 %   Copyright (c) 1996-2010 by Power System Engineering Research Center (PSERC)
0020 %
0021 %   This file is part of MATPOWER.
0022 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0023 %
0024 %   MATPOWER is free software: you can redistribute it and/or modify
0025 %   it under the terms of the GNU General Public License as published
0026 %   by the Free Software Foundation, either version 3 of the License,
0027 %   or (at your option) any later version.
0028 %
0029 %   MATPOWER is distributed in the hope that it will be useful,
0030 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0031 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0032 %   GNU General Public License for more details.
0033 %
0034 %   You should have received a copy of the GNU General Public License
0035 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0036 %
0037 %   Additional permission under GNU GPL version 3 section 7
0038 %
0039 %   If you modify MATPOWER, or any covered work, to interface with
0040 %   other modules (such as MATLAB code and MEX-files) available in a
0041 %   MATLAB(R) or comparable environment containing parts covered
0042 %   under other licensing terms, the licensors of MATPOWER grant
0043 %   you additional permission to convey the resulting work.
0044 
0045 
0046 [ipqh, ipql, Apqhdata, Apqldata] = ...
0047     deal(data.ipqh, data.ipql, data.h, data.l);
0048 
0049 %% define named indices into data matrices
0050 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...
0051     MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
0052     QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
0053 
0054 % If we succeeded and there were generators with general PQ curve
0055 % characteristics, this is the time to re-compute the multipliers,
0056 % splitting any nonzero multiplier on one of the linear bounds among the
0057 % Pmax, Pmin, Qmax or Qmin limits, producing one multiplier for a P limit and
0058 % another for a Q limit. For upper Q limit, if we are neither at Pmin nor at
0059 % Pmax, the limit is taken as Pmin if the Qmax line's normal has a negative P
0060 % component, Pmax if it has a positive P component. Messy but there really
0061 % are many cases.
0062 muPmax = gen(:, MU_PMAX);
0063 muPmin = gen(:, MU_PMIN);
0064 if ~isempty(mu_PQh)
0065 %   gen(:, [MU_PMIN MU_PMAX MU_QMIN MU_QMAX])
0066   k = 1;
0067   for i = ipqh'
0068     if muPmax(i) > 0
0069       gen(i,MU_PMAX)=gen(i,MU_PMAX)-mu_PQh(k)*Apqhdata(k,1)/baseMVA;
0070     elseif muPmin(i) > 0
0071       gen(i,MU_PMIN)=gen(i,MU_PMIN)+mu_PQh(k)*Apqhdata(k,1)/baseMVA;
0072     else
0073       if Apqhdata(k, 1) >= 0
0074          gen(i,MU_PMAX)=gen(i,MU_PMAX)-mu_PQh(k)*Apqhdata(k,1)/baseMVA;
0075       else
0076          gen(i,MU_PMIN)=gen(i,MU_PMIN)+mu_PQh(k)*Apqhdata(k,1)/baseMVA;
0077       end
0078     end
0079     gen(i,MU_QMAX)=gen(i,MU_QMAX)-mu_PQh(k)*Apqhdata(k,2)/baseMVA;
0080     k = k + 1;
0081   end
0082 end
0083 
0084 if ~isempty(mu_PQl)
0085 %   gen(:, [MU_PMIN MU_PMAX MU_QMIN MU_QMAX])
0086   k = 1;
0087   for i = ipql'
0088     if muPmax(i) > 0
0089       gen(i,MU_PMAX)=gen(i,MU_PMAX)-mu_PQl(k)*Apqldata(k,1)/baseMVA;
0090     elseif muPmin(i) > 0
0091       gen(i,MU_PMIN)=gen(i,MU_PMIN)+mu_PQl(k)*Apqldata(k,1)/baseMVA;
0092     else
0093       if Apqldata(k,1) >= 0
0094         gen(i,MU_PMAX)=gen(i,MU_PMAX)-mu_PQl(k)*Apqldata(k,1)/baseMVA;
0095       else
0096         gen(i,MU_PMIN)=gen(i,MU_PMIN)+mu_PQl(k)*Apqldata(k,1)/baseMVA;
0097       end
0098     end
0099     gen(i,MU_QMIN)=gen(i,MU_QMIN)+mu_PQl(k)*Apqldata(k,2)/baseMVA;
0100     k = k + 1;
0101   end
0102 %   gen(:, [MU_PMIN MU_PMAX MU_QMIN MU_QMAX])
0103 %   -[ mu_PQl(1:2) mu_PQh(1:2) ]/baseMVA
0104 %   -[ mu_PQl(1:2).*Apqldata(1:2,1) mu_PQh(1:2).*Apqhdata(1:2,1) ]/baseMVA
0105 %   -[ mu_PQl(1:2).*Apqldata(1:2,2) mu_PQh(1:2).*Apqhdata(1:2,2) ]/baseMVA
0106 end

Generated on Mon 26-Jan-2015 14:56:45 by m2html © 2005