Package pypower :: Package t :: Module t_hasPQcap
[hide private]
[frames] | no frames]

Source Code for Module pypower.t.t_hasPQcap

 1  # Copyright (C) 2005-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  """Tests for C{hasPQcap}. 
18  """ 
19   
20  from numpy import array 
21   
22  from pypower.hasPQcap import hasPQcap 
23   
24  from pypower.t.t_begin import t_begin 
25  from pypower.t.t_is import t_is 
26  from pypower.t.t_end import t_end 
27   
28   
29 -def t_hasPQcap(quiet=False):
30 """Tests for C{hasPQcap}. 31 32 @author: Ray Zimmerman (PSERC Cornell) 33 @author: Richard Lincoln 34 """ 35 t_begin(4, quiet) 36 37 ## generator data 38 # bus Pg Qg Qmax Qmin Vg mBase status Pmax Pmin Pc1 Pc2 Qc1min Qc1max Qc2min Qc2max ramp_agc ramp_10 ramp_30 ramp_q apf 39 gen = array([ 40 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 41 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, 0, 12, 0, 2, 0, 0, 0, 0, 0], 42 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -15, 12, -15, 2, 0, 0, 0, 0, 0], 43 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -12, 0, -2, 0, 0, 0, 0, 0, 0], 44 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -12, 15, -2, 15, 0, 0, 0, 0, 0], 45 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -12, 12, -2, 2, 0, 0, 0, 0, 0], 46 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, 0, 12, 0, 8, 0, 0, 0, 0, 0], 47 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -15, 12, -15, 8, 0, 0, 0, 0, 0], 48 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -12, 0, -8, 0, 0, 0, 0, 0, 0], 49 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -12, 15, -8, 15, 0, 0, 0, 0, 0], 50 [1, 10, 0, 10, -10, 1, 100, 1, 10, 2, 0, 20, -12, 12, -8, 8, 0, 0, 0, 0, 0] 51 ]) 52 53 t = 'hasPQcap(gen)' 54 t_is(hasPQcap(gen), [0,1,1,1,1,1,1,0,1,0,0], 12, t) 55 56 t = 'hasPQcap(gen, \'B\')' 57 t_is(hasPQcap(gen, 'B'), [0,1,1,1,1,1,1,0,1,0,0], 12, t) 58 59 t = 'hasPQcap(gen, \'U\')' 60 t_is(hasPQcap(gen, 'U'), [0,1,1,1,0,1,0,0,1,0,0], 12, t) 61 62 t = 'hasPQcap(gen, \'L\')' 63 t_is(hasPQcap(gen, 'L'), [0,1,0,1,1,1,1,0,0,0,0], 12, t) 64 65 t_end()
66 67 68 if __name__ == '__main__': 69 t_hasPQcap(quiet=False) 70