Validation 06 - Single Snapshot Unit Commitment

In [59]:
%matplotlib inline
In [60]:
import psst
In [61]:
from psst.case import read_matpower
from psst.network import create_network

Validation of case 1

In [62]:
case = read_matpower('./cases/case6.m')
In [63]:
network = create_network(case, prog='neato')
network.draw()
../../_images/notebooks_validation_Validation06-SingleSnapshotUnitCommitment_6_0.png
In [64]:
case
Out[64]:
<psst.case.PSSTCase(name=case, Generators=2, Buses=2, Branches=1)>
In [65]:
case.bus
Out[65]:
TYPE PD QD GS BS AREA VM VA BASEKV ZONE VMAX VMIN
Bus1 3 0 131.47 0 0 1 1 0 230 1 1.1 0.9
Bus2 2 100 0.00 0 0 1 1 0 230 1 1.1 0.9
In [66]:
case.branch
Out[66]:
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 800 800 800 0 0 1 -360 360
In [67]:
case.gen
Out[67]:
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
GenCo0 Bus1 200 0 30 -30 1 100 1 200 0 0 0 0 0 0 0 0 0 0 0 0
GenCo1 Bus2 500 0 30 -30 1 100 1 500 0 0 0 0 0 0 0 0 0 0 0 0
In [68]:
case.gencost
Out[68]:
MODEL STARTUP SHUTDOWN NCOST COST_1 COST_0
GenCo0 1 0.00 0 2 10 0
GenCo1 1 0.01 0 2 14 0
In [69]:
case.load
Out[69]:
Bus1 Bus2
0 0.0 100.0
In [70]:
from psst.model import build_model
In [71]:
model = build_model(case)
In [72]:
model
Out[72]:
<psst.model.PSSTModel(status=None)>
In [73]:
model.solve(solver='cbc', verbose=True)
Welcome to the CBC MILP Solver
Version: 2.9.6
Build Date: May 27 2016

command line - /usr/local/bin/cbc -mipgap 0.01 -printingOptions all -import /var/folders/wk/lcf0vgd90bx0vq1873tn04knk_djr3/T/tmppFZ4n3.pyomo.lp -import -stat=1 -solve -solu /var/folders/wk/lcf0vgd90bx0vq1873tn04knk_djr3/T/tmppFZ4n3.pyomo.soln (default strategy 1)
No match for mipgap - ? for list of commands
No match for 0.01 - ? for list of commands
Option for printingOptions changed from normal to all
Current default (if $ as parameter) for import is /var/folders/wk/lcf0vgd90bx0vq1873tn04knk_djr3/T/tmppFZ4n3.pyomo.lp
Presolve 9 (-39) rows, 15 (-25) columns and 27 (-73) elements
Statistics for presolved model
Original problem has 2 integers (2 of which binary)
Presolved problem has 1 integers (1 of which binary)
==== 6 zero objective 3 different
6 variables have objective of 0
3 variables have objective of 1
6 variables have objective of 1e+06
==== absolute objective values 3 different
6 variables have objective of 0
3 variables have objective of 1
6 variables have objective of 1e+06
==== for integers 1 zero objective 1 different
1 variables have objective of 0
==== for integers absolute objective values 1 different
1 variables have objective of 0
===== end objective counts


Problem has 9 rows, 15 columns (9 with objective) and 27 elements
There are 9 singletons with objective
Column breakdown:
11 of type 0.0->inf, 2 of type 0.0->up, 0 of type lo->inf,
1 of type lo->up, 0 of type free, 0 of type fixed,
0 of type -inf->0.0, 0 of type -inf->up, 1 of type 0.0->1.0
Row breakdown:
1 of type E 0.0, 0 of type E 1.0, 0 of type E -1.0,
2 of type E other, 0 of type G 0.0, 0 of type G 1.0,
0 of type G other, 4 of type L 0.0, 0 of type L 1.0,
2 of type L other, 0 of type Range 0.0->1.0, 0 of type Range other,
0 of type Free
Continuous objective value is 1000 - 0.00 seconds
Cgl0004I processed model has 8 rows, 14 columns (1 integer (1 of which binary)) and 24 elements
Cbc0038I Initial state - 0 integers unsatisfied sum - 0
Cbc0038I Solution found of 1000
Cbc0038I Relaxing continuous gives 1000
Cbc0038I Before mini branch and bound, 1 integers at bound fixed and 9 continuous
Cbc0038I Mini branch and bound did not improve solution (0.00 seconds)
Cbc0038I After 0.00 seconds - Feasibility pump exiting with objective of 1000 - took 0.00 seconds
Cbc0012I Integer solution of 1000 found by feasibility pump after 0 iterations and 0 nodes (0.00 seconds)
Cbc0001I Search completed - best objective 1000, took 0 iterations and 0 nodes (0.00 seconds)
Cbc0035I Maximum depth 0, 0 variables fixed on reduced cost
Cuts at root node changed objective from 1000 to 1000
Probing was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Gomory was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Knapsack was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
Clique was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
MixedIntegerRounding2 was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
FlowCover was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)
TwoMirCuts was tried 0 times and created 0 cuts of which 0 were active after adding rounds of cuts (0.000 seconds)

Result - Optimal solution found

Objective value:                1000.00000000
Enumerated nodes:               0
Total iterations:               0
Time (CPU seconds):             0.01
Time (Wallclock seconds):       0.01

Total time (CPU seconds):       0.01   (Wallclock seconds):       0.02

Input data

In [74]:
import pandas as pd
In [75]:
pd.DataFrame(case.gen['PMAX'])
Out[75]:
PMAX
GenCo0 200
GenCo1 500
In [76]:
case.load
Out[76]:
Bus1 Bus2
0 0.0 100.0

Model Results

In [77]:
model.results.unit_commitment
Out[77]:
GenCo0 GenCo1
0 1 0
In [78]:
model.results.power_generated
Out[78]:
GenCo0 GenCo1
0 100 0
In [79]:
model.results.production_cost
Out[79]:
1000
In [80]:
print(case.gencost.loc['GenCo0', 'COST_1']*model.results.power_generated['GenCo0'].values[0])
print(case.gencost.loc['GenCo1', 'COST_1']*model.results.power_generated['GenCo1'].values[0])
1000.0
0.0
In [81]:
model.results.line_power
Out[81]:
0
0 100
In [82]:
model.results.lmp
Out[82]:
Bus1 Bus2
0 10 10
In [83]:
from psst.plot import line_power
In [84]:
line_power(network, model.results, hour=0)
Out[84]:
<matplotlib.axes._subplots.AxesSubplot at 0x1115cd310>
../../_images/notebooks_validation_Validation06-SingleSnapshotUnitCommitment_29_1.png