Beispiel #1
0
    def __init__(self, inputs: dict, ip: InputProcessor, op: OutputProcessor):
        SimulationEntryPoint.__init__(self, inputs)
        self.temperature = inputs['value']
        self.ip = ip
        self.op = op

        self.inlet_temperature = ip.init_temp()
Beispiel #2
0
    def __init__(self, inputs: dict, ip: InputProcessor, op: OutputProcessor):
        SimulationEntryPoint.__init__(self, inputs)
        self.load = inputs['value']
        self.ip = ip
        self.op = op

        # report variables
        self.inlet_temp = ip.init_temp()
        self.outlet_temp = ip.init_temp()
Beispiel #3
0
    def __init__(self, inputs, ip, op):
        SimulationEntryPoint.__init__(self, inputs)

        # input/output processor
        self.ip = ip
        self.op = op

        # local fluids reference
        self.fluid = self.ip.props_mgr.fluid

        # input data
        self.max_htg_set_point = inputs['max-heating-set-point']
        self.min_htg_set_point = inputs['min-heating-set-point']
        self.wtr_htg_set_point = inputs['water-heating-set-point']
        self.odt_at_max_htg_set_point = inputs[
            'outdoor-air-temperature-at-max-heating-set-point']
        self.odt_at_min_htg_set_point = inputs[
            'outdoor-air-temperature-at-min-heating-set-point']
        self.imm_htr_capacity = inputs['immersion-heater-capacity']
        self.c_capacity = np.array(inputs['capacity-coefficients'])
        self.c_cop = np.array(
            inputs['coefficient-of-performance-coefficients'])
        self.htg_loads = ExternalBase(inputs['load-data-path'], 0)
        self.wtr_htg_loads = ExternalBase(inputs['load-data-path'], 1)
        self.oda_temps = ExternalBase(inputs['load-data-path'], 2)
        self.odt = self.oda_temps.get_value(0)

        # report variables
        self.flow_rate = None
        self.inlet_temperature = None
        self.outlet_temperature = None
        self.cop = 0

        # water heating report variables
        self.wtr_htg = None  # water heating load met by heat pump (W)
        self.wtr_htg_load = None  # water heating load (W)
        self.wtr_htg_elec = None  # electricity consumption of heat pump for water heating (W)
        self.wtr_htg_rtf = None  # run time fraction of heat pump for water heating (-)
        self.wtr_htg_imm_elec = None  # electricity consumption of immersion heater for water heating (W)
        self.wtr_htg_unmet = None  # unmet water heating load (W)
        self.wtr_htg_heat_extraction = None  # heat extraction for water heating (W)

        # heating report variables
        self.htg = None  # heating load met by heat pump (W)
        self.htg_load = None  # heating load (W)
        self.htg_elec = None  # electricity consumption of heat pump for space heating (W)
        self.htg_rtf = None  # run time fraction of heat pump for space heating (-)
        self.htg_imm_elec = None  # electricity consumption of immersion heater for space heating (W)
        self.htg_unmet = None  # unmet water heating load (W)
        self.htg_heat_extraction = None  # heat extraction for space heating (W)

        # other
        self.htg_tot = None  # total heating load met by heat pump (W)
        self.imm_elec_tot = None  # total heating met by immersion heater (W)
        self.hp_rtf = None  # total heat pump runtime fraction (-)
        self.heat_extraction = None  # total heat extracted from borehole (W)
Beispiel #4
0
    def __init__(self, inputs, ip, op):
        SimulationEntryPoint.__init__(self, inputs)
        self.load = inputs['value']
        self.start_time = inputs['start-time']
        self.end_time = inputs['end-time']
        self.ip = ip
        self.op = op

        # report variables
        self.outlet_temp = 0
