Sunday, 11 October 2015

Could graphene be used for super light space craft heat shields?

Last night I was watching an interesting video about a self-made billionaire who is spending 99% of his acquired fortune on funding innovation development to tackle energy, water and health issues. I'd not come across Manoj Bhargava or Billions in Change before, and some of the ideas seem a bit "out there", although if they work out then he's producing some badly needed solutions to world problems.

One of the ideas he's funding is a clean energy concept of bringing up heat from deep in the earth to drive electricity generation without using fossil fuels.  Geothermal energy has of course been done for years - Iceland gets most of its power that way.  However the new twist that Manoj and his engineers and inventors have is to use graphene to shift the heat from deep down below to the surface.

Graphene is the atom thick version of carbon that is the new wonder material for all sorts of applications. But Manoj claimed in the video that its heat transfer capability is tremendous - so much so that heat applied to one end of a graphene string will travel along to the other end, leaving the middle cool.  I'd not heard of this property before, but a quick Google search threw up this paper in which physicists have shown evidence of this marvellous heat transfer capability.

Of course there's a lot more research, not to mention engineering development, required before graphene heat pipes become a widely available thing.  But it got me wondering: assuming graphene does have this great heat transfer capability, could it be used in spacecraft heat shields? In effect I'm wondering if it would be possible to wrap a reentry capsule in a graphene matrix made of graphene strings, with one end of each string at the bottom and the other at the top.  As the heat shield warmed up, the heat from the bottom would be conducted over the sides of the capsule and then radiated from the top at the other end of the graphene strings?

I've not heard of graphene being considered for this application before, but then I'm not intimately involved in spacecraft design.  I bet its Elon Musk's radar if it is a possibility (everything is on Elon's radar!)

Friday, 28 August 2015

Wacky idea time: Nuclear powered ocean going freight islands?

Nuclear powered ocean going vessels have been around for decades.  As well as the well known nuclear power submarines with their deadly payloads of nuclear weapons that can stay submerged for months at a time, there are also nuclear powered aircraft carriers and icebreakers out there.  Nuclear power plants for shipping are expensive but have the advantage of large power outputs, less time spent refuelling and low carbon footprints.

The latter point on carbon footprints made me wonder: onshore nuclear power stations can offer low carbon electricity outputs, but are now massively expensive to build, get mired in politicial objections left, right and centre, and are often unpopular with the local residents around proposed sites.  We need to find a way to deal with long lived nuclear waste from the legacy nuclear power stations. At the same time we need to find low carbon ways to ship bulk goods around.  And it would be great if we could get cheap, renewable replacements for existing liquid fossil fuels so that we could keep more fossil fuels in the ground.  What if we could find a way round all of those issues?

So, my quick brain fart for today: build very large, ocean going freight vessels that are nuclear powered.

By "very large" I mean bigger than the largest oil tankers available today by an order of magnitude - effectively floating metal islands that can plough across the oceans from continent to continent.  Obviously they'd be too big for most ports to handle and many people may object to a nuclear powered vessel turning up in their local harbour (unless they're used to the military ones already).  However what about if these giant vessels went just to the edge of territorial waters and unloaded onto smaller vessels?  Those smaller vessel would be normal sized, conventionally power container ships and tankers.

If you build something big enough, you could effectively include a dock inside the huge ship for normal vessels to go into, protected from rough seas. The loading/unloading of the smaller ships could even be done enroute, which would mean that transshipment and handling time wouldn't be increased. Bringing boats inside a larger ship is already done: the US Navy have vessels that can take smaller boats inside for long distance transport, equipping and deployment.  Or if you're into sci-fi its like the James Bond baddie with the oil tanker that could swallow submarines. Paging Elon Musk on that one!

Manufacture of this mega-freighter would have to be modular so that existing ship yards could build them sections at a time.  Each completed section would be floated out of the dry dock and then joined up to other sections already held at sea.  That's the bit I'm really not sure about: how easy would it be to join up sections at sea that are floating? That would obvious require calm weather to do, but could the modules be designed to interlock easily like some sort of giant floating Lego bricks?  I don't know - I'm not a shipwright or naval architect.  However large floating structures have been joined together in the past, so I don't think its insurmountable.

These floating freight islands would have to be powered by nuclear reactors that provide propulsion power, "hotel" power to keep the crew (and maybe passengers) supplied with heat, light & electricity and potentially enough "extra" power to use the various Fischer-Tropsch processes to combine sea water with air to produce liquid hydrocarbon fuels.  We already know that works - the US military have tried it to produce jet fuel onboard their nuclear powered aircraft carriers.  The synthetic hydrocarbon fuels could then be used to fuel the smaller servicing freighters and/or provide av-gas for helicopters or VTOL aircraft for the short hops to and from shore.

By using the nuclear reactors for the long haul ocean part of the freight journey we'd be reducing the carbon footprint of the goods.  The reactors will effectively live out their lives at sea, many miles from the nearest land. If the reactors are designed using the proposed Gen-IV designs they'll be "walk away safe", and something so massive as this would also mean it would be unlikely to leak radioactive material into the sea (I assume the reactors would be in the heart of the floating metal island, so there could be a lot of steel and concrete between them and the water).  Indeed this might be a great application for the various designs of modular reactors - don't build a ship with one 1GW pressurised water reactor but instead 10 modular 100MW molten salt reactors that can be swapped in and out for refuelling and replacement.  That would help with the economies of scale that modular reactor designs really need if they are going to be constructed on a production line to bring costs down and safety up.

Tsunamis and earthquakes wouldn't be an issue for these reactors, and if they're making enough synthetic fuels as a by product of the reactor running they could even help provide low carbon fuels for import to the countries they visit.  Indeed if they moor up at a fixed off shore point, they could be hooked up to the Grid in that country by a relatively short undersea HVDC power cable.  It might transpire that some could even be nearly permanently moored like that as a safer place to put nuclear capacity for the Grid's low carbon base load supply.

I wonder what the limitations of build these would be?  Cost is an obvious one: a nuclear submarine costs a couple of billion US dollars to make, and this would be something far larger.  Yet Governments and companies are already handling projects that cost many tens of billions - things like new build on-shore nuclear power stations, failing Carbon Capture and Sequestration (CCS) projects, high speed rail lines, etc.

