Skip to content

Commit

Permalink
Merge branch 'master' into issue196_BugInnerWalls
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaMans committed Apr 7, 2016
2 parents f74a1e9 + dd07e08 commit e5a644d
Show file tree
Hide file tree
Showing 7 changed files with 4,710 additions and 3,107 deletions.
7,223 changes: 4,357 additions & 2,866 deletions teaser/Data/SchemaBindings/ProjectBind.py

Large diffs are not rendered by default.

445 changes: 245 additions & 200 deletions teaser/Data/TeaserXML.py

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions teaser/InputData/XSD_Definitions/Project.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,65 @@
<xs:element type="BuildingAHUType" name="CentralAHU" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="InstituteType">
<xs:sequence>
<xs:element type="xs:string" name="name" minOccurs="0"/>
<xs:element type="xs:string" name="street_name" minOccurs="0"/>
<xs:element type="xs:string" name="city" minOccurs="0"/>
<xs:element type="xs:string" name="type_of_building" minOccurs="0"/>
<xs:element type="xs:string" name="year_of_construction" minOccurs="0"/>
<xs:element type="xs:string" name="year_of_retrofit" minOccurs="0"/>
<xs:element type="xs:int" name="number_of_floors" minOccurs="0"/>
<xs:element type="xs:float" name="height_of_floors" minOccurs="0"/>
<xs:element type="xs:float" name="net_leased_area" minOccurs="0"/>
<xs:element type="xs:float" name="outer_area" minOccurs="0"/>
<xs:element type="xs:float" name="window_area" minOccurs="0"/>
<xs:element type="ThermalZoneType" name="ThermalZone" minOccurs="0" maxOccurs="unbounded"/>
<xs:element type="BuildingAHUType" name="CentralAHU" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Institute4Type">
<xs:sequence>
<xs:element type="xs:string" name="name" minOccurs="0"/>
<xs:element type="xs:string" name="street_name" minOccurs="0"/>
<xs:element type="xs:string" name="city" minOccurs="0"/>
<xs:element type="xs:string" name="type_of_building" minOccurs="0"/>
<xs:element type="xs:string" name="year_of_construction" minOccurs="0"/>
<xs:element type="xs:string" name="year_of_retrofit" minOccurs="0"/>
<xs:element type="xs:int" name="number_of_floors" minOccurs="0"/>
<xs:element type="xs:float" name="height_of_floors" minOccurs="0"/>
<xs:element type="xs:float" name="net_leased_area" minOccurs="0"/>
<xs:element type="xs:float" name="outer_area" minOccurs="0"/>
<xs:element type="xs:float" name="window_area" minOccurs="0"/>
<xs:element type="ThermalZoneType" name="ThermalZone" minOccurs="0" maxOccurs="unbounded"/>
<xs:element type="BuildingAHUType" name="CentralAHU" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Institute8Type">
<xs:sequence>
<xs:element type="xs:string" name="name" minOccurs="0"/>
<xs:element type="xs:string" name="street_name" minOccurs="0"/>
<xs:element type="xs:string" name="city" minOccurs="0"/>
<xs:element type="xs:string" name="type_of_building" minOccurs="0"/>
<xs:element type="xs:string" name="year_of_construction" minOccurs="0"/>
<xs:element type="xs:string" name="year_of_retrofit" minOccurs="0"/>
<xs:element type="xs:int" name="number_of_floors" minOccurs="0"/>
<xs:element type="xs:float" name="height_of_floors" minOccurs="0"/>
<xs:element type="xs:float" name="net_leased_area" minOccurs="0"/>
<xs:element type="xs:float" name="outer_area" minOccurs="0"/>
<xs:element type="xs:float" name="window_area" minOccurs="0"/>
<xs:element type="ThermalZoneType" name="ThermalZone" minOccurs="0" maxOccurs="unbounded"/>
<xs:element type="BuildingAHUType" name="CentralAHU" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ProjectType">
<xs:choice maxOccurs="unbounded" minOccurs="0">
<xs:element type="BuildingType" name="Building"/>
<xs:element type="OfficeType" name="Office"/>
<xs:element type="ResidentialType" name="Residential"/>
<xs:element type="InstituteType" name="Institute"/>
<xs:element type="Institute4Type" name="Institute4"/>
<xs:element type="Institute8Type" name="Institute8"/>
</xs:choice>
</xs:complexType>
</xs:schema>
61 changes: 36 additions & 25 deletions teaser/Logic/BuildingObjects/Building.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def __init__(self,
self.file_set_t = None
self.file_weather = None

self._calculation_method = "vdi"
self.calculation_method = None

def set_outer_wall_area(self, new_area, orientation):
'''Outer area wall setter
Expand Down Expand Up @@ -310,7 +310,7 @@ def compare_area_dicts(self):
if key not in self.window_area.keys():
self.window_area[key] = None

def calc_building_parameter(self, calculation_core):
def calc_building_parameter(self, calculation_method=None):
'''calc all building parameters
This functions calculates the parameters of all zones in a building
Expand All @@ -320,17 +320,22 @@ def calc_building_parameter(self, calculation_core):
Parameters
----------
calculation_core : string
calculation_method : string
setter of the used calculation core ('vdi' or 'ebc'), default:'vdi'
'''
self.compare_area_dicts()
if calculation_method is not None:
self.calculation_method = calculation_method
else:
pass

for zone in self.thermal_zones:
zone.calc_zone_parameters(calculation_core)
zone.calc_zone_parameters(self.calculation_method)
self.sum_heating_load += zone.heating_load

def retrofit_building(self, year_of_retrofit=None,
def retrofit_building(self,
year_of_retrofit=None,
window_type=None,
material=None):
''' Retrofits all zones in the building
Expand Down Expand Up @@ -614,9 +619,9 @@ def modelica_gains_boundary(self,

scipy.io.savemat(path,
mdict={'Internals': internal_boundary},
appendmat = False,
format = '4')
appendmat=False,
format='4')

@property
def parent(self):
return self.__parent
Expand All @@ -636,7 +641,8 @@ def parent(self, value):

self.__parent.list_of_buildings.append(self)
else:
pass

self.__parent = None

@property
def name(self):
Expand Down Expand Up @@ -665,14 +671,14 @@ def year_of_construction(self):
@year_of_construction.setter
def year_of_construction(self, value):

if isinstance(value, int) or value == None:
if isinstance(value, int) or value is None:

self.__year_of_construction = value
else:
try:
value = int(value)
self.__year_of_construction = value

except:
raise ValueError("Can't convert year of construction to int")

Expand All @@ -683,37 +689,37 @@ def number_of_floors(self):
@number_of_floors.setter
def number_of_floors(self, value):

if isinstance(value, int) or value == None:
if isinstance(value, int) or value is None:

self.__number_of_floors = value
else:
try:
value = int(value)
self.__number_of_floors = value

except:
raise ValueError("Can't convert number of floors to int")

@property
def height_of_floors(self):
return self.__height_of_floors

@height_of_floors.setter
def height_of_floors(self, value):

if isinstance(value, float) or value == None:
if isinstance(value, float) or value is None:

self.__height_of_floors = value
else:
try:
value = float(value)
self.__height_of_floors = value

except:
raise ValueError("Can't convert height of floors to float")

@property
def net_leased_area(self):
def net_leased_area(self):
return self.__net_leased_area

@net_leased_area.setter
Expand Down Expand Up @@ -778,14 +784,14 @@ def year_of_retrofit(self, value):
self._year_of_retrofit = value
else:
raise ValueError("Specify year of construction first")

@property
def central_ahu(self):
return self._central_ahu

@central_ahu.setter
def central_ahu(self, value):

ass_error_1 = "central AHU has to be an instance of BuildingAHU()"

assert type(value).__name__ == ("BuildingAHU"), ass_error_1
Expand All @@ -804,4 +810,9 @@ def calculation_method(self, value):

assert value != "ebc" or value != "vdi", ass_error_1

self._calculation_method = value
if self.parent is None and value is None:
self._calculation_method = "vdi"
elif self.parent is not None and value is None:
self._calculation_method = self.parent.calculation_method
elif value is not None:
self._calculation_method = value
8 changes: 6 additions & 2 deletions teaser/Logic/BuildingObjects/TypeBuildings/Office.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,12 @@ def __init__(self,
self.gross_factor)
else:
raise ValueError("office_layout value has to be between 0 - 3")

self._est_length = ((self.net_leased_area / self.number_of_floors) *
if self.net_leased_area is not None and self.number_of_floors is not \
None:
self._est_length = ((self.net_leased_area / self.number_of_floors) *
self.gross_factor) / self._est_width
else:
pass

if self.with_ahu is True:
self.central_ahu.profile_temperature = (7*[293.15] +
Expand All @@ -249,6 +252,7 @@ def __init__(self,
self.central_ahu.profile_max_relative_humidity = (25*[0.55])
self.central_ahu.profile_v_flow = (7*[0.0] + 12*[1.0] + 6*[0.0])


def generate_office(self):
'''Generates an office building.
Expand Down
2 changes: 1 addition & 1 deletion teaser/Logic/BuildingObjects/TypeBuildings/Residential.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class Residential(TypeBuilding):

def __init__(self,
parent,
name,
name=None,
year_of_construction=None,
number_of_floors=None,
height_of_floors=None,
Expand Down
24 changes: 11 additions & 13 deletions teaser/Project.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,27 +121,25 @@ def load_weather_file(self, weather_path, file_name):
else:
pass

def calc_all_buildings(self, calculation_core):
def calc_all_buildings(self, calculation_method):
'''Calculates values for all project buildings
Parameters
----------
calculation_core : string
calculation_method : string
setter of the used calculation core ('vdi' or 'ebc'), default:'vdi'
'''

if calculation_core == self.calculation_method:
pass
else:
self.calculation_method = calculation_core
self.calculation_method = calculation_method

for bldg in self.list_of_buildings:

bldg.calc_building_parameter(calculation_core)
bldg.calc_building_parameter()

def retrofit_all_buildings(self, year_of_retrofit,
def retrofit_all_buildings(self,
year_of_retrofit,
window_type=None,
material=None):
''' Retrofits all buildings in the project
Expand Down Expand Up @@ -243,7 +241,7 @@ def type_bldg_office(self,
construction_type)

type_bldg.generate_office()
type_bldg.calc_building_parameter(self.calculation_method)
type_bldg.calc_building_parameter()
return type_bldg

def type_bldg_institute(self,
Expand Down Expand Up @@ -309,7 +307,7 @@ def type_bldg_institute(self,
construction_type)

type_bldg.generate_office()
type_bldg.calc_building_parameter(self.calculation_method)
type_bldg.calc_building_parameter()
return type_bldg

def type_bldg_institute4(self,
Expand Down Expand Up @@ -375,7 +373,7 @@ def type_bldg_institute4(self,
construction_type)

type_bldg.generate_office()
type_bldg.calc_building_parameter(self.calculation_method)
type_bldg.calc_building_parameter()
return type_bldg

def type_bldg_institute8(self,
Expand Down Expand Up @@ -441,7 +439,7 @@ def type_bldg_institute8(self,
construction_type)

type_bldg.generate_office()
type_bldg.calc_building_parameter(self.calculation_method)
type_bldg.calc_building_parameter()
return type_bldg

def type_bldg_residential(self,
Expand Down Expand Up @@ -530,7 +528,7 @@ def type_bldg_residential(self,
construction_type)

type_bldg.generate_residential()
type_bldg.calc_building_parameter(self.calculation_method)
type_bldg.calc_building_parameter()
return type_bldg

def save_project(self, file_name=None, path=None):
Expand Down

0 comments on commit e5a644d

Please sign in to comment.