I Want My New EV (with apologies to Dire Straits)

I’ve hit a wall with this, so please take it and do with it as you will.

Mileage for Nothing

Sung to “Money for Nothing” by Dire Straits

I.. Want.. My.. New.. E.. V..

Now look at them yo-yos that’s the way you do it
You charge the batt’ries on the New EV
That ain’t workin’ that’s the way you do it
Mileage for nothin’ and road tax for free

Now that ain’t workin’ that’s the way you do it
Lemme tell ya them guys ain’t dumb
Maybe get a blister on your little finger
Maybe get a blister on your thumb

We gotta refine hydro-carbons
Middle Eastern deliveries
We gotta drill these oil fields
We gotta pump this petroleum

That JB Straubel with the tesla and the sedan
Yeah buddy that’s his own hair # alt. he’s the CTO
That JB Straubel got his own jet airplane
That JB Straubel he’s a millionaire

Gotta install hybrid drivetrains
Epicyclic planet’ries
We gotta drop these carbon emissions
We gotta up these MPGs

I shoulda learned the AC motor
I shoulda learned them lithiums
Look at that mama, she got it stickin’ in the outlet
Man we could have some
And he’s up there, what’s that? Hawaiian noises?
Bangin’ on the bongos like a chimpanzee

Oh, that ain’t workin’ that’s the way you do it
Get your mileage for nothin’ get road tax for free

We gotta install hydrogen fuel cells # Timing not quite right
Proton exchange membrane
We gotta use these electrolyzers
We gotta move this Clarity

Look a’ here that ain’t workin’ that’s the way you do it
You charge the batt’ry on your new EV
That ain’t workin’ that’s the way you do it
Mileage for nothin’ and road tax for free
Mileage for nothin’ and tax for free
Mileage for nothin’ and your tax for free
Look at that, look at that
Mileage for nothin’ and your tax for free
I want my, I want my, I want my new EV
Mileage for nothin’ and tax for free (Fade)
I want my, I want my, I want my new EV

MPGe of an electric car, revisited

Last year in MPGe of an electric car I attempted to compare the carbon emissions of the BMW Mini-E, and my own Ford Sport Ka. The result was 212 g/km (30 MPGe) for the Mini-E charged from coal, and 172 g/km for my Sport Ka (37 MPGe). In retrospect, the comparison was far too rough to draw conclusions from. This post is an attempt to correct that.

This morning the Today Programme on Radio 4 covered the news that the Nissan Leaf electric car is to be built in Sunderland. In a piece Evan Davis asked the BBC Business Reporter whether the electric car would really reduce carbon emissions. Here is a partial transcript:

Evan Davis:
Coming briefly back to the electric car in Sunderland. You talked about the rollout of a way of getting it recharged. Nissan will make much of the idea that it is a low carbon car, but of course it relies on electricity, which comes from the National Grid, and the National grid is powered by… whatever, coal fired power stations. Is it really a low carbon car, or is it masquerading?
John Moylan:
Well I suppose it depends where you see our wider energy system in the decade to come. The government has decided that it wants nuclear to be a big part of that, it has also announced major plans for off shore wind. So in the future the shape of electricity generation could look very different in the UK, it could have a more low carbon base, and that would link into making people who buy electric vehicles more comforatable about where the energy is coming from.

This provoked a quick AudioBoo response from Robert Llewellyn. Clearly annoyed at Radio 4 he said

The Toyota Prius which I drive regularly and record CarPool in produces between 80 and 90 grams of CO₂ per kilometer. The next cleanest cars are all in the 120-150 mark, that’s most small saloon cars. Anything with a slightly bigger engine it’s up in the 200 – 300 grams per km.

An electric car like the Nissan Leaf plugged directly into a coal burning electricity plant, somewhere like Didcot or Drax B up in Yorkshire. Those huge coal burning plants that burn millions of tonnes of coal every day. They burn that coal incredibly efficiently. It is on a massive scale, it’s not like 10 million tailpipes from lots and lots of clanking internal combustion engines. It’s very simple and that electricity goes into the car where it is used incredibly efficiently.

So even if you charge an electric car from a coal burning, unfiltered power station you release between 40 and 45 grams per km, in comparison to the 90 of the Prius, and the 120-150 of the very small econobox diesel/petrol car, to 350 grams/km for the Porsche Cayenne (oh how I love that car).