The anti-nuclear lobby would probably object to this as its another application of nuclear power, but if the Gen-IV design could make use of legacy high level nuclear wastes, it might be palatable as a way of cleaning up wastes from previous generations of nuclear reactors (which is after all one of the anti-nuclear groups' major concerns). Also there are already many nuclear reactors swimming around in the ocean and have been for decades.

I'm not sure what the legal position would be for nuclear reactors running on vessels in International waters that never actually enter territorial waters once launched. Would it be covered by the flag that the ship sails under? Could you pick a small country that doesn't have a huge amount of nuclear regulation red tape in order to make this viable?

Saturday, 2 May 2015

Energy storage and nuclear power

A couple of days ago, Elon Musk, the billionaire serial business creator, fronted a product launch at one of his companies - Tesla Motors.  Telsa is renowned for building high quality electric cars but this launch wasn't for a car: it was for batteries.  Elon was explaining how the battery technology originally developed for the Tesla cars will now be available to home owners and companies to provide electricity storage.  The news has naturally focused on the $3500 10kWh domestic battery pack, but I think the real killer is in the industrial, grid scale scalable storage that they are going to offer.  This is interesting enough for one un-named utility to already put their name down for 250MWh of capacity, and indeed its the industrial/utility side that analysts see as the major market.

Which got me thinking: how much solar/wind/etc generation and Tesla storage could you buy for, oooh, say the cost of EDF's proposed Hinkley Point C nuclear power station?  The estimated cost of Hinkley Point C keeps going up, but lets use the original EDF £16bn figure here.  Hinkley Point C is a 3.2GW station, so we need to try to match that using renewables for £16bn ($24.22bn at the current exchange rates).

Now first off I have to say that this is just me getting some ball park figures: its not an engineering analysis.  I just want to see if Tesla's batteries plus renewable generation can give us a stable base load power source to the National Grid that would look to the outside world as though a 3.2GW nuclear station were sitting there. To do this we'll need more than 3.2GW of renewable generation capacity: we not only have to match the nuclear station's peak output, but also fill the batteries so that we can also supply power at night and on calm, overcast days.  Lets assume that we want 3 days worth of energy in the batteries to cover these low generation periods to start with.

Now we don't know what cost Tesla's commercial utility scale power packs are going to be, but we do know that the residential 10kWh ones will cost $3500, or in other words $350 per kWh.  I would assume that an economy of scale kicks in when you're buying a huge amount of batteries for utilities that would reduce this $350 per kWh figure for the utility scale one.  Lets say it knocks $50 off the figure - yes, that's a wild, stab in the dark guess, but its seems vaguely sensible and conservative.  So we need three days worth of 3.2GW generation stored:

3 days x 24 hrs x 3.2GW = 230.4GWh = 230400000kWh

At my estimated $300 per kWh that will cost:

$300 per kWh x 230400000kWh = $69120000000 = $69.12bn.

Ah, that's blown the $24.22bn budget already, and we haven't even paid for any of the renewable generation yet - this is just the cost of 3 days of Hinkley Point C sized output storage.

Lets plough on though, and see what the final number is.  For large scale renewable power generation, the costs are falling (ie going the other way to nuclear!).  Large scale wind turbines cost $1.5m-$2m per MW of output.  Large scale solar farms cost ~ £1.6M ($2.42M) per MW if I've read the slightly confusing Solar Trade Association report right.  Lets pick $2M per MW as reasonable wet finger guesstimate of cost for both wind and solar then.

We need to generate more than 3.2GW though: we want to match Hinkley Point C's output when we're generating at our peak and have lots of excess generation capacity available then to fill up the Tesla batteries for the periods when its calm and dark.  Lets guess again and say that we need twice the generation capacity to do this.  We might need more, we might need less, but 6.4GW again seems like a reasonable first guess.

At our $2m per MW estimate of renewable generation costs, this 6.4GW will cost $12.8bn.  Well at least that bit is under the $22.42bn Hinkley Point C budget!

How much energy storage can we get for the $9.62bn difference?  At $300 per kWh estimate we get:

$9.62bn / $300 per kWh =~ 32GWh

So that's about 10 hours worth of storage if we're going to be sucking 3.2GW from the battery system. That's still not bad, but will it be enough to allow large scale solar and wind to challenge nuclear for base load power generation in a decarbonised Grid?  Some people think so, and the numbers will fall on the side of renewables+batteries if their cost trajectory keeps going down in the same direction whilst nuclear's costs keep rising.  It will be interesting to see how this plays out.



Friday, 27 March 2015

Tooling up for repairs

This weekend see's the first Transition Stratford Repair Cafe take place.  For my sins I'm one of the volunteer "repairers".  The idea is pretty simple: there's going to be four or five repairers sitting in a room for a few hours, people come along with things that are broken that they would normally just throw into the landfill and the repairers try to show them how to repair them.  If they manage, everyone is happy: the person doesn't need to spend money on a new replacement, they've potentially learn a valuable new repair skill, the repairer has the good feeling of helping and the Transition group as a whole are helping cut down on waste and the use of resources.  If the repairer can't repair it we can point people at local professional repairers (thus helping the local economy), or the item gets taken away by the person who brought it and it goes in the bin anyway (which is where it was heading in the first place).  All done in a friendly social space, and for free, though people are encouraged to buy tea & cake whilst waiting or make a donation to help cover the room hire costs.

I've seen a Repair Cafe running at first hand Malvern when a couple of us went last year for a spot of industrial espionage (and tea and cake - it is a cafe after all).  The one thing that strikes you is the variety of things people bring in: knives that need sharpening, children's sit on battery cars, flat panel TVs, duff patio umbrellas, clothes that need a bit of stitching, etc, etc.  And that has lead me to this afternoon's quandary: what tools and equipment should I take?

I've just spent three hours in my workshop trying to guess what might be useful.  Its tricky, because I don't really know how many people we'll get, nor what they'll bring.  Its sort of exciting: will they bring stuff we can actually repair, or will it all be things that have designed obsolescence built into them in a way that makes it very hard, or impossible, to repair?  Is it going to be digital electronics that needs tiny specialist screw drivers and a fine soldering iron?  A lawn mower that needs it blades sharpening?  A chair that needs a leg gluing? Just to add to the sense of adventure, we'll only get 20-30 minutes to do each repair, as we might well have a queue of people waiting!

Anyway, here's a rough list of what I've finally decided to take.  I could immediately discount any decorating/building tools and heavy woodworking gear (I doubt I'd need the lathe or pillar drill for example!), so its mostly hand wood & metal working tools and simple electronics stuff. Thankfully one of the other repairers is doing the needle work, so I can also forget the sewing machines, threads, buttons, etc. Which means I'm currently taking:

  • Workmate (vital!)
  • Toolbox containing
    • variety of fixed bit screwdrivers,
    • junior hacksaw,
    • large hacksaw,
    • interchangable bladed tenon/rip saw,
    • some G-clamps,
    • multimeter,
    • hand drill,
    • wood & metal drill bits,
    • PTFE tape,
    • pipe cutter,
    • a couple of  hammers,
    • a variety of wood & metal files,
    • some pliers, 
    • some pipe wrenches,
    • masking tape,
    • pencils,
    • square,
  • A shopping trolley containing:
    • Box of various spanners,
    • Socket set,
    • iFixIt 54 bit electronics screwdriver set,
    • Set of general small screwdriver bits & driver,
    • Como mini drill,
    • Hand staple/nail gun,
    • Soldering iron, solder, etc,
    • Hand operated grinding wheel,
    • Small metal vice mounted on a workmate compatible base,
    • Wood glue,
    • 3-in-1 oil,
    • Superglue,
    • WD-40,
    • Component tray (for keeping screws, etc together when dismantling something),
    • Oil stone,
    • Needle files,
    • Sand and emery paper,
    • Some tins of nuts, screws, bolts, etc.

I'm umming and ahhing about taking my rechargeable drill/driver with me... it might be handy if something big with lots of screws turns up.  No oscilloscope or other electronics diagnostics tools, so it will limit any repairs to complex electronics (but that would probably take more than 20-30 minutes anyway... it can take that long to get in some cases!).  I should possibly have more glues, tapes and clamps: at Malvern they had loads of these available.  Not sure what other "consumables" might be needed... fuses perhaps?

So now we just have to wait and see what comes and thus what gets used that I've taken, and what I should have taken but didn't.  Hopefully with four or five repairers there we'll have a broad coverage of tools and consumables, so if I have forgotten something one of the others may have it (and vice versa). Fingers crossed, eh?

Saturday, 14 February 2015

Insulate existing properties as part of building new ones?

In the UK we're looking to constantly build new housing stock to house both a growing population and because they way we live now is different to 50 years ago (with more single occupancy and single family dwellings).  However new build is still only a fraction of the UK houses available, with many existing ones having been built in the last 150 years to somewhat lower standards of insulation and energy efficiency.  Over the last 20 years Government grants and promotion have lead to about 70% of properties with cavity walls having insulation added to them.

Unfortunately changes in the grant regime have lead to a collapse in the insulation industry and left a relatively large number of homes still requiring more insulation and similar energy efficiency measures. Some of these are "difficult to treat homes" and ones requiring expensive solid wall insulation that have long pay back times. The Green Deal was supposed to help with these but its been a bit of a damp squib, although the periodic Green Deal Home Improvement grants have been over subscribed rapidly demonstrating a demand for such help.

So here's an idea that just struck me: why not make it a requirement that developers of new build homes have to insulate a given number of existing homes in the locality (say within a 5-10 mile radius) for each new build home they erect? And I don't just mean pay into an anonymous pot: I mean actually have workers go into homes in the area and do the insulation whilst the homes are being built (with mandatory fines if they don't - no weaselling out of it later by doing deals with friendly councillors!).  This would have a number of advantages:
  • Developers already need to engage with the local community during the planning cycle so they could find suitable properties and home owners in the locality at that stage, including them in the final planning application,
  • Local people would be getting direct, visible benefits from developments within their communities, rather than funds that might drift away elsewhere,
  • Making local homes, especially those belonging to the elderly, infirm or poor, more energy efficient would be great PR for the developers (and they often need great PR!),
  • Insulation will be pushed up the agenda for new builds as well: if a developer is going to have to talk about insulation during the planning stage and pay for insulation companies to do a load of existing homes, they'll be more likely to make use of the "economies of scale" and get the same people to put decent levels of insulation in the new homes rather than skimp with the minimum.
A similar idea could apply to developers of commercial or industrial space: they could be required to fund insulation and energy efficiency measures in existing local community and local government buildings. This would mean that the developments immediately start to make a positive difference to the amount of energy used by the local community, and potentially reduce costs and/or secure a longer term future for such services.
Linking new builds to the redevelopment of existing housing stock would help ensure that older properties don't become "second class citizens" alongside modern buildings, and would also mean that Governments wouldn't have to be directly involved in the funding of retrofit, which appears to result in "start-stop" bursty situations that wreck industries and confuse the public.

Friday, 22 August 2014

The Plum Tree Exposed to the Time Vortex

There's a new Doctor Who series starting tomorrow and we get to see Peter Capaldi taking on the mantle of the time traveler.  Yes, Doctor Who has regenerated again to cheat death.  If only that could happen in real life, eh?

Well, on our allotment plot we might have a plum tree that, like the good Doctor, has been exposed to the Time Vortex and can regenerate when it is time to meet its maker.  And meet its maker is exactly what it has done this summer.  It was lush and green in the Spring, flowered profusely, fruits appeared and then suddenly one weekend its looking like this:

The leaves have shriveled, turned brown and dropped off.  The fruits remain and are slowly rotting on the branches.  We thought it had been weedkillered (which is a bit odd as we're organic so don't use weedkiller) but raspberries and brambles around it are still fine.  Whatever has afflicted it, this tree is a goner.

Except it has started on its own regeneration.  Yes, like a Time Lord, this tree is cheating death by regenerating.  Just a little way away from the scene of death and destruction is this:
That's a little new plum tree.  There are no other plum trees close by so this is almost certainly coming up from the roots of the dead tree.  In its dying breath it appears to have pushed up into new life!

However unlike Doctor Who, this new plum is in the middle of a path so its going to have a very short regeneration....

Saturday, 12 July 2014

Notes on the July 2014 Great Central Railway shareholders AGM

NOTE: These notes are just what I managed to jot down during the meeting.  They aren't in any way a formal, official record of the meeting - that's what the company secretary does.  I try to capture the main points of the meeting but I apologize if I've misrepresented anything (I'm sure the GCR Board will correct me if I have got something wrong!).

Great Central Railway AGM 12th July 2014

Meeting opened by David Morgan at 10.29am

Standing room only - some of the chairs were out on a train! Introduced Malcolm (new auditor), Caroline Mate (now company secretary) and Lili Tavener. Apologies from Bill Ford who was taken ill whilst on holiday in Scotland. Handed over to Peter Morley (now ex-company secretary) to explain report and accounts. Peter passed to Malcolm to give the auditors report first. Malcolm said the auditors opinion on the accounts was that we have a "clean audit report" and the report and accounts give a clear and accurate view of the company's financial position, which is in profit this year.  The director's report was in a slightly different format from the past with a strategic view that is a government requirement with a short director's report giving the traditional set of notes on the accounts.  The accounts and underlying data provided to the auditors was as they would have expected and didn't provide any difficulty to the auditors.

Peter Morley said that the page at the back of the accounts showing the overall profit and loss is the really important one.  We're in profit this year and it takes a relentless effort from everyone at the railway to keep the kind of momentum required going.  We've had a substantatial level of growth in events and catering, with catering now over £1.1m of income from the various outlets around the railway.  The railway needs to keep costs under control in order to maintain such a profit in the future.  Bill Devitt has been promoting external contracts which has resulted in a year-on-year income increase, often with limited costs.  The overall income is now at £2.6m, and we're approaching £3m turnover, which is up from £1.6m in 2008.  This is significant growth that represents the amazing efforts made by many to make the railway go from strength to strength.

The downside is that costs are also increasing, with coal & oil costs constantly increasing due to global prices.  We can try to buy the best we can and use the most efficient locomotives, but the cost pressures are always there. Total expenditure is close to total income. A operating loss is turned into a profit from revenue grants and depreciation.  Revenue grants are from bodies outside the GCR who pay to have events put on.  The directors expected a loss of £100K so were pleased with a £10K profit.  Net assets has grown up to £1.6M thanks to share sales and little bit of the profit (up from £1M in 2008).  This growth shows that share income isn't just flowing out in payments.  Net current liabilities is showing £10K, whereas 6 years ago it was -£500K, which means that the railway is now living within its means.

Q: How are we showing on the results to date for the first quarter of current year?
A: Income is still growing at 12-15% which a very good sign.  We're getting good publicity and are on the crest of a wave which we need to maintain.  Ticket sales are up.

Q: Approximately how much of the increase is due to price increases?
A: During the recession we've controlled price increases. Family tickets are £25 which targets peoples on lower incomes.  Growing the customer numbers rather than increasing price per customer where possible.

Q: Drive a train incomes are down why?
A: Unknown, but could be people spending less on expensive premium products during the recession.

Nigel Harris (ex-director) said that it was a fantastic acheivement to turn £500K in net current liabilities into £10K profit, especially during a recession.

Report and accounts approved by the shareholders.

Election and re-election of directors.  Dennis Wilcox, Fellow of institute of Mech Eng, emeritus professor at Sunderland Uni and editor of Mainline magazine.  Proposed and elected to the board.  Two other directors retired by rotation and were re-elected.

Auditors reappointed by the shareholders.

Mike Gregory, president of the company, then spoke briefly, thanking staff, volunteers and shareholders for their help in achieving what the GCR has become. Things have improved over the last 5 years... what will it be like in 5 years? 10 years? 20 years? Hopefully better and stronger still. Please keep supporting us and continue to make the GCR the People's Railway.

Tom Ingall then gave one of his classic presentations on the current state of the railway and projects around it. Leicester museum partnership - proposal to build third annex of NRM down by Leicester North station.  Lost out on first round of HLF funding but the team aren't knocked back and are gojng back for the second round.  The team have business plans and documentation ready to go.  LCC have advised not to share details of land acquisitions, etc.  However V2 Green Arrow would be the star of the show at the museum, with interpretation telling the story of how the locomotives and railway tie in with people.  Butler Henderson is also likely to come, and Barrow Hill (where it currently is located) know this as it would mean it would have a much better environment to be preserved in than their round house.  Barnum carriage restoration would happen in front of visitors. APT-E and Woodhead electrics planned to go there.  The Unique Selling Point for the museum is the juxtaposition of the carefully curated museum displays with the working heritage railway next door.  There'll be extra track required.  Its not just big objects like locomotives and carriages though - smaller objects like shovels and uniforms will be on display as well.  It will show what differences the coming of the railways (not just the GCR - other lines covered too!) affected the lifes of people in the area.  The overall project is £15M and the first round failed HLF bids was £10M so we'd need to find £5M ourselves.  Whilst the bid failed it was viewed as a strong bid and just pipped at the post by Nottingham Castle who had a urgent need for the money immediately as they had subsidence.  More surveys and engagement will be made before the bid document is resubmitted at the end of November, with the decision made in April.  We have two more chances for HLF (maximum of three submissions for any one bid).

Bridging the Gap.  Two years ago the scheme wasn't coming together but now it is.  Tom said hopefully this may be the last AGM when there isn't a bridge over the MML.  Bridge was taken away in 1980s to make room for electrification. We have a cost of £1m to reinstate the bridge which is limited lifetime opportunity given to us by Network Rail.  The GCR is in partnership with NR and they have been doing a tremendous amount of work. Consultant engineers on board to make sure that the project is done right. NR have employees who are volunteering for this project (its great experience for them and adds to their CVs).  We have actually had people digging on the site getting ready for the bridge - NR can do ground investigations that we couldn't even afford the insurance to do!  Soil sampling shows that it will need to be a few metres closer to St Pancras than it used to be to get the best possible alignment. This also means one signal gantry doesn't have to move which reduces the costs somewhat.  Concrete abutments and middle pier, both of which will have blue brick slips facing them.  Single track with a walkway on one side - CBC wanted walkways on the sides at one point.  Reading bridge decks have already had old water proofing removed, ready for shot blasting, repairs and replating.  Signal sighting on NR has already been done.  Construction is likely to start during the Xmas shutdown, with pile driving being the major first job (which may well take the whole of the Xmas period, in which case the bridge will go in later in 2015 or even 2016).  Currently raised £535K in one year - funding coming from all over the world.  Need to reach £750K in a few months time - send that money in now!  NR are pleased to be involved in the project - Tom read out a great positive statement from NR thanking everyone involved.

The local growth deal fund has awarded us a £1M grant towards reunification. We can only draw £500K at a time (ie at most once per year) and is match funded against us raising the £1M we need for the MML bridge (this can't be used in the timescale for the MML bridge so we still need to keep on raising funds for that anyway).  This could be used for the canal bridge, embankment and railway terrace bridge.  This week the canal bridge has undergone a survey - worth £10K but done for considerably less than that.  When the numbers are crunched this will tell us how much the canal bridge restoration will cost and how it will be done.  Tom said that there is an element of "organised chaos" as the plan will evolve as we get new data, funding, equipment and resources donated to us. Tom asked us to all go out and fund raise - don't ask for permission from the GCR to run events but just do it and send the money back in!

Q: Are they any thoughts about having a GCR advert on the bridge.
A: Can't have it facing the tracks.  Could be on the abutments but would require extra planning permission.  Good idea though as its "prime retail space". ;-)

Q: When making press releases about £1M should we make it clearer that it doesn't cover the MML bridge?
A: Its in the press releases but its important that everyone realises this and spreads the message that we still need to raise the £465K for the MML.  Don't stop fund raising and making donations to the bridge fund!

Q: What's happening to the Workington Engine Shed?
A: Bits of it survive and GCR would like to incorporate them into a future building?  Talking to the GCR(N) but there are still many unknowns.  The joining up of the Mountsorrel Branch is seen almost a dress rehersal for joining with the GCR(N).

Q: Is there an overall cost for the whole Bridging the Gap project?
A: Tom said approximately £6.5M - railway terrace bridge & embankment will be expensive.

Q: Once the canal bridge is refurbished could we advertise to boaters to get them to come to the GCR?
A: Yes that's a great idea.  No detail plans on how it would be done yet - many things need working out first.

Q: What about Loughborough High Level station?
A: Its an aspiration still but no concrete plans yet. Not ruled out by current bridging plans.

Q: Where will be engine shed move to?
A: Tom not privy to that as he's not on the board.  One suggestion is to have a facility on the western side of the existing loco shed (where the stores containers are).  Lili said that consultant engineers have been asked about location of loco shed based on new alignment required for bridging the gap.  Once joined with the GCR(N) there's opportunities to have engineering facility in Ruddington.

Q: There's quite a large pot of money at East Midlands Airport community pot - could it be tapped?
A: Yes.  Lili said that as well as the Gap and the museum we also need smaller grants for other projects on the railway.  Someone pointed out that we already have had EMA money for the lift in Loughborough.  David Morgan said anyone with information on grant givers should contact Lili or the railway with details.

Q: What implications does the Leicester North museum have on Loughborough Central museum?  Look at how Kent and East Sussex railways are joining.  Why does the shareholders meeting start before the first train on the GCR arrives at Loughborough?
A: The last point is taken on board - maybe we should run a DMU or an early morning "milk train" next year.  Tom said that he didn't forsee the Loughborough museum disappearing - the Leicester North museum is an outstation of the NRM whereas our own award winning museum has its own stock.

Q: There's a very early Brush electric loco in the NRM - could it come to the museum?
A: Tom said the museum stock list hasn't been released yet so it could be included.  Someone also suggested that they know of a Brush built steam loco located in west Leicestershire.

Meeting expressed its thanks to Network Rail for its work on the Gap project.

Q: Could the AGMs be laid out differently so that more people could see the screens?  Eg have two screens.
A: We could go back to the town hall, but that costs £2K.  Point about being able to see taken on board and they'll have to see what can be done next year.

Q: How well did the model railway exhibition do? Could we use a similar large marquee at Quorn for the AGM as there's no parking problems either.
A: Could be an idea to be looked at, but need to make sure that we don't let the costs increase (just as with everything else on the railway).

Q: We're doing a lot less trade at the weekend for the Bronze drive a train weekend - it might be that having more themed weekends means having less drive a train slots. Could there be a midweek day for Bronze drive a train experiences?
A: David asked Caroline to make a note of it.  Would be interesting to see if other railway have experienced a drop in there datex services. David Morgan said that at the last HRA managers meeting it came out that over all hertiage railway footfall has increased by 7% whereas general tourist event footfall has fallen by 6% - HRA aren't sure how railways have ducked the trend.  We're not turning many customers away at the moment though.

Q: Why single track bridge rather than double track?
A: Tom said it would cost far, far more.  Nigel Harris said that clearances are very tight and we'd have to move the brook and do lots more heavy engineering to deal with water course flows, which would be massively expensive.  Railway Terrace needs to be full height access for the tip lorries to get under.  If in the wrong place the bridge over Railway Terrace would be longer than the one over MML.  Its going to be single track... end of story.  Bottom of embankment needs to be to full flood protection standard to meet EU and Environment Agency requirements - we're lucky that the EA are happy with the current plans.

David Morgan then thanked everyone again, highlighting the efforts of Bill Ford, Richard Patching & Mike Gregory. Meeting closed at 11.56am.

Tuesday, 14 January 2014

Optimism and Pessimism over Carbon Reductions

This afternoon I attended an interested debate on energy policy, held at Loughborough University as part of their Impact Festival for research.  Four leading academics working on topics such as carbon capture and storage, renewable energy generation, energy efficiency in the built environment and energy policy were brought together and lead by a chap from the Energy Technologies Institute (ETI).  The ETI is a Government funded institute that encourages research and development of technologies intended to help the UK in its goal of saving 80% of its 1990  CO2 output level by 2050.

The debate was really interesting, with experts touching on a number of mechanisms that could help us reach this target, and with a bit of disagreement amongst them here and there.  Carbon Capture and Storage is seen as important given the amount of existing fossil fuelled power generation but the jury was out on whether the UK would be willing to fund it and whether China and India would have somewhere safe to put the captured carbon (one option being underground in old oil or gas wells, which isn't such a great idea in a geologically unstable area).  Some support for community involvement in renewable energy development (ie what has been happening in Germany and to some extent in the UK too).

At both the start and end of the debate they asked the audience (about 60-70 of us, a real mix of academics, students, industrialists and the general public) three questions.  Paraphrasing they were:

a) SHOULD the UK aim toward the low carbon target by 2050?
b) CAN the UK access technologies to allow the target to be reached?
c) WILL the UK actually make that reduction target.

You could answer "yes", "no" and "don't know" to each of these The answer to a) had a majority saying "yes", both at the start and end, so we mostly seemed to agree a low carbon Britain was something to aim for.  The answer to b) was a bit more mixed, with more folk seeming to move a bit more between start and end.  But the answer to c) was the most telling: the majority at the start thoughts "no" and that hardened at the end, mostly thanks to "don't knows" being converted to "no".
For what its worth, I said "yes" to a) and "don't know" to b) and c) at both ends of the debate, so I wasn't in the majority for either of the latter two questions.

