Skip to content

Commit dd3ea3c

Browse files
committed
TESTING: composite for first 9 commits within PR #276
1 parent fcd79e9 commit dd3ea3c

4 files changed

Lines changed: 206 additions & 101 deletions

File tree

prereise/gather/griddata/hifld/const.py

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
s_base = 100 # MVA
2+
13
mile_to_meter = 1609.34
24
meter_to_mile = 1.0 / mile_to_meter
35

@@ -125,43 +127,6 @@
125127
"500": 500,
126128
}
127129

128-
line_reactance_per_mile = { # per-unit
129-
69: 0.0096,
130-
100: 0.0063,
131-
115: 0.0039,
132-
138: 0.0026,
133-
161: 0.0021,
134-
230: 0.0011,
135-
345: 0.0005,
136-
500: 0.0002,
137-
765: 0.0001,
138-
}
139-
line_rating_short = { # MVA
140-
69: 86,
141-
100: 181,
142-
115: 239,
143-
138: 382,
144-
161: 446,
145-
230: 797,
146-
345: 1793,
147-
500: 2598,
148-
765: 5300,
149-
}
150-
line_rating_short_threshold = 50 # miles
151-
line_rating_surge_impedance_loading = { # MVA
152-
69: 13,
153-
100: 30,
154-
115: 35,
155-
138: 50,
156-
161: 69,
157-
230: 140,
158-
345: 375,
159-
500: 1000,
160-
765: 2250,
161-
}
162-
line_rating_surge_impedance_coefficient = 43.261
163-
line_rating_surge_impedance_exponent = -0.6678
164-
165130
transformer_reactance = { # per-unit
166131
(69, 115): 0.14242,
167132
(69, 138): 0.10895,
@@ -179,7 +144,7 @@
179144
(138, 765): 0.02284,
180145
(161, 230): 0.06539,
181146
(161, 345): 0.03293,
182-
(161, 500): 0.06978,
147+
(161, 500): 0.015,
183148
(230, 345): 0.02085,
184149
(230, 500): 0.01846,
185150
(230, 765): 0.01616,
@@ -629,6 +594,46 @@
629594
"ERCOT": {305330},
630595
}
631596

