Beispiel #1
0
def calculation(self=None, parameters={}, feature=None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant
    wn_uc = NULL

    #differentiation between RB and NRB (for now in case of contemporary U-Values RB=NRB. After getting NRB data for contemporary case code must be adaptet)
    if parameters['BLD_USAGE'] == "RB":
        if not oeq_global.isnull(parameters['YOC']):
            wn_uc = rb_contemporary_window_uvalue_by_building_age_lookup.get(
                parameters['YOC'])

    elif parameters['BLD_USAGE'] == "NRB":
        if not oeq_global.isnull(parameters['YOC']):
            wn_uc = nrb_contemporary_window_uvalue_by_building_age_lookup.get(
                parameters['YOC'])

    else:
        if not oeq_global.isnull(parameters['YOC']):
            wn_uc = (
                ((rb_contemporary_window_uvalue_by_building_age_lookup.get(
                    parameters['YOC'])) +
                 (nrb_contemporary_window_uvalue_by_building_age_lookup.get(
                     parameters['YOC']))) / 2)

    return {'WN_UC': {'type': QVariant.Double, 'value': wn_uc}}
Beispiel #2
0
def calculation(self=None, parameters={},feature = None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant
    # factor for golden rule

    fr_rt = NULL
    fr_ar = NULL
    if not oeq_global.isnull([parameters['YOC'] , parameters['HEIGHT'],parameters['AREA']]):

        if parameters['HEIGHT'] < 5:
            fr1= 1
        elif parameters['HEIGHT'] < 8:
            fr1 = 0
        elif parameters['HEIGHT'] < 33:
            fr1= 0.04 * (parameters['HEIGHT'] - 8)
        else:
            fr1 = 1

        if parameters['YOC'] < 1860:
            fr2=0
        elif parameters['YOC'] < 1960:
            fr2=0.01 * (parameters['YOC'] - 1860)
        else:
            fr2 = 1

        fr_rt = 0.5 * (fr1 + fr2)
        fr_ar = fr_rt * parameters['AREA']

    return {'FR_RT': {'type': QVariant.Double,
                    'value': fr_rt},
            'FR_AR': {'type': QVariant.Double,
                    'value': fr_ar}}
Beispiel #3
0
def calculation(self=None, parameters={},feature = None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant
    ratio_solar_installable=0.6
    solar_earnings_per_sqm=350.0

    soliar = NULL
    solhe = NULL
    solhel = NULL
    solcrt = NULL

    if not oeq_global.isnull([parameters['AHDP'], parameters['FR_AR'],parameters['LIV_AR']]):
        soliar=float(parameters['FR_AR'])*float(ratio_solar_installable)
        solhe=solar_earnings_per_sqm * float(soliar)
        solhel=solhe/float(parameters['LIV_AR'])
        solcrt=float(solhel)/float(parameters['AHDP'])*100

    return {'SOLIAR': {'type': QVariant.Double,
                           'value': soliar},
                       'SOLHE': {'type': QVariant.Double,
                            'value': solhe},
                       'SOLHEL': {'type': QVariant.Double,
                             'value': solhel},
                       'SOLCRT': {'type': QVariant.Double,
                              'value': solcrt}}
Beispiel #4
0
def calculation(self=None, parameters={},feature = None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant
    wl_sqtp = NULL
    if not oeq_global.isnull([parameters['WL_UC'],parameters['HHRS']]):
        wl_sqtp= float(parameters['WL_UC'])*float(parameters['HHRS'])/1000
    return {'WL_SQTC': {'type': QVariant.Double, 'value': wl_sqtp}}
Beispiel #5
0
def calculation(self=None, parameters={}, feature=None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant
    wl_sqtp = NULL
    if not oeq_global.isnull([parameters['WL_UC'], parameters['HHRS']]):
        wl_sqtp = float(parameters['WL_UC']) * float(parameters['HHRS']) / 1000
    return {'WL_SQTC': {'type': QVariant.Double, 'value': wl_sqtp}}
Beispiel #6
0
def calculation(self=None, parameters={}, feature=None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant

    achl = NULL
    if not oeq_global.isnull([parameters['LIV_AR']]):
        achl = 40 * parameters['LIV_AR']  #kWh/a
    return {'ACHL': {'type': QVariant.Double, 'value': achl}}
Beispiel #7
0
def calculation(self=None, parameters={},feature = None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant

    bs_sqtp= NULL
    if not oeq_global.isnull([parameters['BS_UE'],parameters['HHRS']]):
        bs_sqtp= float(parameters['BS_UE'])*float(parameters['HHRS'])/1000 *0.35 #correction factor
    return {'BS_SQTE': {'type': QVariant.Double, 'value': bs_sqtp}}
Beispiel #8
0
def calculation(self=None, parameters={},feature = None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant

    achl = NULL
    if not oeq_global.isnull([parameters['LIV_AR']]):
        achl= 40 * parameters['LIV_AR'] #kWh/a
    return {'ACHL': {'type': QVariant.Double, 'value': achl}}
Beispiel #9
0
def calculation(self=None, parameters={},feature = None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant

    rf_sqtp = NULL
    if not oeq_global.isnull([parameters['RF_UE'],parameters['HHRS']]):
        rf_sqtp= float(parameters['RF_UE'])*float(parameters['HHRS'])/1000 *0.35 #correction factor
    return {'RF_SQTE': {'type': QVariant.Double, 'value': rf_sqtp}}
Beispiel #10
0
def calculation(self=None, parameters={},feature = None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant
    htc = NULL
    if not oeq_global.isnull([parameters['BS_UC'] , parameters['BS_AR'] , parameters['RF_UC'] , parameters['RF_AR'] , parameters['WL_UC'] , parameters['WL_AR'] , parameters['WN_UC'] , parameters['WN_AR']]):
        qtp_total = float(parameters['BS_UC'] * parameters['BS_AR'] *0.35 ) + float(parameters['RF_UC'] * parameters['RF_AR']) + float(parameters['WL_UC'] * parameters['WL_AR'] ) + float(parameters['WN_UC'] * parameters['WN_AR'])
        env_area =  float(parameters['BS_AR']) + float(parameters['RF_AR']) + float(parameters['WL_AR']) + float(parameters['WN_AR'])
        htc=qtp_total/env_area
    return {'HTC': {'type': QVariant.Double,'value': htc}}
Beispiel #11
0
def calculation(self=None, parameters={}, feature=None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant

    ahde = NULL
    if not oeq_global.isnull([parameters['HLAE']]):
        ahde = float(parameters['HLAE']) + 40.0 * 0.8
        # Air Change Heatloss for standard Rooms 40kWh/m2a nach Geiger Lüftung im Wohnungsbau
        # 20% of the Total Area are used for stairs and floors
    return {'AHDE': {'type': QVariant.Double, 'value': ahde}}
Beispiel #12
0
def calculation(self=None, parameters={},feature = None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant
    rf_uc = NULL

#differentiation between RB and NRB (for now in case of contemporary U-Values RB=NRB. After getting NRB data for contemporary case code must be adaptet)
    if parameters['BLD_USAGE'] == "RB":
        if not oeq_global.isnull(parameters['YOC']):
            rf_uc=rb_contemporary_roof_uvalue_by_building_age_lookup.get(parameters['YOC'])

    elif parameters['BLD_USAGE'] == "NRB":
        if not oeq_global.isnull(parameters['YOC']):
            rf_uc=nrb_contemporary_roof_uvalue_by_building_age_lookup.get(parameters['YOC'])

    else:
        if not oeq_global.isnull(parameters['YOC']):
            rf_uc=(((rb_contemporary_roof_uvalue_by_building_age_lookup.get(parameters['YOC'])) + (nrb_contemporary_roof_uvalue_by_building_age_lookup.get(parameters['YOC']))) / 2)

    return {'RF_UC': {'type': QVariant.Double, 'value': rf_uc}}
Beispiel #13
0
def calculation(self=None, parameters={},feature = None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant

    ahde = NULL
    if not oeq_global.isnull([parameters['HLAE']]):
        ahde=float(parameters['HLAE']) + 40.0 * 0.8
        # Air Change Heatloss for standard Rooms 40kWh/m2a nach Geiger Lüftung im Wohnungsbau
        # 20% of the Total Area are used for stairs and floors
    return {'AHDE': {'type': QVariant.Double, 'value': ahde}}
Beispiel #14
0
def calculation(self=None, parameters={},feature = None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant
    print ("AVR")
    avr = NULL
    if not oeq_global.isnull([parameters['AREA'] , parameters['HEIGHT'] , parameters['BS_AR'] , parameters['RF_AR'] , parameters['WL_AR'] , parameters['WN_AR']]):
        volume = float(parameters['AREA']) * float(parameters['HEIGHT'])
        env_area =  float(parameters['BS_AR']) + float(parameters['RF_AR']) + float(parameters['WL_AR']) + float(parameters['WN_AR'])
        avr=env_area/volume
    return {'AVR': {'type': QVariant.Double, 'value': avr}}
Beispiel #15
0
def calculation(self=None, parameters={},feature = None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant

    hlap = NULL
    if not oeq_global.isnull([parameters['AREA'] , parameters['FLOORS'] , parameters['BS_QTP'] , parameters['RF_QTP'] , parameters['WL_QTP'] , parameters['WN_QTP']]):
        living_area = float(parameters['AREA']) * float(parameters['FLOORS']) * 0.8
        qtp_total = float(parameters['BS_QTP']) + float(parameters['RF_QTP']) + float(parameters['WL_QTP']) + float(parameters['WN_QTP'])*1.2
        hlap=qtp_total/living_area
    return {'HLAP': {'type': QVariant.Double,'value': hlap}}
Beispiel #16
0
def calculation(self=None, parameters={}, feature=None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant
    # factor for golden rule

    if not oeq_global.isnull([parameters['VOLUME'], parameters['ENV_AR']]):
        avr = float(parameters['ENV_AR']) / float(parameters['VOLUME'])
    else:
        avr = NULL
    return {'AVR': {'type': QVariant.Double, 'value': avr}}
Beispiel #17
0
def calculation(self=None, parameters={}, feature=None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant
    htc = NULL
    if not oeq_global.isnull([
            parameters['BS_UE'], parameters['BS_AR'], parameters['RF_UE'],
            parameters['RF_AR'], parameters['WL_UE'], parameters['WL_AR'],
            parameters['WN_UE'], parameters['WN_AR']
    ]):
        qtp_total = float(
            parameters['BS_UE'] * parameters['BS_AR'] * 0.35) + float(
                parameters['RF_UE'] * parameters['RF_AR']) + float(
                    parameters['WL_UE'] * parameters['WL_AR']) + float(
                        parameters['WN_UE'] * parameters['WN_AR'])
        env_area = float(parameters['BS_AR']) + float(
            parameters['RF_AR']) + float(parameters['WL_AR']) + float(
                parameters['WN_AR'])
        htc = qtp_total / env_area
    return {'HTE': {'type': QVariant.Double, 'value': htc}}
Beispiel #18
0
def calculation(self=None, parameters={}, feature=None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant
    ratio_solar_installable = 0.6
    solar_earnings_per_sqm = 350.0

    soliar = NULL
    solhe = NULL
    solhel = NULL
    solcrt = NULL

    if not oeq_global.isnull(
        [parameters['AHDP'], parameters['FR_AR'], parameters['LIV_AR']]):
        soliar = float(parameters['FR_AR']) * float(ratio_solar_installable)
        solhe = solar_earnings_per_sqm * float(soliar)
        solhel = solhe / float(parameters['LIV_AR'])
        solcrt = float(solhel) / float(parameters['AHDP']) * 100

    return {
        'SOLIAR': {
            'type': QVariant.Double,
            'value': soliar
        },
        'SOLHE': {
            'type': QVariant.Double,
            'value': solhe
        },
        'SOLHEL': {
            'type': QVariant.Double,
            'value': solhel
        },
        'SOLCRT': {
            'type': QVariant.Double,
            'value': solcrt
        }
    }
Beispiel #19
0
def calculation(self=None, parameters={},feature = None):
    from scipy.constants import golden
    from math import floor, ceil
    from PyQt4.QtCore import QVariant
    # factor for golden rule
    dataset = {'AREA': NULL, 'PERIMETER': NULL, 'LENGTH': NULL, 'WIDTH': NULL, 'HEIGHT': NULL, 'FLOORS': NULL,
               'WN_RAT':NULL,'WL_COM':NULL,'BS_AR':NULL,'WL_AR':NULL,'WN_AR':NULL,'RF_AR':NULL,'LIV_AR':NULL}
    dataset.update(parameters)
    #print parameters
    if (not oeq_global.isnull(dataset['AREA'])):
        if (not oeq_global.isnull(dataset['PERIMETER'])):
            if oeq_global.isnull(dataset['LENGTH']):
                p = -float(dataset['PERIMETER'] / 2.0)
                q = float(dataset['AREA'])
                if ((p / 2) ** 2) > q:
                    dataset['LENGTH'] = -p / 2 + ((((p / 2) ** 2) - q) ** 0.5)
                else:
                    dataset['LENGTH'] = -p / 4
            #print config.building_id_key

            #print 'LENGTH'
            #print dataset['LENGTH']
            #print 'AREA'
            #print dataset['AREA']

            dataset['WIDTH'] = float(dataset['AREA']) / float(dataset['LENGTH'])
            l_max = max(dataset['WIDTH'], dataset['LENGTH'])
            l_min = min(dataset['WIDTH'], dataset['LENGTH'])
            dataset['WIDTH'] = l_min
            dataset['LENGTH'] = l_max
        else:
            if oeq_global.isnull(dataset['WIDTH']):
                if oeq_global.isnull(dataset['LENGTH']):
                    dataset['LENGTH'] = (float(dataset['AREA']) / golden) ** 0.5
                dataset['WIDTH'] = float(dataset['AREA']) / dataset['LENGTH']
            else:
                dataset['LENGTH'] = float(dataset['AREA']) / dataset['WIDTH']
            l_max = max(dataset['WIDTH'], dataset['LENGTH'])
            l_min = min(dataset['WIDTH'], dataset['LENGTH'])
            dataset['WIDTH'] = l_min
            dataset['LENGTH'] = l_max
            dataset['PERIMETER'] = 2 * (dataset['WIDTH'] + dataset['LENGTH'])
    else:
        if (not oeq_global.isnull(dataset['PERIMETER'])):
            if oeq_global.isnull(dataset['WIDTH']):
                if oeq_global.isnull(dataset['LENGTH']):
                    dataset['LENGTH'] = float(dataset['PERIMETER']) / (2 + 2 * golden)
                dataset['WIDTH'] = float(dataset['AREA']) / dataset['LENGTH']
            else:
                dataset['LENGTH'] = float(dataset['AREA']) / dataset['WIDTH']
            l_max = max(dataset['WIDTH'], dataset['LENGTH'])
            l_min = min(dataset['WIDTH'], dataset['LENGTH'])
            dataset['WIDTH'] = l_min
            dataset['LENGTH'] = l_max
            dataset['AREA'] = dataset['WIDTH'] * dataset['LENGTH']
    if oeq_global.isnull(dataset['FLOORS']):
        if (not oeq_global.isnull(dataset['HEIGHT'])):
            dataset['FLOORS'] = floor(dataset['HEIGHT'] / 3.3)
        else:
            if (not oeq_global.isnull(parameters['PDENS'])):
                dataset['FLOORS'] = ceil(float(parameters['PDENS'] / 4000))
                dataset['HEIGHT'] = dataset['FLOORS'] * 3.3
    else:
        if (oeq_global.isnull(dataset['HEIGHT'])):
            dataset['HEIGHT'] = dataset['FLOORS'] * 3.3
    #print type(dataset['YOC'])
    #print dataset['YOC']
    if oeq_global.isnull(dataset['WN_RAT']) & (not oeq_global.isnull(parameters['YOC'])):
       # try:
       dataset['WN_RAT']=window_wall_ratio_AVG_by_building_age_lookup.get(parameters['YOC'])
        #except:
        #    pass

    if oeq_global.isnull(dataset['WL_COM']) & (not oeq_global.isnull(parameters['PDENS'])):
        dataset['WL_COM']=common_walls_by_population_density_corr.get(parameters['PDENS'])

    if oeq_global.isnull(dataset['BS_AR']) & (not oeq_global.isnull(dataset['AREA'])):
        dataset['BS_AR']=dataset['AREA']

    if oeq_global.isnull(dataset['WL_AR'])& (not oeq_global.isnull(dataset['PERIMETER'])) & (not oeq_global.isnull(dataset['WL_COM']))& (not oeq_global.isnull(dataset['WIDTH'])) & (not oeq_global.isnull(dataset['WN_RAT'])):
        dataset['WL_AR']=(dataset['PERIMETER']-dataset['WL_COM']* dataset['WIDTH'])* dataset['HEIGHT']*(1-dataset['WN_RAT'])

    if oeq_global.isnull(dataset['RF_AR']):
        dataset['RF_AR']=dataset['AREA']

    if oeq_global.isnull(dataset['WN_AR'])& (not oeq_global.isnull(dataset['PERIMETER'])) & (not oeq_global.isnull(dataset['WL_COM']))& (not oeq_global.isnull(dataset['WIDTH'])) & (not oeq_global.isnull(dataset['WN_RAT'])):
        dataset['WN_AR']=(dataset['PERIMETER']-dataset['WL_COM']* dataset['WIDTH'])*dataset['HEIGHT']*dataset['WN_RAT']

    if not oeq_global.isnull([dataset['AREA'],dataset['FLOORS']]):
        dataset['LIV_AR'] = float(dataset['AREA']) * float(dataset['FLOORS']) * 0.8
    #print dataset


    result = {}
    for i in dataset.keys():
        result.update({i: {'type': QVariant.Double,
                           'value': dataset[i]}})
    result['FLOORS']['type'] = QVariant.Int

    return result
Beispiel #20
0
def preflight(self=None):
    from mole.project import config
    from PyQt4.QtCore import QVariant
    from qgis.core import QgsField
    from mole.qgisinteraction.layer_interaction import add_attributes_if_not_exists
    from mole.oeq_global import OeQ_get_bld_id

    layer = self.layer()
    #print layer.name()
    if layer == None:
        return False
    features = layer.getFeatures()
    provider = layer.dataProvider()
    #in the Berlin Hausumringe WFS there are additional Features that describe specific building parts. As they are not relevant here they are removed by usig the key "Bauart_sch"
    to_remove =[]
    for i in features:
        try:
            if not isnull(i['Bauart_sch']):
                to_remove.append(i.id())
        except:
            return False

    provider.deleteFeatures(to_remove)

    # in the Berlin Hausumringe WFS there are additional Attributes that are not important here. they are removed
    conversion_fields = [[u'AnzahlDerO',u'FLRS_ALK'],[u'Gebaeudefu',u'FUNC_ALK'],[u'Bauweise_s',u'KIND_ALK']]
    fields = filter(lambda f: f.name() not in [i[0] for i in conversion_fields], provider.fields())
    fieldnames =[field.name() for field in fields]
    to_remove = []
    count = 0
    for field in provider.fields():
        if field.name() in fieldnames:
            to_remove.append(count)
        count += 1

    provider.deleteAttributes(to_remove)
    layer.updateFields()

    # in the Berlin Hausumringe WFS there are additional Attributes that are not important here. they are removed
    layer.startEditing()
    for cf in conversion_fields:
        count = 0
        for field in provider.fields():
            #print field.name()
            if field.name() == cf[0]:
                layer.renameAttribute(count,cf[1])
                break
            count += 1
    layer.commitChanges()


    # create building_ids
    add_attributes_if_not_exists(layer, [QgsField(config.building_id_key,QVariant.String)])
    layer.updateFields()
    features = layer.getFeatures()
    layer.startEditing()
    for i in features:
        i[config.building_id_key] = OeQ_get_bld_id()
        layer.updateFeature(i)
    layer.commitChanges()
    return True