Core¶
Solar utilities based on SOLPOS and SPECTRL2 from NREL RREDC Solar Resource Models and Tools
2013, 2019 SunPower Corp.
Libraries¶
Solar Utils depends on two libraries that must be compiled in the same folder as
core.py
. The library extension depends on the system platform. Windows uses
dynamically linked libraries, .dll
, Linux uses shared objects, .so
and
Mac OS X (aka Darwin) uses dynamic libraries, .dylib
. Also both Linux and
Darwin libraries have lib
prefixed to the library name.
solposAM¶
A library compiled from
NREL’s SOLPOS 2.0
that exports functions called by solposAM()
.
-
solar_utils.core.
SOLPOSAMDLL
¶
spectrl2¶
A library compiled from
NREL’s SPECTRL2 V.2
that imports SOLPOSAMDLL
and exports functions called by
spectrl2()
.
-
solar_utils.core.
SPECTRL2DLL
¶
get_solpos8760¶
-
solar_utils.core.
get_solpos8760
(location, year, weather)[source]¶ Get SOLPOS hourly calculation for specified non-leap year.
- Parameters
- Returns
angles [degrees], airmass [atm]
- Return type
- Raises
Example:
>>> location = [35.56836, -119.2022, -8.0] >>> weather = [1015.62055, 40.0] >>> angles, airmass = get_solpos8760(location, 2013, weather)
get_solposAM¶
-
solar_utils.core.
get_solposAM
(location, datetimes, weather)[source]¶ Get SOLPOS hourly calculation for sequence of datetimes.
- Parameters
- Returns
angles [degrees], airmass [atm]
- Return type
- Raises
Example:
>>> location = [35.56836, -119.2022, -8.0] >>> datetimes = [ ... (datetime.datetime(2013, 1, 1, 0, 0, 0) ... + datetime.timedelta(hours=h)).timetuple()[:6] ... for h in range(1000)] >>> weather = [1015.62055, 40.0] >>> angles, airmass = get_solposAM(location, datetimes, weather)
solposAM¶
-
solar_utils.core.
solposAM
(location, datetime, weather)[source]¶ Calculate solar position and air mass by calling functions exported by
SOLPOSAMDLL
.- Parameters
- Returns
angles [degrees], airmass [atm]
- Return type
- Raises
Returns the solar zenith and azimuth angles in degrees, as well as the relative and absolute (or pressure corrected) air mass.
Examples:
>>> location = [35.56836, -119.2022, -8.0] >>> datetime = [2013, 6, 5, 12, 31, 0] >>> weather = [1015.62055, 40.0] >>> (angles, airmass) = solposAM(location, datetime, weather) >>> list(angles) [15.074043273925781, 213.29042053222656] >>> list(airmass) [1.0352272987365723, 1.0379053354263306]
spectrl2¶
-
solar_utils.core.
spectrl2
(units, location, datetime, weather, orientation, atmospheric_conditions, albedo)[source]¶ Calculate solar spectrum by calling functions exported by
SPECTRL2DLL
.- Parameters
units (int) – set
units
= 1 for W/m2/micronlocation (float) – latitude, longitude and UTC-timezone
datetime (int) – year, month, day, hour, minute and second
weather (float) – ambient-pressure [mB] and ambient-temperature [C]
orientation (float) – tilt and aspect [degrees]
atmospheric_conditions (float) – alpha, assym, ozone, tau500 and watvap
albedo (float) – 6 wavelengths and 6 reflectivities
- Returns
spectral decomposition, x-coordinate
- Return type
- Raises
Returns the diffuse, direct, extraterrestrial and global spectral components on the tilted surface in as a function of x-coordinate specified by units.
units
output units
1
irradiance (W/sq m/micron) per wavelength (microns)
2
photon flux (10.0E+16 /sq cm/s/micron) per wavelength (microns)
3
photon flux density (10.0E+16 /sq cm/s/eV) per energy (eV)
See NREL SPECTRL2 Documentation for more detail.
See also
Examples:
>>> units = 1 >>> location = [33.65, -84.43, -5.0] >>> datetime = [1999, 7, 22, 9, 45, 37] >>> weather = [1006.0, 27.0] >>> orientation = [33.65, 135.0] >>> atmospheric_conditions = [1.14, 0.65, -1.0, 0.2, 1.36] >>> albedo = [0.3, 0.7, 0.8, 1.3, 2.5, 4.0] + ([0.2] * 6) >>> (specdif, specdir, specetr, specglo, specx) = spectrl2(units, location, datetime, weather, orientation, atmospheric_conditions, albedo)