Beispiel #5
0
    def __init__(self, inputs: dict, ip: InputProcessor, op: OutputProcessor):
        SimulationEntryPoint.__init__(self, inputs)
        self.amplitude = inputs['amplitude']
        self.offset = inputs['offset']
        self.period = inputs['period']
        self.ip = ip
        self.op = op

        # report variables
        self.load = 0
        self.outlet_temp = 0
    def __init__(self, inputs: dict, ip: InputProcessor, op: OutputProcessor):
        SimulationEntryPoint.__init__(self, inputs)
        self.ip = ip
        self.op = op

        # props instances
        self.fluid = ip.props_mgr.fluid
        self.soil = ip.props_mgr.soil

        # init paths
        self.paths = []
        for path in inputs['flow-paths']:
            self.paths.append(Path(path, ip, op))

        # some stats about the bh field
        self.h = self.calc_bh_ave_length()
        self.num_bh = self.count_bhs()
        self.num_paths = len(self.paths)

        # generate the g-function data
        self.ts = self.h**2 / (9 * self.soil.diffusivity)
        self.lntts = None
        self.g = None
        self.lntts_b = None
        self.g_b = None

        if 'g-function-path' in inputs:
            data_g = np.genfromtxt(inputs['g-function-path'], delimiter=',')
            self.lntts = data_g[:, 0]
            self.g = data_g[:, 1]
        else:
            self.generate_g()

        # load aggregation method
        la_inputs = merge_dicts(inputs['load-aggregation'], {
            'lntts': self.lntts,
            'g-values': self.g,
            'time-scale': self.ts
        })
        self.load_agg = make_agg_method(la_inputs, ip)

        # other
        self.energy = 0
        self.c_0 = 1 / (2 * pi * self.soil.conductivity)

        # report variables
        self.heat_rate = 0
        self.heat_rate_bh = 0
        self.flow_rate = 0
        self.inlet_temperature = ip.init_temp()
        self.outlet_temperature = ip.init_temp()
        self.bh_wall_temperature = ip.init_temp()
Beispiel #7
0
    def __init__(self, inputs: dict, ip: InputProcessor, op: OutputProcessor):

        if 'column' in inputs:
            col_num = inputs['column']
        else:
            col_num = 1

        ExternalBase.__init__(self, inputs['path'], col_num=col_num)
        SimulationEntryPoint.__init__(self, inputs)
        self.ip = ip
        self.op = op

        # report variables
        self.flow_rate = self.get_value(0)
Beispiel #8
0
    def __init__(self, inputs, ip, op):
        SimulationEntryPoint.__init__(self, inputs)
        self.ip = ip
        self.op = op

        try:
            self.sim_mode = inputs['simulation-mode']
        except KeyError:
            raise KeyError(
                "'simulation-mode' key not found")  # pragma: no cover

        if self.sim_mode == 'enhanced':
            # init TRCM model
            self.sts_ghe = GroundHeatExchangerSTS(inputs, ip, op)

            if 'g_b-function-path' not in inputs:
                if 'g_b-flow-rate' not in inputs:
                    self.sts_ghe.generate_g_b()
                else:
                    self.sts_ghe.generate_g_b(inputs['g_b-flow-rate'])

            # init enhanced model
            d_bh_ave = self.sts_ghe.average_bh()
            lts_inputs = merge_dicts(
                inputs, {
                    'length': self.sts_ghe.h,
                    'number-boreholes': self.sts_ghe.num_bh,
                    'average-borehole': d_bh_ave
                })

            self.lts_ghe = GroundHeatExchangerLTS(lts_inputs, ip, op)

            # alias functions based on sim mode
            self.simulate_time_step = self.lts_ghe.simulate_time_step
            self.report_outputs = self.lts_ghe.report_outputs

        elif self.sim_mode == 'direct':
            # init TRCM model only
            self.sts_ghe = GroundHeatExchangerSTS(inputs, ip, op)

            # alias functions based on sim mode
            self.simulate_time_step = self.sts_ghe.simulate_time_step
            self.report_outputs = self.sts_ghe.report_outputs

        else:
            raise ValueError("Simulation mode '{]' is not valid".format(
                self.sim_mode))  # pragma: no cover
