Skip to main content

SolarEnergy

PyPI PyPI - Downloads Documentation Status PyPI - License

A Python module to do simple modelling in the field of solar energy. The code is being developped by Marc van der Sluys of the department of astrophysics of the Radboud University Nijmegen, the Netherlands and the department of Sustainable energy of the HAN University of Applied Sciences in Arnhem, the Netherlands.

Installation

This package can be installed using pip install solarenergy. This should automatically install the dependency packages pytz, numpy and soltrack if they haven't been installed already. If you are installing by hand, ensure that these packages are installed as well.

Example use

import solarenergy as se
import numpy as np

# Location of my solar panels:
geoLon =  5*se.d2r  # Geographic longitude (>0 for eastern hemisphere; ° -> rad)
geoLat = 52*se.d2r  # Geographic latitude  (>0 for northern hemisphere; ° -> rad)

# Orientation of my solar panels:
spAz   = -2*se.d2r  # Azimuth ('wind direction') of my panels are facing.  Note: South=0, W=90° (pi/2 rad) in the northern hemisphere!  (rad)
spIncl = 28*se.d2r  # Inclination of my panels w.r.t. the horizontal  (rad)

# An hour past noon local time on 1 March 2020:
myTZ  = 'Europe/Amsterdam'
year  = 2020
month = 3
day   = 1
hour  = 13

# Compute Sun position (uses SolTrack behind the scenes):
sunAz,sunAlt,sunDist = se.computeSunPos(geoLon,geoLat, year,month,day, hour, timezone=myTZ)

AM        = se.airmass(sunAlt)                               # Air mass for this Sun altitude
extFac    = se.extinctionFactor(AM)                          # Extinction factor at sea level for this airmass
cosTheta  = se.cosAngleSunPanels(spAz,spIncl, sunAz,sunAlt)  # cos of the angle with which Sun hits my panels
theta     = np.arccos(cosTheta)                              # Angle with which Sun hits my panels

Iext      = se.solConst / sunDist**2                         # Extraterrestrial radiation = Solar constant, scaled with distance
DNIcs     = Iext / extFac                                    # DNI for a clear sky
dirRad    = DNIcs * cosTheta                                 # Insolation of direct sunlight on my panels


# Print input and output:
print("Location:                    %0.3lf E, %0.3lf N"  % (geoLon*se.r2d, geoLat*se.r2d))
print("Date:                        %4d-%2.2d-%2.2d"     % (year, month, day))
print("Time:                        %2d:00"              % (hour))
print()

print("Sun azimuth:                 %7.3lf°"             % (sunAz*se.r2d))
print("Sun altitude:                %7.3lf°"             % (sunAlt*se.r2d))
print("Sun distance:                %7.4lf AU"           % (sunDist))
print()

print("Air mass:                    %7.3lf"              % (AM))
print("Extinction factor:           %7.3lf"              % (extFac))
print("Sun-panels angle:            %7.1lf°"             % (theta*se.r2d))
print()

print("Solar constant:              %7.1lf W/m²"         % (se.solConst))
print("Extraterrestrial radiation:  %7.1lf W/m²"         % (Iext))
print("DNI (clear sky):             %7.1lf W/m²"         % (DNIcs))
print("Direct insolation:           %7.1lf W/m²"         % (dirRad))
print()

SolarEnergy pages

  • Pypi: SolarEnergy Python package
  • GitHub: SolarEnergy source code
  • ReadTheDocs: SolarEnergy documentation

Author and licence

References

Release files for solarenergy 0.0.18

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for solarenergy 0.0.18
File Size Uploaded
solarenergy-0.0.18.tar.gz 27.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for solarenergy 0.0.18
File Interpreter ABI Platform
solarenergy-0.0.18-py3-none-any.whl Python 3 none any Details

Total release size: 54.2 kB

Release files / solarenergy-0.0.18.tar.gz

Download URL solarenergy-0.0.18.tar.gz
Size 27.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9ae0191661ee4ba295de15bb008255df55cc2590bc5bc75840d34cb1405ef728
BLAKE2b-256 checksum
How to use checksums
f9a76009b12d50e76edf7cc5285dc418bbf433c0ce099acb8adcbda0d6fcdea2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.10

Release files / solarenergy-0.0.18-py3-none-any.whl

Download URL solarenergy-0.0.18-py3-none-any.whl
Size 27.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
098854e5a0345df0078b0ae9eb3376ff5d7231850513ce41c41eb50ab7c77b13
BLAKE2b-256 checksum
How to use checksums
f395133776990496084b593e9600e086e4cb3f909771d774af1119f84d887875
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/54.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.7.10
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page