But the majority answer was a great example of why politicians have a problem with supporting green policies.  They know that most folk think that these policies are a good idea, but the politicians also probably realise that most folk have already seen the mess governments (of all sizes and hues) have made of things like energy policies and now cynically don't think there's a hope of reaching the target.  The politicians thus feel free to mess around, cut and generally play short term politics with green policies and know that it isn't likely to rile people up as much as taxation, benefits or the NHS. Its a rather negative feedback loop of course, because this sort of action will just make the general public even more cynical about how likely we are to meet our targets.

Friday, 13 December 2013

Replacing CFL bulbs with LEDs

I replaced the traditional incandescent bulbs in my flat some years ago and it was a no-brainer.  The compact florescent lights (CFLs) were coming rapidly down in price, were available in all the sizes I needed and of course consumed far less energy than the other heated filament bulbs they replaced.  I was happy to be saving energy and cutting my electricity bills.  All was good with the world, even though some of the bulbs took a while to "warm up" before they gave full output. I could live with that in most places.

Scroll forward to 2013 and I've now replaced a few of the first CFL bulbs with another new technology: mains power LED bulbs.  I need to replace some of the older CFLs that had failed over the 8 or 9 years I'd had them and Tesco (of all people) had new 4W LED bulbs on special offer at around £8 per bulb.  Now that's still a lot more than CFLs (which were being given away at one point and which you can quite happily get in pound shops these days).  However I wanted to try them out as I have four down lighters in the kitchen that are used quite a bit and where I could really do with the crisper, bluer, more immediate light from the LEDs.

