Skip to content

Commit

Permalink
Merge branch 'dev' into fix/multiple_simulations_by_user
Browse files Browse the repository at this point in the history
  • Loading branch information
nesnoj committed Oct 6, 2023
2 parents be47cfb + 3041e34 commit e3109e7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ and this project tries to adhere to [Semantic Versioning](https://semver.org/spe
- round chart values to decent fps
- diverging capacities in digipipe datapackage and app due to operational status
- fix PV roof slider values and update slider on startup
- central heat pump share
- capacity and power of thermal storages

## [0.6.0] - 2023-09-01
### Added
Expand Down
2 changes: 2 additions & 0 deletions digiplan/map/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def generate_fields(parameters, additional_parameters=None): # noqa: ANN001, AN
attrs["data-step"] = item["step"]
if "from-min" in item:
attrs["data-from-min"] = item["from-min"]
if "from-max" in item:
attrs["data-from-max"] = item["from-max"]

field = IntegerField(
label=item["label"],
Expand Down
23 changes: 15 additions & 8 deletions digiplan/map/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,8 @@ def adapt_heat_settings(scenario: str, data: dict, request: HttpRequest) -> dict
hp_share = data.pop(hp_sliders[sector]) / 100
hp_energy[sector] = demand[sector] * hp_share
else:
if sector == "hh": # noqa: PLR5501
hp_share = data.pop("w_z_wp_1") / 100
hp_energy[sector] = demand[sector] * hp_share
else:
hp_energy[sector] = demand[sector] * 0
hp_share = data["w_z_wp_1"] / 100
hp_energy[sector] = demand[sector] * hp_share

# HP Capacity and Energies
hp_energy_total = pd.concat(hp_energy.values(), axis=1).sum(axis=1)
Expand All @@ -215,17 +212,27 @@ def adapt_heat_settings(scenario: str, data: dict, request: HttpRequest) -> dict
avg_demand_per_day = total_demand.sum() / 365
logging.info(f"Adapting capacity for storage at {distribution=}.")
capacity = float(avg_demand_per_day * data.pop(storage_sliders[distribution]) / 100)
# Adapt storage capacity to solarthermal collector overpowering:
# Adapt storage capacity to solarthermal collector overpowering (make sure the maximum feedin power of ST can
# be absorbed by the storage):
solar_capacity = data[f"ABW-solar-thermalcollector_{distribution}"]["capacity"]
solar_thermal_energy = (
datapackage.get_thermal_efficiency(f"solar-thermalcollector_{distribution}") * solar_capacity
)
delta_solar = solar_thermal_energy - total_demand
solar_peak = delta_solar[delta_solar > 0].max()
capacity = max(capacity, solar_peak)

tech_mapping = {"central": "large", "decentral": "small"}
power = (
capacity
* config.TECHNOLOGY_DATA["hot_water_storages"][tech_mapping[distribution]][
"nominal_power_per_storage_capacity"
]
)
power = max(power, solar_peak)

data[f"ABW-heat_{distribution}-storage"] = {
"capacity": capacity,
"storage_capacity": capacity,
"capacity": power,
}

# Adapt biomass to biogas plant size
Expand Down

0 comments on commit e3109e7

Please sign in to comment.