ghx package

Module contents

class ghx.aggregated_loads.AggregatedLoadFixed(loads, first_sim_hour, max_length, init=False)[source]

Bases: object

Class that contains a block of aggregated loads

calc_q()[source]

Calculates the mean q value for the aggregation period

time()[source]

:returns absolute time (in hours) when load occurred

class ghx.aggregated_loads.AggregatedLoadShifting(max_loads=0)[source]

Bases: object

Class that contains a block of aggregated loads

calc_q()[source]
shift_energy(energy_in)[source]
class ghx.array.GHXArray(ghx_input_json_path, loads_path, output_path, print_output=True)[source]

Bases: object

get_sim_config(sim_config_path)[source]

Reads the simulation configuration. If not successful, program exits.

Parameters:sim_config_path – path of json file containing the simulation configuration
simulate()[source]

Main simulation routine. Simulates the GHXArray object.

More docs to come...

class ghx.array_fixed.GHXArrayFixedAggBlocks(json_data, loads_path, output_path, print_output=True)[source]

Bases: ghx.base.BaseGHXClass

GHXArrayFixedAggBlocks is the class object that holds the information that defines a ground heat exchanger array. This could be a single borehole, or a field with an arbitrary number of boreholes at arbitrary locations.

aggregate_load()[source]

Creates aggregated load object

collapse_aggregate_loads()[source]

Collapses aggregated loads

merge_agg_load_objs(obj_list)[source]

Merges AggregatedLoad objects into a single AggregatedLoad object

Returns:merged AggregatedLoad object
set_load_aggregation()[source]

Sets the load aggregation intervals based on the type specified by the user.

Intervals must be integer multiples.

simulate()[source]

More docs to come...

class ghx.array.GHXArray(ghx_input_json_path, loads_path, output_path, print_output=True)[source]

Bases: object

get_sim_config(sim_config_path)[source]

Reads the simulation configuration. If not successful, program exits.

Parameters:sim_config_path – path of json file containing the simulation configuration
simulate()[source]

Main simulation routine. Simulates the GHXArray object.

More docs to come...

class ghx.array_fixed.GHXArrayFixedAggBlocks(json_data, loads_path, output_path, print_output=True)[source]

Bases: ghx.base.BaseGHXClass

GHXArrayFixedAggBlocks is the class object that holds the information that defines a ground heat exchanger array. This could be a single borehole, or a field with an arbitrary number of boreholes at arbitrary locations.

aggregate_load()[source]

Creates aggregated load object

collapse_aggregate_loads()[source]

Collapses aggregated loads

merge_agg_load_objs(obj_list)[source]

Merges AggregatedLoad objects into a single AggregatedLoad object

Returns:merged AggregatedLoad object
set_load_aggregation()[source]

Sets the load aggregation intervals based on the type specified by the user.

Intervals must be integer multiples.

simulate()[source]

More docs to come...

class ghx.array_shifting.GHXArrayShiftingAggBlocks(json_data, loads_path, output_path, print_output=True)[source]

Bases: ghx.base.BaseGHXClass

load_g_functions()[source]

Pre-computes the g-functions for each block. This is only done once.

set_load_aggregation()[source]

Sets the load aggregation intervals based on the type specified by the user.

shift_loads(curr_energy)[source]

Manages shifting loads between aggregation blocks

simulate()[source]

More docs to come...

class ghx.base.BaseGHXClass(json_data, loads_path, output_path, print_output=True)[source]

Bases: object

Base class for GHXArray

calc_g_func()[source]

Calculate g-functions for given ground heat exchangers.

calc_ts()[source]

Calculates non-dimensional time.

g_func(ln_t_ts)[source]

Interpolates to the correct g-function value

generate_output_reports()[source]

Generates output results

merge_dicts(list_of_dicts)[source]

Merges two-level dictionaries into a single identical dictionary. For non-int/floats arguments, the first item in the list will remain in place. For int/float arguments, the mean value of the parent dictionaries will calculated.

class ghx.base_properties.BasePropertiesClass(json_data, print_output)[source]

Bases: object

class ghx.borehole.BoreholeClass(json_data, print_output)[source]

Bases: object

calc_bh_average_resistance()[source]

Calculates the average thermal resistance of the borehole using the first-order multipole method.

Javed, S. & Spitler, J.D. 2016. ‘Accuracy of Borehole Thermal Resistance Calculation Methods for Grouted Single U-tube Ground Heat Exchangers.’ J. Energy Engineering. Draft in progress.

Equation 13

calc_bh_grout_resistance()[source]

Calculates borehole resistance. Use for validation.

calc_bh_resistance()[source]

Calculates the effective thermal resistance of the borehole assuming a uniform heat flux.

