aerosandbox.library.power_solar#

Module Contents#

Functions#

_prepare_for_inverse_trig(x)

Ensures that a value is within the open interval (-1, 1), so that if you call an inverse trig function

solar_flux_outside_atmosphere_normal(day_of_year)

Computes the normal solar flux at the top of the atmosphere ("Airmass 0").

declination_angle(day_of_year)

Computes the solar declination angle, in degrees, as a function of day of year.

solar_elevation_angle(latitude, day_of_year, time)

Elevation angle of the sun [degrees] for a local observer.

solar_azimuth_angle(latitude, day_of_year, time)

Azimuth angle of the sun [degrees] for a local observer.

airmass(solar_elevation_angle[, altitude, method])

Computes the (relative) airmass as a function of the (true) solar elevation angle and observer altitude.

solar_flux(latitude, day_of_year, time[, altitude, ...])

Computes the solar power flux (power per unit area) on a flat (possibly tilted) panel. Accounts for atmospheric

peak_sun_hours_per_day_on_horizontal(latitude, day_of_year)

How many hours of equivalent peak sun do you get per day?

length_day(latitude, day_of_year)

Gives the duration where the sun is above the horizon on a given day.

mass_MPPT(power)

Gives the estimated mass of a Maximum Power Point Tracking (MPPT) unit for solar energy

Attributes#

aerosandbox.library.power_solar._prepare_for_inverse_trig(x)[source]#

Ensures that a value is within the open interval (-1, 1), so that if you call an inverse trig function on it (e.g., arcsin, arccos), you won’t get an infinity or NaN.

Parameters:

x (Union[float, aerosandbox.numpy.ndarray]) – A floating-point number or an array of such. If an array, this function acts elementwise.

Return type:

Union[float, aerosandbox.numpy.ndarray]

Returns: A clipped version of the number, constrained to be in the open interval (-1, 1).

aerosandbox.library.power_solar.solar_flux_outside_atmosphere_normal(day_of_year)[source]#

Computes the normal solar flux at the top of the atmosphere (“Airmass 0”). This varies due to Earth’s orbital eccentricity (elliptical orbit).

Source: https://www.itacanet.org/the-sun-as-a-source-of-energy/part-2-solar-energy-reaching-the-earths-surface/#2.1.-The-Solar-Constant

Parameters:

day_of_year (Union[int, float, aerosandbox.numpy.ndarray]) – Julian day (1 == Jan. 1, 365 == Dec. 31)

Return type:

Union[float, aerosandbox.numpy.ndarray]

Returns: The normal solar flux [W/m^2] at the top of the atmosphere.

aerosandbox.library.power_solar.declination_angle(day_of_year)[source]#

Computes the solar declination angle, in degrees, as a function of day of year.

Accounts for the Earth’s obliquity.

Source: https://www.pveducation.org/pvcdrom/properties-of-sunlight/declination-angle

Parameters:

day_of_year (Union[int, float, aerosandbox.numpy.ndarray]) – Julian day (1 == Jan. 1, 365 == Dec. 31)

Return type:

Union[float, aerosandbox.numpy.ndarray]

Returns: Solar declination angle [deg]

aerosandbox.library.power_solar.solar_elevation_angle(latitude, day_of_year, time)[source]#

Elevation angle of the sun [degrees] for a local observer.

Solar elevation angle is the angle between the Sun’s position and the local horizon plane. (Solar elevation angle) = 90 deg - (solar zenith angle)

Source: https://www.pveducation.org/pvcdrom/properties-of-sunlight/elevation-angle

Parameters:
  • latitude (Union[float, aerosandbox.numpy.ndarray]) – Local geographic latitude [degrees]. Positive for north, negative for south.

  • day_of_year (Union[int, float, aerosandbox.numpy.ndarray]) – Julian day (1 == Jan. 1, 365 == Dec. 31)

  • time (Union[float, aerosandbox.numpy.ndarray]) – Time after local solar noon [seconds]

Return type:

Union[float, aerosandbox.numpy.ndarray]

Returns: Solar elevation angle [degrees] (angle between horizon and sun). Returns negative values if the sun is below the horizon.

aerosandbox.library.power_solar.solar_azimuth_angle(latitude, day_of_year, time)[source]#

Azimuth angle of the sun [degrees] for a local observer.

Source: https://www.pveducation.org/pvcdrom/properties-of-sunlight/azimuth-angle

Parameters:
  • latitude (Union[float, aerosandbox.numpy.ndarray]) – Local geographic latitude [degrees]. Positive for north, negative for south.

  • day_of_year (Union[int, float, aerosandbox.numpy.ndarray]) – Julian day (1 == Jan. 1, 365 == Dec. 31)

  • time (Union[float, aerosandbox.numpy.ndarray]) – Time after local solar noon [seconds]

Return type:

