thegreenwebfoundation / co2.js

An npm module for accessing the green web API, and estimating the carbon emissions from using digital services
https://developers.thegreenwebfoundation.org/
Other
417 stars 54 forks source link

Use a model based on more recent peer reviewed work than the 1byte model #2

Closed mrchrisadams closed 1 year ago

mrchrisadams commented 4 years ago

I've been looking for a model that gives numbers closer to my own experiences looking online for the energy from ICT and therefore carbon from ICT than the 1byte model, but nothing has been as easy to use, and I've prioritised having some discussion, compared to having the numbers that are more consistent with the work from Koomey et al.

A new piece of analysis on the carbon brief has some at last.

Bitrate: global weighted average calculated based on subscriptions by country and average country-level data streaming rates from Netflix in 2019; resolution-specific bitrates from Netflix. Data centres: low estimate based on Netflix reported direct and indirect electricity consumption in 2019, viewing statistics and global weighted average bitrate (above); high estimate based on 2019 cloud data centre IP traffic from Cisco and energy use estimates for cloud and hyperscale from IEA. Data transmission networks: calculations based on Aslan et al. (2017), Schien & Priest (2014), Schien et al. (2015), and Andrae & Edler (2015), and weighted based on Netflix viewing data by devices. Devices: smartphones and tablets: calculations based on Urban et al. (2014) and Urban et al. (2019), iPhone 11 specifications (power consumption and battery capacity), and iPad 10.2 specifications; laptops: Urban et al. (2019); televisions: Urban et al. (2019) and Park et al. (2016), and weighted based on Netflix viewing data by devices. Carbon intensity of electricity: based on IEA country-level and global data, and 2030 scenario projections.

I've linked directly to the part of the article that lists the sources.

We should make a table listing these in a way that's comparable to the 1byte model, then allow the use of both, to make comparisons possible.

mrchrisadams commented 4 years ago

Hey @JamieBeevor I've found another good summary to help work update the calculations, from David Mytton, formerly of Server Density, a server analytics platform.

It goes into a decent amount of detail that would be useful to check against the IEA analysis:

https://davidmytton.blog/how-much-energy-do-data-centers-use/

The bits we'd need to update to make a model that takes into account the lower emissions figures in the analysis from Carbon brief, which I mostly agree with TBH.

You can see the code bits here: https://github.com/thegreenwebfoundation/co2.js/blob/master/src/co2.js#L5-L28

And the code powering the figures are here:


// Use the 1byte model for now from the Shift Project, and assume a US grid mix of around 519 g co2 for the time being.
const CO2_PER_KWH_IN_DC_GREY = 519;
const CO2_PER_KWH_IN_DC_GREEN = 33;

// the better way would be do to this with a weighted average of types of RE generation
// from solar, to wind, to biomass, and hydro and so on, based on how much they
// are used.
// For now, let's use a quoted figure from Ecotricity, which quotes OFGEM, the UK regulator
// and it's better than most quoted figures which pretend there is *no* footprint
// for RE.
// More here:
// https://www.ecotricity.co.uk/layout/set/popup/layout/set/print/for-your-home/britain-s-greenest-energy-company/lifecycle-carbon-emissions
// https://twitter.com/mrchrisadams/status/1227972969756086284
// https://en.wikipedia.org/wiki/Life-cycle_greenhouse-gas_emissions_of_energy_sources

// 33.4, but that's for the UK in 2014/15. Shouldn't be too off though. Probably lower now.

const CO2_PER_KWH_NETWORK_GREY = 495;

// these are the figures pulled from the 1byte model, there is a
// third figure to represent carbon emission from *making* the device used to access a site/app but we lieave it out as it relies on
// us knowing how long it's being used to read content
const KWH_PER_BYTE_IN_DC = 0.00000000072;
const KWH_PER_BYTE_FOR_NETWORK = 0.00000000152;

Updating these numbers based on the peer reviewed data

If the folks at the Shift project can have the 1byte model, I figure we can make one too, which until we have a proper name, I'm gonna suggest as calling the Green Byte Model, to indicate that it is intended to be largely 'compatible' for the same kinds of calculations.

In the model, they use these:

const KWH_PER_BYTE_IN_DC = 0.00000000072;
const KWH_PER_BYTE_FOR_NETWORK = 0.00000000152;

I find them a bit hard to read, so lets try going from bytes to gigabytes (i.e. _KWH_PER_BYTE_INDC 1024 1024 * 1024) to make these easier to read:

const KWH_PER_GB_IN_DC = 0.77
const KWH_PER_GB_IN_DC = 1.63

How should we change the numbers? This chart below gives a direct comparison for the numbers (click through to see them)

https://cbhighcharts2020.s3.eu-west-2.amazonaws.com/video-streaming/chart-1.html

I think as a starting point, we could used these updated numbers for a Green Byte Model, and make it a thing we could swap for calculations.

An aside about leaving out device emissions and asking for a sanity check.

I left out the CO2 emissions from devices itself, as for this work on making this work in sitespeed, I felt it was better to be explicit about the boundary, and not even try to incorporate it.

For the purposes of the sitespeed use, I figured it would be hard to reliably measure a drop in total life cycle in carbon from devices, just from optimising a website or having it use green energy, but if this is used elsewhere it might make sense to include.

So I'm tagging you to ask a few questions.

  1. Do you know a more sensible figure for renewables than OFGEM's one from a years back?
  2. The figure for the IEA power is globally just under 500 g for power. Got an idea how we might end up with a more representative figure than the IEA's figure, to account for datacentres?

I understand the point from the IEA analyst about the biggest tech firms using increasing percentages of power, but historically, my understanding is that datacentres have been cited where there are loads of fossil fuels, and providers that aren't in the spotlight tend not to be in such a hurry to buy PPAs and the rest, and in many cases it's straight up difficult.

I'm thinking of Frankfurt, Amsterdam and well, most of North Virginia, which typically have historically have authorities who are more fossil-fuel friendly than fans of low carbon power - see Greenpeace's Virginia report).

Anyway, let me know, and I'll add some of this. I might tag the original analyst, George Kamiya as he might have some reckons on the energy mix for datacentres.

mrchrisadams commented 4 years ago

As an aside, rather than providing averages, I can see an scenario where organisations that know the energy mix they rely on for their infra could include this in a carbon.txt file for their domain.

Given that energy suppliers legally need to publish this to regulators in many countries anyway, (see the example from UK regulator OFGEM below) 'm pretty sure it exists, and as we all know, there's a real need for more transparency in how we power the internet.

https://www.ofgem.gov.uk/environmental-programmes/rego/energy-suppliers/fuel-mix-disclosure

JamieBeevor commented 4 years ago

In the model, they use these:

const KWH_PER_BYTE_IN_DC = 0.00000000072;
const KWH_PER_BYTE_FOR_NETWORK = 0.00000000152;

I find them a bit hard to read, so lets try going from bytes to gigabyes (i.e. _KWH_PER_BYTE_INDC 1024 1024 * 1024) to make these easier to read:

const KWH_PER_GB_IN_DC = 0.77
const KWH_PER_GB_IN_DC = 1.63

How should we change the numbers? This chart below gives a direct comparison for the numbers (click through to see them)

https://cbhighcharts2020.s3.eu-west-2.amazonaws.com/video-streaming/chart-1.html

@mrchrisadams I'll take a look at your questions but I was just going through what you've written here and your conversion from KWH_PER_BYTE to KWH_PER_GB (which looks correct to me) comes up with different numbers to the CB chart you linked to. The chart gives the Shift figures as 0.072kWh/Gb for data centres (vs your 0.77) and 0.488kWh/Gb for network (vs your 1.63). What's going on?

mrchrisadams commented 4 years ago

Yeah, I made a mistake here. I was using the wrong figure for transfer - they use averages across all the kinds of transfer, and I was looking at wifi. I've updated with this changeset here.

https://github.com/thegreenwebfoundation/co2.js/commit/8751a2a9320c2a30daaabbd1d95b0a622449db43

As for the 0.77 figure, I think it's an error I introduced. I've made this fix in a new branch where I started work on fixing this.

https://github.com/thegreenwebfoundation/co2.js/compare/ca-green-byte-model

mrchrisadams commented 4 years ago

