Add occupancy modified 1
This commit is contained in:
parent
6a5e39fba6
commit
d34d4395c1
|
@ -9,7 +9,6 @@ import esoreader
|
|||
from pathlib import Path
|
||||
import helpers.constants as cte
|
||||
|
||||
|
||||
class IdfHelper:
|
||||
_THERMOSTAT = 'HVACTEMPLATE:THERMOSTAT'
|
||||
_IDEAL_LOAD_AIR_SYSTEM = 'HVACTEMPLATE:ZONE:IDEALLOADSAIRSYSTEM'
|
||||
|
@ -64,33 +63,33 @@ class IdfHelper:
|
|||
Visible_Absorptance=layer.material.visible_absorptance
|
||||
)
|
||||
|
||||
def add_schedule(self, occupancy):
|
||||
def add_schedule(self, building):
|
||||
schedule_occupancy = self._idf.newidfobject("SCHEDULE:DAY:HOURLY".upper())
|
||||
schedule_occupancy.Name = 'occupant schedule'
|
||||
schedule_occupancy.Hour_1 = occupancy.occupant_schedule[0]
|
||||
schedule_occupancy.Hour_2 = occupancy.occupant_schedule[1]
|
||||
schedule_occupancy.Hour_3 = occupancy.occupant_schedule[2]
|
||||
schedule_occupancy.Hour_4 = occupancy.occupant_schedule[3]
|
||||
schedule_occupancy.Hour_5 = occupancy.occupant_schedule[4]
|
||||
schedule_occupancy.Hour_6 = occupancy.occupant_schedule[5]
|
||||
schedule_occupancy.Hour_7 = occupancy.occupant_schedule[6]
|
||||
schedule_occupancy.Hour_8 = occupancy.occupant_schedule[7]
|
||||
schedule_occupancy.Hour_9 = occupancy.occupant_schedule[8]
|
||||
schedule_occupancy.Hour_10 = occupancy.occupant_schedule[9]
|
||||
schedule_occupancy.Hour_11 = occupancy.occupant_schedule[10]
|
||||
schedule_occupancy.Hour_12 = occupancy.occupant_schedule[11]
|
||||
schedule_occupancy.Hour_13 = occupancy.occupant_schedule[12]
|
||||
schedule_occupancy.Hour_14 = occupancy.occupant_schedule[13]
|
||||
schedule_occupancy.Hour_15 = occupancy.occupant_schedule[14]
|
||||
schedule_occupancy.Hour_16 = occupancy.occupant_schedule[15]
|
||||
schedule_occupancy.Hour_17 = occupancy.occupant_schedule[16]
|
||||
schedule_occupancy.Hour_18 = occupancy.occupant_schedule[17]
|
||||
schedule_occupancy.Hour_19 = occupancy.occupant_schedule[18]
|
||||
schedule_occupancy.Hour_20 = occupancy.occupant_schedule[19]
|
||||
schedule_occupancy.Hour_21 = occupancy.occupant_schedule[20]
|
||||
schedule_occupancy.Hour_22 = occupancy.occupant_schedule[21]
|
||||
schedule_occupancy.Hour_23 = occupancy.occupant_schedule[22]
|
||||
schedule_occupancy.Hour_24 = occupancy.occupant_schedule[23]
|
||||
schedule_occupancy.Hour_1 = building.usage_zones[0].occupancy.occupant_schedule[0]
|
||||
schedule_occupancy.Hour_2 = building.usage_zones[0].occupancy.occupant_schedule[1]
|
||||
schedule_occupancy.Hour_3 = building.usage_zones[0].occupancy.occupant_schedule[2]
|
||||
schedule_occupancy.Hour_4 = building.usage_zones[0].occupancy.occupant_schedule[3]
|
||||
schedule_occupancy.Hour_5 = building.usage_zones[0].occupancy.occupant_schedule[4]
|
||||
schedule_occupancy.Hour_6 = building.usage_zones[0].occupancy.occupant_schedule[5]
|
||||
schedule_occupancy.Hour_7 = building.usage_zones[0].occupancy.occupant_schedule[6]
|
||||
schedule_occupancy.Hour_8 = building.usage_zones[0].occupancy.occupant_schedule[7]
|
||||
schedule_occupancy.Hour_9 = building.usage_zones[0].occupancy.occupant_schedule[8]
|
||||
schedule_occupancy.Hour_10 = building.usage_zones[0].occupancy.occupant_schedule[9]
|
||||
schedule_occupancy.Hour_11 = building.usage_zones[0].occupancy.occupant_schedule[10]
|
||||
schedule_occupancy.Hour_12 = building.usage_zones[0].occupancy.occupant_schedule[11]
|
||||
schedule_occupancy.Hour_13 = building.usage_zones[0].occupancy.occupant_schedule[12]
|
||||
schedule_occupancy.Hour_14 = building.usage_zones[0].occupancy.occupant_schedule[13]
|
||||
schedule_occupancy.Hour_15 = building.usage_zones[0].occupancy.occupant_schedule[14]
|
||||
schedule_occupancy.Hour_16 = building.usage_zones[0].occupancy.occupant_schedule[15]
|
||||
schedule_occupancy.Hour_17 = building.usage_zones[0].occupancy.occupant_schedule[16]
|
||||
schedule_occupancy.Hour_18 = building.usage_zones[0].occupancy.occupant_schedule[17]
|
||||
schedule_occupancy.Hour_19 = building.usage_zones[0].occupancy.occupant_schedule[18]
|
||||
schedule_occupancy.Hour_20 = building.usage_zones[0].occupancy.occupant_schedule[19]
|
||||
schedule_occupancy.Hour_21 = building.usage_zones[0].occupancy.occupant_schedule[20]
|
||||
schedule_occupancy.Hour_22 = building.usage_zones[0].occupancy.occupant_schedule[21]
|
||||
schedule_occupancy.Hour_23 = building.usage_zones[0].occupancy.occupant_schedule[22]
|
||||
schedule_occupancy.Hour_24 = building.usage_zones[0].occupancy.occupant_schedule[23]
|
||||
|
||||
def _add_construction(self, thermal_boundary):
|
||||
for construction in self._idf.idfobjects[self._CONSTRUCTION]:
|
||||
|
@ -184,19 +183,19 @@ class IdfHelper:
|
|||
Return_Air_Fraction_Calculated_from_Plenum_Temperature='No'
|
||||
)
|
||||
|
||||
def add_occupancy(self, occupancy):
|
||||
def add_occupancy(self):
|
||||
for zone in self._idf.idfobjects["ZONE"]:
|
||||
self._idf.newidfobject("PEOPLE",
|
||||
Name=zone.Name + "_" + "occupancy",
|
||||
Zone_or_ZoneList_Name=zone.Name,
|
||||
Number_of_People_Schedule_Name='occupant schedule',
|
||||
Number_of_People_Calculation_Method="People",
|
||||
Number_of_People=occupancy.number_of_occupants,
|
||||
Number_of_People=500,
|
||||
# Zone_Floor_Area_per_Person=31.41,
|
||||
# People_per_Zone_Floor_Area=17*0.05,
|
||||
# Zone_Floor_Area_per_Person=1.65880764E+01,
|
||||
Fraction_Radiant=0.3,
|
||||
Activity_Level_Schedule_Name="People_Weekday_ActivityLevel"
|
||||
Activity_Level_Schedule_Name='occupant schedule'
|
||||
)
|
||||
|
||||
def add_equipment(self):
|
||||
|
@ -240,7 +239,7 @@ class IdfHelper:
|
|||
idf_path = (Path(__file__).parent / 'in.idf').resolve()
|
||||
|
||||
# There is a bug in the IDF class, when called, it return an error, as a work around we call call energy+ directly
|
||||
run_command = f"energyplus --weather {self._epw_file_path} --output-directory {output_directory} --idd " \
|
||||
run_command = f"C:\EnergyPlusV9-4-0\energyplus.exe --weather {self._epw_file_path} --output-directory {output_directory} --idd " \
|
||||
f"{self._idd_file_path} --expandobjects --output-prefix {output_prefix} {idf_path}"
|
||||
os.system(run_command)
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ from factories.geometry_factory import GeometryFactory
|
|||
from factories.physics_factory import PhysicsFactory
|
||||
from factories.usage_factory import UsageFactory
|
||||
from helpers.idf_helper import IdfHelper
|
||||
from factories.occupancy_factory import OccupancyFactory
|
||||
import os
|
||||
import glob
|
||||
|
||||
|
||||
class TestIdf(TestCase):
|
||||
"""
|
||||
Test IDF Class
|
||||
|
@ -33,6 +33,7 @@ class TestIdf(TestCase):
|
|||
self._city_gml = GeometryFactory('citygml', file_path).city
|
||||
PhysicsFactory('us_new_york', self._city_gml)
|
||||
UsageFactory('us_new_york', self._city_gml)
|
||||
OccupancyFactory('demo', self._city_gml)
|
||||
return self._city_gml
|
||||
|
||||
def test_idf_blocks(self):
|
||||
|
@ -62,6 +63,8 @@ class TestIdf(TestCase):
|
|||
city = self._get_city()
|
||||
for building in city.buildings:
|
||||
idf.add_surfaces(building)
|
||||
idf.add_schedule(building)
|
||||
idf.add_occupancy()
|
||||
test_prefix = 'test_idf_blocks'
|
||||
idf.run(self._output_path, output_prefix=test_prefix, keep_file=self._output_path)
|
||||
eso_file_path = (self._output_path / f'{test_prefix}out.eso')
|
||||
|
@ -69,5 +72,5 @@ class TestIdf(TestCase):
|
|||
self.assertEqual(len(heating), len(cooling), "Cooling and Heating doesn't contains the same amount of values")
|
||||
self.assertNotEqual(len(heating), 0, "Cooling and Heating series are empty")
|
||||
file_list = glob.glob(str(Path(self._output_path / '*').resolve()))
|
||||
for file_path in file_list:
|
||||
os.remove(file_path)
|
||||
#for file_path in file_list:
|
||||
# os.remove(file_path)
|
||||
|
|
Loading…
Reference in New Issue
Block a user