コード例 #1
0
def aoi_projection(surf_tilt, surf_az, sun_zen, sun_az):
    """
    Calculates the dot product of the solar vector and the surface normal.
    
    Input all angles in degrees.
    
    Parameters
    ==========
    
    surf_tilt : float or Series. 
        Panel tilt from horizontal.
    surf_az : float or Series. 
        Panel azimuth from north.
    sun_zen : float or Series. 
        Solar zenith angle.
    sun_az : float or Series. 
        Solar azimuth angle.
        
    Returns
    =======
    float or Series. Dot product of panel normal and solar angle.
    """
    
    projection = pvl_tools.cosd(surf_tilt)*pvl_tools.cosd(sun_zen) + pvl_tools.sind(surf_tilt)*pvl_tools.sind(sun_zen)*pvl_tools.cosd(sun_az - surf_az)
    
    try:
        projection.name = 'aoi_projection'
    except AttributeError:
        pass
    
    return projection
コード例 #2
0
def perez(surf_tilt, surf_az, DHI, DNI, DNI_ET, sun_zen, sun_az, AM, 
          modelt='allsitescomposite1990'):
    ''' 
    Determine diffuse irradiance from the sky on a tilted surface using one of the Perez models

    Perez models determine the diffuse irradiance from the sky (ground
    reflected irradiance is not included in this algorithm) on a tilted
    surface using the surface tilt angle, surface azimuth angle, diffuse
    horizontal irradiance, direct normal irradiance, extraterrestrial
    irradiance, sun zenith angle, sun azimuth angle, and relative (not
    pressure-corrected) airmass. Optionally a selector may be used to use
    any of Perez's model coefficient sets.


    Parameters
    ----------

    surf_tilt : float or Series
          Surface tilt angles in decimal degrees.
          surf_tilt must be >=0 and <=180. The tilt angle is defined as
          degrees from horizontal (e.g. surface facing up = 0, surface facing
          horizon = 90)

    surf_az : float or Series
          Surface azimuth angles in decimal degrees.
          surf_az must be >=0 and <=360. The Azimuth convention is defined
          as degrees east of north (e.g. North = 0, South=180 East = 90, West = 270).

    DHI : float or Series
          diffuse horizontal irradiance in W/m^2. 
          DHI must be >=0.

    DNI : float or Series
          direct normal irradiance in W/m^2. 
          DNI must be >=0.

    DNI_ET : float or Series
          extraterrestrial normal irradiance in W/m^2. 
           DNI_ET must be >=0.

    sun_zen : float or Series
          apparent (refraction-corrected) zenith
          angles in decimal degrees. 
          sun_zen must be >=0 and <=180.

    sun_az : float or Series
          Sun azimuth angles in decimal degrees.
          sun_az must be >=0 and <=360. The Azimuth convention is defined
          as degrees east of north (e.g. North = 0, East = 90, West = 270).

    AM : float or Series
          relative (not pressure-corrected) airmass 
          values. If AM is a DataFrame it must be of the same size as all other 
          DataFrame inputs. AM must be >=0 (careful using the 1/sec(z) model of AM
          generation)

    Other Parameters
    ----------------

    model : string (optional, default='allsitescomposite1990')

          a character string which selects the desired set of Perez
          coefficients. If model is not provided as an input, the default,
          '1990' will be used.
          All possible model selections are: 

          * '1990'
          * 'allsitescomposite1990' (same as '1990')
          * 'allsitescomposite1988'
          * 'sandiacomposite1988'
          * 'usacomposite1988'
          * 'france1988'
          * 'phoenix1988'
          * 'elmonte1988'
          * 'osage1988'
          * 'albuquerque1988'
          * 'capecanaveral1988'
          * 'albany1988'

    Returns
    --------

    float or Series

          the diffuse component of the solar radiation  on an
          arbitrarily tilted surface defined by the Perez model as given in
          reference [3].
          SkyDiffuse is the diffuse component ONLY and does not include the ground
          reflected irradiance or the irradiance due to the beam.


    References
    ----------

    [1] Loutzenhiser P.G. et. al. "Empirical validation of models to compute
    solar irradiance on inclined surfaces for building energy simulation"
    2007, Solar Energy vol. 81. pp. 254-267

    [2] Perez, R., Seals, R., Ineichen, P., Stewart, R., Menicucci, D., 1987. A new
    simplified version of the Perez diffuse irradiance model for tilted
    surfaces. Solar Energy 39(3), 221-232.

    [3] Perez, R., Ineichen, P., Seals, R., Michalsky, J., Stewart, R., 1990.
    Modeling daylight availability and irradiance components from direct
    and global irradiance. Solar Energy 44 (5), 271-289. 

    [4] Perez, R. et. al 1988. "The Development and Verification of the
    Perez Diffuse Radiation Model". SAND88-7030

    See also
    --------
    pvl_ephemeris
    pvl_extraradiation
    pvl_isotropicsky
    pvl_haydavies1980
    pvl_reindl1990
    pvl_klucher1979
    pvl_kingdiffuse
    pvl_relativeairmass

    '''

    pvl_logger.debug('diffuse_sky.perez()')

    kappa = 1.041 #for sun_zen in radians
    z = np.radians(sun_zen) # convert to radians

    # epsilon is the sky's "clearness"
    eps = ( (DHI + DNI)/DHI + kappa*(z**3) ) / ( 1 + kappa*(z**3) )
    
    # Perez et al define clearness bins according to the following rules.
    # 1 = overcast ... 8 = clear 
    # (these names really only make sense for small zenith angles, but...)
    # these values will eventually be used as indicies for coeffecient look ups
    ebin = eps.copy()
    ebin[(eps<1.065)] = 1
    ebin[(eps>=1.065) & (eps<1.23)] = 2
    ebin[(eps>=1.23) & (eps<1.5)] = 3
    ebin[(eps>=1.5) & (eps<1.95)] = 4
    ebin[(eps>=1.95) & (eps<2.8)] = 5
    ebin[(eps>=2.8) & (eps<4.5)] = 6
    ebin[(eps>=4.5) & (eps<6.2)] = 7
    ebin[eps>=6.2] = 8

    ebin = ebin - 1 #correct for 0 indexing in coeffecient lookup

    # remove night time values
    ebin = ebin.dropna().astype(int)

    # This is added because in cases where the sun is below the horizon
    # (var.sun_zen > 90) but there is still diffuse horizontal light (var.DHI>0), it is
    # possible that the airmass (var.AM) could be NaN, which messes up later
    # calculations. Instead, if the sun is down, and there is still var.DHI, we set
    # the airmass to the airmass value on the horizon (approximately 37-38).
    #var.AM(var.sun_zen >=90 & var.DHI >0) = 37;

    #var.DNI_ET[var.DNI_ET==0] = .00000001 #very hacky, fix this
    
    # delta is the sky's "brightness"
    delta = DHI * AM / DNI_ET
    
    # keep only valid times
    delta = delta[ebin.index]
    z = z[ebin.index]

    # The various possible sets of Perez coefficients are contained
    # in a subfunction to clean up the code.
    F1c, F2c = _get_perez_coefficients(modelt)

    F1 = F1c[ebin,0] + F1c[ebin,1]*delta + F1c[ebin,2]*z
    F1[F1 < 0] = 0;
    F1 = F1.astype(float)

    F2 = F2c[ebin,0] + F2c[ebin,1]*delta + F2c[ebin,2]*z
    F2[F2 < 0] = 0
    F2 = F2.astype(float)

    A = aoi_projection(surf_tilt, surf_az, sun_zen, sun_az)
    A[A < 0] = 0

    B = pvl_tools.cosd(sun_zen);
    B[B < pvl_tools.cosd(85)] = pvl_tools.cosd(85)


    #Calculate Diffuse POA from sky dome
    
    term1 = 0.5 * (1 - F1) * (1 + pvl_tools.cosd(surf_tilt))
    term2 = F1 * A[ebin.index] / B[ebin.index]
    term3 = F2*pvl_tools.sind(surf_tilt)
    
    sky_diffuse = DHI[ebin.index] * (term1 + term2 + term3)
    sky_diffuse[sky_diffuse < 0] = 0

    return sky_diffuse