597+
line_voltage_assumptions = {
598+
128842: 230,
599+
}
600+
601+
line_design_assumptions = {
602+
# branch index: (voltage, circuits, bundle count)
603+
101536: (161, 2, 4), # TVA Cumberland (between substations)
604+
103726: (161, 2, 4), # TVA Cumberland (plant to substation)
605+
110220: (115, 1, 2), # Riverside Generating Station
606+
112166: (230, 1, 2), # Waterford 3 Nuclear Generating Station
607+
116493: (230, 1, 2), # Herbert A. Wagner Generating Station
608+
132671: (230, 1, 3), # Florida Power & Light St. Lucie
609+
130105: (161, 1, 3), # TVA Cumberland (downstream)
610+
132804: (230, 1, 2), # Waterford 3 Nuclear Generating Station
611+
139216: (230, 4, 3), # Catawba Nuclear Station
612+
140651: (230, 1, 3), # Florida Power & Light St. Lucie
613+
158263: (100, 1, 4), # G. G. Allen Steam Station
614+
160723: (230, 1, 3), # Florida Power & Light St. Lucie
615+
203381: (230, 1, 2), # Midpoint to Boise Bench
616+
203382: (230, 1, 2), # Midpoint to Boise Bench
617+
203383: (230, 1, 2), # Midpoint to Boise Bench
618+
300029: (69, 2, 1), # Ormat Brawley geothermal
619+
301320: (138, 2, 2), # Collin/Frisco substation connection
620+
301847: (115, 1, 2), # Coso Power Station
621+
303557: (138, 2, 2), # West Levee substations connection (Dallas)
622+
304908: (69, 2, 1), # Heber geothermal
623+
305018: (138, 2, 2), # TH Wharton Generating Station
624+
305464: (230, 2, 2), # The Geysers
625+
305990: (100, 2, 1), # southeast Salton Sea geothermal plants (several)
626+
306949: (230, 2, 2), # The Geysers
627+
307569: (230, 2, 2), # The Geysers
628+
308434: (230, 2, 2), # The Geysers
629+
309268: (69, 2, 1), # Ormat Brawley geothermal
630+
309441: (69, 2, 2), # substation connection near Lake Creek Reservoir, outside Waco
631+
309966: (138, 2, 2), # Garfield to Pilot Knob (south of Austin)
632+
312241: (100, 2, 1), # southeast Salton Sea geothermal plants (several)
633+
313473: (69, 2, 2), # Holtville geothermal?
634+
313474: (69, 2, 2), # Holtville geothermal?
635+
}
636+
632637
b2b_ratings = { # MW
633638
"BLACKWATER TIE": 200, # a.k.a. 'Clovis'/'Roosevelt County' (Eastern/Western)
634639
"EDDY AC-DC-AC TIE": 200, # a.k.a. 'Artesia' (Eastern/Western)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
voltage,circuits,bundle_count,conductor,spacing,a0x,a0y,b0x,b0y,c0x,c0y,a1x,a1y,b1x,b1y,c1x,c1y,a2x,a2y,b2x,b2y,c2x,c2y,a3x,a3y,b3x,b3y,c3x,c3y,notes
2+
69,1,1,Osprey,,-2,16.5,2,15,-2,13.5,,,,,,,,,,,,,,,,,,,single-pole design
3+
69,2,1,Osprey,,-2,16.5,-2,15,-2,13.5,2,13.5,2,15,2,16.5,,,,,,,,,,,,,single-pole double-circuit
4+
69,2,2,Osprey,0.5,-2,16.5,-2,15,-2,13.5,2,13.5,2,15,2,16.5,,,,,,,,,,,,,single-pole double-circuit
5+
100,1,1,Drake,,-2,19,2,17,-2,15,,,,,,,,,,,,,,,,,,,single-pole design
6+
100,2,1,Drake,,-2,19,-2,17,-2,15,2,15,2,17,2,19,,,,,,,,,,,,,single-pole double-circuit
7+
100,1,4,Drake,0.5,-7,15,0,15,7,15,,,,,,,,,,,,,,,,,,,H-frame design
8+
115,1,1,Drake,,-2,19,2,17,-2,15,,,,,,,,,,,,,,,,,,,single-pole design
9+
115,1,2,Drake,0.5,-4,15,0,15,4,15,,,,,,,,,,,,,,,,,,,H-frame design
10+
138,1,1,Ortolan,,-3,22.5,3,20,-3,17.5,,,,,,,,,,,,,,,,,,,single-pole design
11+
138,2,2,Ortolan,0.5,-7.5,15,-4.5,15,-1.5,15,1.5,15,4.5,15,7.5,15,,,,,,,,,,,,,two parallel H-frames
12+
161,1,1,Bluejay,,-5,15,0,15,5,15,,,,,,,,,,,,,,,,,,,H-frame design
13+
161,1,3,Bluejay,0.5,-6,15,0,15,6,15,,,,,,,,,,,,,,,,,,,lattice
14+
161,2,4,Bluejay,0.5,-5,15,-5,17,-5,19,5,19,5,17,5,15,,,,,,,,,,,,,Two parallel single-poles
15+
230,1,1,Falcon,,-7,20,0,20,7,20,,,,,,,,,,,,,,,,,,,H-frame design
16+
230,1,2,Drake,0.5,-7,20,0,20,7,20,,,,,,,,,,,,,,,,,,,H-frame design
17+
230,1,3,Drake,0.5,-7,20,0,20,7,20,,,,,,,,,,,,,,,,,,,H-frame design
18+
230,2,2,Drake,0.5,-3,19,-3,17,-3,15,3,15,3,17,3,19,,,,,,,,,,,,,Double-circuit lattice
19+
230,4,3,Drake,0.5,-7,20,0,20,7,20,18,20,25,20,32,20,43,20,50,20,57,20,68,20,75,20,82,20,Four parallel H-frames
20+
345,1,2,Falcon,0.5,-8,25,0,25,8,25,,,,,,,,,,,,,,,,,,,H-frame design
21+
500,1,3,Rail,0.5,-10,30,0,30,10,30,,,,,,,,,,,,,,,,,,,lattice
22+
500,2,3,Drake,0.5,-5,40,-8,30,-5,20,5,20,8,30,5,40,,,,,,,,,,,,,lattice
23+
765,1,4,Martin,0.5,-15,40,0,40,15,40,,,,,,,,,,,,,,,,,,,H-frame design

prereise/gather/griddata/hifld/data_process/tests/test_transmission.py

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from unittest.mock import Mock
2+
13
import pandas as pd
24
import pytest
35
from pandas.testing import assert_frame_equal, assert_series_equal
@@ -125,15 +127,18 @@ def test_create_transformers():
125127

126128

127129
def test_estimate_branch_impedance_lines():
130+
resistance = 0.01
131+
reactance = 0.1
132+
fake_lines = [Mock(series_impedance=(resistance + 1j * reactance))] * 3
128133
branch = pd.DataFrame(
129-
{"VOLTAGE": [69, 70, 345], "type": ["Line"] * 3, "length": [10, 15, 20]}
134+
{"VOLTAGE": [69, 70, 345], "type": ["Line"] * 3, "Line": fake_lines}
130135
)
131136
x = estimate_branch_impedance(branch.iloc[0], pd.Series())
132-
assert x == const.line_reactance_per_mile[69] * 10
137+
assert x == reactance / (69**2 / const.s_base)
133138
x = estimate_branch_impedance(branch.iloc[1], pd.Series())
134-
assert x == const.line_reactance_per_mile[69] * 15
139+
assert x == reactance / (70**2 / const.s_base)
135140
x = estimate_branch_impedance(branch.iloc[2], pd.Series())
136-
assert x == const.line_reactance_per_mile[345] * 20
141+
assert x == reactance / (345**2 / const.s_base)
137142

138143

139144
def test_estimate_branch_impedance_transformers():
@@ -150,42 +155,30 @@ def test_estimate_branch_impedance_transformers():
150155

151156

152157
def test_estimate_branch_rating_lines():
158+
fake_ratings = pd.Series([10, 20, 30, 40])
159+
fake_thermal_ratings = pd.Series([100, 200, 300, 400])
160+
fake_lines = [Mock(power_rating=i) for i in fake_ratings]
153161
branch = pd.DataFrame(
154-
{
155-
"VOLTAGE": [69, 140, 345, 499],
156-
"type": ["Line"] * 4,
157-
"length": [10, 50, 100, 150],
158-
}
159-
)
160-
rating = estimate_branch_rating(branch.iloc[0], pd.Series())
161-
assert rating == const.line_rating_short[69]
162-
rating = estimate_branch_rating(branch.iloc[1], pd.Series())
163-
assert rating == const.line_rating_short[138]
164-
rating = estimate_branch_rating(branch.iloc[2], pd.Series())
165-
assert rating == (
166-
const.line_rating_surge_impedance_loading[345]
167-
* const.line_rating_surge_impedance_coefficient
168-
* 100**const.line_rating_surge_impedance_exponent
162+
{"VOLTAGE": [69, 140, 345, 499], "type": ["Line"] * 4, "Line": fake_lines}
169163
)
170-
rating = estimate_branch_rating(branch.iloc[3], pd.Series())
171-
assert rating == (
172-
const.line_rating_surge_impedance_loading[500]
173-
* const.line_rating_surge_impedance_coefficient
174-
* 150**const.line_rating_surge_impedance_exponent
164+
assert_series_equal(
165+
fake_ratings,
166+
branch.apply(estimate_branch_rating, args=[None, fake_thermal_ratings], axis=1),
175167
)
176168

177169

178170
def test_estimate_branch_rating_transformers():
171+
thermal_ratings = pd.Series([100, 550, 1655, 2585], index=[69, 230, 345, 500])
179172
transformers = pd.DataFrame(
180173
{"from_bus_id": [0, 1, 2], "to_bus_id": [1, 2, 3], "type": ["Transformer"] * 3}
181174
)
182175
bus_voltages = pd.Series([69, 230, 350, 500])
183176

184-
rating = estimate_branch_rating(transformers.iloc[0], bus_voltages)
177+
rating = estimate_branch_rating(transformers.iloc[0], bus_voltages, thermal_ratings)
185178
assert rating == const.transformer_rating
186-
rating = estimate_branch_rating(transformers.iloc[1], bus_voltages)
179+
rating = estimate_branch_rating(transformers.iloc[1], bus_voltages, thermal_ratings)
187180
assert rating == const.transformer_rating * 3
188-
rating = estimate_branch_rating(transformers.iloc[2], bus_voltages)
181+
rating = estimate_branch_rating(transformers.iloc[2], bus_voltages, thermal_ratings)
189182
assert rating == const.transformer_rating * 4
190183

191184

0 commit comments

Comments
 (0)