Package pypower :: Module idx_cost
[hide private]
[frames] | no frames]

Source Code for Module pypower.idx_cost

 1  # Copyright (C) 1996-2011 Power System Engineering Research Center (PSERC) 
 2  # Copyright (C) 2011 Richard Lincoln 
 3  # 
 4  # PYPOWER is free software: you can redistribute it and/or modify 
 5  # it under the terms of the GNU General Public License as published 
 6  # by the Free Software Foundation, either version 3 of the License, 
 7  # or (at your option) any later version. 
 8  # 
 9  # PYPOWER is distributed in the hope that it will be useful, 
10  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
11  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
12  # GNU General Public License for more details. 
13  # 
14  # You should have received a copy of the GNU General Public License 
15  # along with PYPOWER. If not, see <http://www.gnu.org/licenses/>. 
16   
17  """ Defines constants for named column indices to gencost matrix. 
18   
19  Some examples of usage, after defining the constants using the line above, 
20  are:: 
21   
22      start = gencost[3, STARTUP]       # get startup cost of generator 4 
23      gencost[2, [MODEL, NCOST:COST+2]] = [POLYNOMIAL, 2, 30, 0] 
24      # set the cost of generator 2 to a linear function COST = 30 * Pg 
25   
26  The index, name and meaning of each column of the gencost matrix is given 
27  below: 
28   
29  columns 1-5 
30      1.  C{MODEL}       cost model, 1 - piecewise linear, 2 - polynomial 
31      2.  C{STARTUP}     startup cost in US dollars 
32      3.  C{SHUTDOWN}    shutdown cost in US dollars 
33      4.  C{NCOST}       number of cost coefficients to follow for polynomial 
34      cost function, or number of data points for piecewise linear 
35      5.  C{COST}        1st column of cost parameters 
36      cost data defining total cost function 
37      For polynomial cost (highest order coeff first):: 
38          e.g. cn, ..., c1, c0 
39      where the polynomial is C{c0 + c1*P + ... + cn*P^n} 
40      For piecewise linear cost:: 
41          x0, y0, x1, y1, x2, y2, ... 
42      where C{x0 < x1 < x2 < ...} and the points C{(x0,y0), (x1,y1), 
43      (x2,y2), ...} are the end- and break-points of the total cost function. 
44   
45  additional constants, used to assign/compare values in the C{MODEL} column 
46      1.  C{PW_LINEAR}   piecewise linear generator cost model 
47      2.  C{POLYNOMIAL}  polynomial generator cost model 
48   
49  @author: Ray Zimmerman (PSERC Cornell) 
50  @author: Richard Lincoln 
51  """ 
52  # define cost models 
53  PW_LINEAR   = 1 
54  POLYNOMIAL  = 2 
55   
56  # define the indices 
57  MODEL       = 0 
58  STARTUP     = 1 
59  SHUTDOWN    = 2 
60  NCOST       = 3 
61  COST        = 4 
62