Union[float, aerosandbox.numpy.ndarray]

Returns: Solar azimuth angle [degrees] (the compass direction from which the sunlight is coming).
  • 0 corresponds to North, 90 corresponds to East.

  • Output ranges from 0 to 360 degrees.

aerosandbox.library.power_solar.airmass(solar_elevation_angle, altitude=0.0, method='Young')[source]#

Computes the (relative) airmass as a function of the (true) solar elevation angle and observer altitude. Includes refractive (e.g. curving) effects due to atmospheric density gradient.

Airmass is the line integral of air density along an upwards-pointed ray, extended to infinity. As a raw calculation of “absolute airmass”, this would have units of kg/m^2. It varies primarily as a function of solar elevation angle and observer altitude. (Higher altitude means less optical absorption.) However, “airmass” usually refers to the “relative airmass”, which is the absolute airmass of a given scenario divided by the absolute airmass of a reference scenario. This reference scenario is when the sun is directly overhead (solar elevation angle of 90 degrees) and the observer is at sea level.

Therefore:

  • Outer space has a (relative) airmass of 0 (regardless of solar elevation angle).

  • Sea level with the sun directly overhead has a (relative) airmass of 1.

  • Sea level with the sun at the horizon has a (relative) airmass of ~31.7. (Not infinity, since the Earth is

spherical, so the ray eventually reaches outer space.) Some models will say that this relative airmass at the horizon should be ~38; that is only true if one uses the apparent solar elevation angle, rather than the true (geometric) one. The discrepancy comes from the fact that light refracts (curves) as it passes through the atmosphere’s density gradient, with the difference between true and apparent elevation angles reaching a maximum of 0.56 degrees at the horizon.

Solar elevation angle is the angle between the Sun’s position and the horizon. (Solar elevation angle) = 90 deg - (solar zenith angle)

Note that for small negative values of the solar elevation angle (e.g., -0.5 degree), airmass remains finite, due to ray refraction (curving) through the atmosphere.

For significantly negative values of the solar elevation angle (e.g., -10 degrees), the airmass is theoretically infinite. This function returns 1e100 in lieu of this here.

Sources:

Young model: Young, A. T. 1994. Air mass and refraction. Applied Optics. 33:1108–1110. doi: 10.1364/AO.33.001108. Reproduced at https://en.wikipedia.org/wiki/Air_mass_(astronomy)

Parameters:
  • solar_elevation_angle (Union[float, aerosandbox.numpy.ndarray]) – Solar elevation angle [degrees] (angle between horizon and sun). Note that we use the

  • angle (true solar elevation) –

  • light (rather than the apparent one. The discrepancy comes from the fact that) –

  • refracts (curves) –

  • horizon. (and apparent elevation angles reaching a maximum of 0.56 degrees at the) –

  • altitude (Union[float, aerosandbox.numpy.ndarray]) – Altitude of the observer [meters] above sea level.

  • method – A string that determines which model to use.

Return type:

Union[float, aerosandbox.numpy.ndarray]

Returns: The relative airmass [unitless] as a function of the (true) solar elevation angle and observer altitude.

  • Always ranges from 0 to Infinity

aerosandbox.library.power_solar.solar_flux(latitude, day_of_year, time, altitude=0.0, panel_azimuth_angle=0.0, panel_tilt_angle=0.0, air_quality='typical', albedo=0.2, **deprecated_kwargs)[source]#

Computes the solar power flux (power per unit area) on a flat (possibly tilted) panel. Accounts for atmospheric absorption, scattering, and re-scattering (e.g. diffuse illumination), all as a function of panel altitude.

Fully vectorizable.

Source for atmospheric absorption:

  • Planning and installing photovoltaic systems: a guide for installers, architects and engineers,

2nd Ed. (2008), Table 1.1, Earthscan with the International Institute for Environment and Development, Deutsche Gesellschaft für Sonnenenergie. ISBN 1-84407-442-0., accessed via https://en.wikipedia.org/wiki/Air_mass_(solar_energy)

