UrbanHeatPro.Classes.City

City.py A. Molar-Cruz @ TUM ENS

Module Contents

Classes

City

City class.

class UrbanHeatPro.Classes.City.City(NAME, SIMULATION, CITY, SPACE_HEATING, HOT_WATER, REPORTING)[source]

City class.

Note

This documentation might be incomplete or outdated, check the source code for more information. The types for the attributes might not be correct.

name

The name of the simulation.

Type:

str

region

The region of the simulation.

Type:

str

sce

The scenario of the simulation.

Type:

str

dt_vector

Vector of time steps as datetime objects.

Type:

list

dt_vector_excel

Vector of time steps as excel date.

Type:

list

nts

Number of time steps.

Type:

int

resolution

Temporal resolution in minutes.

Type:

int

number_of_typ_days

Number of typical days.

Type:

int

weights

Weights of typical days.

Type:

list

processes

Number of parallel processes.

Type:

int

chunk_size

Number of buildings in chunk to save.

Type:

int

b_to_save_syncity

Array to save synchronicity data.

Type:

ndarray

b_to_save_heat

Array to save heat data.

Type:

ndarray

counter_syncity

Counter for synchronicity data.

Type:

int

counter_heat

Counter for heat data.

Type:

int

Tamb

Ambient temperature vector in degrees Celsius.

Type:

list

I

Solar radiation vector in W/m2 [I_Gh, I_Dh, I_ex, hs].

Type:

list

buildings

Building data.

Type:

list

building_stock_stats

Building data from statistics.

Type:

list

nb

Number of buildings.

Type:

int

connection_factor

Share of buildings connected to the network.

Type:

float

_space_heating

Flag to calculate space heating demand.

Type:

bool

_hot_water

Flag to calculate hot water demand.

Type:

bool

_energy_only

Flag to calculate only aggregated demand.

Type:

bool

base_load

Vector of base load in W.

Type:

ndarray

_internal_gains

Flag to consider internal gains.

Type:

bool

_solar_gains

Flag to consider solar gains.

Type:

bool

_active_population

Flag to consider active population for occupancy vector.

Type:

bool

_workday_weekend

Flag to consider difference between workdays and weekends.

Type:

bool

_monthly_sh_prob

Flag to consider monthly probability of using heating.

Type:

bool

refurbishment_level

Refurbishment level for all buildings.

Type:

float

Tb0_str

Initial building temperature as ‘ambient’ or ‘Tset’.

Type:

str

dTset

Delta temperature (for Tset_min, Tset_max).

Type:

float

eta

Heating process efficiency.

Type:

float

dT_per_hour

Maximum dT allowed in building per hour in degrees Celsius.

Type:

float

thermal_inertia

Thermal inertia of the heating system.

Type:

float

_night_set_back

Share of buildings with night set-back.

Type:

float

schedule_nsb

[start, end] of night set-back in hours.

Type:

list

T_nsb

Night set-back temperature in degrees Celsius.

Type:

float

power_reduction

Percentage of power reduced (as decimal).

Type:

float

Tw

Hot water temperature in degrees Celsius.

Type:

float

hw_tank_limit

Hot water tank limit as percentage (decimal).

Type:

float

hw_flow

Flow to refill hot water tank in L/min.

Type:

float

dhw_prob

Probabilities for calculation of hot water demand.

Type:

list

rid

Run id.

Type:

int

result_dir

Directory where results are stored.

Type:

str

plot

Plot level [0, 1, 2].

Type:

int

save

Save level [0, 1, 2].

Type:

int

debug

Debug level [0, 1, 2].

Type:

int

Initializes the City object.

Parameters:
  • NAME (str) – Name of the simulation.

  • SIMULATION (list) – List containing the parameters related to the simulation.

  • CITY (list) – List containing the parameters related to the city.

  • SPACE_HEATING (list) – List containing the parameters related to space heating demand.

  • HOT_WATER (list) – List containing the parameters related to hot water demand.

  • REPORTING (list) – List containing the parameters related to reporting.

create_synthetic_city()[source]

Create a synthetic city representing the building stock based on statistics.

update_synthetic_city(ref_matrix_res, ref_matrix_nres)[source]

Create a synthetic city representing the building stock based on statistics.

feed_building_to_process(feederQueue, buildings_list)[source]

Feeds building data to Queue

call_create_synthetic_building(feederQueue, writerQueue)[source]

Calls function to create synthetic building

call_update_synthetic_building(feederQueue, writerQueue)[source]

Calls function to update synthetic building. To update:

  • Refurbishment level

create_synthetic_building(building)[source]

Creates building object and calculates missing building properties

update_synthetic_building(building)[source]

Updates synthetic building. To update:

  • Refurbishment level

write_to_synthetic_city(writerQueue, filename)[source]

Write synthetic building results to file

calculate_city_heat_demand()[source]

Paralellizes the calculation of heating energy demand per building using a given number of processes. Every process modifies a shared dictionary where the heat demand is stored as power and energy.

call_calculate_building_heat_demand(feederQueue, writerQueue)[source]

Calls function to calculate building heat demand

calculate_building_heat_demand(building)[source]

Extracts building information needed to create a Building object. If the building is connected to the district heating network, then a Building object is created and the heat demand is calculted. If it is not, then the heat demand is set to zero.

Parameters:
  • information (building dataframe with building) –

  • counter (iii building) –

create_building_object(building)[source]

Creates instance of class Object

write_to_city_heat_demand(writerQueue, filename)[source]

Writes building properties and heat demand to file

initialize_dhw_probabilities()[source]

Calculates dhw probabilities (daily consumption, event loads, flow rate and duration as interpolate objects.

calculate_seasonal_variation_vector(amplitude=0.1, max_point=45)[source]

Creates a sine wave representing the change of the nominal consumption during the year due to the seasonal variation.

Parameters:
  • amplitude (float) – Variation of consumption (% of nominal load)

  • max_point (int) – Day in year with the highest hot water consumption (lowest ambient temperature)

Returns:

seasonal_vector <numpy array>

calculate_day_vector()[source]

Calculates a vector of the days in the year included in the simulation time frame. Maximum length is 366.

Returns:

self.day_vector, list of day numbers in simulation time frame

with start and end indices

Return type:

list

calculate_min_vector()[source]

Calculates a vector of the simulation time steps in minutes of year. Maximum length is 366*24*60.

Returns:

self.min_vector, list of time steps in minutes

Return type:

list

plot_timeseries(space_heating=True, hot_water=True, total=True, xticks=('month', 3))[source]
save_csv_syn_city_header(filename)[source]

Saves key building parameters of every chunk.

save_csv_energy_header(filename)[source]

Saves key building parameters of every chunk.

save_csv_power()[source]

Saves heat demand timeseries in csv file (space heating, hot water and total).

save_csv_energy()[source]

Saves aggregated heat demand in csv file (space heating, hot water and total).