Today listeners might have have left thinking that electric car and conventional car emissions are on par, but Robert’s numbers put electric car emissions (even on coal) at half that of a Prius. There is a clear discrepancy.

In Februrary Mike Boxwell (author of Owning an Electric Car) performed a direct test. He drove 2 conventional and 2 electric cars along the same route and measuring their respective energy use:

In his test the electric cars charged from the National Grid both emitted 50 g/km, whilst the conventional cars emitted 137 and 155 g/km tank-to-wheel. The same electric cars emitted 131 and 140 g/km charged from coal. I compared Mike’s numbers to my own to arrive at the following tables:

REVA
G-Wiz
Mitsubishi
i-Miev
BMW
Mini-E
Distance travelled (km) 22.6 22.6 100.0
Electricity used (kWh) 2.99 3.19 20.63
Electrical eff. (kWh/km) 0.13 0.14 0.21
Elec. Emissions, grid (g/kWh CO₂) 375.2 351.2
Elec. Emissions, coal (g/kWh CO₂) 1056.2 927.9 1028.8
Car emissions, grid (g/km CO₂) 49.7 49.7
Car emissions, coal (g/km CO₂) 140.0 131.2 212.2
Toyota
Aygo
Fiat
Panda
Ford
Sport Ka
Distance travelled (km) 22.6 22.6 492.4
Fuel used (l) 1.33 1.51 37.60
Fuel eff. (l/km) 0.059 0.067 0.076
Fuel emissions, ttw (g/l CO₂) 2315.0 2314.9 2246.0
Fuel emissions, wtw (g/l CO₂) 2789.6 2789.4
Emissions, ttw (g/km CO₂) 136.5 154.9 171.5
Emissions, wtw (g/km CO₂) 164.5 186.7

The difference came down to how many units of electricity (kilowatt hours/km) were used by the electric car. Not having one to test myself I had used the EPA combined cycle figure for the Mini-E, which represents a very harsh driving style with many stop-starts. Mike’s direct measurements, however used his own driving style in all cases. The EPA figure for the Mini-E (0.21 kWh/km) is 1.5 times Mike’s highest (0.14 kWh/km). Mike’s test produces the fairest comparison, and it’s his numbers that should be used over my flawed comparison. It does show though, how critical driving style is to carbon emissions. Driving an electric car very aggressively, will make it perform worse than a conventional car driven conservatively.

Coming back to the Nissan Leaf, why did the BBC interviewer suggest it wouldn’t reduce carbon emissions? Most likely because that’s the public’s impression, that the power to charge electric cars comes mostly from coal. This impression is wrong, as I write this only 29.5 % of electricity in the UK is coming from coal, you can see the current carbon footprint of the National Grid for yourself.

Robert’s number of 45 g/km is correct for an electric car charged from the UK national grid, but not for a fictional car plugging straight into Drax or Didcot coal power station. It was 7:30 though, so such slips are forgivable.

Hacker Culture and geek groups in Birmingham, West Midlands

Birmingham has a vibrant community of geek/enthusiast groups, of which I’m proud to be a part. That said, it’s sometimes hard to find or even know about all of them, without the right. So collected here are the groups I know of:

Birmingham LUG
Linux User Group that meets at the University of Birmingham, on the third Thursday of each month. Meetings are usually a technical talk, followed by a drink at the bar on campus.
Birmingham Perl Mongers
Perl user group that meets in Birmingham, twice each month alternating between technical and socials. Group members hosted the 2006 YAPC::Europe Perl Conference, and are major contributors to the Perl community.
Brum2600
Hacker group that meet in Birmingham, on the first Saturday of each month. Brum2600 also holds Brumcon, an annual event with speakers from around the country and Europe.
Coventry LUG
Linux User Group that meet in Coventry, twice each month for a socal on the first Tuesday and a technical meeting on the third Tuesday.
fizzPOP
A hackerspace that holds hack sessions in the centre of Birmingham, every few weeks. Hack Sessions involve electronics projects (esp. Arduino), art projects, crafts, mechanics and other varied creative activities.
Mappa Mercia
OpenStreetMap mapping group for the West Midlands. They hold mapping parties and meet regularly for socials. Members have been instrumental in mapping the West Midlands so well.
Midlands Micromouse and Robotics Club
A group that builds and competes robots to map and navigate a maze in the shortest time. Competitions are held monthly. Other robots are also featured.
Multipack
A community of web developers and designers who hold regular meetings and varied meetings in pubs and parks around Birmingham.
Paradise Circus
Group of bloggers, web developers, and social media types that meets monthly to hold a Bloggers Meet and a Social Media Surgery. The group is named after the Building that houses Birmingham Central Library.
PHP WM
PHP West Midlands group meets in the centre of Birmingham, on the second Tuesday of each month. There is usually a talk followed by discussion.
PyWM
Python user group that holds a technical meeting near to Sutton Coldfield, on the fourth Saturday of each month. There was once also a social meeting held on a Thursday, but this is not currently happening. PyWM members have organised PyCon UK and EuroPython for the past few years running.
Redditch and Bromsgrove LUG
Linux User Group that meets in Bromsgrove and Redditch, every other month on the first Thursday.
Warwick University GNU/LUG
Linux User Group that meets at the University of Warwick, each Wednesday during term time.
West Midlands Ruby User Group
Group covering the Ruby programming language and Ruby on Rails framework. They are newly started, so far meeting once in Wolverhampton and once in Birmingham.
Wolves LUG
Linux User Group that meets in Wolverhampton every second Wednesday, for socialising and the occasional talk. Wolves LUG is notable for it’s high preponderance of Ubuntu users. Members have been instrumental in organising LugRadio Live events.

