Ejemplo n.º 1
0
 def groundarea(self):
     """The total area of GroundSurfaces."""
     self.grounds = []
     groundarea = 0.0
     for child in self.xml.getiterator():
         if child.tag == '{%s}GroundSurface' % ns_bldg:
             self.grounds.append(child)
     self.count = 0
     for groundsurface in self.grounds:
         self.count += 1
         groundarea += polygon3dmodule.getAreaOfGML(groundsurface, True)
     return groundarea
Ejemplo n.º 2
0
 def groundarea(self):
     """The total area of GroundSurfaces."""
     self.grounds = []
     groundarea = 0.0
     for child in self.xml.getiterator():
         if child.tag == '{%s}GroundSurface' %ns_bldg:
             self.grounds.append(child)
     self.count = 0
     for groundsurface in self.grounds:
         self.count += 1
         groundarea += polygon3dmodule.getAreaOfGML(groundsurface, True)
     return groundarea
Ejemplo n.º 3
0
 def allarea(self):
     """The total area of all surfaces."""
     self.allareas = []
     allarea = 0.0
     # for child in self.xml.getiterator():
     #   if child.tag == '{%s}surfaceMember' %ns_gml:
     #       self.allareas.append(child)
     self.allareas = self.xml.findall('.//{%s}Polygon' %ns_gml)
     self.count = 0
     for poly in self.allareas:
         self.count += 1
         allarea += polygon3dmodule.getAreaOfGML(poly, True)
     return allarea
Ejemplo n.º 4
0
 def allarea(self):
     """The total area of all surfaces."""
     self.allareas = []
     allarea = 0.0
     # for child in self.xml.getiterator():
     #   if child.tag == '{%s}surfaceMember' %ns_gml:
     #       self.allareas.append(child)
     self.allareas = self.xml.findall('.//{%s}Polygon' % ns_gml)
     self.count = 0
     for poly in self.allareas:
         self.count += 1
         allarea += polygon3dmodule.getAreaOfGML(poly, True)
     return allarea
Ejemplo n.º 5
0
 def solarinfo(self):        
     """Computes the area, azimuth, and tilt for each roof surface (id compulsory)."""
     place = (52.01, 4.36)
     for roofsurface in self.roofsurfaces:
         #-- Skip the openings
         if roofsurface.attrib['{%s}id' %ns_gml] in self.listOfOpenings:
             continue
         #-- Add it to the list
         listofxmlroofsurfaces.append(roofsurface)
         #-- gml:id of the polygon
         pid = roofsurface.attrib['{%s}id' %ns_gml]
         #-- Area
         area = polygon3dmodule.getAreaOfGML(roofsurface, True)
         #-- Compute the normal
         norm = polygon3dmodule.getNormal(markup3dmodule.GMLpoints(markup3dmodule.polydecomposer(roofsurface)[0][0]))
         #-- Get the azimuth and tilt from the surface normal
         az, tilt = polygon3dmodule.getAngles(norm)
         az = round(az, 3)
         #-- 360 -> 0 degrees
         if az == 360.0:
             az = 0.0
         tilt = round(tilt, 3)
         #-- Peculiar problems with the normals, with a cheap solution. Luckily very uncommon.
         if tilt == 180:
             tilt = 0.0
         if tilt >= 180:
             tilt = tilt - 180.01
         elif tilt > 90:
             tilt = tilt - 90.01
         elif tilt == 90:
             tilt = 89.9
         #-- Flat surfaces always have the azimuth zero
         if tilt == 0.0:
             az = 0.0
         #-- If the TOF file is loaded, sample the irradiance
         if loadDict:
             irradiation = irr_from_tof(tilt, az)
         #-- If the TOF file is not loaded, estimate the values
         else:
             irradiation = irr.yearly_total_irr(place, az, tilt)
         #-- Add the values
         self.roofdata[pid] = {'area' : area, 'azimuth' : az, 'tilt' : tilt, 'irradiation' : irradiation, 'total_irradiation' : irradiation*area}
         roofsurfacedata[pid] = {'area' : area, 'azimuth' : az, 'tilt' : tilt, 'irradiation' : irradiation, 'total_irradiation' : irradiation*area}
         #self.roofdata.append([self.id, pid, area, az, tilt, irradiation, irradiation*area])
     self.sumIrr = 0
     #-- Sum the values for the building
     for rs in self.roofdata:
         self.sumIrr += self.roofdata[rs]['total_irradiation']