I thus spent £32 on replacing 4 x 14W CFLs with 4 x 4W LEDs (compared to 4x100W reflectors that were there when I moved in over a decade ago!).  I liked the light and there's no "warming up" period (or at least none that I can detect).  Whilst the LED bulbs were more expensive the energy savings of having them on for a few hours per day on a regular basis means that I should be financially in front after 5 years or so, and the LED bulbs have a much longer predicted lifespan.

With that good experience under my belt, I started to wonder if there were other bulbs I should consider replacing in my flat.  The top contenders are the lounge standard lamp that is on for a few hours every evening, my bedside light (ditto) and the outside light above my front door (which could really do with a brighter light with no warm up whilst I'm trying to go up or down my iron staircase). As a result of discussions at the Footpaths Group at Loughborough University I started to wonder what the embodied energy of the various bulbs is and that's where things got alot more complicated.

Embodied energy is the energy required to actually make and distribute the product. The more complex the processing required to make a product and/or the more raw materials requiring high energy processing, the higher the embodied energy is.  The US Government funded an analysis of the embodied energy in different types of bulbs:

  • Incandescent bulbs require an average of 42MJ per 20 million lumen hours,
  • CFLs require an average of 170MJ per 20 million lumen hours,
  • Current LEDs require an average of 343MJ per 20 million lumen hours.
The "MJ per 20 million lumen hours" might seem to be a rather odd set of units, but it is basically used to standardise the amount of energy (MJ - mega-joules) over a fixed light output (the "per 20 million lumen hours") irrespective of the actual light output of the resulting bulbs.  This lets you compare the embodied energy required to replace, for example, a single very bright incandescent bulb with several CFLs or LEDs with lower light outputs (in lumens).

Now this looks bad for LEDs but the same report also shows the energy used actually lighting the bulbs. The traditional bulb consumes 15,100 MJ per 20 million lumen hours, the CFLs use up 3780 MJ per 20 million lumen hours and current LEDs sip just 3540 MJ per 20 million lumen hours.  This confirms that replacing traditional incandescent bulbs with either CFLs or LEDs is a good thing to do.  Even though both CFLs and LEDs have higher embodied energy, they consume about a fifth of the energy required to provide the standardised light output, and the energy used in lighting the incandescent bulbs dwarfs the embodied energy.

The tricky call is replacing CFLs with current LEDs though.  Whilst the energy used in powering the LEDs is 240MJ less per 20 million lumen hours, they require 173MJ more to make.  So they do win out in the end energy wise but the break even point comes rather late in their life.

I'm probably still going to replace my high use CFLs with LEDs.  However waiting a while may help: mains powered LEDs are still a relatively young technology and the energy use, embodied energy and prices are all likely to fall over the next few years.  My existing CFLs are still pretty good, so its probably best to wait until they break, and then make the switch to LEDs.

Saturday, 30 November 2013

LibCampUK 13 - the highlights for me

I've just spent the day in the brilliant new Library of Birmingham building at the LibCampUK13 "unconference". This is a meeting of librarians, library staff, library consultants, library suppliers and even a few of us lowly techies allowed out into the light from our basements. It being an "unconference" the agenda is created on the fly on the day from things that the attendees want to talk about. Its not about presenting papers or holding workshops - its about sitting around in huddles sharing problems, telling stories and swapping ideas. Its manic, chaotic and absolutely fantastic. It being full of librarians there was also plenty of cake on hand (including a competition won by a lady who had made a superb Moomin cake).

This blog post serves by way of a memory jogger for some of the useful things I came across during the day. There was so, so, so much more than I can record here as there were five or so parallel threads going on. You were encourage to "vote with your feet" and move between threads during each session if you got bored or wanted more variety, but I found all the groups I attended engaging and so stayed put!

My first session was on social media use in libraries. This was a really popular topic - so much so that there were two separate groups discussing it simultaneously. In our group I learnt some really useful tips that the social media aware folk are using (including a lady who works for a pub chain rather than a library service!). For example tweeting events that are in your local area that you don't run but which might be of interest to your followers both gets your tweets retweeted more widely and thus attract new followers, as well as having the event organisers follow you and retweet some of your messages by way of return. Location based searches can be useful as well - see who is talking about topics you are interested in your geographic area and then target their conversations with your own replies. Social media analytics are of interest to many: can they be sure that the effort that they put into social media interactions is actually reaching the desired target markets? Keeping up with the various social media services is also an issue: although Twitter and Facebook are biggies, Pinterest, LibraryThing and Tumblr are also used (hardly anyone seems to care about Google Plus though!). Different social media are used by different groups and even age isn't a sure fire targeting mechanism (some schools say students are into Tumblr as the latest thing but another school librarian said her students viewed it as a bit last year and were all over Instagram now). Some sites have issues with some (or all!) social media being blocked - useful to bear in mind if you're trying to reach certain groups (schools and NHS especially).

After grabbing a quick coffee and trying to grab a charge on my laptop and phone, I headed upstairs to the Open Archives session. It was already in full swing when I crept in and I was surprised to hear that some educational institutions still seem to under value open archives or data repositories as a way of spreading the message about their research (despite them being happy to send data to folk who do manage to seek them out). RCUK mandates of archiving of data supporting publications and Gold/Green journal article publishing with institutional repositories is helping, as are some JISC initiatives. There's lots of active work in this area though so its a "hot topic" at the moment. One chap said he was from FE and there was a large and mostly untapped market for repositories in FE colleges. Some discussion of open data and the benefit it provides for "mash ups" (especially if library folk are hacking on open source code).

Next was lunch, followed by three more sessions. The first afternoon session I attended was on digitisation. Some interesting work being done on private digitisation initiatives, especially for things like maps (which the chap who pitched and initiated the session was really into). Some discussion on the +/- aspects of things like Google Books: I was on the +ve side as we've used it in LORLS reading lists and its been really useful and popular, but some complaints over lack of transparency on quality of OCR behind the page scans (which I can understand as that's an expensive thing to do and probably isn't Google's primary aim at the moment). Heard about a group of heritage conservation volunteers called NADFAS who had help digitise and preserve works in some special libraries (though it needs librarian input to ensure metadata about digital objects are captured).