EDITS: 2010-02-11 21:00 Added Multipack. 2010-02-17 Added Birmingham Micromouse.

MPGe of an electric car

Does an electric car gets better or worse mileage than a conventional petrol or diesel car? To a large extent, it depends on what we choose to include or exclude in the calculation. We can measure the whole chain, accounting for every step in the process of extraction, refinement, transportation and use – a well to wheel model. Or more easily, and less accurately, we can account only for burning the fuel – a tank to wheel model. A tank to wheel module is what I shall use here to compare 2 cars (one petrol and one electric) on:

  • Direct fuel/charge cost per mile
  • Carbon dioxide (CO2) emitted per mile

Petrol Car

First the petrol car, for which I’ll be using my Ford SportKa. At it’s last fill this car used 37.6 litres of petrol to drive 306 miles, thus obtaining 37 mpg.

So fuel cost is easy:

(37.6 l / 306 miles) * 105 p/l = 12.9 pence/mile.

CO2 emissions for a car are:

(Mass of fuel burnt * Proportion of carbon * Relative mass of CO2) / Distance

Density of petrol is 0.72 kg/l, and by mass it contains approx 85 % carbon [wp:Gasoline]. Each carbon atom has an atomic mass of 12, and combines with 2 oxygen atoms with atomic mass 16. So 12 kg of carbon (C) burns to make 12 + 16 + 16 = 44 kg of CO2, or 3.67 kg/kg.

So CO2 emitted is:

(37.6 litres * 0.72 kg/l * 0.85 * 3.67 kg/kg) / 306 miles =  275 g/mile

Electric Car

All the emissions of the electric car happen at the power station, so the calculation is more involved. For this I shall use the BMW Mini E. The Mini E has a quoted energy use of 20 kWh/100 km or 0.323 kWh/mile [mini_e]. This makes the direct fuel cost

0.323 kWh/mile *9.8 p/kWh = 3.1 p/mile.

The CO2 emissions follow the same formula as a petrol car:

(Mass of fuel burnt * Proportion of carbon * Relative mass of CO2) / Distance

The mass of fuel burned is given by:

Electricity used / (Fuel energy density * Power plant efficiency * Grid efficiency)

Referring to the Digest of UK Energy Statistics (DUKES) 2008, coal has a gross energy density of 25.4 GJ/tonne, or 7.05 kWh/kg [dukes08]. Coal burnt in 2007 by Drax – the UK’s largest coal fired power station station – was 60 % carbon [draxenv:table7]. The relative mass of CO2 remains the same. Coal plants in the UK were overall 33 % efficient in 2008, and grid losses were about 8 % [dukes08]. So:

0.323 kWh/mile / (7.05 kWh/kg * 0.33 * 0.92) = 151 g/mile of coal.

Working through:

0.151 kg/mile * 0.60 * 3.67 kg/kg = 332 g/mile of CO2.

Results

To my surprise, based on emissions a 37 mpg petrol car beats an electric car run exclusively on coal. The MPGe is only 30.6 mpg.

Based on cost an electric car run on electricity costing 9.8 p/kWh gets an MPGe of 154 mpg.

Considerations

