Tag: choices

  • A quick look at energy in South Africa

    I suppose I should stop worrying about people being wrong on the internet, but when you’re invigilating an exam, you start reading Facebook, and then you end up with a long debate about renewable energy.  It just came up.  I’ve decided to take some of the stuff I put up on Facebook and add it to the comments I’ve been collecting in this post about energy in South Africa.

    An article on IOL started it all, but this one is better. Both of the articles get very confused about the units – the IOL one talks about “GW per hour” and the Guardian one mentions electricity costing “23 cents per kW/h”.  The point is that Germany set a record of 22 GW of electricity being produced at some point on Saturday, 26 May 2012.

    Units

    So let’s clear up the energy unit problem first, with some examples.   We have to understand
    the difference between energy, measured in Joule in the SI system, and
    power, which is measured in Watt (Joule/second) in the SI system. Power
    is energy per time, or the rate at which energy is used. In more understandable terms, energy is to distance as power is to speed.

    Now let’s look at what the IOL article is saying: “22 gigawatts of
    electricity per hour”. This is the same as saying “I drove to Pretoria
    at 60 kilometers per hour per hour”. Note the extra “per hour” – it
    doesn’t make sense. The official they quote, and the Guardian gets it right and says that
    they were producing “22 GW” at their peak capacity. Remembering the
    speed analogy, this is like saying you hit 160 km/h on the highway on the way to Pretoria.
    Your average speed will typically be much less. For perspective the
    article also mentions that this is about a third to half of their
    demand, which puts their demand at between 44 GW and 66 GW.  The entire world’s electricity consumption is around 119 PWh/year or 13.6 TW.

    Energy from the sun

    Solar energy has a lot of potential.  Most people have seen the following picture showing how much energy the sun provides. Those small black dots are the area we would need to cover with 8% efficient photovoltaics (PV) to provide 50% more than the 2010 use of electricity. I recommend having a look at how good PV actually is over at Do the Math
    Most of the solar capacity in Germany is from PV power stations, while they also have very aggressive subsidies for Grid Tie PV. These subsidies are currently being reconsidered, and there is much debate over whether they were worth it.

    South Africa vs Germany

    South Africa is well-known as a sunny country – it is clear we are in a good place solar insolation-wise from the graph above, and we have more surface area with less people than Germany.  So why are the Germans supplying such a large fraction of their electricity demand with solar while we aren’t?  In fact, why are we planning to build more nuclear power stations?

    How much are we talking about?

    Eskom has a nice page showing the key facts about electricity production in South Africa. This page quotes their sales for 2011 as 218 120 GWh. This converts to about 25 GW (Google “218120 GWh per year in GW”). That is an “average speed” figure – they produce that much electricity over the whole year. The same website mentions the peak demand for 2011 was 34.807 GW.  Now, although the peak value supplied by solar in Germany is very high, the actual production of electricity over the entire year is quite a bit less.  The Wikipedia page on solar power in Germany lists solar as supplying 3.2 % of the electricity in Germany in 2011. That seems quite a bit less impressive, although the peak values show something of what is possible.  One should remember that that peak value cannot be maintained through a whole day. You can see the capacity factor is around 10%

    We have things they don’t (coal and uranium)

    Probably the best argument that I have come up with is shown in the following graph showing Energy imports as % of energy use.  Note that this is bigger than just electricity.

    It is clear that Germany does not have enough sources of energy inside their borders to supply their demand. South Africa does. Their investment into other sources of energy reduces their reliance on other countries. South Africa exported 67 Mt of hard coal in 2009 while Germany imported 38 Mt, our economy is largely constrained by the resources available to us. If Germany had more coal, I am pretty sure they would not have pushed nearly as hard to get rid of this import. By the way, the same source also lists Germany as one of the top importers of natural gas in 2009.

    They have things we don’t (money)

    Also notice this sentence in the IOL article: “German consumers pay about 4 billion euros ($5 billion) per year on top of their electricity bills for solar power”. SA just is not rich enough to afford the kind of rollout Germany has done. Their yearly expense for solar power is larger than our planned building expense for the nuclear power plants that will then produce power more cheaply.  The SA nuclear program seems to be about R800 billion over 20 years. That’s about 4 billion Euros per year for 9.6 GW (with 80% availability that becomes 7.68) – which is what Germany payed for 2 GW (18 TWh/year in GW)

    Why even consider coal if it’s bad for the environment?

    The allure of cheap energy is huge. Coal as a Energy Return on Energy Invested (EROEI) of over 100, nuclear in the 50s and solar closer to 10 (see table 2 of this analysis).  Tom Murphy has a much better analysis of the problems of low EROEI that I could hope to do called The Energy Trap.  Briefly, the problem is that it takes energy to build devices to make energy, even if the ultimate source of that energy is “Free”.  This means that we have to climb into debt somewhat to build new capacity when we don’t have the really huge payback we get from coal.

    Final words

    From what I can see at the moment, your best bet if you want to reduce your impact on the environment is to reduce your energy consumption through directly trying to use less energy. Walk more instead of driving, open up the blinds instead of turning on a light. Install some of the awesomely efficient new LED lights or CFLs.  These things will save energy and save you money with very little effort and very little discomfort.
    If you’re OK with a little discomfort in order to reduce your environmental impact, stop watching TV, use less electronics in general, plant a garden and eat from it rather than eating imported stuff from far away, sell your family’s second car. These will not cost you much in monetary terms, but will require a change in lifestyle.
    A solar water heater is probably a good investment.
    If you feel moved to do so, you can spend money on solar panels or wind turbines. This requires a large initial investment and is not quite yet at grid parity (the figures I’ve seen for Grid-tie PV systems is R1.6/kWh, while Eskom charges between R0.50/kWh and R1.4/kWh).
  • Factors to consider when choosing a programming language

    This morning a colleague and I spoke briefly about choosing a programming language for some high-performance scientific computing (thermodynamic calculations) he wants to do. I started writing an e-mail with a couple of my thoughts, and then thought it would make a pretty good blog post for the same amount of time. So here’s my list of things to consider when choosing a programming language. Note that these are not orthogonal to one another – many seem to describe the same thing from different angles. This is just my musings, not a research study.

    1. Popularity. This is a very important one. A good place to start is the Tiobe index. You are more likely to find people to collaborate with if you use a popular language. You are also more likely to find reference material and other help. Unfortunately, the most popular language globally may not be a good match for your problem domain.
    2. Language-domain match. Choose one that matches your problem domain. You can do this by looking at what other people in your field are using (after adjusting for popularity, so don’t think the match with Java is good simply because a lot of people are using Java) or by looking at some code that solves problems you are likely to have and seeing how natural the mapping is.
    3. Availability of libraries. Some would argue that this is the same as the point above, but I don’t think so. If there’s a library that solves your problem well, you’ll put up with some ugly calling conventions or hassle in the language.
    4. Efficiency. Languages aren’t fast – compilers are efficient. Look at the efficiency of compilers or interpreters for your language. Be aware that interpreted code will run an order of magnitude slower than compiled code as a rule of thumb.
    5. Expressiveness. The number of lines of code you create per hour is not a strong function of language, so favour languages that are expressive or powerful
    6. Project-size. Do you want to be programming in the large or programming in the small? Choose a language that supports your use case.
    7. Tool support. Popularity usually buys tool support (and some languages are easier to write tools for). If you are a tool-oriented user, choose a language with good tool support. Just read this article on tool mavens vs language mavens before you make a choice.

    Note that all these things have no single right answer: they define the languages on my Pareto front. A good starting point to observe the trade-off between expressiveness and efficiency is the Computer Shootout. Also check out this analysis of some of the results.

    Of course, a personal blog need some personal input, right?

    I happen to know many languages, and the combination I use at the moment is Python for prototyping and Fortran (2003) for speed. Python is popular (it’s the second interpreted language on the Tiobe index, after PHP, which sucks for scientific stuff). It’s got a really nice set of libraries for the jobs that I am doing now and makes wrapping Fortran code easy. Fortran has some really good compilers (and the free gfortran is pretty good), and suits matrix-oriented programming really, really well. YMMV

    Both of these languages have good tool support in Emacs (my favourite text editor) and Eclipse (which I am slowly picking up).