Back in the main theatre the middle session of the afternoon I dropped into was about gadgets, a topic close to my techie heart. Most folk in the group held up smart phones or tablets and said lots of their users had them. Some talk about managers buying "iPads" without any real idea how they would be loaned out or to who. Some sites have issues with setting up shared tablets as the software eco-systems on them don't really encourage it, whereas others (ones using "bump-in-the-wire" wireless portals for network authentication) have fewer issues. I asked if other sites had any great solutions to students trailing power leads everywhere (as policies and telling them off don't really work): one chap said that even their new sofas had power sockets in the arms and all tables had power sockets. I managed to also slip in a mention that NFC capable phones/tablets can also pick up RFID tags which seemed to interest several folk!

 I then stayed put for the last session of the day which in my group was on open source. The immediately useful take home for me was Library Box, which is a content hosting wifi hotspot that I'd not come across before. Great for providing educational/library resources in "pop up" environments, especially where there isn't decent Wifi or 3G coverage (eg book events in public parks). Some discussion about appropriate open source software for managing small library catalogues: I suggested Koha but one of the facilitators suggested it was too complex for really small libraries and she'd made good use of Drupal with cataloguing extensions. Another chap was looking for suggestions for school data repositories - Dspace and Eprints were mentioned but again may be too complex to set up and maintain, whereas a CMS like Wordpress might work fine and be more familiar to school teachers.