Such numbers are very sensitive to the assumptions made. For instance if the same car is powered exclusively by natural gas, then the MPGe is nearer 65 mpg, because gas emits less than half the CO2/kWh of coal. If the petrol car were filled at US prices, the cost based MPGe would be much lower.

I would love to improve upon these simple calculations. Please try the numbers with your own figures and post the results for comparison. If I’ve made a bad assumption, or calculations errors, or if you have other sources please let me know.

Here are the assumptions I used, primarily to keep things simple, secondly to make it unfair to the electric car:

  • Manufacturing, maintenance, component replacement, insurance, tax, congestion charges, parking and battery replacement are excluded.
  • Extraction, refinement and transportation of petrol/diesel is excluded, as is extraction and transport of coal.
  • Electricity is generated from coal, the dirtiest of sources.
  • Gross calorific value is used for all fuels, rather than net.
  • The fuel is burnt perfectly, so all the contained carbon is emitted as CO2.
  • Electrical use by the electric car is measured at the wall socket.
  • When referred to imperial (UK) gallons, and metric tonnes are used throughout.
  • Petrol is taken to cost £1.05 per litre, and electricity 9.8p per kWh.

Electric vehicle forums and websites

There are quite a few forums on the net for electric bikes, scooters, motorcycles and cars. Mostly they cover early adopter issues, tinkering, advocacy and DIY conversions. Here are the ones I’ve been drawn to:

  • Endless Sphere, A lively forum with an emphasis on electric bikes
  • V is for Voltage Another lively forum with many posts on scooters and motorcycles, particularly the Vectrix
  • Electric Motoring A UK forum that’s relatively new, it covers mostly imported Chinese scooters
  • Battery Vehicle Society A UK site with many posts concerning electric car/van conversions, and (unsurprisingly) batteries
  • Elmoto A forum dedicated electric motorcycles and conversions
  • DIY Electric Car Forums Electric car conversions galore, including a gallery and blogs

Also for those just dipping their toe, these sites give a nice overview/introduction:

  • Autoblog Green An offshoot of the automitive news site Autoblog that covers alternative fuel and fuel efficient vehicles
  • EV World Electric vehicle news
  • EVcast Electric vehicle podcasts from the US and the UK
  • EVTV.me Video blog of a thorough BMW Mini EV conversion
  • EV Album A gallery of electric vehicles big and small, from around the world

I’m sure there are plenty more I’ve missed, please leave a comment if you know of any.

A new twist on spam?

These two messages appeared on the Spatialite mailing list today:

From: stefanobartol87453@gmail.com
Subject:Where can I find an online anti-virus that doesn’t install on your PC?
I’ve got 5 PCs that I’m trying to use to train disadvantaged young people. The problem is they are riddled with viruses and a firewall blocks me from updating them. The people in charge of maintaining the PCs won’t fix them or give me the admin password (Win XP) to let me install a new or updated antivirus the centre is being shut down in afew months.
If they were working, I could still do a lot with them, so I’ve been looking for a good online virus scan – but they all try to download a little .exe onto your PC first, and the settings on the PCs won’t allow that.
Suggestions? Solutions? Links?

The alleged reply:

From: schinicamiyake54418@gmail.com
To: Where can I find an online anti-virus that doesn’t install on your PC?
>so I’ve been looking for a good online virus scan

I usually use this one http://pmcware.conartists/freedowns

That site (address altered to protect the vulnerable) is most definitely not hosting anti-virus. In fact it’s certainly hosting malware. The page claimed that it found ‘Nuker.Win32.CGSi’ in ‘C:\WINDOWS\system32′, on my Linux laptop.

Given the site, the similarity of the email addresses, and the impossibility of a request (virus scan without any download) – I think both messages are part of the same phishing attempt. Which makes this the first time I’ve seen a spammer have a conversion with them-self.

l_1600_1200_8CF3CC3E-88A2-49FB-8FC1-2CFB30F7788F.jpeg

Electric scooter

Petrol is fantastic stuff. It’s driven modern society, to the point of defining it: dirty, but very effective. Petrol has been so popular because of it’s convenience – as a liquid it’s easy to handle; and the fantastic amount of energy it holds – about 10 kilowatt hours in each litre. That’s an amazing amount of energy, in a very small space

If the chemical energy in petrol could be be turned directly into electricity:

  • A teacup full could boil enough water for 114 cups of tea
  • A shot glass full could run my laptop for 13 hours. Compared to only 3 hours on battery.
  • A petrol pump filling my car at 45 litres/minute would have a power output of 26 megawatts. Enough to power about 58 000 UK homes.