Awright - I've merged in the fix to the embarrassing error around 0.77 and 0.72.

That likely leaves this issue here:

  1. Do you know a more sensible figure for renewables than OFGEM's one from a years back?
  2. The figure for the IEA power is globally just under 500 g for power. Got an idea how we might end up with a more representative figure than the IEA's figure, to account for datacentres?

For number two, you could make the argument that the big tech firms are running on 50% green power and so on.

My understanding is that they are largely based on a market based reporting convention where you get to claim things are green if you burn coal, but buy certificates from green providers to even out your usage.

This is different to the location based convention where you use the actual CO2 figures. Oliver Corradi's piece on this on the tmrow blog is accessible and well written, and cites a good paper, Creative accounting: A critical perspective on the market-based method for reporting purchased electricity (scope 2) emissions, which has a decent set of recommendations as well.

JamieBeevor commented 4 years ago

2.

I also have misgivings about allocating zero carbon emissions to conventional green tariffs so am very interested to check out that paper. I think the GHG Protocol is getting this wrong and it means that there's a risk of companies (and householders) taking their eye off the demand reduction ball. The weakness of the REC/REGO approach to greening an electricity tariff is one aspect but also in the UK (for example, but it happens all over the place), all householders and businesses (including those not on a green tariff) pay a not insubstantial levy on their bills to subsidise renewables so I think that the zero emission contribution of renewables should be spread around (I suspect there's double counting going on if you call green tariffs zero carbon).

BUT, those are just standard green tariffs. Big tech companies sign long-term PPAs with renewables developers which is starting to get a little warmer but that PV installation or wind farm isn't generating all the time and it's still a bit of an accounting trick. Warmer still are PPAs that match your half hourly demand but I don't know to what extent they exist yet. I'm guessing you know this doc:

http://resource-platform.eu/files/knowledge/reports/Google-24x7-carbon-free-energy-data-centers-October-2018.pdf

It highlights some of the complexities at play here.

Where did you get the 50% figure from?

Latest IEA figure for global carbon intensity of electricity is 475gCO2/kWh:

https://www.iea.org/reports/global-energy-co2-status-report-2019/emissions

I don't know the extent of variations by region.

JamieBeevor commented 4 years ago
  1. I don't think the 33gCO2e/kWh figure that Ecotricity quotes comes directly from Ofgem. I think it's their analysis of data in the REGO database which is managed by Ofgem. I presume they've taken the mix of UK renewables and then applied lifecycle emission factors to that mix to come up with the 33g figure.

Globally that mix is going to be different. Also you won't be comparing like with like as the IEA figure is doubtless emissions due to combustion of fuels while the Ecotricity factor is emissions on a lifecycle basis. Also note that the IEA figure is an emission factor for "electricity generated" so is unlikely to take into account transmission & distribution losses (somewhere in the region of 5% to 10% in most countries). I'll have a proper look around this evening for better numbers.

mrchrisadams commented 4 years ago

Wow, the rabbit hole keeps getting deeper, doesn't it?

So, to use the IEA number for comparison it sounds like I'd need the equivalent non-lifecycle figure for renewables in the wider sense of the term "renewables", right?

I think the Ecoinvent database has this, but I think it's in the form of loads of figures that are likely to be extremely specific to a kind of solar panel, or wind turbine, that we'd need an average from.

Thanks for looking either way.

mrchrisadams commented 4 years ago

Okay, more digging, and a final sanity check.

Previously all the messaging I read around the one byte model, and in particular its use when talking about video and devices, and holding onto them longer made me think it was also including the embodied emissions from making the devices.

You can see one of the videos in English as an example below:

https://www.youtube.com/watch?v=JJn6pja_l8s&feature=emb_title

When I re-read their report, and in particular the documentation I could find about the 1byte model in English, I now see that they split out the use phase, from the production phase, and page 71 on in their report shares the assumptions, which I've linked to using hypothesis

So if we look at the 1byte model, they assume a figure of 5.9kwH per year from just using a smartphone.

TO keep the maths simple for this commnent, let's call it 6kwH, so if we assume 3 years, and between 250 and 500g of CO2 per kwH , that gives us some figures like below for the total CO2 over a phone's lifetime, just from the use phase:

use per year years used carbon intensity CO2 per kwH total
6 3 0.25 4.5
6 3 0.5 9

So, between 4 and 9kg of CO2 from use, at the device end, for a phone.

As a sanity check, this isn't too different from the figures given in Fairphone's life cycle report. I have linked directly to the table showing 6kg of CO2 over a 3 year period using hypothes.is

I'm not sure how in sitespeed we can get an idea for how long a site is being used after being downloaded, so I've chosen to leave this out for the time being, although it's a thing you coud conceivably add in with analytics on a device itself.

This leads to me realising two things.

If we want to include green energy and try to compare like with like, because the other figures:

I think we probably should use an emission factor for generation for renewable energy too, rather than trying to be clever with LCA, which would either be zero, or almost zero.

This would make the difference between green-hosted and conventional figure, greater as previously we've been using a figure of 33g of CO2 per KWh, which covers the entire life cycle emissions, not just the generation.

What changes we need to make

For the 1byte model to include green energy, we'd need that lower figure than what we have. I think it'll be either zero, or very close to zero - this is the point of renewables after all.

Since Peter's change was merged in this week we can run calcs with different assumptions for CO2, and compare runs using the 1byte model, with runs using this updated green byte outlined above.

I think I'll want to sanity check green byte numbers before having it as a default, so I'll change the green energy figs and update the docs accordingly.

Switching to use an updated green byte model sound like it's better done in a future release.

JamieBeevor commented 4 years ago

Sounds reasonable to me.

I think using the in-use emissions for power generation makes sense. You could potentially add in an embodied/upstream carbon component to the calculation as good quality data emerges.

Regarding the in-use emissions of renewables, they are all zero rather than very close to zero except, arguably, biomass. I say arguably because biomass is considered by governments to be zero emission but of course it is releasing huge amounts of CO2 into the atmosphere when the wood is burnt. It is just assumed that new tree growth to replace those cut down absorbs that CO2 back from the atmosphere.

mrchrisadams commented 4 years ago

Awesome, thanks Jamie.

I feel like I have enough to make the final changes now, publish to npm, and crucially explain it in a README or blog post…

mrchrisadams commented 4 years ago

@all-contributors please add @JamieBeevor for advice on implementing the 1 byte model

allcontributors[bot] commented 4 years ago

@mrchrisadams

I couldn't determine any contributions to add, did you specify any contributions? Please make sure to use valid contribution names.

mrchrisadams commented 4 years ago

Whoops. Lets' try this again.

@all-contributors please add @JamieBeevor for ideas on how best to use the different models for estimating carbon emissions

allcontributors[bot] commented 4 years ago

@mrchrisadams

I've put up a pull request to add @JamieBeevor! :tada:

mrchrisadams commented 4 years ago

I've heard back from George Kamiya. With some luck we'll have a call next week, and I'll add a few notes here.

Once I have that, I think I'll share a summary to the ICT4S mailing list, to see what the profs think (it's a good group, and full of proper sustainability and tech boffins who are writing the papers we all cite), then I think we should have a sensible defensible basis for aan optional green byte model 👍

dvelasquez commented 4 years ago

Hi guys! Loving the work you have been doing here 👍 . I started writing a npm package that basically does the same, the only difference is that I'm using the co2 intensity of the European Environment Agency mostly out of necessity (at work most of the sites are in Europe).

Do you think I could add the CO2 intensity data to this repository so we can use this instead of my NPM Package?

mrchrisadams commented 4 years ago

hi @dvelasquez thanks - that would be great, but I think I would need some help understanding the data there, and when it the data runs up to, before I say it's a really good idea.

The data I see on the link you shared reports up to the mid 2010's for Germany, which would mean that it will likely overestimate the carbon intensity of the grid for many countries that are further along with decarbonisation in 2020.

Take this example: https://www.eea.europa.eu/data-and-maps/daviz/co2-emission-intensity-5#tab-chart_2

The latest figure for Germany's CO2 intensity is 477g CO2 per kilowatt hour, from 2014.

Screenshot 2020-08-16 at 20 12 42

