Validation 13 - 5 BusΒΆ

In [1]:
from psst.case import read_matpower
In [2]:
case = read_matpower('./../../psst/cases/case5.m')
In [3]:
case.gen
Out[3]:
GEN_BUS PG QG QMAX QMIN VG MBASE GEN_STATUS PMAX PMIN PC1 PC2 QC1MIN QC1MAX QC2MIN QC2MAX RAMP_AGC RAMP_10 RAMP_30 RAMP_Q APF STARTUP_RAMP SHUTDOWN_RAMP MINIMUM_UP_TIME MINIMUM_DOWN_TIME
GenCo0 Bus1 40.00 0 30.0 -30.0 1 100 1 40 0 0 0 0 0 0 0 0 40 0 0 0 40 40 0 0
GenCo1 Bus1 170.00 0 127.5 -127.5 1 100 1 170 0 0 0 0 0 0 0 0 170 0 0 0 170 170 0 0
GenCo2 Bus3 323.49 0 390.0 -390.0 1 100 1 520 0 0 0 0 0 0 0 0 520 0 0 0 520 520 0 0
GenCo3 Bus4 0.00 0 150.0 -150.0 1 100 1 200 0 0 0 0 0 0 0 0 200 0 0 0 200 200 0 0
GenCo4 Bus5 466.51 0 450.0 -450.0 1 100 1 600 0 0 0 0 0 0 0 0 600 0 0 0 600 600 0 0
In [4]:
case.gencost
Out[4]:
MODEL STARTUP SHUTDOWN NCOST COST_2 COST_1 COST_0
GenCo0 2 0 0 3 0.005 14 56.90
GenCo1 2 0 0 3 0.006 15 0.11
GenCo2 2 0 0 3 0.010 25 2267.53
GenCo3 2 0 0 3 0.012 30 5.19
GenCo4 2 0 0 3 0.007 10 1391.16
In [5]:
case.branch
Out[5]:
F_BUS T_BUS BR_R BR_X BR_B RATE_A RATE_B RATE_C TAP SHIFT BR_STATUS ANGMIN ANGMAX
0 Bus1 Bus2 0.00281 0.0281 0.00712 400 400 400 0 0 1 -360 360
1 Bus1 Bus4 0.00304 0.0304 0.00658 0 0 0 0 0 1 -360 360
2 Bus1 Bus5 0.00064 0.0064 0.03126 0 0 0 0 0 1 -360 360
3 Bus2 Bus3 0.00108 0.0108 0.01852 0 0 0 0 0 1 -360 360
4 Bus3 Bus4 0.00297 0.0297 0.00674 0 0 0 0 0 1 -360 360
5 Bus4 Bus5 0.00297 0.0297 0.00674 240 240 240 0 0 1 -360 360
In [6]:
from psst.case.utils import solve_pf

results, _ = solve_pf(case)
In [9]:
import pandas as pd
In [10]:
pd.DataFrame(results['branch'])
Out[10]:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
0 1.0 2.0 0.00281 0.0281 0.00712 400.0 400.0 400.0 0.0 0.0 1.0 -360.0 360.0 249.773373 21.599095 -248.006760 -4.637368
1 1.0 4.0 0.00304 0.0304 0.00658 0.0 0.0 0.0 0.0 0.0 1.0 -360.0 360.0 186.500142 -13.612148 -185.437396 23.581606
2 1.0 5.0 0.00064 0.0064 0.03126 0.0 0.0 0.0 0.0 0.0 1.0 -360.0 360.0 -226.273515 22.738212 226.604972 -22.549636
3 2.0 3.0 0.00108 0.0108 0.01852 0.0 0.0 0.0 0.0 0.0 1.0 -360.0 360.0 -51.993240 -93.972632 52.118657 93.394588
4 3.0 4.0 0.00297 0.0297 0.00674 0.0 0.0 0.0 0.0 0.0 1.0 -360.0 360.0 -28.628657 2.650132 28.653264 -3.078060
5 4.0 5.0 0.00297 0.0297 0.00674 240.0 240.0 240.0 0.0 0.0 1.0 -360.0 360.0 -238.188688 32.149384 239.905028 -15.659987
In [11]:
pd.DataFrame(results['bus'])
Out[11]:
0 1 2 3 4 5 6 7 8 9 10 11 12
0 1.0 2.0 0.0 0.00 0.0 0.0 1.0 1.000000 3.273361 230.0 1.0 1.1 0.9
1 2.0 1.0 300.0 98.61 0.0 0.0 1.0 0.989261 -0.759269 230.0 1.0 1.1 0.9
2 3.0 2.0 300.0 98.61 0.0 0.0 1.0 1.000000 -0.492259 230.0 1.0 1.1 0.9
3 4.0 3.0 400.0 131.47 0.0 0.0 1.0 1.000000 0.000000 230.0 1.0 1.1 0.9
4 5.0 2.0 0.0 0.00 0.0 0.0 1.0 1.000000 4.112031 230.0 1.0 1.1 0.9
In [12]:
from psst.model import build_model
In [13]:
model = build_model(case)
In [14]:
model.solve(solver='xpress', verbose=True)
FICO Xpress-Optimizer 64-bit v29.01.10 (Hyper capacity)
(c) Copyright Fair Isaac Corporation 1983-2016. All rights reserved
Using Xpress-Optimizer [/Users/dkrishna/opt/xpressmp/lib/libxprs.dylib]

Reading Problem /tmpgRr1VC.pyomo
Problem Statistics
         106 (      0 spare) rows
          87 (      0 spare) structural columns
         239 (      0 spare) non-zero elements
Global Statistics
           5 entities        0 sets        0 set members
Minimizing MILP /tmpgRr1VC.pyomo
Original problem has:
       106 rows           87 cols          239 elements         5 globals
Presolved problem has:
        16 rows           31 cols           61 elements         5 globals
Will try to keep branch and bound tree memory usage below 5.5Gb
Starting concurrent solve with dual

 Concurrent-Solve,   0s
            Dual
    objective   dual inf
 D  20013.800   .0000000
------- optimal --------
Concurrent statistics:
      Dual: 13 simplex iterations, 0.00s
Optimal solution found

   Its         Obj Value      S   Ninf  Nneg   Sum Dual Inf  Time
    13       20013.80036      D      0     0        .000000     0
Dual solved problem
  13 simplex iterations in 0s

Final objective                         : 2.001380036213346e+04
  Max primal violation      (abs / rel) : 2.274e-13 / 2.274e-13
  Max dual violation        (abs / rel) :       0.0 /       0.0
  Max complementarity viol. (abs / rel) :       0.0 /       0.0
All values within tolerances

Starting root cutting & heuristics

 Its Type    BestSoln    BestBound   Sols    Add    Del     Gap     GInf   Time
k         22255.36973  20013.80036      1                 10.07%       0      0
 *** Search completed ***     Time:     0 Nodes:          1
Number of integer feasible solutions found is 1
Best integer solution found is  22255.36973
Best bound is  22255.36973
Uncrunching matrix
In [33]:
s1 = (model.results.angles / 2 / pd.np.pi * 360).T[0]
In [34]:
case.gen['PG'] = model.results.power_generated.T[0]

from psst.case.utils import solve_pf

results, _ = solve_pf(case)

s2 = pd.DataFrame(results['bus'])[8]
In [44]:
np = pd.np
In [45]:
def rms(x):
    return np.sqrt(x.dot(x)/x.size)
In [46]:
rms(s1.values - s2.values)
Out[46]:
0.052620045089577835