Esempio n. 1
0
 def set_pipe_lengths(self, _input=[], _ghdoc=None, _ghenv=None):
     """Will try and find the lengths of the things input 
     
     Arguments:
         _input: (float: curve:) If input is number, uses that. Otherwise gets curve from Rhino
         _ghdoc: (ghdoc)
         _ghenv: (ghenv)
     """
     output = []
     
     with context_rh_doc( _ghdoc ):
         for geom_input in _input:
             try:
                 output.append( float(convert_value_to_metric(geom_input, 'M')) )
             except AttributeError as e:
                 crv = rs.coercecurve(geom_input)
                 if crv:
                     pipeLen = ghc.Length(crv)
                 else:
                     pipeLen = False
                 
                 if not pipeLen:
                     crvWarning = "Something went wrong getting the Pipe Geometry length?\n"\
                     "Please ensure you are passing in only curves / polyline objects or numeric values.?"
                     _ghenv.Component.AddRuntimeMessage(ghK.GH_RuntimeMessageLevel.Warning, crvWarning)
                 else:
                     output.append(pipeLen)
     
     self.length = output
Esempio n. 2
0
    def set_values_from_Rhino(self, _inputs, _ghenv, _input_num=0):
        """ Will try and pull relevant data for the Recirc loop from the Rhino scene

        Arguments:
            _inputs: (float: curve:)
            _ghenv: (ghenv)
            _input_num: (int) The index (zero based) of the GH Component input to look at
        """
        
        def cleanPipeDimInputs(_diam, _thickness):
            # Clean diam, thickness
            if _diam != None:
                if " (" in _diam: 
                    _diam = float( _diam.split(" (")[0] )
            
            if _thickness != None:
                if " (" in _thickness: 
                    _thickness = float( _thickness.split(" (")[0] )
            
            return _diam, _thickness
        
        # First, see if I can pull any data from the Rhino scene?
        # Otherwise, if its just a number, use that as the length
        lengths, diams, insul_thks, insul_lambdas, refectives = [], [], [], [], []
        for i, input in enumerate( _inputs ):
            try:
                lengths.append( float(convert_value_to_metric( input, 'M' )) )
            except AttributeError as e:
                try:
                    rhinoGuid = _ghenv.Component.Params.Input[_input_num].VolatileData[0][i].ReferenceID
                    rh_obj = Rhino.RhinoDoc.ActiveDoc.Objects.Find( rhinoGuid )
                    
                    length = float(rh_obj.CurveGeometry.GetLength())
                    
                    k = rs.GetUserText(rh_obj, 'insulation_conductivity')
                    r = rs.GetUserText(rh_obj, 'insulation_reflective')
                    t = rs.GetUserText(rh_obj, 'insulation_thickness')
                    d = rs.GetUserText(rh_obj, 'pipe_diameter')
                    d, t = cleanPipeDimInputs(d, t)
                    
                    lengths.append(length)
                    diams.append(d)
                    insul_thks.append(t)
                    insul_lambdas.append(k)
                    refectives.append(r)
                except Exception as e:
                    msg = str(e)
                    msg += "\nSorry, I am not sure what to do with the input: {} in 'pipe_geom_'?\n"\
                        "Please input either a Curve or a number/numbers representing the pipe segments.".format(input)
                    _ghenv.Component.AddRuntimeMessage( ghK.GH_RuntimeMessageLevel.Warning, msg )

        if lengths: self.lengths = lengths
        if diams: self.diams = diams
        if insul_thks: self.insul_thicknesses = insul_thks
        if insul_lambdas: self.insul_conductivities = insul_lambdas
        if refectives: self.insul_reflectives = refectives
Esempio n. 3
0
def clean_input(_in, _nm, _unit='-', _ghenv=None):
    try:
        out = float(convert_value_to_metric(_in, _unit) )
        
        if _nm == "tank_standby_frac_":
            if out > 1:
                msg = "Standby Units should be decimal fraction. ie: 30% should be entered as 0.30" 
                _ghenv.Component.AddRuntimeMessage(ghK.GH_RuntimeMessageLevel.Warning, msg)
                return out/100
        elif _nm == "diameter_":
            if out > 1:
                unitWarning = "Check diameter units? Should be in METERS not MM." 
                _ghenv.Component.AddRuntimeMessage(ghK.GH_RuntimeMessageLevel.Warning, unitWarning)
            
        return out

    except:
        msg = '"{}" input should be a number'.format(_nm)
        _ghenv.Component.AddRuntimeMessage(ghK.GH_RuntimeMessageLevel.Warning, msg)
        return _in