Beispiel #9
0
    def __init__(self, inputs, ip, op):
        SimulationEntryPoint.__init__(self, inputs)
        self.ip = ip
        self.op = op

        # valid components which can exist on the path
        valid_comp_types = ['borehole', 'pipe']

        # init all components on the path
        self.components = []
        for comp in inputs['components']:
            comp_type = comp['comp-type']
            if comp_type in valid_comp_types:
                self.components.append(make_ghe_component(comp, ip, op))
            else:
                raise KeyError("Component type: '{}' is not "
                               "supported by the {} object.".format(
                                   comp_type, self.Type))  # pragma: no cover

        # report variables
        self.inlet_temperature = ip.init_temp()
        self.outlet_temperature = ip.init_temp()
        self.flow_rate = 0
Beispiel #10
0
    def __init__(self, inputs: dict, ip: InputProcessor, op: OutputProcessor):
        SimulationEntryPoint.__init__(self, inputs)
        self.ip = ip
        self.op = op

        # report variables
        self.load = 0
        self.outlet_temp = 0

        method = inputs['synthetic-method']

        if method == 'asymmetric':
            params = {
                'a': inputs['amplitude'],
                'b': 1000,
                'c': 80,
                'd': 0.01,
                'e': 0.95,
                'f': 4 / 3,
                'g': 2190
            }
            SyntheticBase.__init__(self, params)
        elif method == 'symmetric':
            params = {
                'a': inputs['amplitude'],
                'b': 2190,
                'c': 80,
                'd': 0.01,
                'e': 0.95,
                'f': 2,
                'g': 0
            }
            SyntheticBase.__init__(self, params)
        else:
            raise ValueError(
                "Synthetic method '{}' is not valid.".format(method))
Beispiel #11
0
 def __init__(self, inputs: dict, ip: InputProcessor, op: OutputProcessor):
     SimulationEntryPoint.__init__(self, inputs)
     self.flow_rate = inputs['value']
     self.ip = ip
     self.op = op
