Solar Farm Calculator

During my final year of electrical engineering I opted to take a sustainable energy paper in order to get out of having to take a brutal computer hardware paper. For this paper we were required to take a real world site and design a sustainable energy system based on that site.

After a few false starts with sites that turned out to not have much opportunity for improvement, time was running out for our team to complete our design! My two team members had experience in solar systems and during our discussions I gathered that most solar installations followed a very similar architecture (see below)


In light of this I proposed that instead of developing a specific design for a given site, why not take all the parameters from a site and use them to develop a generic tool which would allow you to check if installing solar on a site was even feasible. Not only did this solve the requirements for the paper but it also would help others get past the annoying stage we kept hitting where after a significant amount of time had been invested the site turned out to be a poor candidate for a sustainable upgrade.

The result of all this was the Solar Farm Calculator, an open source solar simulation tool written in Python. The tool takes parameters about a site and a given time frame, then runs a simulation to calculate the expected power output of the site and the related financials.


The calculator takes a latitude and longitude for a site, and uses the Google Maps Reverse GeoCoding API to find out where that location actually is. Then using PySolar the program is able to simulate the solar energy the site receives across the given timeframe. This is coupled with a bunch of solar models to calculate the energy generated at 20 minute intervals across a day, which is then averaged down to a one day resolution. Using the location we can also access average temperature data from the World Bank Climate Data API to figure out how much power we’re losing through the cables, which is altered by ambient temperature.

Taking all this with a bunch of other losses from stuff like inverters and transformers we can then figure out how much power the site is generating per day, and given a price that we can sell the power for we can then figure out how much money the solar farm generates in a day.

To keep things generic we used the Open Exchange Rates API to gather currency information. This allows all the components to be specified in their own currency, and the factored in when calculating the financial results. To make this easier I ended up writing a little module in Python called PyExchangeRates to handle all the exchange rates stuff and offline caching.

The financials even factor in the depreciation of the equipment and the interest on the loan needed to start the solar farm. After running a simulation the results end up looking like this:


The calculator can be downloaded as a pre-built binary for Windows and Mac OSX from SourceForge, and as always the source is available on GitHub if you want to contribute.

Special thanks to Darren O’Neill and Jarrad Raumati who worked on this project with me 0 specifically all the nasty power flow analysis and excellent late night banter as the assignment deadline crept up.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s