Skip to content

Commit

Permalink
- switched of old AV Rate Extension
Browse files Browse the repository at this point in the history
- rewrote oeq_solar Extension
- wrote FR_AR_ Extension to calculate the horizontal roof portion from age and height of a building
  • Loading branch information
YOUR NAMEWerner committed Jan 8, 2016
1 parent c8c1946 commit 5c8f9c7
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 14 deletions.
2 changes: 1 addition & 1 deletion mole/extensions/eval1/oeq_heatinghrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def calculation(self=None, parameters={}):
par_in=[],
layer_in=config.data_layer_name,
layer_out=config.data_layer_name,
active=True,
active=False,
show_results=['HHRS'],
description=u"Calculate Average Heating Hours",
evaluation_method=calculation)
Expand Down
2 changes: 1 addition & 1 deletion mole/extensions/eval4/oeq_AVR.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def calculation(self=None, parameters={}):
par_in=['BS_AR','RF_AR','WL_AR','WN_AR','AREA','HEIGHT'],
layer_in=config.data_layer_name,
layer_out=config.data_layer_name,
active=True,
active=False,
show_results=['AVR'],
description=u"Calculate the present Transmission Heat Koefficient of the Building",
evaluation_method=calculation)
Expand Down
66 changes: 66 additions & 0 deletions mole/extensions/eval4/oeq_FR_AR.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-

import os,math
from qgis.core import NULL
from mole import oeq_global
from mole.project import config
from mole.extensions import OeQExtension
from mole.stat_corr import contemporary_base_uvalue_by_building_age_lookup

def calculation(self=None, parameters={}):
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['YOC'] , parameters['HEIGHT'],parameters['AREA']]):

if 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

flatroofratio = 0.5 * (fr1 + fr2)


return {'FR_RT': {'type': QVariant.Double,
'value': flatroofratio},
'FR_AR': {'type': QVariant.Double,
'value': flatroofratio * parameters['AREA']}}

return {'FR_RT': {'type': QVariant.Double,
'value': NULL},
'FR_AR': {'type': QVariant.Double,
'value': NULL}}


extension = OeQExtension(
extension_id=__name__,

category='Evaluation',
subcategory='General',
extension_name='Flat Roof Area',
layer_name= 'Flat Roof Area',
extension_filepath=os.path.join(__file__),
colortable = os.path.join(os.path.splitext(__file__)[0] + '.qml'),
field_id='FR_RT',
source_type='none',
par_in=['HEIGHT','YOC','AREA'],
layer_in=config.data_layer_name,
layer_out=config.data_layer_name,
active=True,
show_results=['FR_RT'],
description=u"Calculate the flat area of the roof of the Building",
evaluation_method=calculation)

extension.registerExtension(default=True)
20 changes: 8 additions & 12 deletions mole/extensions/eval5/oeq_SOLAR.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,16 @@ def calculation(self=None, parameters={}):
from scipy.constants import golden
from math import floor, ceil
from PyQt4.QtCore import QVariant
# factor for golden rule
ratio_solar_available=0.5
ratio_solar_installable=0.5
solar_earnings_per_sqm=450.0
ratio_solar_installable=0.6
solar_earnings_per_sqm=350.0

dataset = {'SOLAR':NULL,'SOLIAR': NULL,'SOLHE': NULL,'SOLHEL': NULL,'SOLCRT': NULL}
dataset.update(parameters)
dataset = {'SOLIAR': NULL,'SOLHE': NULL,'SOLHEL': NULL,'SOLCRT': NULL}

if not oeq_global.isnull([dataset['AHDP'], dataset['RF_AR'],dataset['LIV_AR']]):
dataset['SOLAR']=float(dataset['RF_AR']) * float(ratio_solar_available)
dataset['SOLIAR']=float(dataset['SOLAR'])*float(ratio_solar_installable)
if not oeq_global.isnull([parameters['AHDP'], parameters['FR_AR'],parameters['LIV_AR']]):
dataset['SOLIAR']=float(parameters['FR_AR'])*float(ratio_solar_installable)
dataset['SOLHE']=solar_earnings_per_sqm * float(dataset['SOLIAR'])
dataset['SOLHEL']=dataset['SOLHE']/float(dataset['LIV_AR'])
dataset['SOLCRT']=float(dataset['SOLHEL'])/float(dataset['AHDP'])*100
dataset['SOLHEL']=dataset['SOLHE']/float(parameters['LIV_AR'])
dataset['SOLCRT']=float(dataset['SOLHEL'])/float(parameters['AHDP'])*100

result = {}
for i in dataset.keys():
Expand All @@ -42,7 +38,7 @@ def calculation(self=None, parameters={}):
colortable = os.path.join(os.path.splitext(__file__)[0] + '.qml'),
field_id='SOLCRT',
source_type='none',
par_in=['AHDP','RF_AR','LIV_AR'],
par_in=['AHDP','FR_AR','LIV_AR'],
layer_in=config.data_layer_name,
layer_out=config.data_layer_name,
active=True,
Expand Down

0 comments on commit 5c8f9c7

Please sign in to comment.