Пример #1
0
 def test_gbxml_add_zone(self):
     g=Gbxml()
     campus=g.add_element(g.root(),'Campus')
     building=g.add_element(campus,'Building')
     space=g.add_element(building,'Space')
     space.set('id','space-1')
     g.add_zone('zone-1','space-1')
     l=g.elements('Zone')
     check=1
     self.assertEqual(len(l),check)
     st=space.get('zoneIdRef')
     check='zone-1'
     self.assertEqual(st,check)
Пример #2
0
    def test_get_children_list(self):

        g = Gbxml('detached_house.gbxml')

        result = g.get_children_list(id='DINING_ROOM')
        #print(result)
        answer = [{
            'tag': 'Name',
            'text': 'DINING_ROOM',
            'attributes': {}
        }, {
            'tag': 'Area',
            'text': '13.136900',
            'attributes': {}
        }, {
            'tag': 'Volume',
            'text': '32.842250',
            'attributes': {}
        }, {
            'tag': 'AirChangesPerHour',
            'text': '0.5',
            'attributes': {}
        }, {
            'tag': 'PeopleNumber',
            'text': '0.2',
            'attributes': {
                'unit': 'NumberOfPeople'
            }
        }, {
            'tag': 'PeopleHeatGain',
            'text': '90',
            'attributes': {
                'unit': 'WattPerPerson',
                'heatGainType': 'Total'
            }
        }, {
            'tag': 'LightPowerPerArea',
            'text': '0.5',
            'attributes': {
                'unit': 'WattPerSquareMeter'
            }
        }, {
            'tag': 'EquipPowerPerArea',
            'text': '3',
            'attributes': {
                'unit': 'WattPerSquareMeter'
            }
        }]
        self.assertEqual(result, answer)
Пример #3
0
    def test_get_attributes(self):

        g = Gbxml('detached_house.gbxml')

        result = g.get_attributes(id='DINING_ROOM')
        #print(result)
        answer = {
            'id': 'DINING_ROOM',
            'conditionType': 'HeatedAndCooled',
            'buildingStoreyIdRef': 'GROUP_1',
            'peopleScheduleIdRef': 'schedule-alwaysOn',
            'lightScheduleIdRef': 'schedule-alwaysOn',
            'equipmentScheduleIdRef': 'schedule-alwaysOn',
            'zoneIdRef': 'Zone-DINING_ROOM'
        }
        self.assertEqual(result, answer)
Пример #4
0
 def test_gbxml_surface_layers(self):
     g=Gbxml(config.xml,config.xsd)
     l=g.surface_layers('surface-1')
     layer_ids=[x.get('id') for x in l]
     check=['layer-STD_FLO1']
     self.assertEqual(layer_ids,check)
Пример #5
0
 def test_gbxml_surface_construction(self):
     g=Gbxml(config.xml,config.xsd)
     e=g.surface_construction('surface-1')
     check='STD_FLO1'
     self.assertEqual(e.get('id'),check)
Пример #6
0
 def test_gbxml_surface_tilt(self):
     g=Gbxml(config.xml,config.xsd)
     st=g.surface_tilt('surface-1')
     check=180
     self.assertEqual(st,check)
Пример #7
0
 def test_gbxml_element(self):
     g=Gbxml(config.xml,config.xsd)
     e=g.element(id='campus-1')
     st=g.label(e)
     check='Campus'
     self.assertEqual(st,check)
Пример #8
0
 def test_gbxml_add_element(self):
     g=Gbxml()
     g.add_element(g.root(),'Campus')
     n=len(g.elements())
     check=2
     self.assertEqual(n,check)
Пример #9
0
 def test_gbxml_layer_materials(self):
     g=Gbxml(config.xml,config.xsd)
     l=g.layer_materials('layer-CEIL')
     material_ids=[x.get('id') for x in l]
     check=['SCP-0.005', 'TMF-0.02', 'Cavity-AIR-0.2', 'GPB-0.01']
     self.assertEqual(material_ids,check)
Пример #10
0
 def test_gbxml_construction_layers(self):
     g=Gbxml(config.xml,config.xsd)
     l=g.construction_layers('CEIL')
     layer_ids=[x.get('id') for x in l]
     check=['layer-CEIL']
     self.assertEqual(layer_ids,check)
