electricitymaps / electricitymaps-contrib

A real-time visualisation of the CO2 emissions of electricity consumption
https://app.electricitymaps.com
GNU Affero General Public License v3.0
3.37k stars 910 forks source link

Missing oil generation in Ibiza and Menorca #5595

Closed silimotion closed 9 months ago

silimotion commented 11 months ago

Description

It seems the values for diesel (oil) generation are not being recorded:

Screenshot_20230712_164941 Screenshot_20230712_165018

This happens also in Menorca.

Running the parser locally shows oil production as 0 MW:

{'correctedModes': [],
  'datetime': datetime.datetime(2023, 7, 12, 17, 0, tzinfo=datetime.timezone.utc),
  'production': {'biomass': 0.0,
                 'coal': 0.0,
                 'gas': 82.4,
                 'hydro': 0.0,
                 'nuclear': 0.0,
                 'oil': 0.0,
                 'solar': 1.5,
                 'unknown': 0.0,
                 'wind': 0.0},
  'source': 'demanda.ree.es',
  'sourceType': <EventSourceType.measured: 'measured'>,
  'storage': {},
  'zoneKey': 'ES-IB-IZ'}
VIKTORVAV99 commented 11 months ago

It seems like the package we use to interface with the API is not picking this up. I'll look into it and see if I can submit an update.

VIKTORVAV99 commented 11 months ago

So I kind of took this one step further and upgraded large parts of ree as well but the PR is open here at least: https://github.com/hectorespert/ree/pull/13

q-- commented 11 months ago

Slightly off-topic, but are we sure the 'gas turbines' are actually burning natural gas? A lot of gas turbine plants are actually running on oil-based fuel, so I'm bringing it up in case someone saw 'gas' and thought 'natural gas' when creating this parser.

VIKTORVAV99 commented 11 months ago

While I'm not 100% sure, there is a gas pipeline that goes to the Balearic islands so at least there is the infrastructure for it.

We are however overriding that for the canary islands as the LNG terminals have not been built yet (last I checked) and treating it as oil.

silimotion commented 11 months ago

After searching a bit, I've found that the only islands using oil are Menorca and Formentera. Ibiza power plant was changed to natural gas, so both "Diesel engines" and "Gas turbine" use natural gas now. In Menorca both use diesel.

VIKTORVAV99 commented 11 months ago

That complicates things significantly. Because ree (the package) combines both auxiliary generation and diesel to oil which means there is no way for us to split it and I would think the auxilary generation (backups) still use diesel oil?

Might be easier for us to just parse the sources directly and than using the REE package, or we would have to make even more changes to it (which is a little outside of our control).

silimotion commented 11 months ago

Um, but wasn't auxiliary generation only used in Formentera? If this is the case, the fact that they are added doesn't cause any problems, we'll just have to parse diesel to natural gas in the case of Ibiza.

VIKTORVAV99 commented 11 months ago

GenAux is included for the Ibiza dataset as well although I don't know if they are reporing any values for it as it's zero (for the day I checked). Here is the endpoint and values that are reported: demanda.ree.es/WSvisionaMovilesBalearesRest/resources/demandaGeneracionBaleares?curva=IBIZA5M&fecha=2023-07-12

silimotion commented 11 months ago

In case a rewrite of ree or the parser is needed, I'd like to point out that diesel and gas turbines seem to have different carbon intensities, as can be seen in demanda.ree.es. Could we make the parser so that this is taken into account? I've seen that in many cases you just use precalculated averages based on the previous years production and aggregate different production types, but I feel this isn't as accurate, and doesn't show why/if one production type is favoured to decrease CO2 emissions. Is this a design limitation or is the parser feasible without changes to the codebase? Sorry if I went a bit off-topic.

VIKTORVAV99 commented 11 months ago

That's fine and yes we do aggregate some data. I wouldn't say it limitation rather than a design choice to better unify all the parser data for all zones so we can say this is coal, even if one source reports all coal as coal or another breaks it down by type. With that said I have suggested the same thing here https://github.com/electricitymaps/electricitymaps-contrib/discussions/4219#discussioncomment-3110126 before I started working at Electricity Maps.

With the suggested changes in there we could compute hourly (or better) carbon intensities based on the raw production and still aggregate it to the current modes we use now and use the weighted average emission factor instead.

I'll see if I can push for this a little more internally but as you said that is off topic for this particular issue.

VIKTORVAV99 commented 11 months ago

If there is no activity from the ree maintainer in next few days I think we should go ahead and create our own parser, if nothing else so we have control over the source code and any changes in there.

silimotion commented 10 months ago

Any news on this? I can work on a new parser.

VIKTORVAV99 commented 10 months ago

Any news on this? I can work on a new parser.

No new news. I just haven't had the time.

The old parser works for the most part. We just need to replace the usage of REE with our own data fetching so we can assign the raw data as we please.

If you want to take a look at it feel free to do so.