Beispiel #12
0
    def __init__(self, inputs, ip, op):
        SimulationEntryPoint.__init__(self, inputs)

        # input/output processor
        self.ip = ip
        self.op = op

        # load the properties from the definitions
        if 'average-pipe' in inputs:
            pipe_props = inputs['average-pipe']
        else:
            pipe_props = ip.get_definition_object('pipe-definitions',
                                                  inputs['pipe-def-name'])

        # init the properties
        PropertiesBase.__init__(self, pipe_props)

        # local fluids reference
        self.fluid = self.ip.props_mgr.fluid

        # key geometric parameters
        self.inner_diameter = pipe_props["inner-diameter"]
        self.outer_diameter = pipe_props["outer-diameter"]
        self.length = inputs['length']
        self.init_temp = self.ip.init_temp()

        # include transit delay effects
        self.apply_transit_delay = True

        # compute radii and thickness
        self.wall_thickness = (self.outer_diameter - self.inner_diameter) / 2
        self.inner_radius = self.inner_diameter / 2
        self.outer_radius = self.outer_diameter / 2

        # compute cross-sectional areas
        self.area_cr_inner = pi / 4 * self.inner_diameter**2
        self.area_cr_outer = pi / 4 * self.outer_diameter**2
        self.area_cr_pipe = self.area_cr_outer - self.area_cr_inner

        # compute surface areas
        self.area_s_inner = pi * self.inner_diameter * self.length
        self.area_s_outer = pi * self.outer_diameter * self.length

        # compute volumes
        self.total_vol = self.area_cr_outer * self.length
        self.fluid_vol = self.area_cr_inner * self.length
        self.pipe_wall_vol = self.area_cr_pipe * self.length

        # other inits
        self.friction_factor = 0
        self.resist_pipe = 0
        self.resist_conv = 0
        self.re = 0

        if 'number-cells' in inputs:
            self.num_pipe_cells = inputs['number-cells']
        else:
            # recommendation by Skoglund
            self.num_pipe_cells = 16

        self.cell_temps = np.full(self.num_pipe_cells, ip.init_temp())
        self.inlet_temps = deque([ip.init_temp()])
        self.inlet_temps_times = deque([0.0])
        self.outlet_temperature = ip.init_temp()
    def __init__(self, inputs: dict, ip: InputProcessor, op: OutputProcessor):
        SimulationEntryPoint.__init__(self, inputs)
        self.ip = ip
        self.op = op

        # props instances
        self.fluid = ip.props_mgr.fluid
        self.soil = ip.props_mgr.soil

        # geometry and other config parameters needed externally
        self.h = inputs['length']
        self.num_bh = inputs['number-boreholes']
        self.num_paths = len(inputs['flow-paths'])

        # load aggregation method
        ts = self.h**2 / (9 * self.soil.diffusivity)
        la_inputs = merge_dicts(
            inputs['load-aggregation'], {
                'g-function-path': inputs['g-function-path'],
                'g_b-function-path': inputs['g_b-function-path'],
                'time-scale': ts
            })

        if 'g_b-flow-rates' in inputs:
            la_inputs['g_b-flow-rates'] = inputs['g_b-flow-rates']
        self.load_agg = make_agg_method(la_inputs, ip)

        # average borehole
        d_ave_bh = {
            'average-borehole': inputs['average-borehole'],
            'name': 'average-borehole',
            'borehole-type': 'single-grouted'
        }
        self.ave_bh = make_borehole(d_ave_bh, ip, op)

        self.cross_ghe_present = False
        self.cross_ghe = []
        if 'cross-loads' in inputs:
            self.cross_ghe_present = True
            for x_ghe in inputs['cross-loads']:
                d_x = {
                    'load-aggregation':
                    merge_dicts(
                        inputs['load-aggregation'], {
                            'g-function-path': x_ghe['g-function-path'],
                            'time-scale': ts
                        }),
                    'load-data-path':
                    x_ghe['load-data-path'],
                    'start-time':
                    x_ghe['start-time'],
                    'length':
                    x_ghe['length']
                }
                if 'number-of-instances' in x_ghe:
                    num_duplicates = x_ghe['number-of-instances']
                else:
                    num_duplicates = 1
                for idx in range(num_duplicates):
                    self.cross_ghe.append(CrossGHE(d_x, ip, op))

        # method constants
        k_s = self.soil.conductivity
        self.c_0 = 1 / (2 * pi * k_s)

        # heat rate (W/m)
        self.q = 0

        # energy (J/m)
        self.energy = 0

        # report variables
        self.heat_rate = 0
        self.inlet_temperature = ip.init_temp()
        self.outlet_temperature = ip.init_temp()
        self.bh_wall_temperature = ip.init_temp()
        self.resist_b = 0
        self.resist_b_eff = 0