Пример #11
0
 def test_gbxml_descendent_elements(self):
     g=Gbxml(config.xml,config.xsd)
     l=g.descendent_elements(g.root(),label='Building')
     st=g.label(l[0])
     check='Building'
     self.assertEqual(st,check)
Пример #12
0
 def test_gbxml_child_elements(self):
     g=Gbxml(config.xml,config.xsd)
     l=g.child_elements(g.root(),label='Campus')
     st=g.label(l[0])
     check='Campus'
     self.assertEqual(st,check)
Пример #13
0
 def test_gbxml_text(self):
     g=Gbxml(config.xml,config.xsd)
     e=g.elements(label='Name')[0]
     st=g.text(e)
     check='detached_house'
     self.assertEqual(st,check)
Пример #14
0
 def test_gbxml_attributes(self):
     g=Gbxml()
     e=g.root()
     d=g.attributes(e)
     check={'temperatureUnit': 'C', 'lengthUnit': 'Meters', 'areaUnit': 'SquareMeters', 'volumeUnit': 'CubicMeters', 'useSIUnitsForResults': 'true', 'version': '0.37'}
     self.assertEqual(d,check)
Пример #15
0
 def test_gbxml_label(self):
     g=Gbxml()
     e=g.root()
     st=g.label(e)
     check='gbXML'
     self.assertEqual(st,check)
Пример #16
0
 def test_gbxml_surface_materials(self):
     g=Gbxml(config.xml,config.xsd)
     l=g.surface_materials('surface-1')
     material_ids=[x.get('id') for x in l]
     check=['STD_PH1-0.0982','STD_CC2-0.1','Cavity-AIR-0.05','STD_FBA-0.02']
     self.assertEqual(material_ids,check)
Пример #17
0
 def test_gbxml_windowType_materials(self):
     g=Gbxml(config.xml,config.xsd)
     l=g.windowType_materials('STD_EXTW')
     ids=[x.get('id') for x in l]
     check=['STD_EXTW-layer-1', 'STD_EXTW-layer-2', 'STD_EXTW-layer-3']
     self.assertEqual(ids,check)
Пример #18
0
 def test_gbxml_opening_coordinates(self):
     g=Gbxml(config.xml,config.xsd)
     l=g.opening_coordinates('surface-6-opening-1')
     check=[(2.122, 8.979, 2.15), (3.922, 8.979, 2.15), (3.922, 8.979, 0.05), (2.122, 8.979, 0.05)]
     self.assertEqual(l,check)
Пример #19
0
 def test_gbxml_xmlstring(self):
     g=Gbxml(config.xml,config.xsd)
     st=g.xmlstring()
     check="""<ns0:gbXML xmlns:ns0="http://www.gbxml.org/schema" temperatureUnit="C" lengthUnit="Meters" areaUnit="SquareMeters" volumeUnit="CubicMeters" useSIUnitsForResults="true" version="0.37">"""
     self.assertEqual(st[:len(check)],check)
Пример #20
0
 def test_gbxml_surface_azimuth(self):
     g=Gbxml(config.xml,config.xsd)
     st=g.surface_azimuth('surface-1')
     check=0
     self.assertEqual(st,check)
Пример #21
0
 def test_gbxml_remove_element(self):
     g=Gbxml(config.xml,config.xsd)
     g.remove_element('campus-1')
     l=g.elements('Campus')
     check=[]
     self.assertEqual(l,check)
Пример #22
0
 def test_gbxml_surface_coordinates(self):
     g=Gbxml(config.xml,config.xsd)
     l=g.surface_coordinates('surface-1')
     check=[(1.1125, 4.7895, 0.0), (1.1125, 8.979, 0.0), (4.902, 8.979, 0.0), (4.902, 4.7895, 0.0)]
     self.assertEqual(l,check)
Пример #23
0
 def test_gbxml_surface_inner_space(self):
     g=Gbxml(config.xml,config.xsd)
     space=g.surface_inner_space('surface-1')
     st=space.get('id')
     check='DINING_ROOM'
     self.assertEqual(st,check)
Пример #24
0
 def test_gbxml_elements(self):
     g=Gbxml(config.xml,config.xsd)
     l=g.elements()
     n=len(l)
     check=2707
     self.assertEqual(n,check)