Idf surfaces connection
This commit is contained in:
parent
e8758eb76d
commit
c1b7d346bd
|
@ -35,7 +35,7 @@ class Building(CityObject):
|
||||||
self._function = function
|
self._function = function
|
||||||
self._lower_corner = lower_corner
|
self._lower_corner = lower_corner
|
||||||
self._average_storey_height = None
|
self._average_storey_height = None
|
||||||
self._storeys_above_ground = 1
|
self._storeys_above_ground = None
|
||||||
self._foot_print = None
|
self._foot_print = None
|
||||||
self._usage_zones = []
|
self._usage_zones = []
|
||||||
self._building_units = []
|
self._building_units = []
|
||||||
|
|
|
@ -5,25 +5,19 @@ Copyright © 2020 Project Author Sanam Dabirian sanam.dabirian@mail.concordia.ca
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class facilities:
|
class Facility:
|
||||||
"""
|
"""
|
||||||
facilities class
|
facilities class
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, operation_schedules, convective_fraction, latent_fraction,
|
def __init__(self, operation_schedules, convective_fraction, latent_fraction,
|
||||||
radiant_fraction, total_value_of_heat_dissipation):
|
radiant_fraction, total_value_of_heat_dissipation):
|
||||||
"""
|
|
||||||
Constructor
|
|
||||||
"""
|
|
||||||
|
|
||||||
self._operation_schedules = operation_schedules
|
self._operation_schedules = operation_schedules
|
||||||
self._convective_fraction = convective_fraction
|
self._convective_fraction = convective_fraction
|
||||||
self._latent_fraction = latent_fraction
|
self._latent_fraction = latent_fraction
|
||||||
self._radiant_fraction = radiant_fraction
|
self._radiant_fraction = radiant_fraction
|
||||||
self._total_value_of_heat_dissipation = total_value_of_heat_dissipation
|
self._total_value_of_heat_dissipation = total_value_of_heat_dissipation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def operation_schedules(self):
|
def operation_schedules(self):
|
||||||
"""
|
"""
|
||||||
|
@ -32,7 +26,7 @@ class facilities:
|
||||||
"""
|
"""
|
||||||
return self._operation_schedules
|
return self._operation_schedules
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def convective_fraction(self):
|
def convective_fraction(self):
|
||||||
"""
|
"""
|
||||||
Get convective fraction value
|
Get convective fraction value
|
||||||
|
@ -62,4 +56,4 @@ class facilities:
|
||||||
Get heat dissipation value
|
Get heat dissipation value
|
||||||
:return: heat dissipation
|
:return: heat dissipation
|
||||||
"""
|
"""
|
||||||
return self._total_value_of_heat_dissipation
|
return self._total_value_of_heat_dissipation
|
|
@ -5,7 +5,7 @@ Copyright © 2020 Project Author Sanam Dabirian sanam.dabirian@mail.concordia.ca
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class hvac_facilities:
|
class HvacFacility:
|
||||||
"""
|
"""
|
||||||
HVAC facilities class
|
HVAC facilities class
|
||||||
"""
|
"""
|
|
@ -27,7 +27,7 @@ class IdfHelper:
|
||||||
self._idf = IDF(self._idf_file_path, self._epw_file_path)
|
self._idf = IDF(self._idf_file_path, self._epw_file_path)
|
||||||
self._idf.epw = self._epw_file_path
|
self._idf.epw = self._epw_file_path
|
||||||
|
|
||||||
def add_heating_system(self, building):
|
def add_heating_system(self, building, zone = None):
|
||||||
for usage_zone in building.usage_zones:
|
for usage_zone in building.usage_zones:
|
||||||
thermostat_name = f'Thermostat {building.name}'
|
thermostat_name = f'Thermostat {building.name}'
|
||||||
# todo: this will fail for more than one usage zone
|
# todo: this will fail for more than one usage zone
|
||||||
|
@ -36,26 +36,14 @@ class IdfHelper:
|
||||||
Constant_Heating_Setpoint=usage_zone.heating_setpoint,
|
Constant_Heating_Setpoint=usage_zone.heating_setpoint,
|
||||||
Constant_Cooling_Setpoint=usage_zone.cooling_setpoint
|
Constant_Cooling_Setpoint=usage_zone.cooling_setpoint
|
||||||
)
|
)
|
||||||
for zone in self._idf.idfobjects['ZONE']:
|
if zone is None:
|
||||||
if zone.Name.find(building.name) != -1:
|
for zone in self._idf.idfobjects['ZONE']:
|
||||||
self._idf.newidfobject(self._IDEAL_LOAD_AIR_SYSTEM,
|
if zone.Name.find(building.name) != -1:
|
||||||
Zone_Name=zone.Name,
|
break
|
||||||
Template_Thermostat_Name=static_thermostat.Name
|
self._idf.newidfobject(self._IDEAL_LOAD_AIR_SYSTEM,
|
||||||
)
|
Zone_Name=zone.Name,
|
||||||
|
Template_Thermostat_Name=static_thermostat.Name
|
||||||
def add_heating_system2(self):
|
)
|
||||||
stat = self._idf.newidfobject(
|
|
||||||
"HVACTEMPLATE:THERMOSTAT",
|
|
||||||
Name="Zone Stat",
|
|
||||||
Constant_Heating_Setpoint=20,
|
|
||||||
Constant_Cooling_Setpoint=25,
|
|
||||||
)
|
|
||||||
for zone in self._idf.idfobjects["ZONE"]:
|
|
||||||
self._idf.newidfobject(
|
|
||||||
"HVACTEMPLATE:ZONE:IDEALLOADSAIRSYSTEM",
|
|
||||||
Zone_Name=zone.Name,
|
|
||||||
Template_Thermostat_Name=stat.Name,
|
|
||||||
)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _matrix_to_list(points):
|
def _matrix_to_list(points):
|
||||||
|
@ -79,12 +67,16 @@ class IdfHelper:
|
||||||
# self.add_heating_system(building)
|
# self.add_heating_system(building)
|
||||||
|
|
||||||
def add_surfaces(self, building):
|
def add_surfaces(self, building):
|
||||||
zone = self._idf.newidfobject('ZONE', Name=building.name)
|
self.add_block(building)
|
||||||
# self.add_heating_system(building)
|
for zone in self._idf.idfobjects['ZONE']:
|
||||||
for surface in building.surfaces:
|
if zone.Name.find(building.name) != -1:
|
||||||
idf_surface = self.idf_surfaces[surface.type]
|
for surface in building.surfaces:
|
||||||
wall = self._idf.newidfobject(self._SURFACE, Name=surface.name, Surface_Type=idf_surface, Zone_Name=building.name)
|
idf_surface = self.idf_surfaces[surface.type]
|
||||||
wall.setcoords(IdfHelper._matrix_to_list(surface.points))
|
wall = self._idf.newidfobject(self._SURFACE, Name=surface.name, Surface_Type=idf_surface, Zone_Name=zone.Name)
|
||||||
|
coordinates = IdfHelper._matrix_to_list(surface.points)
|
||||||
|
if len(coordinates) > 2:
|
||||||
|
wall.setcoords(coordinates)
|
||||||
|
# self.add_heating_system(building, zone)
|
||||||
|
|
||||||
def run(self, window_ratio=0.35, display_render=False, output_prefix=None, output_directory='tests'):
|
def run(self, window_ratio=0.35, display_render=False, output_prefix=None, output_directory='tests'):
|
||||||
self._idf.intersect_match()
|
self._idf.intersect_match()
|
||||||
|
@ -94,11 +86,17 @@ class IdfHelper:
|
||||||
if display_render:
|
if display_render:
|
||||||
self._idf.view_model()
|
self._idf.view_model()
|
||||||
else:
|
else:
|
||||||
self._idf.to_obj('ep_outputs/city.obj')
|
# self._idf.to_obj('ep_outputs/city.obj')
|
||||||
# Run
|
print("match")
|
||||||
# self._idf.newidfobject("OUTPUT:METER", Key_Name="Heating:DistrictHeating", Reporting_Frequency="hourly")
|
# Run
|
||||||
# self._idf.newidfobject("OUTPUT:METER", Key_Name="Cooling:DistrictCooling", Reporting_Frequency="hourly")
|
self._idf.newidfobject("OUTPUT:METER", Key_Name="Heating:DistrictHeating", Reporting_Frequency="hourly")
|
||||||
self._idf.run(output_prefix=output_prefix, output_directory=output_directory)
|
self._idf.newidfobject("OUTPUT:METER", Key_Name="Cooling:DistrictCooling", Reporting_Frequency="hourly")
|
||||||
|
try:
|
||||||
|
self._idf.run(output_prefix=output_prefix, output_directory=output_directory)
|
||||||
|
except:
|
||||||
|
print("exception launched")
|
||||||
|
print("completed!")
|
||||||
|
return
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read_eso(eso_path):
|
def read_eso(eso_path):
|
||||||
|
|
|
@ -10,7 +10,6 @@ from physics.physics_factory import PhysicsFactory
|
||||||
from usage.usage_factory import UsageFactory
|
from usage.usage_factory import UsageFactory
|
||||||
from helpers.idf_helper import IdfHelper
|
from helpers.idf_helper import IdfHelper
|
||||||
from geomeppy import IDF
|
from geomeppy import IDF
|
||||||
from esoreader import EsoFile
|
|
||||||
|
|
||||||
|
|
||||||
class TestIdf(TestCase):
|
class TestIdf(TestCase):
|
||||||
|
@ -43,28 +42,32 @@ class TestIdf(TestCase):
|
||||||
for building in city.buildings:
|
for building in city.buildings:
|
||||||
_idf.add_block(building)
|
_idf.add_block(building)
|
||||||
_idf.run(output_prefix='test_idf_blocks', output_directory="ep_outputs")
|
_idf.run(output_prefix='test_idf_blocks', output_directory="ep_outputs")
|
||||||
heating, cooling = IdfHelper.read_eso((Path(__file__).parent / 'ep_outputs/eplusout.eso'))
|
_idf.read_eso(str(self._example_path))
|
||||||
self.assertEqual(len(heating), 0)
|
self.assertEqual(1, 2, "arent equal")
|
||||||
|
# todo: clean up the files
|
||||||
|
|
||||||
def test_idf_surfaces(self):
|
def test_idf_surfaces(self):
|
||||||
idd_file_path = (self._example_path / 'energy+.idd').resolve()
|
idd_file_path = (self._example_path / 'energy+.idd').resolve()
|
||||||
idf_file_path = (self._example_path / 'minimal.idf').resolve()
|
idf_file_path = (self._example_path / 'minimal.idf').resolve()
|
||||||
epw_file_path = (self._example_path / 'montreal.epw').resolve()
|
epw_file_path = (self._example_path / 'montreal.epw').resolve()
|
||||||
|
|
||||||
_idf = IdfHelper(idf_file_path, idd_file_path, epw_file_path)
|
_idf = IdfHelper(idf_file_path, idd_file_path, epw_file_path)
|
||||||
city = self._get_city()
|
city = self._get_city()
|
||||||
for building in city.buildings:
|
for building in city.buildings:
|
||||||
_idf.add_surfaces(building)
|
_idf.add_surfaces(building)
|
||||||
_idf.run(output_prefix='test_idf_surfaces', output_directory="ep_outputs")
|
print("prepare to run")
|
||||||
heating, cooling = IdfHelper.read_eso((Path(__file__).parent / 'ep_outputs/eplusout.eso'))
|
_idf.run(output_prefix='test_idf_surfaces', output_directory="ep_outputs")
|
||||||
self.assertEqual(1, 1, "arent equal")
|
print("done...")
|
||||||
|
self.assertEqual(1, 2, "arent equal")
|
||||||
|
# todo: clean up the files
|
||||||
|
|
||||||
def test_tutorial_2(self):
|
def test_tutorial_2(self):
|
||||||
idd_file_path = (self._example_path / 'energy+.idd').resolve()
|
idd_file_path = (self._example_path / 'energy+.idd').resolve()
|
||||||
idf_file_path = (self._example_path / 'minimal.idf').resolve()
|
idf_file_path = (self._example_path / 'minimal.idf').resolve()
|
||||||
epw_file_path = (self._example_path / 'montreal.epw').resolve()
|
epw_file_path = (self._example_path / 'montreal.epw').resolve()
|
||||||
IDF.setiddname(str(idd_file_path), testing=True)
|
IDF.setiddname(idd_file_path, testing=True)
|
||||||
idf = IDF(str(idf_file_path))
|
idf = IDF(idf_file_path)
|
||||||
idf.epw = str(epw_file_path)
|
idf.epw = epw_file_path
|
||||||
idf.add_block(
|
idf.add_block(
|
||||||
name="Two storey",
|
name="Two storey",
|
||||||
coordinates=[(10, 0), (10, 5), (0, 5), (0, 0)],
|
coordinates=[(10, 0), (10, 5), (0, 5), (0, 0)],
|
||||||
|
@ -100,13 +103,11 @@ class TestIdf(TestCase):
|
||||||
Variable_Name="Zone Ideal Loads Supply Air Total Cooling Energy",
|
Variable_Name="Zone Ideal Loads Supply Air Total Cooling Energy",
|
||||||
Reporting_Frequency="Hourly",
|
Reporting_Frequency="Hourly",
|
||||||
)
|
)
|
||||||
# run a set of simulations, moving glazing from mostly on the South facade, to mostly on the North facade
|
|
||||||
north_wwr = [i / 10 for i in range(1, 10)]
|
|
||||||
south_wwr = [1 - wwr for wwr in north_wwr]
|
|
||||||
|
|
||||||
|
idf.set_wwr(0.4, construction="Project External Window")
|
||||||
idf.run(
|
idf.run(
|
||||||
output_directory="ep_outputs",
|
output_prefix=f"tutorial_2",
|
||||||
expandobjects=True,
|
output_directory="ep_outputs",
|
||||||
verbose="v",
|
expandobjects=True,
|
||||||
)
|
verbose="q",
|
||||||
results = []
|
)
|
Loading…
Reference in New Issue
Block a user