clustering module
- clustering.add_hot_water_demand(building_cluster: GeoDataFrame, cluster_TS: DataFrame, cost_parameter: dict) DataFrame [source]
Add a simplified hot water demand to the heat demand time series.
This function adds a simplified hot water demand to the heat demand time series of the buildings. The hot water demand is equally distributed over the year and is calculated based on the number of dwellings in each cluster. The hot water demand is added to the existing heat demand time series.
- Parameters:
building_cluster (gpd.GeoDataFrame) -- geodataframe with data for each cluster
cluster_TS (pd.DataFrame) -- dataframe with heat demand time series of the clusters
cost_parameter (dict) -- dictionary with cost parameters for the clustering
- Returns:
dataframe with heat demand time serieswith added hot water demand in the same time series
- Return type:
pd.DataFrame
- clustering.cluster_buildings(gdf_building_data: GeoDataFrame, cost_parameter: dict) GeoDataFrame [source]
Cluster the buildings into clusters based on their location and aggregate/calculate properties for each cluster.
This implementation uses KMeans clustering to group buildings into clusters based on their geographical coordinates. A different clustering method can be used if needed.
- Parameters:
gdf_building_data (gpd.GeoDataFrame) -- geodataframe with building data, must contain a centroid column
cost_parameter (dict) -- dictionary with cost parameters for the clustering
- Returns:
geodataframe with data for each cluster for subsequent analysis
- Return type:
gpd.GeoDataFrame
- clustering.cluster_heat_demand(gdf_allheatnodes: GeoDataFrame, df_building_TS: DataFrame) DataFrame [source]
Cluster the heat demand time series of the buildings into clusters based on the spatial clustering of the buildings.
- Parameters:
gdf_allheatnodes (gpd.GeoDataFrame) -- geodataframe with data for each cluster and the heat generation units
df_building_TS (pd.DataFrame) -- dataframe with heat demand time series of the buildings
- Returns:
dataframe with heat demand time series of the clusters
- Return type:
pd.DataFrame
- clustering.get_centroids(gdf_building_data: GeoDataFrame)[source]
Calculate the centroids of the buildings and add them to the geodataframe.
- Parameters:
gdf_building_data (gpd.GeoDataFrame) -- geodataframe with building data, must contain a geometry column
- clustering.merge_heatGenUnits(gdf_clustered_buildings: GeoDataFrame, gdf_heatGenUnits: GeoDataFrame) GeoDataFrame [source]
Merge the data for the heat generation units with the data for the clusters of buildings.
- Parameters:
gdf_clustered_buildings (gpd.GeoDataFrame) -- geodataframe with data for each building cluster
gdf_heatGenUnits (gpd.GeoDataFrame) -- geodataframe with data for the heat generation units
- Returns:
geodataframe with data for each cluster and the heat generation units
- Return type:
gpd.GeoDataFrame
- clustering.perform_complete_clustering(case_study_name: str, scenario_name: str) None [source]
Perform the complete clustering process and save the data for the optimisation model.
- Parameters:
case_study_name (str) -- name of the case study
scenario_name (str) -- name of the scenario
- clustering.propose_network(gdf_heat_nodes: GeoDataFrame) GeoDataFrame [source]
Propose a network of heat pipes between the clusters of building clusters.
The network is based on the delaunay triangulation and minimum spanning tree. A different network generation method can be used if needed.
- Parameters:
gdf_heat_nodes (gpd.GeoDataFrame) -- geodataframe with data for each cluster
- Returns:
geodataframe with data for the network
- Return type:
gpd.GeoDataFrame
- clustering.read_building_TS_from_disk(case_study_name: str, config: dict) DataFrame [source]
Read the building heat demand time series for a given casestudy from the disk and return a dataframe.
- Parameters:
case_study_name (str) -- name of the case study
config (dict) -- configuration dictionary
- Returns:
dataframe with building heat demand time series of the buildings
- Return type:
pd.DataFrame
- clustering.read_geo_data_from_disk(case_study_name: str, config: dict) GeoDataFrame [source]
Read the building data for a given casestudy from the disk and return a geodataframe.
- Parameters:
case_study_name (str) -- name of the case study
config (dict) -- configuration dictionary
- Returns:
geodataframe with building data
- Return type:
gpd.GeoDataFrame
- clustering.read_heatGenUnits_from_disk(case_study_name: str, scenario_name: str, config: dict) GeoDataFrame [source]
Read the heat generation units for a given casestudy from the disk and return a geodataframe.
- Parameters:
case_study_name (str) -- name of the case study
scenario_name (str) -- name of the scenario
config (dict) -- configuration dictionary
- Returns:
geodataframe with heat generation units
- Return type:
gpd.GeoDataFrame
- clustering.read_wasteHeatProfiles_from_disk(gdf_heat_gen: GeoDataFrame, case_study_name: str, scenario_name: str, config: dict) DataFrame [source]
Read the waste heat profiles for a given casestudy from the disk and return a dataframe.
- Parameters:
gdf_heat_gen (gpd.GeoDataFrame) -- geodataframe with heat generation units
case_study_name (str) -- name of the case study
scenario_name (str) -- name of the scenario
config (dict) -- configuration dictionary
- Returns:
dataframe with waste heat profiles of the heat generation units
- Return type:
pd.DataFrame
- clustering.save_data(gdf_heat_nodes: GeoDataFrame, df_cluster_TS: DataFrame, gdf_heat_network: GeoDataFrame, gdf_heat_gen: GeoDataFrame, df_waste_heat_profiles: DataFrame, case_study_name: str, scenario_name: str, config: dict)[source]
Save the data in the format for the optimisation model to the scenario folder.
- Parameters:
gdf_heat_nodes (gpd.GeoDataFrame) -- geodataframe with data for each cluster
df_cluster_TS (pd.DataFrame) -- dataframe with heat demand time series of the clusters
gdf_heat_network (gpd.GeoDataFrame) -- geodataframe with data for the network
gdf_heat_gen (gpd.GeoDataFrame) -- geodataframe with data for the heat generation units
df_waste_heat_profiles (pd.DataFrame) -- dataframe with waste heat profiles of the heat generation units
case_study_name (str) -- name of the case study
scenario_name (str) -- name of the scenario
config (dict) -- configuration dictionary