So some great stuff there, and so much more in the other sessions I didn't get to (and probably in the bar after the meeting which I didn't go to either). LibCamp is definitely on my list to attend again next year... assuming they let Shambrarians like me slip in again!

Wednesday, 27 November 2013

Goodreads, Perl and Net::OAuth::Simple

Part of my day job is developing and gluing together library systems.  This week I've been making a start on doing some of this "gluing" by prototyping some code that will hopefully link our LORLS reading list management system with the Goodreads social book reading site.  Now most of our LORLS code is written in either Perl or JavaScript; I tend to write the back end Perl stuff that talks to our databases and my partner in crime Jason Cooper writes the delightful, user friendly front ends in JavaScript.  This means that I needed to get a way for a Perl CGI script to take some ISBNs and then use them to populate a shelf in Goodreads. The first prototype doesn't have to look pretty - indeed my code may well end up being a LORLS API call that does the heavy lifting for some nice pretty JavaScript that Jason is far better at producing than I am!

Luckily, Goodreads has a really well thought out API, so I lunged straight in. They use OAuth 1.0 to authenticate requests to some of the API calls (mostly the ones concerned with updating data, which is exactly what I was up to) so I started looking for a Perl OAuth 1.0 module on CPAN. There's some choice out there! OAuth 1.0 has been round the block for a while so it appears that multiple authors have had a go at making supporting libraries with varying amounts of success and complexity.

So in the spirit of being super helpful, I thought I'd share with you the prototype code that I knocked up today.  Its far, far, far from production ready and there's probably loads of security holes that you'll need to plug.  However it does demonstrate how to do OAuth 1.0 using the Net::OAuth::Simple Perl module and how to do both GET and POST style (view and update) Goodreads API calls.  Its also a great way for me to remember what the heck I did when I next need to use OAuth calls!

First off we have a new Perl module I called Goodreads.pm. Its a super class of the Net::OAuth::Simple module that sets things up to talk to Goodreads and provides a few convenience functions. Its obviously massively stolen from the example in the Net::OAuth::Simple perldoc that comes with the module.

#!/usr/bin/perl

package Goodreads;

use strict;
use base qw(Net::OAuth::Simple);

sub new {
    my $class  = shift;
    my %tokens = @_;

    return $class->SUPER::new( tokens => \%tokens,
                               protocol_version => '1.0',
                               return_undef_on_error => 1,
                               urls   => {
                                   authorization_url => 'http://www.goodreads.com/oauth/authorize',
                                   request_token_url => 'http://www.goodreads.com/oauth/request_token',
                                   access_token_url  => 'http://www.goodreads.com/oauth/access_token',
                               });
}

sub view_restricted_resource {
    my $self = shift;
    my $url  = shift;
    return $self->make_restricted_request($url, 'GET');
}

sub update_restricted_resource {
    my $self = shift;
    my $url          = shift;
    my %extra_params = @_;
    return $self->make_restricted_request($url, 'POST', %extra_params);
}

sub make_restricted_request {
    my $self = shift;
    croak $Net::OAuth::Simple::UNAUTHORIZED unless $self->authorized;

    my( $url, $method, %extras ) = @_;

    my $uri = URI->new( $url );
    my %query = $uri->query_form;
    $uri->query_form( {} );

    $method = lc $method;

    my $content_body = delete $extras{ContentBody};
    my $content_type = delete $extras{ContentType};

    my $request = Net::OAuth::ProtectedResourceRequest->new(
        consumer_key     => $self->consumer_key,
        consumer_secret  => $self->consumer_secret,
        request_url      => $uri,
        request_method   => uc( $method ),
        signature_method => $self->signature_method,
        protocol_version => $self->oauth_1_0a ?
                                   Net::OAuth::PROTOCOL_VERSION_1_0A :
                                   Net::OAuth::PROTOCOL_VERSION_1_0,
        timestamp        => time,
        nonce            => $self->_nonce,
        token            => $self->access_token,
        token_secret     => $self->access_token_secret,
        extra_params     => { %query, %extras },
        );
    $request->sign;
    die "COULDN'T VERIFY! Check OAuth parameters.\n"
        unless $request->verify;

    my $request_url = URI->new( $url );

    my $req = HTTP::Request->new(uc($method) => $request_url);
    $req->header('Authorization' => $request->to_authorization_header);
    if ($content_body) {
        $req->content_type($content_type);
        $req->content_length(length $content_body);
        $req->content($content_body);
    }

    my $response = $self->{browser}->request($req);
    return $response;
}
1;

Next we have the actual CGI script that makes use of this module. This shows how to call the Goodreads.pm (and thus Net::OAuth::Simple) and then do the Goodreads API calls:

#!/usr/bin/perl

use strict;
use CGI;
use CGI::Cookie;
use Goodreads;
use XML::Mini::Document;
use Data::Dumper;

my %tokens;
$tokens{'consumer_key'} =  'YOUR_CONSUMER_KEY_GOES_IN_HERE';
$tokens{'consumer_secret'} = 'YOUR_CONSUMER_SECRET_GOES_IN_HERE';

my $q = new CGI;
my %cookies = fetch CGI::Cookie;

if($cookies{'at'}) {
    $tokens{'access_token'} = $cookies{'at'}->value;
}
if($cookies{'ats'}) {
    $tokens{'access_token_secret'} = $cookies{'ats'}->value;
}

