Skip to content

Commit

Permalink
refactor: update transformer creation test
Browse files Browse the repository at this point in the history
  • Loading branch information
danielolsen committed May 3, 2022
1 parent 3411d85 commit ec35bd2
Showing 1 changed file with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,27 +190,35 @@ def test_create_transformers():
)
lines = pd.DataFrame(
[
# One branch to low-voltage side of buses (0, 1) transformer
{"from_bus_id": 100, "to_bus_id": 0, "rateA": 75},
# Two branches to high-voltage side of buses (0, 1) transformer
{"from_bus_id": 1, "to_bus_id": 100, "rateA": 100},
{"from_bus_id": 1, "to_bus_id": 101, "rateA": 300},
# Two branches to low-voltage side of buses (2, 3) transformer
{"from_bus_id": 102, "to_bus_id": 2, "rateA": 50},
{"from_bus_id": 103, "to_bus_id": 2, "rateA": 100},
{"from_bus_id": 1, "to_bus_id": 101, "rateA": 100},
{"from_bus_id": 1, "to_bus_id": 102, "rateA": 300},
# Three branches to low-voltage side of buses (2, 3) transformer
{"from_bus_id": 103, "to_bus_id": 2, "rateA": 50},
{"from_bus_id": 104, "to_bus_id": 2, "rateA": 100},
# One branch to high-voltage side of buses (2, 3) transformer
{"from_bus_id": 3, "to_bus_id": 105, "rateA": 300},
# One branch to each side of buses (5, 6) transformer
# The second of these is also on the high-voltage side of buses (4, 5) xfmr
{"from_bus_id": 6, "to_bus_id": 104, "rateA": 500},
{"from_bus_id": 5, "to_bus_id": 105, "rateA": 250},
{"from_bus_id": 6, "to_bus_id": 106, "rateA": 500},
{"from_bus_id": 5, "to_bus_id": 107, "rateA": 250},
# One branch connected to no transformers
{"from_bus_id": 998, "to_bus_id": 999, "rateA": 100e3},
]
)
# One transformer to (0, 1) (only needs to support the low-voltage power)
# Three transformer to (2, 3) (low-voltage side requires 3x transformers in total)
# One transformer to (4, 5) (only needs to support the low-voltage power)
# One transformer to (5, 6) (only needs to support the low-voltage power)
expected_transformers = pd.DataFrame(
{
"from_bus_id": [0, 0, 2, 2, 4, 5],
"to_bus_id": [1, 1, 3, 3, 5, 6],
"x": [0.07, 0.07, 0.19, 0.19, 0.044, 0.018],
"r": [0.001, 0.001, 0.01, 0.01, 0.001, 5e-4],
"rateA": [250.0, 250.0, 60.0, 60.0, 280.0, 580.0],
"from_bus_id": [0, 2, 2, 2, 4, 5],
"to_bus_id": [1, 3, 3, 3, 5, 6],
"x": [0.07, 0.19, 0.19, 0.19, 0.044, 0.018],
"r": [0.001, 0.01, 0.01, 0.01, 0.001, 5e-4],
"rateA": [250.0, 60.0, 60.0, 60.0, 280.0, 580.0],
}
)
transformers = create_transformers(bus, lines, transformer_designs)
Expand Down

0 comments on commit ec35bd2

Please sign in to comment.