Linear Powerflow¶
This notebook adds linear powerflow constraints to the Energy Hub model in BESOS. These equations solve the optimal power flow problem for the electricty grid to identify grid congestion problems.
[ ]:
from pyehub.multiple_hubs import multiple_hubs
Multiple Hubs Input¶
The inputs and outputs of multiple hubs are unchanged. The pattern for the names of the files for the hubs invovled, the number of hubs in the network, and the path to the network files are required. In this example network.xlsx
is a network that has links between the different hubs but has no possibilities for power transmission lines. network2.xlsx
is the exact same except all its possible links are power transmission lines.
[ ]:
input_file = "hub__"
n = 4
network = "network.xlsx"
network2 = "network2.xlsx"
Solving the Models¶
Here we run the multiple_hubs
model twice, the only difference being the network configuration. The stdout is very long, so we capture it to a variable sol_output
.
[ ]:
%%capture sol_output
sol = multiple_hubs(input_files=input_file, n=n, network_excel=network)
[ ]:
%%capture LPsol_output
LPsol = multiple_hubs(input_files=input_file, n=n, network_excel=network2)
Observing the Difference in Outputs¶
We can examine the network links that are installed:
[ ]:
print(sol[0]["is_link_installed"])
print(LPsol[0]["is_link_installed"])
And the capacity of Link 3:
[ ]:
print(sol[0]["capacity3"])
print(LPsol[0]["capacity3"])
[ ]: