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.41k stars 917 forks source link

Data for region AR (ARGENTINA) #2378

Closed DiegoRioboCabot closed 2 years ago

DiegoRioboCabot commented 4 years ago

Hí everyone, I'm a python beginner, yet I've worked for 8+ years in Argentina's electrical market as a Market Analyst.

I'd be glad to help you refine the data that's online (and keep it up to date), but I would need a brief intro from someone and a bit of guidance.

A short meeting through 8x8.vc or something similar would prove very useful to mee, so I can start actively contributing.

Thank you very much

jarek commented 4 years ago

Hi Diego,

We actually have a parser for Argentina, its source code https://github.com/tmrowco/electricitymap-contrib/blob/master/parsers/AR.py

Sometimes it doesn't have live data, but right now it's showing the following:

Screenshot_2020-04-15_20-54-16

The data source is Cammesa: https://portalweb.cammesa.com/Memnet1/default.aspx

We map power plants to fuel with a hardcoded mapping, and are currently missing some plants, identified by IDs in the Cammesa system. Do you know what fuel those might run on? ROJOTG04. LCA2EO, EN1MEO, GRIOEO, ANCHFV, CAFAFV, ANPCFV. I'm guessing ROJOTG04 might be natural gas, the EO plants wind, and FV solar photovoltaic?

You can use the following monitoring page for warnings and errors Electricity Map systems are generating when trying to collect Argentinian data: kibana.electricitymap.org searching for extra.key: "AR" and NOT level: "INFO" - super long link, sorry&_a=(columns:!(message,extra.key,level),filters:!(('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'96f67170-0c49-11e9-85c1-1d63df8c862c',key:extra.key,negate:!f,params:(query:AR,type:phrase),type:phrase,value:AR),query:(match:(extra.key:(query:AR,type:phrase)))),('$state':(store:appState),meta:(alias:!n,disabled:!f,index:'96f67170-0c49-11e9-85c1-1d63df8c862c',key:level,negate:!t,params:(query:INFO,type:phrase),type:phrase,value:INFO),query:(match:(level:(query:INFO,type:phrase))))),index:'96f67170-0c49-11e9-85c1-1d63df8c862c',interval:auto,query:(language:lucene,query:''),sort:!('@timestamp',asc)))

I think the 'NoneType' object has no attribute 'getText' errors are when data is not available shortly after midnight local time?

DiegoRioboCabot commented 4 years ago

Okay, I will help you update the plant's list and keep it updated. I actually worked in some of those plants and currently are working with others. So i'ts no problem for me.

To get that info you need a username and password to CAMMESA, which I have.

I'll look into the NoneType.

Where are you getting the machines heat rate for each given fuel? (Diesel, Fuel Oil, Carbon and Fuel) To match their CO2 emission rate?

I'll be in touch for further assistance before implementing anything!

Thank you very much,

DiegoRioboCabot commented 4 years ago

Also some of the plants you tagged as "oil" are actually BioGas plants, just that CAMMESA doesn't have a proper tag for them and tags them as "DI" as if they were diesel plants, like "SMIGDI01" or other turbines burn bio fuel like "TABATV01" which burns Sugarcane's bagasse.

I can help fine tune all of this.

alixunderplatz commented 4 years ago

Hey @DiegoRioboCabot, awesome to have somebody here who knows the electricity system of AR well :) :+1: you might want to look into the older issue #565 . It is possible to split Argentina by system regions (NOA, NEA, CUY, CEN, ...) shown in the maps in that issue. we have all the plant abbreviations, so we could add an attribute which identifies the plants' location as well. do you think that's easy? is there an existing list? I remember I used to find various lists by searching for the power plant codes on the web. maybe there is one with the regions as well. We'd also have to carefully implement the exchanges from all 135-500kV HV-power lines between the regions from some of these detailed cammesa site "flujos de potencia activa" (like we did for AR<>Uruguay and the others in the existing parser). no worries about coding it :) we'd just need a description of what belongs to which region and which data to consider for each of the exchanges between the regions first.

systemcatch commented 4 years ago

Hey @DiegoRioboCabot, it's very useful to have someone who has worked with the electricity system in Argentina. I wrote the parser that gets the data, it's a bit messy since it's scraping data rather than using a proper API.

Happy to help with any questions you might have.

alixunderplatz commented 3 years ago

@systemcatch good news: Seems like we have 5-minute-data for all the Argentinan grid regions now :) I guess we can start overhauling the parser, first for Argentina as a whole, then maybe for the grid zones?😃

There is an API now which will make things easier and smoother, and we wouldn't have to update that plant mapping every now and then when new unknown generators start operating and deal with the slow data sources.

Link to production graphs (disable adblock first, may take a few seconds to load), select generacion: https://cammesaweb.cammesa.com/

You'll see today's data and it's probably near real-time (!) (graph is shifted to my local time, but API data has correct timestamp): grafik

This is an API-link for the entire Argentinian production (id_region = 1002): https://api.cammesa.com/demanda-svc/generacion/ObtieneGeneracioEnergiaPorRegion?id_region=1002 From here we can get 'Thermal' (mostly natural gas, a very small fraction of coal & fuel oil), 'nuclear', and 'large hydro'. Unfortunately, 'the renewables' section provides no split here.

However, there is a renewable breakdown for AR as a whole over here: https://cammesaweb.cammesa.com/generacion-real/ 'wind', 'solar', 'biomass', and 'small hydro' (which must be added to aboves large hydro). grafik

This is a data-link for today: https://cdsrenovables.cammesa.com/exhisto/RenovablesService/GetChartTotalTRDataSource?desde=26-12-2020&hasta=27-12-2020

Putting the "thermal" category to "unknown" and assigning a calculated intensity to it will result in a loss of 3 types (gas, coal, oil), but the data interval (5 minutes) and availability (near real-time) will improve significantly. 😃

I couldn't yet find the breakdown of renewable production for the grid regions, so we cannot split Argentina by now. I try to put the zone-IDs in a context so we can work on this once the data is there:

region breakdown for id_region: '418': 'NEA', '419': 'NOA', '426': 'GBA', (could be Buenos Aires itself? if so, production could be added to 425 to make it a single zone, due to no exchange data with GBA) '422': 'Centro', '111': 'Patagonia', '417': 'Litoral', '420': 'Comahue', '425': 'Provincia de Buenos Aires', '429': 'Cuyo'

Geometries of the regions available as geojson: https://microfe.cammesa.com/demandaregionchart/assets/data/regionesCammesa.geojson.json

import/export between the regions (seems to lag by about 4 hours): grafik

Data link for national and international exchanges (direction defined by angle given behind 'flecha...'). Timestamp for imports/exports is indicated on the website itself (4 hours behind real-time when I checked): https://api.cammesa.com/demanda-svc/demanda/IntercambioCorredoresGeo

How to read: interconenctor between 'ZONE_A0ZONE_B', first 3 numbers = id_region of 'ZONE_A' then 0 as separator, next 3 numbers = id_region of 'ZONE_B'. The rotation angle 'flecha...' and my remark 'COM -> PAT' indicate the true direction of flow for the given rotation (based on screenshot above.)

0 'COM <-> PAT': '4200111', 'flecha270' COM -> PAT 1 'CEN <-> LIT': '4170422', 'flecha45' CEN -> LIT 2 'LIT <-> NOA': '4170419', ???'flecha135' ? -> ? 3 'CEN <-> CUY': '4220429', 'flecha225' CEN -> CUY 4 'LIT <-> NEA': '4170418', 'flecha45' LIT -> NEA 5 'CEN <-> NOA': '4220419', 'flecha135' CEN -> NOA 6 'BAS <-> COM': '4250420', 'flecha45' COM -> BAS !!! 7 'CUY <-> COM': '4290420' 'flecha135' COM -> CUY !!! 8 'CUY <-> NOA' : '4290419', ???'flecha45' ? -> ? 9 'BAS <-> LIT': '4250417', 'flecha90' BAS -> LIT 10 'CEN <-> COM': '4220420', 'flecha90' COM -> CEN !!! 11 'NEA <-> NOA': '4180419', 'flecha0' NOA -> NEA !!! 12 4250422 BAS <-> CEN, ??? 'flecha135' ? -> ?

International connections: 13 1002055 AR-NEA <-> Brasil-South, 'flecha45' 14 1002595 AR-NEA <-> PAR, ''flecha225' PAR -> AR-NEA !!! 15 1002056 AR-CUY <-> CL-SEN, 'flecha180' 16 1002598 AR-LIT <-> UR, 'flecha180' UR -> AR-LIT !!!

That's it for now.

gvillo commented 2 years ago

I was about to start a thread about this and I found this issue opened, after reviewing this wikipage https://github.com/electricitymap/electricitymap-contrib/wiki/Technical-requirements-for-parser-data, it says It is acceptable to have thermal production sources grouped as unknown., so we can use the new public API from cammesa to extract the data directly without any translation -as @alixunderplatz correctly pointed up here- (https://api.cammesa.com/demanda-svc/swagger-ui.html and https://api.cammesa.com/pub-svc/swagger-ui.html), also we could get the temperature.

After getting the parser working we could improve it by splitting the country in regions, is there a pushed branch to contribute?

alixunderplatz commented 2 years ago

Hi @gvillo! Thank you for your comment and for the additional API links. Just go ahead if you like to start writing a new parser for AR :) I also recommend splitting AR by regions at a later point, as we have the data, but it will take some time to implement all that correctly, especially the power flows :) I opened the duplicate #3699 a few days ago to push AR a bit higher in the issues-list to get it fixed :) Happy to help should you have any questions 👍

aemartinez commented 2 years ago

Hi folks! I just created a PR for this. I'm sorry if someone else was already working on it, I hope it helps. Let's start discussing more improvements for the AR parser!

Thanks for all the data you provided! It was very helpful 😄

Kongkille commented 2 years ago

I believe we can close this issue after #3723 :)