Esempio n. 4
0
def cleanInputs(_in, _nm, _default, _units='-'):
    # Apply defaults if the inputs are Nones
    out = _in if _in != None else _default
    out = convert_value_to_metric(str(out), _units)
    
    # Check that output can be float
    try:
        # Check units
        if _nm == "thickness":
            if float(out.ToString()) > 1:
                unitWarning = "Check thickness units? Should be in METERS not MM." 
                ghenv.Component.AddRuntimeMessage(ghK.GH_RuntimeMessageLevel.Warning, unitWarning)
            return float(out.ToString())
        elif _nm == 'orientation':
            return out
        elif _nm == 'psi':
            return str(out)
        else:
            return float(out.ToString())
    except:
        ghenv.Component.AddRuntimeMessage(ghK.GH_RuntimeMessageLevel.Error, '"{}" input should be a number'.format(_nm))
        return out
def clean_input(_input, _unit):
    val_list = [ convert_value_to_metric(val, _unit) for val in _input]
    
    return val_list
            the waste heat from the dehumidification unit will be considered as 
            an internal heat gain. On the contrary, dehumidification has no influence 
            on the thermal balance.
        SEER_: Default=1. 1 litre water per kWh electricity result in an energy 
            efficiency ratio of 0.7. Good devices, e.g. with internal heat recovery, 
            achieve values of up to 2.
    Returns:
        dehumidCooling_: 
"""

import LBT2PH
import LBT2PH.__versions__
import LBT2PH.heating_cooling
from LBT2PH.helpers import preview_obj
from LBT2PH.helpers import convert_value_to_metric

reload(LBT2PH)
reload(LBT2PH.__versions__)
reload(LBT2PH.heating_cooling)
reload(LBT2PH.helpers)

ghenv.Component.Name = "LBT2PH Cooling Dehumid"
LBT2PH.__versions__.set_component_params(ghenv, dev=False)

# ------------------------------------------------------------------------------
dehumid_cooling_ = LBT2PH.heating_cooling.PHPP_Cooling_Dehumid()

if waste_heat_to_room_: dehumid_cooling_.waste_to_room = waste_heat_to_room_
if SEER_: dehumid_cooling_.seer = convert_value_to_metric(SEER_, 'W/W')

preview_obj(dehumid_cooling_)
Esempio n. 7
0
from LBT2PH.helpers import preview_obj
from LBT2PH.helpers import convert_value_to_metric

reload(LBT2PH)
reload(LBT2PH.__versions__)
reload(LBT2PH.heating_cooling)
reload(LBT2PH.helpers)

ghenv.Component.Name = "LBT2PH Heating HP Options"
LBT2PH.__versions__.set_component_params(ghenv, dev=False)

#-------------------------------------------------------------------------------
hp_options_ = LBT2PH.heating_cooling.PHPP_HP_Options()

if _design_forward_water_temp:
    hp_options_.frwd_temp = convert_value_to_metric(_design_forward_water_temp,
                                                    'C')
if hp_distribution_: hp_options_.hp_distribution = hp_distribution_
if nom_power_:
    hp_options_.nom_power = convert_value_to_metric(nom_power_, 'KW')
if rad_exponent_: hp_options_.rad_exponent = rad_exponent_
if backup_type_: hp_options_.backup_type = backup_type_
if dT_elec_flow_water_:
    hp_options_.dT_elec_flow = convert_value_to_metric(dT_elec_flow_water_,
                                                       'C')
if hp_priority_: hp_options_.hp_priority = hp_priority_
if hp_control_: hp_options_.hp_control = hp_control_
if depth_groundwater_:
    hp_options_.depth_groundwater = convert_value_to_metric(
        depth_groundwater_, 'M')
if power_groundpump_:
    hp_options_.power_groundwater = convert_value_to_metric(
# @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
#
"""
Set the parameters for a Panel Cooling Element. Sets the values on the 'Cooling Unit' worksheet.
-
EM March 1, 2021
    Args:
        SEER_: (W/W) Default=3
    Returns:
        panelCooling_: 
"""

import LBT2PH
import LBT2PH.__versions__
import LBT2PH.heating_cooling
from LBT2PH.helpers import preview_obj
from LBT2PH.helpers import convert_value_to_metric

reload( LBT2PH )
reload(LBT2PH.__versions__)
reload( LBT2PH.heating_cooling )
reload(LBT2PH.helpers)

ghenv.Component.Name = "LBT2PH Cooling Panel"
LBT2PH.__versions__.set_component_params(ghenv, dev=False)

#-------------------------------------------------------------------------------
panel_cooling_ = LBT2PH.heating_cooling.PHPP_Cooling_Panel()
if SEER_: panel_cooling_.seer = convert_value_to_metric(SEER_, 'W/W')

preview_obj(panel_cooling_)
Esempio n. 9
0
        _name: The name for the new Window Glazing object
        _uValue: (List) Input value for the glazing U-Value (W/m2-k). Glass U-Value to be calculate as per EN-673 / ISO 10292
        _gValue: (List) Input value for the glazing g-Value (SHGC) . Glass g-Value (~SHGC) to be calculate as per EN-410
    Return:
        PHPPGlazing_: A new PHPP-Style Glazing Object for use in a PHPP Window. Connect to the 'PHPP Apertures' Component.
"""