Javed, S. & Spitler, J.D. Calculation of Borehole Thermal Resistance. In ‘Advances in Ground-Source Heat Pump Systems,’ pp. 84. Rees, S.J. ed. Cambridge, MA. Elsevier Ltd. 2016.

Eq: 3-67

Coefficients for equations 13 and 26 from Javed & Spitler 2016 calculated here.

Javed, S. & Spitler, J.D. 2016. ‘Accuracy of Borehole Thermal Resistance Calculation Methods for Grouted Single U-tube Ground Heat Exchangers.’ J. Energy Engineering. Draft in progress.

Equation 14

calc_bh_total_internal_resistance()[source]

Calculates the total internal thermal resistance of the borehole using the first-order multipole method.

Javed, S. & Spitler, J.D. 2016. ‘Accuracy of Borehole Thermal Resistance Calculation Methods for Grouted Single U-tube Ground Heat Exchangers.’ J. Energy Engineering. Draft in progress.

Equation 26

class ghx.constants.ConstantClass[source]

Bases: object

celsius_to_kelvin = 273.15
hours_in_month = 730
hours_in_year = 8760
months_in_year = 12
sec_in_hour = 3600
class ghx.fluids.FluidsClass(json_data, initial_temp, print_output)[source]

Bases: object

Contains all fluid properties, correlations, etc.

calc_mass_flow_rate()[source]

Calculates the fluid mass flow rate

cond()[source]

Determines the fluid conductivity as a function of temperature, in Celsius. Uses the CoolProp python library. Fluid type is determined from the type of fluid specified for the GHX array object.

:returns fluid conductivity in [W/m-K]

cp()[source]

Determines the fluid specific heat as a function of temperature, in Celsius. Uses the CoolProp python library to find the fluid specific heat. Fluid type is determined from the type of fluid specified for the GHX array object.

:returns fluid specific heat in [J/kg-K]

dens()[source]

Determines the fluid density as a function of temperature, in Celsius. Uses the CoolProp python library. Fluid type is determined from the type of fluid specified for the GHX array object.

:returns fluid density in [kg/m3]

heat_capacity()[source]

Calculates fluid thermal capacitance

pr()[source]

Determines the fluid Prandtl as a function of temperature, in Celsius. Uses the CoolProp python library. Fluid type is determined from the type of fluid specified for the GHX array object.

:returns fluid Prandtl number

update_fluid_state(new_temp=None, new_flow_rate=None)[source]

Updates fluid state as necessary

visc()[source]

Determines the fluid viscosity as a function of temperature, in Celsius. Uses the CoolProp python library. Fluid type is determined from the type of fluid specified for the GHX array object.

:returns fluid viscosity in [Pa-s]

class ghx.my_print.PrintClass(print_output, output_path)[source]

Bases: object

color_fail = 'red'
color_success = 'green'
color_warn = 'yellow'
static fatal_error(message=None)[source]

Fatal error. Terminate program

log_messages = ''
static my_print(message, color='')[source]

prints the message if self.print_output default color is black, unless overridden

output_path = None
print_output = None
static write_log_file()[source]

Write log file

class ghx.pipe.PipeClass(json_data_pipe, json_data_fluid, initial_temp, print_output)[source]

Bases: ghx.base_properties.BasePropertiesClass

calc_pipe_conduction_resistance()[source]

Calculates the thermal resistance of a pipe, in [K/(W/m)].

Javed, S. & Spitler, J.D. 2016. ‘Accuracy of Borehole Thermal Resistance Calculation Methods for Grouted Single U-tube Ground Heat Exchangers.’ J. Energy Engineering. Draft in progress.

calc_pipe_convection_resistance()[source]

Calculates the convection resistance using Gnielinski and Petukov, in [k/(W/m)]

Gneilinski, V. 1976. ‘New equations for heat and mass transfer in turbulent pipe and channel flow.’ International Chemical Engineering 16(1976), pp. 359-368.

calc_pipe_resistance()[source]

Calculates the combined conduction and convection pipe resistance

Javed, S. & Spitler, J.D. 2016. ‘Accuracy of Borehole Thermal Resistance Calculation Methods for Grouted Single U-tube Ground Heat Exchangers.’ J. Energy Engineering. Draft in progress.

Equation 3

friction_factor(re)[source]

Calculates the friction factor in smooth tubes

Petukov, B.S. 1970. ‘Heat transfer and friction in turbulent pipe flow with variable physical properties.’ In Advances in Heat Transfer, ed. T.F. Irvine and J.P. Hartnett, Vol. 6. New York Academic Press.

class ghx.soil.SoilClass(json_data, print_output)[source]

Bases: ghx.base_properties.BasePropertiesClass