Home > matpower5.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 %   $Id: pqcost.m 1635 2010-04-26 19:45:26Z ray $
0012 %   by Ray Zimmerman, PSERC Cornell
0013 %   Copyright (c) 1996-2010 by Power System Engineering Research Center (PSERC)
0014 %
0015 %   This file is part of MATPOWER.
0016 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0017 %
0018 %   MATPOWER is free software: you can redistribute it and/or modify
0019 %   it under the terms of the GNU General Public License as published
0020 %   by the Free Software Foundation, either version 3 of the License,
0021 %   or (at your option) any later version.
0022 %
0023 %   MATPOWER is distributed in the hope that it will be useful,
0024 %   but WITHOUT ANY WARRANTY; without even the implied warranty of
0025 %   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0026 %   GNU General Public License for more details.
0027 %
0028 %   You should have received a copy of the GNU General Public License
0029 %   along with MATPOWER. If not, see <http://www.gnu.org/licenses/>.
0030 %
0031 %   Additional permission under GNU GPL version 3 section 7
0032 %
0033 %   If you modify MATPOWER, or any covered work, to interface with
0034 %   other modules (such as MATLAB code and MEX-files) available in a
0035 %   MATLAB(R) or comparable environment containing parts covered
0036 %   under other licensing terms, the licensors of MATPOWER grant
0037 %   you additional permission to convey the resulting work.
0038 
0039 if nargin < 3
0040     on = (1:ng)';
0041 end
0042 
0043 if size(gencost, 1) == ng
0044     pcost = gencost(on, :);
0045     qcost = [];
0046 elseif size(gencost, 1) == 2 * ng
0047     pcost = gencost(on, :);
0048     qcost = gencost(on+ng, :);
0049 else
0050     error('pqcost: gencost has wrong number of rows');
0051 end

Generated on Mon 26-Jan-2015 15:21:31 by m2html © 2005