import LBT2PH
import LBT2PH.__versions__
import LBT2PH.windows
from LBT2PH.helpers import convert_value_to_metric
from LBT2PH.helpers import preview_obj

reload(LBT2PH)
reload(LBT2PH.__versions__)
reload(LBT2PH.windows)
reload(LBT2PH.helpers)

ghenv.Component.Name = "LBT2PH PHPP Aperture Glazing"
LBT2PH.__versions__.set_component_params(ghenv, dev=False)
#-------------------------------------------------------------------------------

if _name:
    _name = _name.replace(" ", "_")
    
    PHPPGlazing_ = LBT2PH.windows.PHPP_Glazing()
    if _name:   PHPPGlazing_.name = _name
    if _gValue: PHPPGlazing_.gValue = convert_value_to_metric(_gValue, '-')
    if _uValue: PHPPGlazing_.uValue = convert_value_to_metric(_uValue, 'W/M2K')
    
    preview_obj(PHPPGlazing_)
Esempio n. 10
0
if _temps_source: tsrcs = _temps_source
if _temps_sink: tsnks = _temps_sink
if _heating_capacities: hcs = _heating_capacities
if _COPs: cops = _COPs

#-------------------------------------------------------------------------------
# Create the Heat Pump Object

heat_pump_ = LBT2PH.heating_cooling.PHPP_HP_AirSource()

if _unit_name: heat_pump_.name = _unit_name
if _source: heat_pump_.source = _source
if tsrcs:
    heat_pump_.temps_sources = [
        convert_value_to_metric(val, 'C') for val in tsrcs
    ]
if tsnks:
    heat_pump_.temps_sinks = [
        convert_value_to_metric(val, 'C') for val in tsnks
    ]
if hcs:
    heat_pump_.heating_capacities = [
        convert_value_to_metric(val, 'KW') for val in hcs
    ]
if cops:
    heat_pump_.cops = [convert_value_to_metric(val, 'W/W') for val in cops]
if dt_sink_: heat_pump_.sink_dt = convert_value_to_metric(dt_sink_, 'C')

for warning in heat_pump_.warnings:
    ghenv.Component.AddRuntimeMessage(ghK.GH_RuntimeMessageLevel.Warning,
Esempio n. 11
0
            > bad devices: 2.5
            > split units, energy efficiency class A: > 3.2
            > compact units, energy efficiency class A: > 3.0
            > turbo compressor > 500 kW with water cooling: up to more than 6
    Returns:
        supplyAirCooling_: 
"""

import LBT2PH
import LBT2PH.__versions__
import LBT2PH.heating_cooling
from LBT2PH.helpers import preview_obj
from LBT2PH.helpers import convert_value_to_metric

reload(LBT2PH)
reload(LBT2PH.__versions__)
reload(LBT2PH.heating_cooling)
reload(LBT2PH.helpers)

ghenv.Component.Name = "LBT2PH Cooling Supply Air"
LBT2PH.__versions__.set_component_params(ghenv, dev=False)

#-------------------------------------------------------------------------------
supply_air_cooling_ = LBT2PH.heating_cooling.PHPP_Cooling_SupplyAir()
if on_off_mode_: supply_air_cooling_.on_off = on_off_mode_
if max_cooling_cap_:
    supply_air_cooling_.max_capacity = convert_value_to_metric(
        max_cooling_cap_, 'KW')
if SEER_: supply_air_cooling_.seer = convert_value_to_metric(SEER_, 'W/W')

preview_obj(supply_air_cooling_)
    Returns:
        recircAirCooling_: 
"""

import scriptcontext as sc
import Grasshopper.Kernel as ghK

import LBT2PH
import LBT2PH.__versions__
import LBT2PH.heating_cooling
from LBT2PH.helpers import preview_obj
from LBT2PH.helpers import convert_value_to_metric

reload( LBT2PH )
reload(LBT2PH.__versions__)
reload( LBT2PH.heating_cooling )
reload(LBT2PH.helpers)

ghenv.Component.Name = "LBT2PH Cooling Recirc"
LBT2PH.__versions__.set_component_params(ghenv, dev=False)

#-------------------------------------------------------------------------------
recirc_air_cooling_ = LBT2PH.heating_cooling.PHPP_Cooling_RecircAir()

if on_off_mode_:            recirc_air_cooling_.on_off = on_off_mode_
if max_cooling_cap_:        recirc_air_cooling_.max_capacity = convert_value_to_metric(max_cooling_cap_, 'KW')
if vol_flow_at_nom_power_:  recirc_air_cooling_.nominal_vol = convert_value_to_metric(vol_flow_at_nom_power_, 'M3/H')
if variable_vol_:           recirc_air_cooling_.variable_vol = variable_vol_
if SEER_:                   recirc_air_cooling_.seer = convert_value_to_metric(SEER_, 'W/W')

preview_obj(recirc_air_cooling_)