Windmill Energy Calculator

via <a href="https://commons.wikimedia.org/wiki/File:BANGUI_WINDMILL,ILOCOS_NORTE_2.jpg" target="_blank">Obra19 / Wikimedia Commons</a>

How much power can a windmill generate if a windmill could generate power? I endeavor to find out how..

People sometimes talk about the odd ways they come up with ideas. Such as hitting their head on the bathroom sink to think of the flux capacitor. Recently, for me it was a dream. The details escape me, but it had to do with coming up with a way to calculate how much could be earned from energy produced by a windmill. I woke up thinking that may be a neat thing to put together in my play pen. So I did it.

First thing, first. If I’m going to figure out how much power a windmill can produce, I needed to know how much power a windmill can produce. Some Googling led me to a website for a windmill manufacturer that included a spec sheet. The specs provided a chart linking wind speeds to the power the windmill will produce. I converted this chart into a database table for use by other parts of this mini-app.

A windmill cannot generate power without one very important thing… wind! One aspect of this mini-app that was very important to me was to not fake the data. Just as with obtaining real data on a windmill’s power output, I wanted to obtain real data about wind speeds in a given location. Open Weather Map provides an API to allow a person to make queries against their system to get near real-time weather conditions. This was very convenient to me, I simply needed to obtain an API key and submit properly constructed queries. The information Open Weather Map responded with is saved to a database for future use.

These two pieces of information, wind speed and energy production by a windmill at varying wind speeds, tells me how much power a windmill could generate in a particular location. How much is that power worth? A completely accurate answer is difficult to get, but I made an attempt at coming up with a reasonable number. Many power companies will buy back energy produced by individuals through solar panels, and presumably windmills.

I wasn’t able to find a data feed that included the price at which power companies will buy back power. However, I did find a data feed from the Open Energy Information that provided the cost of power used by consumers throughout the country. Similarly to the Open Weather Map, Open Energy Information allows queries to be made to their system (for a particular address) and it will return information about power companies serving that address and can also provide the most recently reported cost of the power. I used this number (the cost to the consumer) for computing the value of the energy that a windmill produces.
With all of this information collected it is time to put it all together into a friendly view for humans to look at. My initial attempts at putting together a single query, against the multiple database tables, and pull of of the information together quickly became an overly complicated mess. I decided it was too unwieldy to be used in a true production environment (after all, the point of my playpen is to show off my abilities to produce production ready code, or at least some reasonable approximation of it). So, I decided to take a short cut.

I have a cron job that, every six hours, collects the most recent weather conditions and energy rates. Once that was completed, I executed a function that pre-computed all of the important numbers that would be used on the website pages itself and put that information into a kind of look up table. Each entry in this table includes references to the other tables containing the individual data points. It then includes a field with the earnings for a single time slice consisting of the current weather conditions, windmill production, and current energy rates.

This completed the steps to collect data for this mini-project. Next up was creating views to display the collected data. I'll not go into depth here since you can go to the windmill calculator and see the results for yourself.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.