Idf blocks connection
This commit is contained in:
parent
ee9364d704
commit
e74f4ead79
|
@ -5,7 +5,7 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv38" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.7 (libs)" jdkType="Python SDK" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
|
@ -20,8 +20,8 @@ class IdfHelper:
|
|||
self._idf_file_path = str(idf_file_path)
|
||||
self._epw_file_path = str(epw_file_path)
|
||||
self._eso_file_path = str(eso_file_path)
|
||||
IDF.setiddname(self._idd_file_path)
|
||||
self._idf = IDF(self._idf_file_path)
|
||||
IDF.setiddname(self._idd_file_path, testing=True)
|
||||
self._idf = IDF(self._idf_file_path, self._epw_file_path)
|
||||
self._idf.epw = self._epw_file_path
|
||||
self._eso_file_path = str((Path.cwd() / 'eplusout.eso').resolve())
|
||||
|
||||
|
@ -62,33 +62,33 @@ class IdfHelper:
|
|||
for point in points:
|
||||
point_tuple = (point[0], point[1])
|
||||
points_list.append(point_tuple)
|
||||
points_list.reverse()
|
||||
points_list.reverse()
|
||||
return points_list
|
||||
|
||||
def add_block(self, building):
|
||||
_points = IdfHelper._matrix_to_2d_list(building.foot_print.points)
|
||||
self._idf.add_block(name=building.name, coordinates=_points,
|
||||
height=building.max_height, num_stories=building.storeys_above_ground)
|
||||
height=building.max_height)
|
||||
|
||||
def add_surfaces(self, building):
|
||||
for surface in building.surfaces:
|
||||
wall = self._idf.newidfobject('BUILDINGSURFACE:DETAILED', Name=surface.name,
|
||||
Surface_Type=self.idf_surfaces[surface.type], Zone_Name=building.name)
|
||||
wall.setcoords(IdfHelper._matrix_to_list(surface.ground_points))
|
||||
|
||||
def run(self, window_ratio=0.35, display_render=False):
|
||||
|
||||
self._idf.set_wwr(window_ratio)
|
||||
# self._idf.translate_to_origin()
|
||||
wall.setcoords(IdfHelper._matrix_to_list(surface.points))
|
||||
|
||||
def run(self, window_ratio=0.35, display_render=False, output_directory='tests'):
|
||||
self._idf.intersect_match()
|
||||
self._idf.set_wwr(window_ratio, construction="Project External Window")
|
||||
self._idf.set_default_constructions()
|
||||
self._idf.translate_to_origin()
|
||||
if display_render:
|
||||
self._idf.view_model()
|
||||
else:
|
||||
self._idf.to_obj('city.obj')
|
||||
# self._idf.to_obj('ep_outputs/city.obj')
|
||||
# Run
|
||||
self._idf.newidfobject("OUTPUT:METER", Key_Name="Heating:DistrictHeating", Reporting_Frequency="hourly", )
|
||||
self._idf.newidfobject("OUTPUT:METER", Key_Name="Cooling:DistrictCooling", Reporting_Frequency="hourly", )
|
||||
self._idf.run()
|
||||
# self._idf.newidfobject("OUTPUT:METER", Key_Name="Heating:DistrictHeating", Reporting_Frequency="hourly")
|
||||
# self._idf.newidfobject("OUTPUT:METER", Key_Name="Cooling:DistrictCooling", Reporting_Frequency="hourly" )
|
||||
self._idf.run(output_directory=output_directory)
|
||||
"""
|
||||
dd, data = esoreader.read(self._eso_file_path)
|
||||
list_values = [v for v in data.values()]
|
||||
|
|
|
@ -5,7 +5,7 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
|
|||
"""
|
||||
from pathlib import Path
|
||||
from unittest import TestCase
|
||||
|
||||
from geomeppy import IDF
|
||||
from geometry.geometry_factory import GeometryFactory
|
||||
from helpers.idf_helper import IdfHelper
|
||||
|
||||
|
@ -38,12 +38,91 @@ class TestIdf(TestCase):
|
|||
city = self._get_citygml()
|
||||
for building in city.buildings:
|
||||
_idf.add_block(building)
|
||||
_idf.add_zone(building.name)
|
||||
|
||||
# _idf.add_surfaces(building)
|
||||
# for surface in building.surfaces:
|
||||
# _idf.add_surface(surface, building.name)
|
||||
_idf.add_heating_system()
|
||||
_idf.run()
|
||||
|
||||
_idf.run(output_directory="ep_outputs")
|
||||
self.assertTrue(True)
|
||||
|
||||
def test_tutorial_1(self):
|
||||
idd_file_path = (self._example_path / 'energy+.idd').resolve()
|
||||
idf_file_path = (self._example_path / 'minimal.idf').resolve()
|
||||
epw_file_path = (self._example_path / 'montreal.epw').resolve()
|
||||
IDF.setiddname(str(idd_file_path), testing=True)
|
||||
idf = IDF(str(idf_file_path))
|
||||
idf.epw = str(epw_file_path)
|
||||
idf.add_block(
|
||||
name="Boring hut", coordinates=[(10, 0), (10, 10), (0, 10), (0, 0)], height=3.5
|
||||
)
|
||||
idf.intersect_match()
|
||||
idf.set_wwr(0.6, construction="Project External Window")
|
||||
idf.set_default_constructions()
|
||||
idf.to_obj("boring_hut.obj")
|
||||
idf.run(output_directory="tests")
|
||||
|
||||
def test_tutorial_2(self):
|
||||
IDF.setiddname("C:/EnergyPlusV9-1-0/Energy+.idd", testing=True)
|
||||
idf = IDF("C:/EnergyPlusV9-1-0/ExampleFiles/Minimal.idf")
|
||||
idf.epw = "USA_CO_Golden-NREL.724666_TMY3.epw"
|
||||
idf.add_block(
|
||||
name="Two storey",
|
||||
coordinates=[(10, 0), (10, 5), (0, 5), (0, 0)],
|
||||
height=6,
|
||||
num_stories=2,
|
||||
)
|
||||
idf.add_block(
|
||||
name="One storey", coordinates=[(10, 5), (10, 10), (0, 10), (0, 5)], height=3
|
||||
)
|
||||
idf.intersect_match()
|
||||
idf.set_default_constructions()
|
||||
# add a heating system
|
||||
stat = idf.newidfobject(
|
||||
"HVACTEMPLATE:THERMOSTAT",
|
||||
Name="Zone Stat",
|
||||
Constant_Heating_Setpoint=20,
|
||||
Constant_Cooling_Setpoint=25,
|
||||
)
|
||||
for zone in idf.idfobjects["ZONE"]:
|
||||
idf.newidfobject(
|
||||
"HVACTEMPLATE:ZONE:IDEALLOADSAIRSYSTEM",
|
||||
Zone_Name=zone.Name,
|
||||
Template_Thermostat_Name=stat.Name,
|
||||
)
|
||||
# add some output variables
|
||||
idf.newidfobject(
|
||||
"OUTPUT:VARIABLE",
|
||||
Variable_Name="Zone Ideal Loads Supply Air Total Heating Energy",
|
||||
Reporting_Frequency="Hourly",
|
||||
)
|
||||
idf.newidfobject(
|
||||
"OUTPUT:VARIABLE",
|
||||
Variable_Name="Zone Ideal Loads Supply Air Total Cooling Energy",
|
||||
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]
|
||||
for north, south in zip(north_wwr, south_wwr):
|
||||
idf.set_wwr(north, construction="Project External Window", orientation="north")
|
||||
idf.set_wwr(south, construction="Project External Window", orientation="south")
|
||||
idf.run(
|
||||
output_prefix=f"{north}_{south}_",
|
||||
output_directory="tests/tutorial",
|
||||
expandobjects=True,
|
||||
verbose="q",
|
||||
)
|
||||
results = []
|
||||
for north, south in zip(north_wwr, south_wwr):
|
||||
eso = ESO(f"tests/tutorial/{north}_{south}_out.eso")
|
||||
heat = eso.total_kwh("Zone Ideal Loads Supply Air Total Heating Energy")
|
||||
cool = eso.total_kwh("Zone Ideal Loads Supply Air Total Cooling Energy")
|
||||
results.append([north, south, heat, cool, heat + cool])
|
||||
# print out the results
|
||||
headers = ["WWR-N", "WWR-S", "Heat", "Cool", "Total"]
|
||||
header_format = "{:>10}" * (len(headers))
|
||||
print(header_format.format(*headers))
|
||||
row_format = "{:>10.1f}" * (len(headers))
|
||||
for row in results:
|
||||
print(row_format.format(*row))
|
Loading…
Reference in New Issue
Block a user