Skip to content

Commit

Permalink
Fix results aggregation, supply-demand interaction
Browse files Browse the repository at this point in the history
Aggregating according to a simplified list of heating technologies must
sum up any grouped technologies.

Fix is to test if entry exists in dict and create if missing,
otherwise add values rather than overwriting.
  • Loading branch information
tomalrussell committed Sep 1, 2020
1 parent 2261cf4 commit 374eac0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions energy_demand/basic/demand_supply_interaction.py
Expand Up @@ -64,13 +64,17 @@ def constrained_results(
# ----------------------------------------
for submodel_nr, submodel in enumerate(submodels_names):
for tech, fuel_tech in results_constrained.items():
# Technological simplifications because of different technology definition and because not all technologies are used in supply model
# Technological simplifications because of different technology
# definition and because not all technologies are used in supply model
tech_simplified = model_tech_simplification(tech)
fueltype_str = technologies[tech_simplified].fueltype_str
fueltype_int = technologies[tech_simplified].fueltype_int
key_name = "{}_{}_{}".format(submodel, fueltype_str, tech_simplified)

supply_results[key_name] = fuel_tech[submodel_nr][:, fueltype_int, :]
if key_name not in supply_results:
supply_results[key_name] = fuel_tech[submodel_nr][:, fueltype_int, :]
else:
supply_results[key_name] += fuel_tech[submodel_nr][:, fueltype_int, :]

assert not testing_functions.test_if_minus_value_in_array(results_unconstrained_no_heating)

Expand Down

0 comments on commit 374eac0

Please sign in to comment.