-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Version Checks (indicate both or one)
-
I have confirmed this bug exists on the lastest release of Linopy.
-
I have confirmed this bug exists on the current
masterbranch of Linopy.
Issue Description
I am using linopy v0.5.8 in a Jupyter Notebook to solve a pypsa toy model.
When running the notebook the first time everything is fine, but when changing a parameter in a pypsa component and running the code again, the onjective value is 0. I have to restart the Kernel everytime to make it work.
Using linopy v0.5.5 everything is fine.
Reproducible Example
import pandas as pd
import pypsa
ts = pd.DataFrame(
{
"load_mw": [10, 15, 30, 20],
"wind_pu": [1,1,1,1],
},
index=pd.to_datetime([
"2019-01-01 00:00:00",
"2019-01-01 01:00:00",
"2019-01-01 02:00:00",
"2019-01-01 03:00:00",
])
)
ts.index.name = "timestamp"
n = pypsa.Network()
n.set_snapshots(ts.index) # snapshots 0..x-1
# Set snapshot weightings (hours each snapshot represents)
n.snapshot_weightings[:] = 1 # Each snapshot represents x hour
# Add all carrier definitions upfront
n.add("Carrier", carriers, color=colors)
# Add a single bus
n.add("Bus", "bus", carrier="AC")
# add load
n.add("Load", "load", p_set=ts['load_mw'], bus="bus")
n.add(
"Generator",
"gas",
carrier="gas",
bus="bus",
p_nom=10,
p_nom_min=10,
marginal_cost=70,
capital_cost=30000,
p_nom_extendable=True,
)
n.add(
"Generator",
"wind",
carrier="wind",
bus="bus",
p_nom=10,
p_nom_min=10,
marginal_cost=0,
capital_cost=100000,
p_max_pu=ts['wind_pu'],
p_nom_extendable=True,
)
n.optimize(solver_name="highs")Expected Behavior
when changing the parameters of a component and rerunning the code, a new plausible result should be shown.
Installed Versions
Details
Replace this line.Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working