Solar energy calculation primer
‘solprimer’, or ‘Python Solar Energy Calculation Primer’, is Python package for the most important calculations and simulations related to the use of solar energy, in particular for photovoltaic applications. The scripts include solutions to calculate the solar position and draw its orbit as seen from any location on earth, to calculate the energy yield on solar panels, also in consideration of meteorological factors, the presentation of climate data on psychrometric diagrams, the simulation of solar power systems, and several others. Much attention is dedicated to the use of ‘Typical Meteorological Year’ (TMY) data, which is available for thousands locations on earth.
The purpose of the code and of the accompanying documentation is mainly didactic, to illustrate theoretical, “textbook” procedures with actual code and application examples. The most important calculations in solar energy applications are presented in the code, with the theory kept at a necessary minimum. Some more in-depth explanations are given to those aspects, such as the use of the TMY datasets, which are not yet adequately covered by established textbooks.
The program modules have been developed in Python 3.5 on the Ubuntu operating system, LibreOffice Calc was used as spreadsheet. The code is built on self-contained modules that give predictable results on any given set of input parameters. For each module are indicated the input/output parameters, while the internal algorithms are briefly described in the accompanying primer and more at length with comments in the code itself. Each function, such as, for example, the calculation of the solar declination as function of the day of the year, is dealt with only in one module. In this way any update of equations or procedures can be carried out in one place only and immediately serve for all procedures. The code makes use of Python intrinsic data structures, such as the ‘datetime’ class, and builds on the most important packages for data processing and presentation: numpy, pandas, matplotlib.
The ‘solprimer’ package and the attached description primer have been prepared for students at Bachelor and Master’s level in engineering and environmental sciences, in first place in solar energy applications, as well as for practicing engineers. The package could be useful in particular for students who need to prepare a Thesis and have a limited time to find relevant data sources, references, and understand and build on the code. With several basic tasks solved, they may dedicate more time and attention to the innovative parts of their works.
The text contains several references to online resources, data repositories, and other freely accessible software by non-commercial sources. All examples can be fully replicated without the need of licensed software of any kind.