branch

class src.branch.Branch(initial_values=None, th_values=None, **kwargs)[source]

Bases: object

Evaluates a single branch of a district heatng or cooling network. Performs calculations of pipe sections sequentiall for the supply line first and then for the return line.

initial_values

Data required to set the initial configuration of the system. Refer to data in the BranchInitialConfig class in config_data.py.

Type:

None

th_values

Pipe and insulation thickness data. Data can be read from a dedicated JSON file.

Type:

None

damage_mode

Defines how insulation damage is modelled. See the __init__ definition for more information.

Type:

str

damage

Amaunt of insulation damage. See the __initi__ definition for more information.

Type:

float

Helper methods:

_calculate_internal_diameter() get_class_instance_count() print_input_data() calculate_branch_length()

Calculation methods:

calculate_supply() calculate_return() calculate_system_heat_flow

calculate_branch_length()[source]

Sums lengths of all pipeline elements to get the length of the analysed branch.

Return l_branch:

Length in [m]

Return type:

float

calculate_return()[source]

Performs calculations for the return line.

calculate_supply()[source]

Performs calculations for the supply line.

calculate_system_heat_flow()[source]
Return type:

None

Gathers total heat flow data from the supply and return calculations to calculate the total system heat flow:

Q̇ _total_system = Q̇ _total_supply - Q̇ _total_return.

class_instances_created = 0
classmethod get_class_instance_count()[source]

Returns the number of Branch objects created (used for tracking the number of instances created).

:return Number of class instances

Return type:

int

print_input_data()[source]
Return type:

None

Outputs to terminal information about input data:
  • Insulation damage mode (average or per element)

  • Level of damage in percent

config_data

class src.config_data.AmbientTemp(t_surface_c=3.5, t_channel_c=30, t_soil_c=10)[source]

Bases: object

Temperatures of different ambients considered in the calculations.

Parameters:
  • t_surface_c (float) – Air temperature at the surface in [°C]. Surface is considered at the level of the installation of the pipeline.

  • t_channel_c (float) – Average temperature inside the channel in [°C].

  • t_soil_c (float) – Average temperature of the soil around the pipeline in [°C].

t_channel_c: float = 30
t_soil_c: float = 10
t_surface_c: float = 3.5
class src.config_data.BranchInitialConfig(fluid='Water', p_nominal_pa=1600000.0, t_in_supply_c=134.443, t_in_return_c=84.4, t_consumer_release_c=85, vdot_m3_per_h=189.92, th_avg_ins_damage_m=0.017)[source]

Bases: object

Contains data required for setting up the initial configuration of the analysed system. Default values are given for a branch of the primary district heating network in the city of Velenje in Slovenia.

Parameters:
  • fluid (str) – Fluid type in the pipeline. Should be of the type recognised by the CoolProp module.

  • p_nominal_pa (float) – Average pressure in the pipeline in [Pa].

  • t_in_supply_c (float) – Temperature at the start of the supply line of the analysed branch in [°C].

  • t_in_return_c (float) – Temperature at the start of the return line of the analysed branch in [°C].

  • t_consumer_release_c (float) – Temperature of the fluid returning to the return line from each consumer in [°C].

  • vdot_m3_per_h (float) – Flow rate at the start of the supply line in [m3/h].

  • th_avg_ins_damage_m (float) – Average thickness of damaged insulation in [m].

fluid: str = 'Water'
p_nominal_pa: float = 1600000.0
t_consumer_release_c: float = 85
t_in_return_c: float = 84.4
t_in_supply_c: float = 134.443
th_avg_ins_damage_m: float = 0.017
vdot_m3_per_h: float = 189.92

data_input

data_output

class src.data_output.PipeRow(lat, lon, l_tot, t_in, mdot, qdot_loss, qdotnorm_loss, qdot_loss_tot, v_fluid, mdot_consumer, qdot_consumer_abs, qdot_consumer_act, qdot_tot)[source]

Bases: object

Defines names and types of DataFrames columns for the results of supply and return calculations.

convert_to_dict_pipe()[source]
l_tot: float
lat: float
lon: float
mdot: float
mdot_consumer: float
qdot_consumer_abs: float
qdot_consumer_act: float
qdot_loss: float
qdot_loss_tot: float
qdot_tot: float
qdotnorm_loss: float
t_in: float
v_fluid: float
class src.data_output.SystemRow(lat, lon, l_tot, qdot_system)[source]

Bases: object

Defines names and types of DataFrame columns for the results of system heat flow calculations.

convert_to_dict_system()[source]
l_tot: float
lat: float
lon: float
qdot_system: float

main

src.main.main()[source]

Runs the analysis in a Python environment.

src.main.plot_branch_dir()[source]

Calls the plot_branch() function in plots.py and plots the supply and return configuration of the network separately.

Return type:

None

src.main.plot_config()[source]

Calls the plot_branch() function in plots.py and plots the supply and return pipelines on a map. It also plots insulation thicknesses of supply and return line from the plot_insulation() function.

Return type:

None

src.main.plot_losses()[source]
Return type:

None

Calls the functions to plot heat flow losses in a static plot:
  • plot_heat_flow_loss(): for absolute heat flow losses

  • plot_normalised_heat_flow_loss(): shows losses that have been normalised with respect to the length of the pipeline section

