Exemple #1
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']
Exemple #2
0
        TOF = pickle.load(myFile)

else:
    # -- Create the dictionary
    TOF = {}

    # -- For each azimuth
    for az in azimuths:

        # -- Open a sub-dictionary
        TOF[str(az)] = {}

        # -- For each tilt
        for tr in tilts:
            # -- Get the total yearly solar irradiation
            total = irr.yearly_total_irr(PLACE, az, tr)  # , INTERVAL, cloud_cover)
            # -- Store it in the dictionary
            TOF[str(az)][str(tr)] = total
            # -- Print the progress
            print "Azimuth:", az, "\tTilt:", tr, "\tIrradiation:", total, "kWh/m^2"

    # -- Store the obtained values to save time later
    if TOF:
        with open("TOF.dict", "wb") as dict_items_save:
            pickle.dump(TOF, dict_items_save)


if PLOT:
    # -- Plotting time!
    import matplotlib as mpl
Exemple #3
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']
Exemple #4
0
        TOF = pickle.load(myFile)

else:
    #-- Create the dictionary
    TOF = {}

    #-- For each azimuth
    for az in azimuths:

        #-- Open a sub-dictionary
        TOF[str(az)] = {}

        #-- For each tilt
        for tr in tilts:
            #-- Get the total yearly solar irradiation
            total = irr.yearly_total_irr(PLACE, az,
                                         tr)  #, INTERVAL, cloud_cover)
            #-- Store it in the dictionary
            TOF[str(az)][str(tr)] = total
            #-- Print the progress
            print "Azimuth:", az, "\tTilt:", tr, "\tIrradiation:", total, "kWh/m^2"

    #-- Store the obtained values to save time later
    if TOF:
        with open('TOF.dict', 'wb') as dict_items_save:
            pickle.dump(TOF, dict_items_save)

if PLOT:
    #-- Plotting time!
    import matplotlib as mpl
    #from matplotlib import rc
    import matplotlib.pyplot as plt