コード例 #3
0
def reindl(surf_tilt, surf_az, DHI, DNI, GHI, DNI_ET, sun_zen, sun_az):
    '''
    Determine diffuse irradiance from the sky on a 
    tilted surface using Reindl's 1990 model

    .. math::

       I_{d} = DHI (A R_b + (1 - A) (\frac{1 + \cos\beta}{2}) (1 + \sqrt{\frac{I_{hb}}{I_h}} \sin^3(\beta/2)) )

    Reindl's 1990 model determines the diffuse irradiance from the sky
    (ground reflected irradiance is not included in this algorithm) on a
    tilted surface using the surface tilt angle, surface azimuth angle,
    diffuse horizontal irradiance, direct normal irradiance, global
    horizontal irradiance, extraterrestrial irradiance, sun zenith angle,
    and sun azimuth angle.

    Parameters
    ----------

    surf_tilt : float or Series.
          Surface tilt angles in decimal degrees.
          The tilt angle is defined as
          degrees from horizontal (e.g. surface facing up = 0, surface facing
          horizon = 90)

    surf_az : float or Series.
          Surface azimuth angles in decimal degrees.
          The Azimuth convention is defined
          as degrees east of north (e.g. North = 0, South=180 East = 90, West = 270).

    DHI : float or Series.
          diffuse horizontal irradiance in W/m^2. 

    DNI : float or Series.
          direct normal irradiance in W/m^2. 

    GHI: float or Series.
          Global irradiance in W/m^2. 

    DNI_ET : float or Series.
          extraterrestrial normal irradiance in W/m^2. 

    sun_zen : float or Series.
          apparent (refraction-corrected) zenith
          angles in decimal degrees. 

    sun_az : float or Series.
          Sun azimuth angles in decimal degrees. 
          The Azimuth convention is defined
          as degrees east of north (e.g. North = 0, East = 90, West = 270).

    Returns
    -------

    SkyDiffuse : float or Series.

           the diffuse component of the solar radiation  on an
           arbitrarily tilted surface defined by the Reindl model as given in
           Loutzenhiser et. al (2007) equation 8.
           SkyDiffuse is the diffuse component ONLY and does not include the ground
           reflected irradiance or the irradiance due to the beam.
           SkyDiffuse is a column vector vector with a number of elements equal to
           the input vector(s).


    Notes
    -----

     The POAskydiffuse calculation is generated from the Loutzenhiser et al.
     (2007) paper, equation 8. Note that I have removed the beam and ground
     reflectance portion of the equation and this generates ONLY the diffuse
     radiation from the sky and circumsolar, so the form of the equation
     varies slightly from equation 8.

    References
    ----------

    [1] Loutzenhiser P.G. et. al. "Empirical validation of models to compute
    solar irradiance on inclined surfaces for building energy simulation"
    2007, Solar Energy vol. 81. pp. 254-267

    [2] Reindl, D.T., Beckmann, W.A., Duffie, J.A., 1990a. Diffuse fraction
    correlations. Solar Energy 45(1), 1-7.

    [3] Reindl, D.T., Beckmann, W.A., Duffie, J.A., 1990b. Evaluation of hourly
    tilted surface radiation models. Solar Energy 45(1), 9-17.

    See Also 
    ---------
    pvl_ephemeris   
    pvl_extraradiation   
    pvl_isotropicsky
    pvl_haydavies1980   
    pvl_perez 
    pvl_klucher1979   
    pvl_kingdiffuse

    '''          
    
    pvl_logger.debug('diffuse_sky.reindl()')
    
    cos_tt = aoi_projection(surf_tilt, surf_az, sun_zen, sun_az)
    
    cos_sun_zen = pvl_tools.cosd(sun_zen)
    
    # ratio of titled and horizontal beam irradiance
    Rb = cos_tt / cos_sun_zen
    
    # Anisotropy Index
    AI = DNI / DNI_ET
    
    # DNI projected onto horizontal
    HB = DNI * cos_sun_zen   
    HB[HB < 0] = 0

    # these are actually the () and [] sub-terms of the second term of eqn 8
    term1 = 1 - AI
    term2 = 0.5 * (1 + pvl_tools.cosd(surf_tilt))
    term3 = 1 + np.sqrt(HB / GHI) * (pvl_tools.sind(0.5*surf_tilt) ** 3)

    sky_diffuse = DHI * ( AI*Rb + term1 * term2 * term3 )
    sky_diffuse[sky_diffuse < 0] = 0
    
    return sky_diffuse
