Most modellers of energy systems need time series of wind and pv systems but it is hard to find existing models. The developer of the Open Energy Modelling Framework (oemof) wanted to change this and published a library to create such time series.
The project can be found at github: https://github.com/oemof/feedinlib
In this post, I briefly summarise the options I use for retrieving log files for the two solvers GLPK and Gurobi to an arbitrary path when solved from a Python script. Its skeleton looks like this:
from coopr.opt.base import SolverFactory
model = create_your_model()
prob = model.create()
optim = SolverFactory('glpk')
result = optim.solve(prob)
solve arguments are not treated equally for all solvers. Continue reading
If you know how to retrieve geometries as WKT from a postgis database you can go on, otherwise you should start with the first part of this tutorial.
To test the given example you must download the Postgresql dump (geotest_germany) and load it to your local database. The postgis extension has to be installed. Continue reading
Postgis is a powerful tool to handle spatial data for energy models. To illustrate the results it is useful to plot them into a map. Thomas Lecocq shows how to plot shapefiles with the python module ‘basmap’ (Matplotlib Basemap tutorial 10: Shapefiles Unleached). This post will present the basic steps to create the left plot of the following figure directly from a postgis database. For further information check the tutorials of Thomas Lecocq or leave a comment.
LEFT: Advanced example, RIGHT: Basic example (Left: Average temperature in Germany 2012 from the coastdat2 dataset)
The fantastic Pyomo package allows to formulate AMPL-style mathematical optimization problems directly in Python. Leveraging the underlying Coopr package, the problems are compatible with a wide range of open source and commercial solvers.
Since the last update (I am now using VOTD.8748), the model writer that converts the Python model object into a plain LP file changed: instead of using the labels used in the code to create the model like this: Continue reading
If you want to use the figures created by matplotlib directly in a report, it is a good idea to match its font with the one you are using for your text. This post describes how to change the font used by matplotlib for axis labels, tick labels and plot titles. Continue reading
I use IPython to interactively use and debug code that I edit in a text editor at the same time. Unfortunately, Python does not automatically reload packages and functions after an initial
import foo, simply for performance reasons.
Fortunately, there is a solution: the IPython extension autoreload does what its name says: either all (how I use it) or only selected (imported using magic function
%aimport) are refreshed, whenever I hit the Enter key. Continue reading