Ejemplo n.º 6
0
def oparea(xmlelement):
    """The total area of Openings in the XML tree."""
    matching = []
    openings = []
    openingarea = 0.0
    for child in xmlelement.getiterator():
        if child.tag == '{%s}opening' %ns_bldg:
            #print 'opening'
            matching.append(child)
    for match in matching:
        for child in match.getiterator():
            if child.tag == '{%s}surfaceMember' %ns_gml:
                openings.append(child)
    for openingsurface in openings:
        openingarea += polygon3dmodule.getAreaOfGML(openingsurface, True)
    return openingarea  
Ejemplo n.º 7
0
def oparea(xmlelement):
    """The total area of Openings in the XML tree."""
    matching = []
    openings = []
    openingarea = 0.0
    for child in xmlelement.getiterator():
        if child.tag == '{%s}opening' % ns_bldg:
            #print 'opening'
            matching.append(child)
    for match in matching:
        for child in match.getiterator():
            if child.tag == '{%s}surfaceMember' % ns_gml:
                openings.append(child)
    for openingsurface in openings:
        openingarea += polygon3dmodule.getAreaOfGML(openingsurface, True)
    return openingarea
Ejemplo n.º 8
0
 def wallarea(self):
     """The total area of WallSurfaces."""
     self.walls = []
     self.wallsurfaces = []
     wallarea = 0.0
     openings = 0.0
     #-- Account for openings
     for child in self.xml.getiterator():
         if child.tag == '{%s}WallSurface' %ns_bldg:
             self.walls.append(child)
             openings += oparea(child)
     for surface in self.walls:
         for w in surface.findall('.//{%s}Polygon' %ns_gml):
             self.wallsurfaces.append(w)
     for wallsurface in self.wallsurfaces:
         wallarea += polygon3dmodule.getAreaOfGML(wallsurface, True)
     return wallarea - openings
Ejemplo n.º 9
0
 def wallarea(self):
     """The total area of WallSurfaces."""
     self.walls = []
     self.wallsurfaces = []
     wallarea = 0.0
     openings = 0.0
     #-- Account for openings
     for child in self.xml.getiterator():
         if child.tag == '{%s}WallSurface' % ns_bldg:
             self.walls.append(child)
             openings += oparea(child)
     for surface in self.walls:
         for w in surface.findall('.//{%s}Polygon' % ns_gml):
             self.wallsurfaces.append(w)
     for wallsurface in self.wallsurfaces:
         wallarea += polygon3dmodule.getAreaOfGML(wallsurface, True)
     return wallarea - openings
Ejemplo n.º 10
0
 def roofarea(self):
     """The total area of RoofSurface."""
     self.roofs = []
     self.roofsurfaces = []
     roofarea = 0.0
     openings = 0.0
     for child in self.xml.getiterator():
         if child.tag == '{%s}RoofSurface' %ns_bldg:
             self.roofs.append(child)
             openings += oparea(child)
     for surface in self.roofs:
         for w in surface.findall('.//{%s}Polygon' %ns_gml):
             self.roofsurfaces.append(w)
     for roofsurface in self.roofsurfaces:
         roofarea += polygon3dmodule.getAreaOfGML(roofsurface, True)
         #-- Compute the normal
         norm = polygon3dmodule.getNormal(markup3dmodule.GMLpoints(markup3dmodule.polydecomposer(roofsurface)[0][0]))
         polygon3dmodule.getAngles(norm)
     return roofarea - openings
Ejemplo n.º 11
0
 def openingarea(self):
     """The total area of Openings."""
     matching = []
     self.openings = []
     openingarea = 0.0
     for child in self.xml.getiterator():
         if child.tag == '{%s}opening' %ns_bldg:
             matching.append(child)
             #-- Store the list of openings
             for o in child.findall('.//{%s}Polygon' %ns_gml):
                 self.listOfOpenings.append(o.attrib['{%s}id' %ns_gml])
     for match in matching:
         for child in match.getiterator():
             if child.tag == '{%s}surfaceMember' %ns_gml:
                 self.openings.append(child)
     self.count = 0
     for openingsurface in self.openings:
         self.count += 1
         openingarea += polygon3dmodule.getAreaOfGML(openingsurface, True)
     return openingarea
