Home > matpower5.1 > 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 %   Copyright (c) 1996-2015 by Power System Engineering Research Center (PSERC)
0017 %   by Ray Zimmerman, PSERC Cornell
0018 %   and Carlos E. Murillo-Sanchez, PSERC Cornell & Universidad Autonoma de Manizales
0019 %
0020 %   $Id: update_mupq.m 2644 2015-03-11 19:34:22Z ray $
0021 %
0022 %   This file is part of MATPOWER.
0023 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0024 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0025 
0026 %% extract the constraint parameters
0027 [ipqh, ipql, Apqhdata, Apqldata] = ...
0028     deal(data.ipqh, data.ipql, data.h, data.l);
0029 
0030 %% define named indices into data matrices
0031 [GEN_BUS, PG, QG, QMAX, QMIN, VG, MBASE, GEN_STATUS, PMAX, PMIN, ...
0032     MU_PMAX, MU_PMIN, MU_QMAX, MU_QMIN, PC1, PC2, QC1MIN, QC1MAX, ...
0033     QC2MIN, QC2MAX, RAMP_AGC, RAMP_10, RAMP_30, RAMP_Q, APF] = idx_gen;
0034 
0035 %% combine original limit multipliers into single value
0036 muP = gen(:, MU_PMAX) - gen(:, MU_PMIN);
0037 muQ = gen(:, MU_QMAX) - gen(:, MU_QMIN);
0038 
0039 %% add P and Q components of multipliers on upper sloped constraint
0040 muP(ipqh) = muP(ipqh) - mu_PQh .* Apqhdata(:,1)/baseMVA;
0041 muQ(ipqh) = muQ(ipqh) - mu_PQh .* Apqhdata(:,2)/baseMVA;
0042 
0043 %% add P and Q components of multipliers on lower sloped constraint
0044 muP(ipql) = muP(ipql) - mu_PQl .* Apqldata(:,1)/baseMVA;
0045 muQ(ipql) = muQ(ipql) - mu_PQl .* Apqldata(:,2)/baseMVA;
0046 
0047 %% split back into upper and lower multipliers based on sign
0048 gen(:, MU_PMAX) = (muP > 0) .*  muP;
0049 gen(:, MU_PMIN) = (muP < 0) .* -muP;
0050 gen(:, MU_QMAX) = (muQ > 0) .*  muQ;
0051 gen(:, MU_QMIN) = (muQ < 0) .* -muQ;

Generated on Fri 20-Mar-2015 18:23:34 by m2html © 2005