solve_network.py: fix filter bug

This commit is contained in:
Philipp Glaum 2022-04-21 09:54:52 +02:00
parent 175a030a9f
commit da5a5141f8

View File

@ -220,7 +220,7 @@ def add_minRenew_constraints(n, config, o):
renewables=list(config["electricity"]["renewable_aim"].keys()) renewables=list(config["electricity"]["renewable_aim"].keys())
if len(o)>2: if len(o)>2:
share=float(o[2:]) share=float(o[2:])
renewables_i = n.generators.query('carrier in @renewables').index renewables_i = n.generators[n.generators.carrier.str.contains("|".join(renewables))].index
weightings = n.snapshot_weightings.generators weightings = n.snapshot_weightings.generators
coeff = pd.DataFrame({c: weightings for c in renewables_i}) coeff = pd.DataFrame({c: weightings for c in renewables_i})
vars = get_var(n, "Generator", "p")[renewables_i] vars = get_var(n, "Generator", "p")[renewables_i]