Ejemplo n.º 12
0
 def openingarea(self):
     """The total area of Openings."""
     matching = []
     self.openings = []
     openingarea = 0.0
     for child in self.xml.getiterator():
         if child.tag == '{%s}opening' % ns_bldg:
             matching.append(child)
             #-- Store the list of openings
             for o in child.findall('.//{%s}Polygon' % ns_gml):
                 self.listOfOpenings.append(o.attrib['{%s}id' % ns_gml])
     for match in matching:
         for child in match.getiterator():
             if child.tag == '{%s}surfaceMember' % ns_gml:
                 self.openings.append(child)
     self.count = 0
     for openingsurface in self.openings:
         self.count += 1
         openingarea += polygon3dmodule.getAreaOfGML(openingsurface, True)
     return openingarea
Ejemplo n.º 13
0
 def roofarea(self):
     """The total area of RoofSurface."""
     self.roofs = []
     self.roofsurfaces = []
     roofarea = 0.0
     openings = 0.0
     for child in self.xml.getiterator():
         if child.tag == '{%s}RoofSurface' % ns_bldg:
             self.roofs.append(child)
             openings += oparea(child)
     for surface in self.roofs:
         for w in surface.findall('.//{%s}Polygon' % ns_gml):
             self.roofsurfaces.append(w)
     for roofsurface in self.roofsurfaces:
         roofarea += polygon3dmodule.getAreaOfGML(roofsurface, True)
         #-- Compute the normal
         norm = polygon3dmodule.getNormal(
             markup3dmodule.GMLpoints(
                 markup3dmodule.polydecomposer(roofsurface)[0][0]))
         polygon3dmodule.getAngles(norm)
     return roofarea - openings
Ejemplo n.º 14
0
 def solarinfo(self):
     """Computes the area, azimuth, and tilt for each roof surface (id compulsory)."""
     place = (52.01, 4.36)
     for roofsurface in self.roofsurfaces:
         #-- Skip the openings
         if roofsurface.attrib['{%s}id' % ns_gml] in self.listOfOpenings:
             continue
         #-- Add it to the list
         listofxmlroofsurfaces.append(roofsurface)
         #-- gml:id of the polygon
         pid = roofsurface.attrib['{%s}id' % ns_gml]
         #-- Area
         area = polygon3dmodule.getAreaOfGML(roofsurface, True)
         #-- Compute the normal
         norm = polygon3dmodule.getNormal(
             markup3dmodule.GMLpoints(
                 markup3dmodule.polydecomposer(roofsurface)[0][0]))
         #-- Get the azimuth and tilt from the surface normal
         az, tilt = polygon3dmodule.getAngles(norm)
         az = round(az, 3)
         #-- 360 -> 0 degrees
         if az == 360.0:
             az = 0.0
         tilt = round(tilt, 3)
         #-- Peculiar problems with the normals, with a cheap solution. Luckily very uncommon.
         if tilt == 180:
             tilt = 0.0
         if tilt >= 180:
             tilt = tilt - 180.01
         elif tilt > 90:
             tilt = tilt - 90.01
         elif tilt == 90:
             tilt = 89.9
         #-- Flat surfaces always have the azimuth zero
         if tilt == 0.0:
             az = 0.0
         #-- If the TOF file is loaded, sample the irradiance
         if loadDict:
             irradiation = irr_from_tof(tilt, az)
         #-- If the TOF file is not loaded, estimate the values
         else:
             irradiation = irr.yearly_total_irr(place, az, tilt)
         #-- Add the values
         self.roofdata[pid] = {
             'area': area,
             'azimuth': az,
             'tilt': tilt,
             'irradiation': irradiation,
             'total_irradiation': irradiation * area
         }
         roofsurfacedata[pid] = {
             'area': area,
             'azimuth': az,
             'tilt': tilt,
             'irradiation': irradiation,
             'total_irradiation': irradiation * area
         }
         #self.roofdata.append([self.id, pid, area, az, tilt, irradiation, irradiation*area])
     self.sumIrr = 0
     #-- Sum the values for the building
     for rs in self.roofdata:
         self.sumIrr += self.roofdata[rs]['total_irradiation']