diff --git a/RELEASE.md b/RELEASE.md index 6ec9922..be0c2e3 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -5,6 +5,7 @@ p: patch ## next +* p: from version 9.2, allow schedule type limit to be set at "On/Off" * p: preserve order of ``EnergyManagementSystem:ProgramCallingManager`` objects when saving ``Epm``. * p: handle 0-length records diff --git a/opyplus/idd/idd_debug.py b/opyplus/idd/idd_debug.py index 5ee5343..4512999 100644 --- a/opyplus/idd/idd_debug.py +++ b/opyplus/idd/idd_debug.py @@ -54,3 +54,18 @@ def correct_idd(idd): td = idd.table_descriptors["comfortviewfactorangles"] fd = td.get_field_descriptor(2) fd.append_tag("begin-extensible") + + # for all version >= 9.2, add key On/Off for object listing ScheduleTypeLimitNames + if idd.version >= (9, 2, 0): + for table_ref, table_descriptor in idd.table_descriptors.items(): + field_descriptor_names = [fd.name for fd in table_descriptor._field_descriptors] + field_name = 'Schedule Type Limits Name' + if field_name in field_descriptor_names: + field_index = table_descriptor.get_field_index(field_name.lower().replace(" ", "_")) + field_descriptor = table_descriptor.get_field_descriptor(field_index) + field_descriptor.append_tag("key", "On/Off") + field_descriptor.tags.update({ + "type": ["choice"], + "key": ["On/Off"] + }) + diff --git a/tests/test_idd.py b/tests/test_idd.py index 2080eae..d7dc7da 100644 --- a/tests/test_idd.py +++ b/tests/test_idd.py @@ -1,6 +1,7 @@ import unittest +import os -from opyplus.idd.idd import Idd +import opyplus as op from tests.util import iter_eplus_versions @@ -8,6 +9,19 @@ class IddTest(unittest.TestCase): def test_load(self): for _ in iter_eplus_versions(self): - idd = Idd() + idd = op.Idd() + + def test_on_off_schedule_type_limit(self): + for eplus_version in iter_eplus_versions(self): + if eplus_version >= (9, 2, 0): + epm = op.Epm(idd_or_version=eplus_version) # empty epm + epm.Schedule_Compact.add( + name="test_on_off", + schedule_type_limit_names="on/off", + field_1="through: 12/31", + field_2="for: alldays", + field_3="until: 24:00", + field_4="1" + )