Of course, currently we can’t turn petrol directly into electricity. Instead we run internal combustion engines with it, to power cars and generators. Car engines operate at around 20% efficiency – for every 10 kW hours (1 litre) of fuel burnt, only 2 kW hours (0.2 litres) turn the wheels. The rest is lost as heat.

Electric motors are highly efficient. Brushless DC motor are around 85% efficient – for every 10 kW hours of electricity that flow in, 8.5 kW hours turn the wheels.

Batteries however, are not nearly so great. The current leader is Lithium ion batteries, which at best achieve up to 0.5 kWh/litre (and more typically 0.25 – 0.3 kWh/l). Petrol is 20 times more energy dense than batteries (by volume).

To put it bluntly

  1. Petrol is a brilliant energy carrier. The internal combustion engine sucks at using that energy.
  2. The electric motor is a brilliant energy user. Batteries suck, at storing or delivering that energy.

What does this have to do with scooters?

Well, electric cars are just entering the market. To have a 100+ mile range, they must carry hundreds of kilos of batteries. Those batteries is expensive, and in the case of the Mini E consume the back seats. For me, the electric car is not practical yet.

Scooters are easier to electrify. They’re lighter, simpler and more practical as a supplement to a petrol car. Because there is less weight to carry, they need only a fraction (perhaps 1/5) of the batteries, so they’re only a fraction of the price.

Eco Machines Electra 2012 Review

p_1600_1200_225700FE-CFF9-4248-8E43-5C3EA409BB06.jpegl_1600_1200_8CA06209-FC72-4A03-94AF-A936AD0E7C45.jpeg

In June I bought an Eco Machines Electra 2012 scooter. An electric scooter restricted to 30 mph, with a 2 kW motor in the hub of the rear wheel. The scooter carries 8 lead acid batteries, in 2 parallel strings. Each is 12 V, giving a capacity of 40 AH at 48 V and a quoted range of 30 miles. The cost of the scooter is currently about £1000, plus delivery and a one off registration fee. A full recharge takes 8 hours, and costs no more than 25 pence.

p_1600_1200_551DA55F-E65B-4D8D-A6C9-E6B85A899C8D.jpeg

I went for the Electra because the dealer is local to me, and because of the internals. The parallel strings of batteries are to my knowledge unique with in this class of scooter, most use only 4 or 5 batteries. The wiring and motor controller are similarly up rated for better performance. Customer service from Eco Machines was great, they knew their products well.

So far I’ve been riding for 2 weeks, on a 16 mile round trip. Overall I’m happy with the scooter. It copes okay with the 40 mph dual-carriageway sections of my route, and fine with city centre streets. Acceleration is good for a 50 cc equivalent, it’s smooth off the line and reaches top speed quickly enough. I would like more acceleration off the line, for when joining large roundabouts from a stand still.

Riding a scooter is similar to riding a bicycle, minus the pedals, so experience on one is useful. The front brake is on the right handle bar, and the rear is on the left. The throttle is controlled by twisting the right handle bar, a spring returns it to 0 if the pressure is released. Lights, indicators and the horn are controlled by thumb switches. There are no gears or clutch to worry about, and nothing for your feet to do whilst on the move.

l_1600_1200_8CF3CC3E-88A2-49FB-8FC1-2CFB30F7788F.jpeg

I spend most of my journey at the scooter’s top speed. Without a top-up at work it’s top speed has reduced to about 27 mph by the time I reach home. Like all lead acid scooters, power fades as the battery discharges. I expect that on a scooter with fewer batteries, I would see much greater fade. The ‘fuel gauge’ measures the voltage of the batteries, rather than smoothly decreasing with distance it will droop when under acceleration. The amount of droop indicates the amount of charge left – more droop, less charge.

p_1600_1200_FCFC3871-67F8-4E2B-9E8F-8BCA487D2CB3.jpegl_1600_1200_4AEC2230-07B0-41C6-95B0-5B9CC98B04E2.jpeg

I’ve had no problems with the included charger, which has an aluminium housing that feels robust. I’m able to leave it unattended, as it switches off once it senses charging has completed. The charger fits in the under-seat storage with room to spare. Although the ignition switch suggests The Electra also has a glove box with enough space for a pair of gloves and some waterproofs. Mine came with a top box mounted behind the seat, this had sufficient space for an open face helmet, but not a full face helmet. The glove box and under-seat storage open with the ignition key, the top box uses a second key.