Beispiel #14
0
    def __init__(self, inputs, ip, op):
        SimulationEntryPoint.__init__(self, inputs)
        self.ip = ip
        self.op = op

        self.fluid = ip.props_mgr.fluid
        self.soil = ip.props_mgr.soil

        # get borehole definition data
        if 'average-borehole' in inputs:
            bh_inputs = {'location': {'x': 0, 'y': 0, 'z': 0}}
            bh_def_inputs = {'length': inputs['average-borehole']['length'],
                             'diameter': inputs['average-borehole']['diameter'],
                             'shank-spacing': inputs['average-borehole']['shank-spacing'],
                             'segments': 1}
        else:
            bh_inputs = ip.get_definition_object('borehole', inputs['name'])
            bh_def_inputs = ip.get_definition_object('borehole-definitions', bh_inputs['borehole-def-name'])

        # init geometry
        self.h = bh_def_inputs['length']
        self.diameter = bh_def_inputs['diameter']
        self.radius = self.diameter / 2
        self.shank_space = bh_def_inputs['shank-spacing']

        # bh location
        self.location = Location(bh_inputs['location']['x'], bh_inputs['location']['y'], bh_inputs['location']['z'])

        # init grout
        if 'average-borehole' in inputs:
            grout_inputs = {'conductivity': inputs['average-borehole']['grout-conductivity'],
                            'density': inputs['average-borehole']['grout-density'],
                            'specific-heat': inputs['average-borehole']['grout-specific-heat']}
        else:
            grout_inputs = ip.get_definition_object('grout-definitions', bh_def_inputs['grout-def-name'])

        self.grout = PropertiesBase(grout_inputs)

        # init pipes
        self.num_pipes = 2
        if 'average-borehole' in inputs:
            pipe_inputs = {'average-pipe': {'inner-diameter': inputs['average-borehole']['pipe-inner-diameter'],
                                            'outer-diameter': inputs['average-borehole']['pipe-outer-diameter'],
                                            'conductivity': inputs['average-borehole']['pipe-conductivity'],
                                            'density': inputs['average-borehole']['pipe-density'],
                                            'specific-heat': inputs['average-borehole']['pipe-specific-heat']},
                           'length': inputs['average-borehole']['length']}
        else:
            pipe_inputs = {'pipe-def-name': bh_def_inputs['pipe-def-name'], 'length': self.h}

        pipe_inputs['length'] = pipe_inputs['length']

        pipe_inputs['name'] = '{}: Pipe 1'.format(inputs['name'])
        self.pipe_1 = Pipe(pipe_inputs, ip, op)
        pipe_inputs['name'] = '{}: Pipe 2'.format(inputs['name'])
        self.pipe_2 = Pipe(pipe_inputs, ip, op)
        self.pipe_2.apply_transit_delay = False

        if 'number-iterations' in bh_def_inputs:
            self.num_iterations = bh_def_inputs['number-iterations']
        else:
            self.num_iterations = 2

        # init segments
        self.segments = []

        if 'segments' in bh_def_inputs:
            self.num_segments = bh_def_inputs['segments']
        else:
            self.num_segments = 1
        seg_length = self.h / self.num_segments
        if 'average-borehole' in inputs:
            seg_inputs = {'length': seg_length,
                          'diameter': self.diameter,
                          'segment-name': 'BH:{}:Seg:0'.format(inputs['name']),
                          'average-grout': grout_inputs,
                          'average-pipe': pipe_inputs['average-pipe']}
        else:
            seg_inputs = {'length': seg_length,
                          'diameter': self.diameter,
                          'segment-name': 'BH:{}:Seg:0'.format(inputs['name']),
                          'grout-def-name': bh_def_inputs['grout-def-name'],
                          'pipe-def-name': bh_def_inputs['pipe-def-name']}

        if 'grout-fraction' in bh_def_inputs:
            seg_inputs['grout-fraction'] = bh_def_inputs['grout-fraction']
        else:
            seg_inputs['grout-fraction'] = 0.5

        for idx in range(self.num_segments):
            seg_inputs['segment-name'] = 'BH:{}:Seg:{}'.format(inputs['name'], idx + 1)
            self.segments.append(SingleUTubeGroutedSegment(seg_inputs, ip, op))

        # final segment is a pass-through segment that connects the U-tube nodes
        seg_inputs['segment-name'] = 'BH:{}:Seg:{}'.format(inputs['name'], self.num_segments + 1)
        self.segments.append(SingleUTubePassThroughSegment(seg_inputs, ip, op))

        # multipole method parameters
        self.resist_bh_ave = None
        self.resist_bh_total_internal = None
        self.resist_bh_grout = None
        self.resist_bh_effective = None
        self.resist_bh_direct_coupling = None
        self.theta_1 = self.shank_space / (2 * self.radius)
        self.theta_2 = self.radius / self.pipe_1.outer_radius
        self.theta_3 = 1 / (2 * self.theta_1 * self.theta_2)
        sigma_num = self.grout.conductivity - self.soil.conductivity
        sigma_den = self.grout.conductivity + self.soil.conductivity
        self.sigma = sigma_num / sigma_den
        self.beta = None

        # report variables
        self.heat_rate = 0
        self.heat_rate_bh = 0
        self.inlet_temperature = ip.init_temp()
        self.outlet_temperature = ip.init_temp()