Home > matpower6.0 > 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-2016, Power Systems Engineering Research Center (PSERC)
0012 %   by Ray Zimmerman, PSERC Cornell
0013 %
0014 %   This file is part of MATPOWER.
0015 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0016 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0017 
0018 if nargin < 3
0019     on = (1:ng)';
0020 end
0021 
0022 if size(gencost, 1) == ng
0023     pcost = gencost(on, :);
0024     qcost = [];
0025 elseif size(gencost, 1) == 2 * ng
0026     pcost = gencost(on, :);
0027     qcost = gencost(on+ng, :);
0028 else
0029     error('pqcost: gencost has wrong number of rows');
0030 end

Generated on Fri 16-Dec-2016 12:45:37 by m2html © 2005