if($q->param('isbns')) {
    $cookies{'isbns'} = $q->param('isbns');
}


my $oauth_token = undef;
if($q->param('authorize') == 1 && $q->param('oauth_token')) {
    $oauth_token = $q->param('oauth_token');
} elsif(defined $q->param('authorize') && !$q->param('authorize')) {
    print $q->header, 
    $q->start_html,
    $q->h1('Not authorized to use Goodreads'),
    $q->p('This user does not allow us to use Goodreads');
    $q->end_html;
    exit;
}

my $app = Goodreads->new(%tokens);

unless ($app->consumer_key && $app->consumer_secret) {
    die "You must go get a consumer key and secret from App\n";
}       

if ($oauth_token) {
    if(!$app->authorized) {
        GetOAuthAccessTokens();
    }
    StartInjection();
} else {
    my $url = $app->get_authorization_url(callback => 'https://example.com/cgi-bin/good-reads/inject');
    my @cookies;
    foreach my $name (qw(request_token request_token_secret)) {
        my $cookie = $q->cookie(-name => $name, -value => $app->$name);
        push @cookies, $cookie;
    }
    push @cookies, $q->cookie(-name => 'isbns',
                              -value => $cookies{'isbns'} || '');
#    print $q->redirect($url);
    print $q->header(-cookie => \@cookies,
                     -status=>'302 Moved',
                     -location=>$url,
                     );
}

exit;

sub GetOAuthAccessTokens {
    foreach my $name (qw(request_token request_token_secret)) {
        my $value = $q->cookie($name);
        $app->$name($value);
    }
    ($tokens{'access_token'}, 
     $tokens{'access_token_secret'}) = 
         $app->request_access_token(
                                    callback => 'https://example.com/cgi-bin/goodreads-inject',
                                    );
}

sub StartInjection {
    my $at_cookie = new CGI::Cookie(-name=>'at',
                                    -value => $tokens{'access_token'});
    my $ats_cookie = new CGI::Cookie(-name => 'ats',
                                     -value => $tokens{'access_token_secret'}
                                     );
    my $isbns_cookie = new CGI::Cookie(-name => 'isbns',
                                       -value => '');
    print $q->header(-cookie=>[$at_cookie,$ats_cookie,$isbns_cookie]);
    print $q->start_html;

    my $user_id = GetUserId();
    if($user_id) {
        my $shelf_id = LoughboroughShelf(user_id => $user_id);
        if($shelf_id) {
            my $isbns = $cookies{'isbns'}->value;
            print $q->p("Got ISBNs list of $isbns");
            AddBooksToShelf(shelf_id => $shelf_id,
                            isbns => $isbns,
                            )
        }
    }
        
    print $q->end_html;
}

sub GetUserId {
    my $user_id = 0;
    my $response = $app->view_restricted_resource(
                                                  'https://www.goodreads.com/api/auth_user'
                                                  );
    if($response->content) {
        my $xml = XML::Mini::Document->new();
        $xml->parse($response->content);
        my $user_xml = $xml->toHash();
        $user_id = $user_xml->{'GoodreadsResponse'}->{'user'}->{'id'};
    }
    return $user_id;
}

sub LoughboroughShelf {
    my $params;
    %{$params} = @_;

    my $shelf_id = 0;
    my $user_id = $params->{'user_id'} || return $shelf_id;
    
    my $response = $app->view_restricted_resource('https://www.goodreads.com/shelf/list.xml?key=' . $tokens{'consumer_key'} . '&user_id=' . $user_id);
    if($response->content) {
        my $xml = XML::Mini::Document->new();
        $xml->parse($response->content);
        my $shelf_xml = $xml->toHash();
        foreach my $this_shelf (@{$shelf_xml->{'GoodreadsResponse'}->{'shelves'}->{'user_shelf'}}) {
            if($this_shelf->{'name'} eq 'loughborough-wishlist') {
                $shelf_id = $this_shelf->{'id'}->{'-content'};
                last;
            }
        }
        if(!$shelf_id) {
            $shelf_id = MakeLoughboroughShelf(user_id => $user_id);
        }
    }
    print $q->p("Returning shelf id of $shelf_id");
    return $shelf_id;
}

sub MakeLoughboroughShelf {
    my $params;
    %{$params} = @_;

    my $shelf_id = 0;
    my $user_id = $params->{'user_id'} || return $shelf_id;

    my $response = $app->update_restricted_resource('https://www.goodreads.com/user_shelves.xml?user_shelf[name]=loughborough-wishlist',
                                               );
    if($response->content) {
        my $xml = XML::Mini::Document->new();
        $xml->parse($response->content);
        my $shelf_xml = $xml->toHash();
        $shelf_id = $shelf_xml->{'user_shelf'}->{'id'}->{'-content'};
        print $q->p("Shelf hash: ".Dumper($shelf_xml));
    }
    return $shelf_id;
}

sub AddBooksToShelf {
    my $params;
    %{$params} = @_;

    my $shelf_id = $params->{'shelf_id'} || return;
    my $isbns = $params->{'isbns'} || return;
    foreach my $isbn (split(',',$isbns)) {
        my $response = $app->view_restricted_resource('https://www.goodreads.com/book/isbn_to_id?key=' . $tokens{'consumer_key'} . '&isbn=' . $isbn);
        if($response->content) {
            my $book_id = $response->content;
            print $q->p("Adding book ID for ISBN $isbn is $book_id");
            $response = $app->update_restricted_resource('http://www.goodreads.com/shelf/add_to_shelf.xml?name=loughborough-wishlist&book_id='.$book_id);
        }
    }
}