The headlights are suitable for urban use. To be more visible, I run them during the day as well as night time. I wouldn’t ride this scooter on unlit roads. The horn is nice and loud. The steering is responsive, the instruments are clear, and the front disc brake/rear drum brake are good enough for my needs

Overall I’m happy with the purchase, particularly as a gadget to tinker with. If Eco Machines had offered it, I would have gone for lithium ion batteries. When it comes time to replace the batteries, I shall look in to making the switch.

Electric Scooter Costs

The purchase price, and the electricity to run an electric scooter are not the only costs to be budgeted for. You should budget at least £500, for protective clothing and ancillary items. The following one off costs are compulsory or highly advisable:

Item Description Price range
Helmet Required by law for protection. A proper fit is essential, so be fitted in person by somebody experienced. Don’t buy second hand or by mail order. Price alone does not determine level of protection. £50 – £500+
Number plate Required by law. Must adhere to regulation size/lettering. Proof of registration required £10 – £20
Tax disc holder Required to display tax disc £15 – £20
Gloves Strongly Advised for comfort and protection. Sturdy leather on the palms and fingers is important £10 – £80
Jacket Advised for comfort and protection. Leather or polyester fabric with ‘CE armour’ shoulder and elbow pads. Some have thermal and waterproof lining £60 – £300+
CBT Compulsory Basic Training required by law unless a pre-2001 car licence holder, but then still strongly advised. Lasts 1 day, teaches the basics £90 – £120
Trousers Advised for comfort and protection. Leather or polyester, with ‘CE armour’ knee pads and padding. Some have thermal and waterproof lining £45 – £250
Boots Advised for protection and comfort. Leather with reinforced ankle and sole, waterproof. £50 – £180+
Chain/lock Advised, to deter thieves. A chain/padlock and/or disc-lock. Sold Secure or Thatcham approved ones may reduce insurance. £20 – £150+
Ground anchor Optional. Provides a secure attachment point for a chain. Sold Secure or Thatcham approved ones may reduce insurance. £10 – £150

Items other than the helmet could be bought second hand, to bring down the cost. The following recurring costs must also be budgeted for:

Item Description Price range
Insurance Required by law. Price is highly variable. Claim history, address and other factors determine price. Car NCD usually doesn’t transfer. £100+ / year
Batteries Necessary. To replace worn out lead acid cells. £XXX / 500 full charges

Electric Scooter Tips

  • Don’t take specifications such as range at face value. Most range figures are optimistic, or quoted under ideal conditions at low speeds. Hills and stop-start traffic will reduce you range significantly.
  • Get to know the dealer and their warranty/after sales support. Are you confident in the support they can provide?
  • For an idea of the dealers in the UK, visit the A to B electric motorcycle price guide.
  • Take photocopies of your licence, licence counterpart and any documentation, before sending them with the V55 registration form to DVLA.
  • Consider where you will keep a scooter, and how you will plug it in to charge. Is there room to manoeuvre, and if necessary to perform a 3 point turn?
  • Outside charging is possible, by running the cable through a nearby window, or having a weather proof IP66 socket on an external wall.
  • Insurance can be arranged the same day over the phone, and registration may take weeks to complete, so wait until registration documents are received before taking out insurance. A list of insurers thread mentions some electric scooter insurers.
  • Take CBT whether it’s required or not, and further training as you see fit. On 2 wheels you are more vulnerable, and inexperienced. The Motorcycle Training Beginners Guide has more information
  • Experience with a car does not automatically make you experienced on 2 wheels. In fact some car instincts are counter productive on 2 wheels.
  • Pay attention on the road, and don’t ride in the gutter. Treat everything as a potential threat when riding.
  • Pay particular attention in wet weather. Roads become very slippery on 2 wheels, in such condition.
  • In Birmingham (unlike London, where there are currently trials) motorcycles and scooters are not automatically allowed to use bus lanes. However many bus lanes are marked for motorcycle use.
  • Ask questions. Here, at the Electric Transport forum or at Bike Chat Forums.

Some LocalView Intranet performance tips