Parameters:
  • latitude (Union[float, aerosandbox.numpy.ndarray]) – Local geographic latitude [degrees]. Positive for north, negative for south.

  • day_of_year (Union[int, float, aerosandbox.numpy.ndarray]) – The day of the year, represented in the Julian day format (i.e., 1 == Jan. 1, 365 == Dec. 31). This accounts for seasonal variations in the sun’s position in the sky.

  • time (Union[float, aerosandbox.numpy.ndarray]) – The time of day, measured as the time elapsed after local solar noon [seconds]. Should range from 0 to 86,400 (the number of seconds in a day). Local solar noon is the time of day when the sun is at its highest point in the sky, directly above the observer’s local meridian. This is the time when the sun’s rays are most directly overhead and solar flux is at its peak for a given location. Solar noon does not necessarily occur at exactly 12:00 PM local standard time, as it depends on your longitude, the equation of time, and the time of year. (Also, don’t forget to account for Daylight Savings Time, if that’s a relevant consideration for your location and season.) Typically, local solar noon is +- 15 minutes from 12:00 PM local standard time.

  • altitude (Union[float, aerosandbox.numpy.ndarray]) – Altitude of the panel above sea level [meters]. This affects atmospheric absorption and scattering characteristics.

  • panel_azimuth_angle (Union[float, aerosandbox.numpy.ndarray]) –

    The azimuth angle of the panel normal [degrees] (the compass direction in which the panel normal is tilted). Irrelevant if the panel tilt angle is 0 (e.g., the panel is horizontal).

    • 0 corresponds to North, 90 corresponds to East.

    • Input ranges from 0 to 360 degrees.

  • panel_tilt_angle (Union[float, aerosandbox.numpy.ndarray]) –

    The angle between the panel normal and vertical (zenith) [degrees].

    • Note: this angle convention is different than the solar elevation angle convention!

    • A horizontal panel has a tilt angle of 0, and a vertical panel has a tilt angle of 90 degrees.

    If the angle between the panel normal and the sun direction is ever more than 90 degrees (e.g. the panel is pointed the wrong way), we assume that the panel receives no direct irradiation. (However, it may still receive minor amounts of power due to diffuse irradiation from re-scattering.)

  • air_quality (str) –

    Indicates the amount of pollution in the air. A string, one of:

    • ’clean’: Pristine atmosphere conditions.

    • ’typical’: Corresponds to “rural aerosol loading” following ASTM G-173.

    • ’polluted’: Urban atmosphere conditions.

    Note: in very weird edge cases, a polluted atmosphere can actually result in slightly higher solar flux than clean air, due to increased back-scattering. For example, imagine it’s near sunset, with the sun in the west, and your panel normal vector points east. Increased pollution can, in some edge cases, result in enough increased back-scattering (multipathing) that you have a smidge more illumination.

  • albedo (Union[float, aerosandbox.numpy.ndarray]) –

    The fraction of light that hits the ground that is reflected. Affects illumination from re-scattering when panels are tilted. Typical values for general terrestrial surfaces are 0.2, which is the default here.

    • Other values, taken from the Earthscan source (citation above):

      • Grass (July, August): 0.25

      • Lawn: 0.18 - 0.23

      • Dry grass: 0.28 - 0.32

      • Milled fields: 0.26

      • Barren soil: 0.17

      • Gravel: 0.18

      • Clean concrete: 0.30

      • Eroded concrete: 0.20

      • Clean cement: 0.55

      • Asphalt: 0.15

      • Forests: 0.05 - 0.18

      • Sandy areas: 0.10 - 0.25

      • Water: Strongly dependent on incidence angle; 0.05 - 0.22

      • Fresh snow: 0.80 - 0.90

      • Old snow: 0.45 - 0.70

Return type:

Union[float, aerosandbox.numpy.ndarray]

Returns: The solar power flux [W/m^2] on the panel.

  • Note: does not account for any potential reflectivity of the solar panel’s coating itself.

aerosandbox.library.power_solar.peak_sun_hours_per_day_on_horizontal(latitude, day_of_year)[source]#

How many hours of equivalent peak sun do you get per day? :param latitude: Latitude [degrees] :param day_of_year: Julian day (1 == Jan. 1, 365 == Dec. 31) :param time: Time since (local) solar noon [seconds] :return:

Parameters:
  • latitude (Union[float, aerosandbox.numpy.ndarray]) –

  • day_of_year (Union[int, float, aerosandbox.numpy.ndarray]) –

Return type:

Union[float, aerosandbox.numpy.ndarray]

aerosandbox.library.power_solar.length_day(latitude, day_of_year)[source]#

Gives the duration where the sun is above the horizon on a given day.

Parameters:
  • latitude (Union[float, aerosandbox.numpy.ndarray]) – Local geographic latitude [degrees]. Positive for north, negative for south.

  • day_of_year (Union[int, float, aerosandbox.numpy.ndarray]) – Julian day (1 == Jan. 1, 365 == Dec. 31)

Return type:

Union[float, aerosandbox.numpy.ndarray]

Returns: The duration where the sun is above the horizon on a given day. [seconds]

aerosandbox.library.power_solar.mass_MPPT(power)[source]#

Gives the estimated mass of a Maximum Power Point Tracking (MPPT) unit for solar energy collection. Based on regressions at AeroSandbox/studies/SolarMPPTMasses.

Parameters:

power (Union[float, aerosandbox.numpy.ndarray]) – Power of MPPT [watts]

Returns:

Estimated MPPT mass [kg]

Return type:

Union[float, aerosandbox.numpy.ndarray]

aerosandbox.library.power_solar.base_color[source]#