import numpy as np
import pandas as pd
path = "/home/tezirg/Code/Grid2Op.BDonnot/grid2op/data/case14_realistic/case14_realistic.json"
import pandapower as pp
import pandapower.networks as pn
case = pp.from_json(path)
ref = pn.case118()
case.line[np.all(case.line[["from_bus", "to_bus"]]+1 == [1,2], axis=1)]
name | std_type | from_bus | to_bus | length_km | r_ohm_per_km | x_ohm_per_km | c_nf_per_km | g_us_per_km | max_i_ka | df | parallel | type | in_service | max_loading_percent | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | None | None | 0 | 1 | 1.0 | 3.690727 | 11.268335 | 882.522684 | 0.0 | 41.418606 | 1.0 | 1 | ol | True | 100.0 |
3.532005 / 0.01938
182.24999999999997
10.783732 / 0.05917
182.24999154977186
case.line[np.all(case.line[["from_bus", "to_bus"]]+1 == [1,5], axis=1)]
name | std_type | from_bus | to_bus | length_km | r_ohm_per_km | x_ohm_per_km | c_nf_per_km | g_us_per_km | max_i_ka | df | parallel | type | in_service | max_loading_percent | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | None | None | 0 | 4 | 1.0 | 10.289473 | 42.475738 | 822.350683 | 0.0 | 41.418606 | 1.0 | 1 | ol | True | 100.0 |
9.846967 / 0.05403
182.2499907458819
40.64904 / 0.22304
182.25
case.line[np.all(case.line[["from_bus", "to_bus"]]+1 == [9,10], axis=1)]
name | std_type | from_bus | to_bus | length_km | r_ohm_per_km | x_ohm_per_km | c_nf_per_km | g_us_per_km | max_i_ka | df | parallel | type | in_service | max_loading_percent | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10 | None | None | 8 | 9 | 1.0 | 0.12724 | 0.338 | 0.0 | 0.0 | 285.788383 | 1.0 | 1 | ol | True | 100.0 |
0.000014 / 0.03181
0.00044011317195850365
0.000037 / 0.0845
0.0004378698224852071
case.line[np.all(case.line[["from_bus", "to_bus"]]+1 == [9,14], axis=1)]
name | std_type | from_bus | to_bus | length_km | r_ohm_per_km | x_ohm_per_km | c_nf_per_km | g_us_per_km | max_i_ka | df | parallel | type | in_service | max_loading_percent | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11 | None | None | 8 | 13 | 1.0 | 0.50844 | 1.08152 | 0.0 | 0.0 | 285.788383 | 1.0 | 1 | ol | True | 100.0 |
0.000055 / 0.12711
0.0004326960900007867
200 / 0.00044011317195850365
454428.5714285714
138000 / 182.25
757.201646090535
pp.runpp(case)
from numpy import array
def case14():
"""Power flow data for IEEE 14 bus test case.
Please see L{caseformat} for details on the case file format.
This data was converted from IEEE Common Data Format
(ieee14cdf.txt) on 20-Sep-2004 by cdf2matp, rev. 1.11
Converted from IEEE CDF file from:
U{http://www.ee.washington.edu/research/pstca/}
08/19/93 UW ARCHIVE 100.0 1962 W IEEE 14 Bus Test Case
@return: Power flow data for IEEE 14 bus test case.
This function was originally foud in pypower.
the voltages have been adapted to have a more relistic transmission grid in order to have:
138kV on high voltage (buses 1 to 4)
20kV on low voltage (bus 6, 9 to 14)
14 kV on bus 7
12 kV on bus 8
"""
ppc = {"version": '2'}
##----- Power Flow Data -----##
## system MVA base
ppc["baseMVA"] = 100.0
## bus data
# bus_i type Pd Qd Gs Bs area Vm Va baseKV zone Vmax Vmin
ppc["bus"] = array([
[1, 3, 0, 0, 0, 0, 1, 1.06, 0, 138, 1, 1.06, 0.94],
[2, 2, 21.7, 12.7, 0, 0, 1, 1.045, -4.98, 138, 1, 1.06, 0.94],
[3, 2, 94.2, 19, 0, 0, 1, 1.01, -12.72, 138, 1, 1.06, 0.94],
[4, 1, 47.8, -3.9, 0, 0, 1, 1.019, -10.33, 138, 1, 1.06, 0.94],
[5, 1, 7.6, 1.6, 0, 0, 1, 1.02, -8.78, 138, 1, 1.06, 0.94],
[6, 2, 11.2, 7.5, 0, 0, 1, 1.07, -14.22, 20, 1, 1.06, 0.94],
[7, 1, 0, 0, 0, 0, 1, 1.062, -13.37, 14, 1, 1.06, 0.94],
[8, 2, 0, 0, 0, 0, 1, 1.09, -13.36, 12, 1, 1.06, 0.94],
[9, 1, 29.5, 16.6, 0, 19, 1, 1.056, -14.94, 20, 1, 1.06, 0.94],
[10, 1, 9, 5.8, 0, 0, 1, 1.051, -15.1, 20, 1, 1.06, 0.94],
[11, 1, 3.5, 1.8, 0, 0, 1, 1.057, -14.79, 20, 1, 1.06, 0.94],
[12, 1, 6.1, 1.6, 0, 0, 1, 1.055, -15.07, 20, 1, 1.06, 0.94],
[13, 1, 13.5, 5.8, 0, 0, 1, 1.05, -15.16, 20, 1, 1.06, 0.94],
[14, 1, 14.9, 5, 0, 0, 1, 1.036, -16.04, 20, 1, 1.06, 0.94]
])
## generator data
# 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
ppc["gen"] = array([
[1, 232.4, -16.9, 10, 0, 1.06, 100, 1, 332.4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[2, 40, 42.4, 50, -40, 1.045, 100, 1, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[3, 0, 23.4, 40, 0, 1.01, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[6, 0, 12.2, 24, -6, 1.07, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[8, 0, 17.4, 24, -6, 1.09, 100, 1, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
])
## branch data
# fbus, tbus, r, x, b, rateA, rateB, rateC, ratio, angle, status, angmin, angmax
ppc["branch"] = array([
[1, 2, 0.01938, 0.05917, 0.0528, 9900, 0, 0, 0, 0, 1, -360, 360],
[1, 5, 0.05403, 0.22304, 0.0492, 9900, 0, 0, 0, 0, 1, -360, 360],
[2, 3, 0.04699, 0.19797, 0.0438, 9900, 0, 0, 0, 0, 1, -360, 360],
[2, 4, 0.05811, 0.17632, 0.034, 9900, 0, 0, 0, 0, 1, -360, 360],
[2, 5, 0.05695, 0.17388, 0.0346, 9900, 0, 0, 0, 0, 1, -360, 360],
[3, 4, 0.06701, 0.17103, 0.0128, 9900, 0, 0, 0, 0, 1, -360, 360],
[4, 5, 0.01335, 0.04211, 0, 9900, 0, 0, 0, 0, 1, -360, 360],
[4, 7, 0, 0.20912, 0, 9900, 0, 0, 0.978, 0, 1, -360, 360],
[4, 9, 0, 0.55618, 0, 9900, 0, 0, 0.969, 0, 1, -360, 360],
[5, 6, 0, 0.25202, 0, 9900, 0, 0, 0.932, 0, 1, -360, 360],
[6, 11, 0.09498, 0.1989, 0, 9900, 0, 0, 0, 0, 1, -360, 360],
[6, 12, 0.12291, 0.25581, 0, 9900, 0, 0, 0, 0, 1, -360, 360],
[6, 13, 0.06615, 0.13027, 0, 9900, 0, 0, 0, 0, 1, -360, 360],
[7, 8, 0, 0.17615, 0, 9900, 0, 0, 0, 0, 1, -360, 360],
[7, 9, 0, 0.11001, 0, 9900, 0, 0, 0, 0, 1, -360, 360],
[9, 10, 0.03181, 0.0845, 0, 9900, 0, 0, 0, 0, 1, -360, 360],
[9, 14, 0.12711, 0.27038, 0, 9900, 0, 0, 0, 0, 1, -360, 360],
[10, 11, 0.08205, 0.19207, 0, 9900, 0, 0, 0, 0, 1, -360, 360],
[12, 13, 0.22092, 0.19988, 0, 9900, 0, 0, 0, 0, 1, -360, 360],
[13, 14, 0.17093, 0.34802, 0, 9900, 0, 0, 0, 0, 1, -360, 360]
])
##----- OPF Data -----##
## generator cost data
# 1 startup shutdown n x1 y1 ... xn yn
# 2 startup shutdown n c(n-1) ... c0
ppc["gencost"] = array([
[2, 0, 0, 3, 0.0430293, 20, 0],
[2, 0, 0, 3, 0.25, 20, 0],
[2, 0, 0, 3, 0.01, 40, 0],
[2, 0, 0, 3, 0.01, 40, 0],
[2, 0, 0, 3, 0.01, 40, 0]
])
return ppc
ppc = case14()
grid = pp.converter.from_ppc(ppc)
grid.bus
name | vn_kv | type | zone | in_service | min_vm_pu | max_vm_pu | |
---|---|---|---|---|---|---|---|
0 | 1 | 138.0 | b | 1 | True | 0.94 | 1.06 |
1 | 2 | 138.0 | b | 1 | True | 0.94 | 1.06 |
2 | 3 | 138.0 | b | 1 | True | 0.94 | 1.06 |
3 | 4 | 138.0 | b | 1 | True | 0.94 | 1.06 |
4 | 5 | 138.0 | b | 1 | True | 0.94 | 1.06 |
5 | 6 | 20.0 | b | 1 | True | 0.94 | 1.06 |
6 | 7 | 14.0 | b | 1 | True | 0.94 | 1.06 |
7 | 8 | 12.0 | b | 1 | True | 0.94 | 1.06 |
8 | 9 | 20.0 | b | 1 | True | 0.94 | 1.06 |
9 | 10 | 20.0 | b | 1 | True | 0.94 | 1.06 |
10 | 11 | 20.0 | b | 1 | True | 0.94 | 1.06 |
11 | 12 | 20.0 | b | 1 | True | 0.94 | 1.06 |
12 | 13 | 20.0 | b | 1 | True | 0.94 | 1.06 |
13 | 14 | 20.0 | b | 1 | True | 0.94 | 1.06 |
pp.runpp(grid)
grid.trafo
name | std_type | hv_bus | lv_bus | sn_mva | vn_hv_kv | vn_lv_kv | vk_percent | vkr_percent | pfe_kw | ... | tap_min | tap_max | tap_step_percent | tap_step_degree | tap_pos | tap_phase_shifter | parallel | df | in_service | max_loading_percent | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | None | None | 3 | 6 | 9900.0 | 138.0 | 14.0 | 2070.288 | 0.0 | 0.0 | ... | NaN | NaN | 2.2 | NaN | -1.0 | False | 1 | 1.0 | True | 100.0 |
1 | None | None | 3 | 8 | 9900.0 | 138.0 | 20.0 | 5506.182 | 0.0 | 0.0 | ... | NaN | NaN | 3.1 | NaN | -1.0 | False | 1 | 1.0 | True | 100.0 |
2 | None | None | 4 | 5 | 9900.0 | 138.0 | 20.0 | 2494.998 | 0.0 | 0.0 | ... | NaN | NaN | 6.8 | NaN | -1.0 | False | 1 | 1.0 | True | 100.0 |
3 | None | None | 6 | 7 | 9900.0 | 14.0 | 12.0 | 1743.885 | 0.0 | 0.0 | ... | NaN | NaN | NaN | NaN | NaN | False | 1 | 1.0 | True | 100.0 |
4 | None | None | 8 | 6 | 9900.0 | 20.0 | 14.0 | 1089.099 | 0.0 | 0.0 | ... | NaN | NaN | NaN | NaN | NaN | False | 1 | 1.0 | True | 100.0 |
5 rows × 24 columns
pp.to_json(grid, path)
pp.runpp(case)