-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more advanced heatpump with outputs for dhw and building heating - ne…
…w branch (#288) * new branch with new hp model - branch is up to date with origin - no models that have nothing to do with the branch - only heatpump branch * fix test issues --> ready for testing (utsp test will fail due to .env file) * fixing test issues - new Classnames due to tests * fixing test issues - new Classnames due to tests * update to new utsp connector in system_setups * update and corrections due to email * incorrectly specified result path, now it is correct * correction of outputname State_dhw * - more output parameters for hp - optimized test and system setup for new hp model * - new system_setup "household_1c" --> exactly same config as household_1 with one dhw hp and one hp for spaceheating, spaceheating hp is here the "new" more_advanced_heat_pump_hplib.py model --> results fits to household_1 --> household_1c can replace household_1 - change hp model in compute_kpis.py --> change advanced_hp with more_advanced_hp - improvements of more_advanced_heat_pump_hplib.py inputs --> now inputs are more flexibel (parameter "mandatory" to "false") --> hp can use as before (only provide space heating) or both dhw and space heating * fixing test issus (class name exist two times) * adding "oszilation" check in caching function so variable "force_convergence" is not used anymore in hp calculations * "new" code for comparison * back to original * rename variables on primary side of hp * Idea from Noah: put "force_convergence" in cache for calculating results works fine * - update to newest HiSim version for fixing conflicts in PulLRequest - additional preparation of HP for heating systems without hot water storage --> HP connected to hds directly ( changes in hds model will follow in new branch) * - Save the previous DHW temperature, since in the simulation a "0" is sometimes transferred from DHW storage to the DHW controller of the heat pump even though the storage temperature is correct. The result is that the hp switches to dhw mode too early due to the prioritization of the dhw. - cleaning dhw hp controller * - Update to newest HiSim Version - new parameter in config to check if hp should prepare dhw --> if no dhw more advanced hp model is same as original advanced hp model - new test for operation mode sh only --> acts like original * include hp with brine as source also in input and output parameters * - fix test for ems controller - add modular and advanced hp for dhw in kpis * fix pylint tests
- Loading branch information
Showing
9 changed files
with
3,658 additions
and
87 deletions.
There are no files selected for viewing
1,912 changes: 1,912 additions & 0 deletions
1,912
hisim/components/more_advanced_heat_pump_hplib.py
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
454 changes: 454 additions & 0 deletions
454
system_setups/household_1b_more_advanced_hp_diesel_car.py
Large diffs are not rendered by default.
Oops, something went wrong.
427 changes: 427 additions & 0 deletions
427
system_setups/household_1c_more_advanced_hp_dhw_hp_diesel_car.py
Large diffs are not rendered by default.
Oops, something went wrong.
294 changes: 294 additions & 0 deletions
294
system_setups/household_with_more_advanced_hp_hws_dhw_hds.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,294 @@ | ||
""" Basic household new system setup. """ | ||
|
||
# clean | ||
|
||
from typing import Optional, Any | ||
from hisim.simulator import SimulationParameters | ||
from hisim.components import loadprofilegenerator_utsp_connector | ||
from hisim.components import weather | ||
from hisim.components import building | ||
from hisim.components import more_advanced_heat_pump_hplib | ||
from hisim.components import electricity_meter | ||
from hisim.components import simple_hot_water_storage | ||
from hisim.components import generic_hot_water_storage_modular | ||
from hisim.components import heat_distribution_system | ||
from hisim import loadtypes as lt | ||
from hisim.units import Quantity, Celsius, Watt | ||
|
||
__authors__ = "Jonas Hoppe" | ||
__copyright__ = "" | ||
__credits__ = ["Jonas Hoppe"] | ||
__license__ = "-" | ||
__version__ = "" | ||
__maintainer__ = "" | ||
__status__ = "" | ||
|
||
|
||
def setup_function( | ||
my_sim: Any, my_simulation_parameters: Optional[SimulationParameters] = None | ||
) -> None: # noqa: too-many-statements | ||
"""Basic household system setup. | ||
This setup function emulates an household including the basic components. Here the residents have their | ||
electricity and heating needs covered by the photovoltaic system and the heat pump. | ||
- Simulation Parameters | ||
- Components | ||
- Occupancy (Residents' Demands) | ||
- Weather | ||
- Building | ||
- Heat Pump | ||
- Heat Pump Controller for dhw | ||
- Heat Pump Controller for building heating | ||
- Heat Distribution System | ||
- Heat Distribution Controller | ||
- Hot Water Storage | ||
- DHW Water Storage | ||
""" | ||
|
||
# ================================================================================================================================= | ||
# Set System Parameters | ||
|
||
# Set Simulation Parameters | ||
year = 2021 | ||
seconds_per_timestep = 60 | ||
|
||
# Set Heat Pump Controller | ||
hp_controller_mode = 2 # mode 1 for on/off and mode 2 for heating/cooling/off (regulated) | ||
set_heating_threshold_outside_temperature_for_heat_pump_in_celsius = 16.0 | ||
set_cooling_threshold_outside_temperature_for_heat_pump_in_celsius = 22.0 | ||
temperature_offset_for_state_conditions_in_celsius = 5.0 | ||
|
||
# Set Heat Pump | ||
group_id: int = 1 # outdoor/air heat pump (choose 1 for regulated or 4 for on/off) | ||
heating_reference_temperature_in_celsius: float = -7.0 # t_in | ||
flow_temperature_in_celsius: float = 21.0 # t_out_val | ||
with_domestic_hot_water_preparation: bool = True | ||
|
||
# ================================================================================================================================= | ||
# Build Components | ||
|
||
# Build Simulation Parameters | ||
|
||
if my_simulation_parameters is None: | ||
my_simulation_parameters = SimulationParameters.full_year_with_only_plots( | ||
year=year, seconds_per_timestep=seconds_per_timestep | ||
) | ||
|
||
my_sim.set_simulation_parameters(my_simulation_parameters) | ||
|
||
# Build Building | ||
my_building_config = building.BuildingConfig.get_default_german_single_family_home( | ||
heating_reference_temperature_in_celsius=heating_reference_temperature_in_celsius, | ||
) | ||
my_building_information = building.BuildingInformation(config=my_building_config) | ||
my_building = building.Building(config=my_building_config, my_simulation_parameters=my_simulation_parameters) | ||
# Build Occupancy | ||
my_occupancy_config = loadprofilegenerator_utsp_connector.UtspLpgConnectorConfig.get_default_utsp_connector_config() | ||
my_occupancy = loadprofilegenerator_utsp_connector.UtspLpgConnector( | ||
config=my_occupancy_config, my_simulation_parameters=my_simulation_parameters | ||
) | ||
|
||
# Build Weather | ||
my_weather_config = weather.WeatherConfig.get_default(location_entry=weather.LocationEnum.AACHEN) | ||
my_weather = weather.Weather(config=my_weather_config, my_simulation_parameters=my_simulation_parameters) | ||
|
||
# Build Heat Distribution Controller | ||
my_heat_distribution_controller_config = heat_distribution_system.HeatDistributionControllerConfig.get_default_heat_distribution_controller_config( | ||
set_heating_temperature_for_building_in_celsius=my_building_information.set_heating_temperature_for_building_in_celsius, | ||
set_cooling_temperature_for_building_in_celsius=my_building_information.set_cooling_temperature_for_building_in_celsius, | ||
heating_load_of_building_in_watt=my_building_information.max_thermal_building_demand_in_watt, | ||
heating_reference_temperature_in_celsius=heating_reference_temperature_in_celsius, | ||
) | ||
|
||
my_heat_distribution_controller = heat_distribution_system.HeatDistributionController( | ||
my_simulation_parameters=my_simulation_parameters, | ||
config=my_heat_distribution_controller_config, | ||
) | ||
my_hds_controller_information = heat_distribution_system.HeatDistributionControllerInformation( | ||
config=my_heat_distribution_controller_config | ||
) | ||
|
||
# Build Electricity Meter | ||
my_electricity_meter = electricity_meter.ElectricityMeter( | ||
my_simulation_parameters=my_simulation_parameters, | ||
config=electricity_meter.ElectricityMeterConfig.get_electricity_meter_default_config(), | ||
) | ||
|
||
# Build Heat Pump Controller for hot water (heating building) | ||
my_heatpump_controller_sh_config = more_advanced_heat_pump_hplib.HeatPumpHplibControllerSpaceHeatingConfig( | ||
name="HeatPumpControllerSH", | ||
mode=hp_controller_mode, | ||
set_heating_threshold_outside_temperature_in_celsius=set_heating_threshold_outside_temperature_for_heat_pump_in_celsius, | ||
set_cooling_threshold_outside_temperature_in_celsius=set_cooling_threshold_outside_temperature_for_heat_pump_in_celsius, | ||
upper_temperature_offset_for_state_conditions_in_celsius=temperature_offset_for_state_conditions_in_celsius, | ||
lower_temperature_offset_for_state_conditions_in_celsius=temperature_offset_for_state_conditions_in_celsius, | ||
heat_distribution_system_type=my_hds_controller_information.heat_distribution_system_type, | ||
) | ||
|
||
my_heatpump_controller_hotwater = more_advanced_heat_pump_hplib.HeatPumpHplibControllerSpaceHeating( | ||
config=my_heatpump_controller_sh_config, my_simulation_parameters=my_simulation_parameters | ||
) | ||
|
||
my_heatpump_controller_dhw_config = ( | ||
more_advanced_heat_pump_hplib.HeatPumpHplibControllerDHWConfig.get_default_dhw_controller_config() | ||
) | ||
|
||
# Build Heat Pump Controller for dhw | ||
my_heatpump_controller_dhw = more_advanced_heat_pump_hplib.HeatPumpHplibControllerDHW( | ||
config=my_heatpump_controller_dhw_config, my_simulation_parameters=my_simulation_parameters | ||
) | ||
|
||
# Build Heat Pump | ||
my_heatpump_config = more_advanced_heat_pump_hplib.HeatPumpHplibWithTwoOutputsConfig.get_scaled_advanced_hp_lib( | ||
heating_load_of_building_in_watt=Quantity(my_building_information.max_thermal_building_demand_in_watt, Watt), | ||
heating_reference_temperature_in_celsius=Quantity(heating_reference_temperature_in_celsius, Celsius), | ||
) | ||
my_heatpump_config.group_id = group_id | ||
my_heatpump_config.flow_temperature_in_celsius = Quantity(float(flow_temperature_in_celsius), Celsius) | ||
my_heatpump_config.with_domestic_hot_water_preparation = with_domestic_hot_water_preparation | ||
|
||
my_heatpump = more_advanced_heat_pump_hplib.HeatPumpHplibWithTwoOutputs( | ||
config=my_heatpump_config, | ||
my_simulation_parameters=my_simulation_parameters, | ||
) | ||
|
||
# Build Heat Distribution System | ||
my_heat_distribution_config = heat_distribution_system.HeatDistributionConfig.get_default_heatdistributionsystem_config( | ||
temperature_difference_between_flow_and_return_in_celsius=my_hds_controller_information.temperature_difference_between_flow_and_return_in_celsius, | ||
water_mass_flow_rate_in_kg_per_second=my_hds_controller_information.water_mass_flow_rate_in_kp_per_second, | ||
) | ||
|
||
my_heat_distribution = heat_distribution_system.HeatDistribution( | ||
config=my_heat_distribution_config, | ||
my_simulation_parameters=my_simulation_parameters, | ||
) | ||
|
||
# Build Heat Water Storage | ||
my_hot_water_storage_config = simple_hot_water_storage.SimpleHotWaterStorageConfig.get_scaled_hot_water_storage( | ||
max_thermal_power_in_watt_of_heating_system=my_heatpump_config.set_thermal_output_power_in_watt.value, | ||
sizing_option=simple_hot_water_storage.HotWaterStorageSizingEnum.SIZE_ACCORDING_TO_HEAT_PUMP, | ||
temperature_difference_between_flow_and_return_in_celsius=my_hds_controller_information.temperature_difference_between_flow_and_return_in_celsius, | ||
water_mass_flow_rate_from_hds_in_kg_per_second=my_hds_controller_information.water_mass_flow_rate_in_kp_per_second, | ||
) | ||
|
||
my_hot_water_storage = simple_hot_water_storage.SimpleHotWaterStorage( | ||
config=my_hot_water_storage_config, | ||
my_simulation_parameters=my_simulation_parameters, | ||
) | ||
|
||
# Build DHW Storage | ||
my_dhw_storage_config = generic_hot_water_storage_modular.StorageConfig.get_default_config_for_boiler() | ||
|
||
my_dhw_storage = generic_hot_water_storage_modular.HotWaterStorage( | ||
config=my_dhw_storage_config, | ||
my_simulation_parameters=my_simulation_parameters, | ||
) | ||
|
||
# ================================================================================================================================= | ||
# Connect Components | ||
my_building.connect_only_predefined_connections(my_weather) | ||
my_building.connect_only_predefined_connections(my_occupancy) | ||
|
||
my_building.connect_input( | ||
my_building.ThermalPowerDelivered, | ||
my_heat_distribution.component_name, | ||
my_heat_distribution.ThermalPowerDelivered, | ||
) | ||
|
||
################################# | ||
my_heat_distribution_controller.connect_only_predefined_connections(my_weather, my_building, my_hot_water_storage) | ||
|
||
my_heat_distribution.connect_only_predefined_connections( | ||
my_building, my_heat_distribution_controller, my_hot_water_storage | ||
) | ||
|
||
################################# | ||
my_heatpump.connect_only_predefined_connections( | ||
my_heatpump_controller_hotwater, my_heatpump_controller_dhw, my_weather, my_hot_water_storage, my_dhw_storage | ||
) | ||
|
||
# Verknüpfung mit Luft als Umgebungswärmeqzuelle | ||
if my_heatpump.parameters["Group"].iloc[0] == 1.0 or my_heatpump.parameters["Group"].iloc[0] == 4.0: | ||
my_heatpump.connect_input( | ||
my_heatpump.TemperatureInputPrimary, | ||
my_weather.component_name, | ||
my_weather.DailyAverageOutsideTemperatures, | ||
) | ||
else: | ||
raise KeyError( | ||
"Wasser oder Sole als primäres Wärmeträgermedium muss über extra Wärmenetz-Modell noch bereitgestellt werden" | ||
) | ||
|
||
# todo: Water and Brine Connection | ||
|
||
my_heatpump_controller_hotwater.connect_only_predefined_connections( | ||
my_heat_distribution_controller, my_weather, my_hot_water_storage | ||
) | ||
|
||
my_heatpump_controller_dhw.connect_only_predefined_connections(my_dhw_storage) | ||
|
||
################################# | ||
my_hot_water_storage.connect_input( | ||
my_hot_water_storage.WaterTemperatureFromHeatDistribution, | ||
my_heat_distribution.component_name, | ||
my_heat_distribution.WaterTemperatureOutput, | ||
) | ||
|
||
my_hot_water_storage.connect_input( | ||
my_hot_water_storage.WaterTemperatureFromHeatGenerator, | ||
my_heatpump.component_name, | ||
my_heatpump.TemperatureOutputSH, | ||
) | ||
|
||
my_hot_water_storage.connect_input( | ||
my_hot_water_storage.WaterMassFlowRateFromHeatGenerator, | ||
my_heatpump.component_name, | ||
my_heatpump.MassFlowOutputSH, | ||
) | ||
|
||
################################# | ||
|
||
my_dhw_storage.connect_only_predefined_connections(my_occupancy) | ||
my_dhw_storage.connect_input( | ||
my_dhw_storage.ThermalPowerDelivered, | ||
my_heatpump.component_name, | ||
my_heatpump.ThermalOutputPowerDHW, | ||
) | ||
|
||
################################ | ||
|
||
my_electricity_meter.add_component_input_and_connect( | ||
source_object_name=my_occupancy.component_name, | ||
source_component_output=my_occupancy.ElectricityOutput, | ||
source_load_type=lt.LoadTypes.ELECTRICITY, | ||
source_unit=lt.Units.WATT, | ||
source_tags=[lt.InandOutputType.ELECTRICITY_CONSUMPTION_UNCONTROLLED], | ||
source_weight=999, | ||
) | ||
|
||
my_electricity_meter.add_component_input_and_connect( | ||
source_object_name=my_heatpump.component_name, | ||
source_component_output=my_heatpump.ElectricalInputPowerTotal, | ||
source_load_type=lt.LoadTypes.ELECTRICITY, | ||
source_unit=lt.Units.WATT, | ||
source_tags=[ | ||
lt.InandOutputType.ELECTRICITY_CONSUMPTION_UNCONTROLLED, | ||
], | ||
source_weight=999, | ||
) | ||
|
||
# ================================================================================================================================= | ||
# Add Components to Simulation Parameters | ||
|
||
my_sim.add_component(my_occupancy) | ||
my_sim.add_component(my_weather) | ||
my_sim.add_component(my_electricity_meter) | ||
my_sim.add_component(my_building) | ||
my_sim.add_component(my_heat_distribution_controller) | ||
my_sim.add_component(my_heat_distribution) | ||
my_sim.add_component(my_hot_water_storage) | ||
my_sim.add_component(my_dhw_storage) | ||
my_sim.add_component(my_heatpump_controller_hotwater) | ||
my_sim.add_component(my_heatpump_controller_dhw) | ||
my_sim.add_component(my_heatpump) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.