Also calls the plot_output_heatmap() function in plots.py to plot interactive heatmaps of results in the supply and return line superimposed on the map.

src.main.plot_temperature()[source]

Calls the plot_supply_temperature() function in plots.py and plots the supply and return temperatures.

Return type:

None

model_param

class src.model_param.PipeSectionLocation(*values)[source]

Bases: Enum

Contains the names of locations where sections of the pipelines are installed.

Parameters:
  • (str) (loc3) – channel

  • (str) – surface

  • (str) – soil

loc1 = 'channel'
loc2 = 'surface'
loc3 = 'soil'
class src.model_param.ThermalCoeff(h_water_w_per_m2k=3000.0, h_surface_w_per_m2k=200.0, h_channel_w_per_m2k=100.0, h_soil_w_per_m2k=3.0, k_pipe_w_per_mk=43.0, k_ins_w_per_mk=0.03, k_ins_damaged_w_per_mk=0.03)[source]

Bases: object

Contains thermal property data for different materials.

Parameters:
  • (float) (k_ins_damaged_w_per_mk) – The heat transfer coefficient for the pipe - water to pipe wall in [W/m²K].

  • (float) – The heat transfer coefficient for the insulation - insulation to surface air in [W/m²K].

  • (float) – The heat transfer coefficient for the insulation - insulation to channel air in [W/m²K].

  • (float) – The heat transfer coefficient for the insulation - insulation to surrounding soil in [W/m²K].

  • (float) – Thermal conductivity of the pipe material in [W/mK].

  • (float) – Thermal conductivity of intact insulation in [W/mK].

  • (float) – Thermal conductivity of the damaged insulation in [W/mK]. Default: same as intact insulation.

h_channel_w_per_m2k: float = 100.0
h_soil_w_per_m2k: float = 3.0
h_surface_w_per_m2k: float = 200.0
h_water_w_per_m2k: float = 3000.0
k_ins_damaged_w_per_mk: float = 0.03
k_ins_w_per_mk: float = 0.03
k_pipe_w_per_mk: float = 43.0

plots

src.plots.plot_branch(direction)[source]

Reads data from the input DataFrames and plots the configuration of the analysed branch on top of a map.

Parameters:

direction (str) – Chooses the direction of the pipeline to plot. Options: - ‘supply’: Plots only the supply line. - ‘return’: Plots only the return line. - ‘all’: Plots both lines on the same map.

Return type:

None

src.plots.plot_heat_flow_loss(direction)[source]

Reads data from the output DataFrames and plots the heat flow loss distribution along the lenght of the pipeline.

Parameters:

direction (str) – Chooses the direction of the pipeline to plot. Options: - ‘supply’: Plots only the supply line. - ‘return’: Plots only the return line.

Return type:

None

src.plots.plot_heat_flow_loss_nodes(direction)[source]

Reads data from the output DataFrames and plots nodes using longitude, latitude, and the heat flow loss value column for colouring.

Parameters:

direction (str) – Chooses the direction of the pipeline to plot. Options: - ‘supply’: Plots only the supply line. - ‘return’: Plots only the return line.

Return type:

None

src.plots.plot_insulation(direction)[source]

Reads data from the input DataFrames and plots insulation thickness of the analysed branch on top of a map.

Parameters:

direction (str) – Chooses the direction of the pipeline to plot. Options: - ‘supply’: Plots only the supply line. - ‘return’: Plots only the return line.

Return type:

None

src.plots.plot_mass_flow(direction)[source]

Reads data from the output DataFrames and plots the mass flow distribution along the lenght of the pipeline.

Parameters:

direction (str) – Chooses the direction of the pipeline to plot. Options: - ‘supply’: Plots only the supply line. - ‘return’: Plots only the return line.

Return type:

None

src.plots.plot_normalised_heat_flow_loss(direction)[source]

Reads data from the output DataFrames and plots the normalised heat flow loss distribution along the lenght of the pipeline.

Parameters:

direction (str) – Chooses the direction of the pipeline to plot. Options: - ‘supply’: Plots only the supply line. - ‘return’: Plots only the return line.

Return type:

None

src.plots.plot_output_heatmap(direction, value_column)[source]

Reads data from the output DataFrames and plots line segments on a map using longitude, latitude, and a value column for colouring.

Parameters:
  • direction (str) – Chooses the direction of the pipeline to plot. Options: - ‘supply’: Plots only the supply line. - ‘return’: Plots only the return line.

  • value_column (str) – Column in the DataFrame to use for coloring the segments.

Return type:

None

src.plots.plot_temperature(direction)[source]

Reads data from the output DataFrames and plots the temperature distribution along the lenght of the pipeline.

Parameters:

direction (str) – Chooses the direction of the pipeline to plot. Options: - ‘supply’: Plots only the supply line. - ‘return’: Plots only the return line.

Return type:

None

src.plots.plot_total_heat_flow_loss(direction)[source]

Reads data from the output DataFrames and plots the cumulative heat flow loss distribution along the lenght of the pipeline.

Parameters:

direction (str) – Chooses the direction of the pipeline to plot. Options: - ‘supply’: Plots only the supply line. - ‘return’: Plots only the return line.

Return type:

None