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
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
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']
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']