Compare this to Electricity map's figures today, of 341g of Co2 per kilowatt hour instead. Screenshot 2020-08-16 at 20 11 37

It might be worth looking at how the electricity map do it, as from memory they pull data from another EU data source that is more up to date, but well… there's a reason they offer an API for this stuff as it's pretty complex, and you need a decent amount of domain expertise to do it well.

Here's an example of their scraper: https://github.com/tmrowco/electricitymap-contrib/blob/master/parsers/ENTSOE.py

And here's the site it gets the data from: https://transparency.entsoe.eu/dashboard/show

The scraper gives an idea of how much work and what kind of knowledge you might need to get meaningful figures, and also helps you understand why they have an API too.

The other alternative would be to look at the IEA's figures - I think they have some recent per-country ones too, but I don't know the licensing of the data well enough to know if we can use them in this package.

Let's use this issue to figure out what data we can get into it, as this is pretty much I why i wanted to get this npm package published :)

dvelasquez commented 4 years ago

Thanks for your response @mrchrisadams and you are right, the data is a bit outdated but is what I've found that I can use right away. I've sent an email to ElectricityMap to check if I can use their data from the API and what is the license of the data. Otherwise with a little more time I could write something on NodeJS using the python scraper as a starting point to get the data by ourselves. Since the data doesn't change much, a "hard api" (a JSON file) could be created yearly and cached in a CDN with close to 0 cost. This is the endpoint they are using for the map: https://api.electricitymap.org/v3/state

mrchrisadams commented 4 years ago

there's a new report today that gives figures for 5G connectivity, in terms of CO2/GB.

Also, there's a helpful diagram in the paper that gives us an idea of where the lion's share of the emissions come from in the per gigabyte figure. they define the networks like so:

Screenshot 2020-10-29 at 12 24 28

Presumably, the transport part here is data moving through various backbone networks to another datacentre in the 'deep' internet, as opposed to the 'shallows' of where most consumers access digital services. I'm guessing this might be this be at the CDN level for us.

Based on this, I get the impression that CDNs don't actually make much of a difference in terms of energy, and lots of the discussion about reducing hops, while something that might intuitively be a place you think of optimising, as you get other 'co-benefits' (lower latency, cost etc.) might actually be misguided and not actually that useful.

Screenshot 2020-10-29 at 12 34 35

I've asked if the paper it came from New study: Next generation mobile networks - problem or solution for climate is available yet, but the study was announced last year, and you can check there for news.

https://www.ifi.uzh.ch/en/isr/news/news/5G-study.html

mrchrisadams commented 4 years ago

It's been published now officially - https://www.ifi.uzh.ch/en/isr/news/news/5G-study-published.html

dvelasquez commented 4 years ago

Hey @mrchrisadams coming back to you about the Electricity Map data.

I've spoke to them (Tmrow.com) and they told me that I could use the data for Open Source projects. The data they are showing is real time, so he suggest me to get the data every hour and make a daily average (since they don't have any type of averages).

I've been doing that since then here: https://github.com/dvelasquez/electricity-data I also have this small library with the data of 1 day: https://github.com/dvelasquez/carbon-tools/tree/main/packages/co2-data

I'm planning to update the dataset soon.

mrchrisadams commented 4 years ago

Sweet, that's awesome news!

Lol, we've been working in parallel on grid intensity too!

https://github.com/thegreenwebfoundation/grid-intensity 🤣

I didn't realise the data was available at a country level - we only had the UK feed, but that's super useful!

Are you in the https://climateaction.tech slack? I had tried to learn how to use lerna, but totally failed each time. We should totally chat more :)

mrchrisadams commented 4 years ago

Also @dvelasquez , you might like this - here's the online magazine, all about sustainability and digital, that a few of us launched this week, using a bunch of these ideas:

https://branch.climateaction.tech/

And this piece in particular might interest you - we're incorporating carbon awareness into the design of the site itself

Especially given your recent tweet about the <picture> element

Are you in the climateAction.tech slack? If not, come say - there's a bunch of us hacking on stuff like this, and there's spanish contingent too 👍

dvelasquez commented 4 years ago

Also @dvelasquez , you might like this - here's the online magazine, all about sustainability and digital, that a few of us launched this week, using a bunch of these ideas:

