Skip to content

aaghamohammadi/pysolorie

Repository files navigation

pysolorie

Quality Checks Publish CodeQL GitHub License PyPI - Downloads Documentation Status PyPI - Version PyPI - Format PyPI - Status codecov pre-commit code style: black DOI

SonarCloud

pysolorie stands for Python Solar Orientation Analysis of Solar Panel. It is a Python library designed to help you analyze the orientation of solar panels.

How can one maximize the solar irradiation energy received by a solar panel?

Features

pysolorie is a library designed to help you find this optimal orientation. Its features include, but are not limited to:

  • Finding the optimal tilt angle for a fixed solar panel, assuming a clear-sky condition.
  • Plotting the optimal tilt angle over a range of days.
  • Plotting the daily direct irradiation energy over a range of days.
  • Generating a CSV, JSON, or XML report detailing the optimal tilt angle over a range of days.
  • Calculating the sunrise and sunset hour angles for a specific day.
  • Utilizing Hottel's model to quantify clear-sky conditions and estimate the atmospheric transmission of clear-sky beam radiation.
  • Calculating the solar zenith angle.
  • Calculating the solar time.
  • Calculating solar declination and hour angle.

How to Install pysolorie

pysolorie requires Python 3.9 or higher.

The easiest way to install pysolorie is from PyPI.

python3 -m pip install pysolorie

Example Usage

With the pysolorie package, you can plot the optimal orientation of a solar panel given the climate type, altitude, and latitude of the location. For instance, the following code plots the optimal orientation for each day of the year for the city of Tehran. For more examples, please refer to the Getting started section of our documentation. The full API Reference is also available on our website.

from pathlib import Path
from pysolorie import IrradiationCalculator, Plotter

# Instantiate a Plotter object from the pysolorie library
plotter = Plotter()

# Instantiate an IrradiationCalculator object for the city of Tehran
irradiation_calculator = IrradiationCalculator(
    climate_type="MIDLATITUDE SUMMER",
    observer_altitude=1200,
    observer_latitude=35.6892
)


# Use the plotter to plot the optimal orientation of a solar panel for each day of the year
plotter.plot_optimal_orientation(
    irradiation_calculator,
    from_day=1,
    to_day=365,
    path=Path("results.svg"),
    plot_kwargs={
        "xlabel": "Day",
        "ylabel": "Beta (degrees)",
        "title": "Optimal Solar Panel Orientation",
    },
    savefig_kwargs={"dpi": 300},
)

This figure, generated by the example code, illustrates the optimal orientation of a solar panel for each day of the year in Tehran. The x-axis represents the day of the year, while the y-axis represents the optimal angle (Beta) in degrees. As can be seen, the optimal angle varies throughout the year, highlighting the importance of adjusting the orientation of the solar panel to maximize the energy received.

Documentation

You can find the complete documentation for pysolorie at our Read the Docs page.

Contributing

We welcome contributions to pysolorie! If you're interested in contributing, please take a look at our contribution guidelines for detailed information on how you can help.

Thank you for considering contributing to pysolorie!