You'll obviously need to get a developer consumer key and secret from the Goodreads site and pop them into the variables at the start of the script (no, I'm not sharing mine with you!). The real work is done by the StartInjection() subroutine and the subordinate subroutines that it then calls once the OAuth process has been completed. By this point we've got an access token and its associated secret so we can act as whichever user has allowed us to connect to Goodreads as them. The code will find this user's Goodreads ID, see if they have a bookshelf called "loughborough-wishlist" (and create it if they don't) and then add any books that Goodreads knows about with the given ISBN(s). You'd call this CGI script with a URL something like:

https://example.com/cgi-bin/goodreads-inject?isbns=9781565928282

Anyway, there's a "works for me" simple example of talking to Goodreads from Perl using OAuth 1.0. There's plenty of development work left in turning this into production level code (it needs to be made more secure for a start off, and the access tokens and secret could be cached in a file or database for reuse in subsequent sessions) but I hope some folk find this useful.

Friday, 22 November 2013

Post nuclear differences

In the wake of the Fukushima Daiichi nuclear power station disaster in early 2011 both Japan and Germany changed their stance on nuclear power generation. Some nuclear plants were shut down immediately and the rest will most likely be decommissioned with the next decade.  Both countries appeared to have widespread public support for this radical change in their national energy policy.
Solar city, science park, Gelsenkirchen.
Source: Green Baroque Ins. Flickr under Creative
Commons CC BY-NC 2.0 Licence 

The effect these decisions have had on these two nations response to climate change is interesting.  Germany was already well into building out its solar & wind based renewable generation capacity before the earthquake and tidal wave wrecked the reactors in Japan. With widespread community involvement in the investment in renewables, and helpful financial and regulatory environment provided by the German authorities,  they've been able carry this forward.  They've still got fossil fuels in their mix but they do still seem to be on target for their carbon emissions targets.  Germany already had a strong anti-nuclear movement and was planning on phasing out nuclear by 2036 anyway so this event really accelerated that timetable.

Japan on the other hand have just announced during the UN COP19 climate change talks that they were going to have to substantially reduce their existing emissions reduction target.  They are building renewable generating capacity of course - practically every developed nation is.  However it will not be enough to cope with losing all the nuclear generating capacity that they are removing,  which prior to March 2011 contributed around 30% of their total generating capacity.  They are having to turn to increasing use of imported fossil fuels as oil, coal and gas to supply their electricity.

I was wondering what we could learn from the different outcomes arising from what, at first, appear to be very similar decisions.  Germany had something of a head start as they were already aggressively building solar PV & wind generators. But they also have a geographic  advantage over Japan: Germany is bigger with more land available.  Solar & wind both have low "energy density" so to get a decent amount generated you need alot of them covering lots of roofs & land. Japan is a relatively crowded country so space is at a much higher premium.  As a comparison Japan is 39th in the population density league table whereas Germany is 58th.  Japan does have potential for many gigawatts of renewable power generation though, as it has amply space in the seas around it for large scale off-shore wind farms.  There does appear to be the need to encourage more community involvement and investment in on-shore renewables though.
Fukushima Unit 4 with cranes working on 
stabilizing the site. Source: IAEA Imagebank under 
Creative Commons CC BY-NC-ND 2.0 Licence

Both nations have to bear the costs of decommissioning their nuclear infrastructure, which will mostly likely be a long and expensive task.  Again Germany has an advantage - it only had 17 nuclear power stations operating prior to March 2011 whereas Japan had over 50.  Germany was already well into decommissioning quite a few reactors, especially from the former East Germany.

Japan also has the expense and difficulty of cleaning up Fukushima itself to deal with. That's going to be a big drain on the resources of both its owner Tepco and the Japanese government. The clean up may well be competing for funds, people and time required to ramp up construction of  renewables, even though those renewables are part of the solution to the overall problem. Indeed one wonders if the exclusion zone around Fukushima might well end up being a good place to site renewables with their relatively low maintenance requirements (so fewer people have to spend less time in the potentially more radioactive areas).  At least they might provide some economic payback to the people whose land is otherwise now worthless.

Japan's economy has taken some serious blows over the last few years, which also puts them at a disadvantage against Germany. Germany is the economic power house of the EU, and so it can afford to invest in the capital cost of renewables. Indeed its a positive cycle for the Germans: the more renewables they can invest in the more insulated they are from fossil fuel price rises, which improves their competitiveness and increases their income, part of which they can invest in more renewables.  Japan has the opposite problem - its emergency switch to large scale fossil fuels to replace the nuclear power stations is costing the Japanese power companies an extra 3.6 trillion yen in 2013 over the costs in 2010 before the disaster.  Things are likely to get worse for Japan before they start to get better.

There is one overarching "take home message" I pick up from the different reaction to the change in energy policy in the two countries.  The sooner a nation starts to make a large scale switch to distributed renewable power generation, the better placed it is likely to be to deal with sudden, external changes in traditional centralized power generation.  In this case it was the rapid removal of all nuclear capacity but in the future who knows what it will be?  Gas pipelines cut off as part of national sabre rattling? Wars leading rapid price rises in global oil prices? Coal shipments being disrupted by industrial unrest?  All of these could affect national grids that rely too heavily on one particular fuel source, especially if that fuel is controlled by others.  We all need to be investing in clean, distributed energy generation to make our nations, towns, cities and communities more resilient in the face of these unexpected changes.

Saturday, 9 November 2013

Replacing Green Levies with Brown Ones

There's been much talk in the UK media and within political circles recently about the costs associated with so called "green levies".  These are additional costs added to energy bills to help fund climate change mitigations such as increased power production from renewable sources, carbon reduction strategies and the all important energy efficiency measures for low income and vulnerable groups in society.  The principle is that the more energy you use, the more you end up paying to help turn that energy generation into a cleaner, greener form and help poorer folk save energy.

Now some people are campaigning that these levies need to be reduced or removed completely and/or moved to general taxation.  The rising energy prices from the Big Six energy companies are hitting the "hard working" people of the UK and some politicians are sensing a quick, popular vote winner in appearing to do something to cut these bills.  Moving some of the green funding measures to general taxation is probably the most progressive option as it moves the cost towards those who can afford to pay more, even if they themselves have already reduced their energy demands. Of course that might be rather unpopular with people in power who tend to pay more of such taxes, and there is a bit of recent history of socially responsible tax payer funded schemes facing the axe.

But what if these green levies are removed completely and we succeed in stalling UK plc's green economy?  Not only will that affect quite a lot of jobs (many in the private section - that bit of the market place that is supposed to be pulling us out of economic doldrums) but it will also mean there will be less investment being made in climate change mitigation technologies, and we'll also end up putting a lot more CO2 into the atmosphere as a result.  We may well find that it becomes impossible to meet our legally binding targets on carbon emissions, which may have some direct economic costs if we're fined or foreign competitors manage to lock the "dirty man of Europe" out of future deals.

One argument put forward by those wishing to remove the green levies is that they don't think that climate change, global warming, call it what you will, is a man-made or even man-influenced effect.  To them it doesn't really matter how much CO2 or other greenhouse gases we emit, the climate will just do its own thing, and actually it will just fluctuate a bit and really we can all just carry on with business as usual.  Ignore the "ecomentalists" and get on with a continuation of 20th Century life into a bright, energy guzzling future.

Unfortunately people with such views currently seem to hold some of the reins of power in the UK, so there's a distinct possibility that at least some of the climate change mitigation funding may be lost.  If that does come to pass, I'd like to propose something to replace them: "brown levies".  Such levies will not be used to fund climate change mitigation strategies but instead fund climate change adaptation strategies. For example such things as building better sea defences, increasing the use of permeable paving systems in urban areas to reduce flooding, covering more of the UK countryside with polytunnels or glasshouses to reduce weather event effects on agriculture, etc, etc.

Some of that is happening now, but at a relatively low level, so the brown levy wouldn't need to be large to start with, but we do need to fund it.  At the moment what funding there is coming from disparate sources such as water bills, council taxes and general taxation, but it is hidden away rather that splashed all over the front pages.  Lets bring it out into the light as a nice, visible set of costs in the same way that the green levies have been brought centre stage by having them bundled together in energy bills.  That way people can see what they have to pay to adapt to climate change.  What goes into the levies could be given to one of Parliament's climate change committees to look after, or be debated every year in the House.

If the climate change deniers are right, the brown levies will stay small, and possibly even reduce as the climate swings naturally back to a late 19th/early 20th century.  Nothing will need to be decided on by Parliament and everyone gets to laugh and point at members of the the Green Party, Friends of the Earth and Transition Towns.  The worst that will happen is that we'll have funded some useful short term environmental protections in coastal towns and flood plains which will have reduced their insurance costs and protected some local industries.  The sort of thing we've been doing for years.

Of course if those folk from the Green Party, Friends of the Earth and Transition Towns are right about man made climate change, and the climate deniers in power right now do manage to wreck the current green levies funding climate change mitigation strategies, then those brown levies will have to go up over time.  And up.  And up.  Adapting to global climate change, even with the moderate changes we're likely to see in the UK, is likely to be very expensive.  Possibly more expensive than the cost of mitigating climate change in the first place.  And of course you'll also be paying for the higher priced fossil fuels themselves still, as UK plc won't have been made more energy efficient or built out its low carbon power generation sufficiently.  We may well be less competitive with some of our neighbours who will be more self-reliant on locally sourced power, so those increased costs will come at the same time as reduced trading incomes.  Oh, and there's those targets we won't have met to deal with as well.

So there's the glove slapped down to the climate change deniers in power trying to reduce green levies: put your (and everyone else's) money where your mouths are and agree to introduce legally binding climate adaptation brown levies if you remove climate mitigation green levies.  What do you, in your world view, have to lose after all?