コード例 #4
0
def klucher(surf_tilt, surf_az, DHI, GHI, sun_zen, sun_az):
    '''
    Determine diffuse irradiance from the sky on a tilted surface 
    using Klucher's 1979 model

    .. math::

       I_{d} = DHI \frac{1 + \cos\beta}{2} (1 + F' \sin^3(\beta/2)) (1 + F' \cos^2\theta\sin^3\theta_z)
   
    where

    .. math::
   
       F' = 1 - (I_{d0} / GHI)

    Klucher's 1979 model determines the diffuse irradiance from the sky
    (ground reflected irradiance is not included in this algorithm) on a
    tilted surface using the surface tilt angle, surface azimuth angle,
    diffuse horizontal irradiance, direct normal irradiance, global
    horizontal irradiance, extraterrestrial irradiance, sun zenith angle,
    and sun azimuth angle.

    Parameters
    ----------

    surf_tilt : float or Series
            Surface tilt angles in decimal degrees.
            surf_tilt must be >=0 and <=180. The tilt angle is defined as
            degrees from horizontal (e.g. surface facing up = 0, surface facing
            horizon = 90)

    surf_az : float or Series
            Surface azimuth angles in decimal degrees.
            surf_az must be >=0 and <=360. The Azimuth convention is defined
            as degrees east of north (e.g. North = 0, South=180 East = 90, West = 270).

    DHI : float or Series
            diffuse horizontal irradiance in W/m^2. 
            DHI must be >=0.

    GHI : float or Series
            Global  irradiance in W/m^2. 
            DNI must be >=0.

    sun_zen : float or Series
            apparent (refraction-corrected) zenith
            angles in decimal degrees. 
            sun_zen must be >=0 and <=180.

    sun_az : float or Series
            Sun azimuth angles in decimal degrees.
            sun_az must be >=0 and <=360. The Azimuth convention is defined
            as degrees east of north (e.g. North = 0, East = 90, West = 270).

    Returns
    -------
    float or Series

                the diffuse component of the solar radiation on an
                arbitrarily tilted surface defined by the Klucher model as given in
                Loutzenhiser et. al (2007) equation 4.
                SkyDiffuse is the diffuse component ONLY and does not include the ground
                reflected irradiance or the irradiance due to the beam.
                SkyDiffuse is a column vector vector with a number of elements equal to
                the input vector(s).

    References
    ----------
    [1] Loutzenhiser P.G. et. al. "Empirical validation of models to compute
    solar irradiance on inclined surfaces for building energy simulation"
    2007, Solar Energy vol. 81. pp. 254-267

    [2] Klucher, T.M., 1979. Evaluation of models to predict insolation on tilted
    surfaces. Solar Energy 23 (2), 111-114.

    See also
    --------
    pvl_ephemeris   
    pvl_extraradiation   
    pvl_isotropicsky
    pvl_haydavies1980   
    pvl_perez 
    pvl_reindl1990  
    pvl_kingdiffuse

    '''

    pvl_logger.debug('diffuse_sky.klucher()')

    # zenith angle with respect to panel normal.
    cos_tt = aoi_projection(surf_tilt, surf_az, sun_zen, sun_az)
    
    F = 1 - ((DHI / GHI) ** 2)
    try:
        # fails with single point input
        F.fillna(0, inplace=True)
    except AttributeError:
        F = 0

    term1 = 0.5 * (1 + pvl_tools.cosd(surf_tilt))
    term2 = 1 + F * (pvl_tools.sind(0.5*surf_tilt) ** 3)
    term3 = 1 + F * (cos_tt ** 2) * (pvl_tools.sind(sun_zen) ** 3)

    sky_diffuse = DHI * term1 * term2 * term3

    return sky_diffuse