LocalView Intranet is a web mapping product developed and sold by ESRI UK, predominantly to local councils. The current version (as of August 2009) is 2.1 SP2, supported on ArcGIS Server 9.2 SP5. The following are some straight forward tips for improving it’s performance:

  1. The ArcMap document (mxd)  defining each map service is critical to every aspect of LocalView performance. Simplify, simplify, simplify. Start with a few, simple layers and test the responsiveness of the site, particularly with simultaneous users.
  2. You’re only as fast as your slowest layer. Test your mxd separately with MXDPERFSTAT.  For an overall quick map response, with many concurrent users then you should aim for a worst case 0.5-1.0 second draw time per layer.
  3. File Geodatabases are very fast. Hold as many layers as you can (all if possible) locally in a File Geodatabase. Small latencies in the data access add up, and you may be surprised at the performance gain, perhaps 50% or higher.
  4. Minimize the number of tasks you assign to each role, don’t assign every task to every user. Each task added increases the cost of starting a new session.
  5. Don’t enable the navigation overlay, if you can avoid it.
  6. LocalView is written in ASP.NET, using the Web ADF. To maintain your session these use ViewState extensively. With each request the ViewState is sent from the browser to the server and back. This has a performance impact, particularly on high latency network links. To keep the ViewState manageable keep the number of layers and tasks to a minimum.
    To monitor the ViewState use Firefox with the ViewState size addon. For LocalView I consider a 2 kB ViewState small, a 20 kB ViewState on the large size, and a 200 kB ViewState very large.
  7. Within the MXD hide any attributes that are unnecessary. Each visible attribute contributes to the size of ViewState. However, do not hide the spatial column – it is necessary for the correct function of LocalView.
  8. Read and understand the articles listed in Top Ten Most Helpful ArcGIS Server Help Topics Countdown. But don’t spend too long reading about the map cache, LocalView won’t use it.

Once you’ve taken care of the above, there are some more esoteric

  1. Enable HTTP Keep-Alive in IIS. LocalView makes a lot of GETs and POSTs, and establishing a new connection for each one is unnecessary.
  2. Enable persistent Kerberos Integrated Authentication. If you’re in an Active Directory domain and using Integrated Authentication, then the default configuration of IIS and Internet Explore may double the number of requests made by the browser.
    NB: You must still set EnableKerbAuthPersist whether you have the hotfix or SP2, the Microsoft Knowledge-base article doesn’t make this clear.
  3. If your server has CPU cycles to spare, enable HTTP compression for both static and dynamic content. This should reduce your network traffic significantly. Follow the instructions at Coding Horror. The bulk of LocalView traffic is from dynamic content, unfortunately.
  4. Choose the image format of your map carefully. On a large monitor, each map zoom could result in a 1 MB image being generated. If your data is mostly vector and pre-rendered rasters (e.g. OS 1:50000), then 8-bit PNG should suffice. If you are using scanned maps, or aerial imagery in your map, then JPEG may be better.
  5. Check what requests and responses are happening, with Firebug for Firefox and Fiddler for Internet Explorer. Bare in mind that they may behave differently, depending on your proxy and authentication settings.
  6. If you can choose the browser, then I’ve found that Firefox 3 is most responsive, then Internet Explorer 7, and Internet Explorer 6 is the least responsive. Particularly, IE 6 can freeze for many seconds at a time.

To enable integrated authentication within Firefox, the following 2 items should be configured within about:config:

  • network.automatic-ntlm-auth.trusted-uris
  • network.negotiate-auth.trusted-uris

Back on the air

Apologies if your email to me has bounced these last few days. My domain was due for renewal, and neither I nor my calendar went bing. Everything should be back now, if you’ve sent me something and I haven’t reacted or replied please resend it.

Make a Windows installer for your python module

To help you build and distribute your Python packges, Python provides distutils. This library knows how to bring together your modules, where to put scripts and how to compile C extensions. The process is driven by a setup.py file, written by the package author or maintainer. Depending on what argument is passed, setup.py can install the package, build an archive or build an installer. To create a Windows installer for a module called wibble.py proceeed as follows.

Create a setup.py file in the same directory as your existing module(s), describing what is to be installed:

from distutils.core import setup
setup(name='Wibble',
      version='1.0',
      description='A utility to deal with underpants and pencils.',
      author='Fred Bloggs',
      author_email='fbloggs@example.org',
      py_modules=['wibble'], # Add more modules as desired
      )

Run the following command:

python setup.py bdist_wininst

This will generate wibble-1.0.win32.exe, which can install Wibble on any Windows PC already having a version of Python. As a bonus the bdist_wininst command doesn’t itself require Windows, so you can create the installer on Linux or Mac OS.