https://branch.climateaction.tech/

And this piece in particular might interest you - we're incorporating carbon awareness into the design of the site itself

Especially given your recent tweet about the <picture> element

Are you in the climateAction.tech slack? If not, come say - there's a bunch of us hacking on stuff like this, and there's spanish contingent too 👍

@mrchrisadams Hey, I haven't join the slack (yet). I just signed up there :D

I'm happy to help, let's move the talk there then ;)

mrchrisadams commented 3 years ago

There's some newish numbers from Umsweltbundesamt = the German environment ministry.

They give a figure of 2Gb per hour, which we could turn to a figure per byte:

The data rate of the video stream at 2 gigabytes per hour corresponds to HD quality (High Definition, 1280x720).

Screenshot 2020-11-11 at 14 03 12

Frustratingly they don't actually point to the numbers- just tease us with charts. you can download the factsheet PDF on the linked set of downloads.

mrchrisadams commented 3 years ago

There are two papers coming out soon: (next month, I believe). If we can get in touch with these people, I think this would give us some useful numbers to plug into the green byte model, and we'd have a some recent research to point to.

  • Green Cloud Computing (2020): Gröger, Jens; Liu, Ran; Stobbe, Lutz; Richter, Nikolai. Life cycle- based data collection on the environmental impacts of cloud computing. Study commissioned by the Federal Environment Agency. In progress.
  • UTAMO (2020): Stobbe, Lutz et al. Environmental impact assessment of mobile network and end-user device technology. Study commissioned by the Federal Environment Agency. In progress.
mrchrisadams commented 3 years ago

George Kamiya from the IEA got in touch today to share some pointers to some more research:

Just a quick heads up that I updated the numbers in my Carbon Brief article with some numbers Jens Malmodin shared with me shown here, so the data transmission portion is much lower now, especially 4G. They are now largely calculated based on time rather than data, which is what Jens advised is best to calculate high bitrate applications like video.

I think these numbers are more applicable for long running video connections than the more bursty connections of the web, but it's worth bearing in mind.

martin-laurent commented 3 years ago

Hey everyone, I've been following this conversation. My use case it to compute electricity consumption for transmissions between data centers (excluding end-users consumption, thus excluding 4G traffic for example)

I have read a number of articles on the subject but if there was one that represents well the scale of the problem it would be this one Electricity Intensity of Internet Data Transmission: Untangling the Estimates 2017

It's a meta study of all the attempted estimates of such numbers until 2016. It focuses on the "internet traffic" which includes "IP core network" and "Access network". It lists all the reasons why there is so much variance in the literature. The range: 136 kilowatt‐hours (kWh)/GB in 2000 (Koomey et al. 2004) and 0.004 kWh/GB in 2008 (Baliga et al. 2009). It excludes the study that don't cross validate their estimations with at least to complementary methods + some other criterions.

The resulting trend is this

Screen Shot 2021-01-15 at 7 03 29 PM

which ends up at the number of 0.06 kWh / GB in 2015

It also acknowledge the fact that a time-based model would be great (kWh / hr) , but it is impractical to compare with previous literature which uses a data-based model (kWh / GB)

So the TL;DR (which you are suppose to write at the beginning I know) is: 0.06 kWh / GB in 2015 based on most of the literature available at this point (both pessimistic and optimistic articles) Suggests a trend of efficiency increased by 10x every 6 years BUT they are cautious to not encourage people to extrapolate this treend beyond the range of 2000-2015 which they studied.

ceddlyburge commented 1 year ago

Is it worth changing CO2_PER_KWH_IN_DC_GREEN from 0 to 50, which is used by websitecarbon (https://sustainablewebdesign.org/calculating-digital-emissions/) and comes from this study by NREL (https://www.nrel.gov/docs/fy13osti/57187.pdf).

The Ember data explorer also used to be able to show a global clean energy carbon intensity figure, but it isn't available any more. Last time I saw it, it was also very near 50 (I think it was 49 if I remember correctly)

fershad commented 1 year ago

Now that we have the SWD model in CO2.js, this issue can be closed. If there's a desire to update the SWD model, or add any newer models later down the line, they can be tracked under new issues.