コード例 #5
0
ファイル: pvsystem.py プロジェクト: alorenzo175/PVLIB_Python
def physicaliam(K,L,n,theta):

    '''
    Determine the incidence angle modifier using refractive 
    index, glazing thickness, and extinction coefficient

    pvl_physicaliam calculates the incidence angle modifier as described in
    De Soto et al. "Improvement and validation of a model for photovoltaic
    array performance", section 3. The calculation is based upon a physical
    model of absorbtion and transmission through a cover. Required
    information includes, incident angle, cover extinction coefficient,
    cover thickness

    Note: The authors of this function believe that eqn. 14 in [1] is
    incorrect. This function uses the following equation in its place:
    theta_r = arcsin(1/n * sin(theta))

    Parameters
    ----------

    K : float

            The glazing extinction coefficient in units of 1/meters. Reference
            [1] indicates that a value of  4 is reasonable for "water white"
            glass. K must be a numeric scalar or vector with all values >=0. If K
            is a vector, it must be the same size as all other input vectors.

    L : float

            The glazing thickness in units of meters. Reference [1] indicates
            that 0.002 meters (2 mm) is reasonable for most glass-covered
            PV panels. L must be a numeric scalar or vector with all values >=0. 
            If L is a vector, it must be the same size as all other input vectors.

    n : float

            The effective index of refraction (unitless). Reference [1]
            indicates that a value of 1.526 is acceptable for glass. n must be a 
            numeric scalar or vector with all values >=0. If n is a vector, it 
            must be the same size as all other input vectors.

    theta :float

            The angle of incidence between the module normal vector and the
            sun-beam vector in degrees. Theta must be a numeric scalar or vector.
            For any values of theta where abs(theta)>90, IAM is set to 0. For any
            values of theta where -90 < theta < 0, theta is set to abs(theta) and
            evaluated. A warning will be generated if any(theta<0 or theta>90).

    Returns
    -------

    IAM : float

       The incident angle modifier as specified in eqns. 14-16 of [1].
         IAM is a column vector with the same number of elements as the
         largest input vector.

    References
    ----------

    [1] W. De Soto et al., "Improvement and validation of a model for
     photovoltaic array performance", Solar Energy, vol 80, pp. 78-88,
     2006.

    [2] Duffie, John A. & Beckman, William A.. (2006). Solar Engineering 
     of Thermal Processes, third edition. [Books24x7 version] Available 
     from http://common.books24x7.com/toc.aspx?bookid=17160. 

    See Also 
    --------
          
    pvl_getaoi   
    pvl_ephemeris   
    pvl_spa    
    pvl_ashraeiam

    '''
    Vars=locals()

    Expect={'K':'x >= 0',
            'L':'x >= 0',
            'n':'x >= 0',
            'theta':'num'}
    var=pvl_tools.Parse(Vars,Expect)



    if any((var.theta < 0) | (var.theta >= 90)):
        print('Input incident angles <0 or >=90 detected For input angles with absolute value greater than 90, the ' + 'modifier is set to 0. For input angles between -90 and 0, the ' + 'angle is changed to its absolute value and evaluated.')
        var.theta[(var.theta < 0) | (var.theta >= 90)]=abs((var.theta < 0) | (var.theta >= 90))

    thetar_deg=pvl_tools.asind(1.0 / n*(pvl_tools.sind(theta)))

    tau=np.exp(- 1.0 * (K*(L) / pvl_tools.cosd(thetar_deg)))*((1 - 0.5*((((pvl_tools.sind(thetar_deg - theta)) ** 2) / ((pvl_tools.sind(thetar_deg + theta)) ** 2) + ((pvl_tools.tand(thetar_deg - theta)) ** 2) / ((pvl_tools.tand(thetar_deg + theta)) ** 2)))))
    
    zeroang=1e-06
    
    thetar_deg0=pvl_tools.asind(1.0 / n*(pvl_tools.sind(zeroang)))
    
    tau0=np.exp(- 1.0 * (K*(L) / pvl_tools.cosd(thetar_deg0)))*((1 - 0.5*((((pvl_tools.sind(thetar_deg0 - zeroang)) ** 2) / ((pvl_tools.sind(thetar_deg0 + zeroang)) ** 2) + ((pvl_tools.tand(thetar_deg0 - zeroang)) ** 2) / ((pvl_tools.tand(thetar_deg0 + zeroang)) ** 2)))))
    
    IAM=tau / tau0
    
    IAM[theta == 0]=1
    
    IAM[abs(theta) > 90 | (IAM < 0)]=0
    
    return IAM