Home > matpower5.1 > pqcost.m

pqcost

PURPOSE ^

PQCOST Splits the gencost variable into two pieces if costs are given for Qg.

SYNOPSIS ^

function [pcost, qcost] = pqcost(gencost, ng, on)

DESCRIPTION ^

PQCOST  Splits the gencost variable into two pieces if costs are given for Qg.
   [PCOST, QCOST] = PQCOST(GENCOST, NG, ON) checks whether GENCOST has
   cost information for reactive power generation (rows ng+1 to 2*ng).
   If so, it returns the first NG rows in PCOST and the last NG rows in
   QCOST. Otherwise, leaves QCOST empty. Also does some error checking.
   If ON is specified (list of indices of generators which are on line)
   it only returns the rows corresponding to these generators.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [pcost, qcost] = pqcost(gencost, ng, on)
0002 %PQCOST  Splits the gencost variable into two pieces if costs are given for Qg.
0003 %   [PCOST, QCOST] = PQCOST(GENCOST, NG, ON) checks whether GENCOST has
0004 %   cost information for reactive power generation (rows ng+1 to 2*ng).
0005 %   If so, it returns the first NG rows in PCOST and the last NG rows in
0006 %   QCOST. Otherwise, leaves QCOST empty. Also does some error checking.
0007 %   If ON is specified (list of indices of generators which are on line)
0008 %   it only returns the rows corresponding to these generators.
0009 
0010 %   MATPOWER
0011 %   Copyright (c) 1996-2015 by Power System Engineering Research Center (PSERC)
0012 %   by Ray Zimmerman, PSERC Cornell
0013 %
0014 %   $Id: pqcost.m 2644 2015-03-11 19:34:22Z ray $
0015 %
0016 %   This file is part of MATPOWER.
0017 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0018 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0019 
0020 if nargin < 3
0021     on = (1:ng)';
0022 end
0023 
0024 if size(gencost, 1) == ng
0025     pcost = gencost(on, :);
0026     qcost = [];
0027 elseif size(gencost, 1) == 2 * ng
0028     pcost = gencost(on, :);
0029     qcost = gencost(on+ng, :);
0030 else
0031     error('pqcost: gencost has wrong number of rows');
0032 end

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