Skip to main content

Emissions simulator for Mosaik

Project description

This is a simulator that implements CO₂ emissions calculation for certain mosaik scenario and pandapower network configuration.

This simulator is still work in progress. In particular, not every desirable attribute is implemented yet. If you have need for a particular attribute, leave an issue here.

Methodology

CO₂ emissions are dynamically aggregated based on predefined pandapower network characteristics.

To obtain the emission factor for a particular fuel, we refer to 2006 IPCC and in particular to the chapter Stationary Combustion.

To obtain the carbon intensity depending on a country's energy mix, we refer to OurWorldInData, which aggregates data from Ember's European Electricity Review and the Energy Institute's Statistical Review of World Energy.

For Germany, the state can be specified, in which case historical carbon intensity estimates from co2map.de will be used.

Units

  • Power produced - [MW]
  • Default emission factor - [tones CO₂eq. / MWh]
  • Carbon intensity of the electricity - [tones CO₂eq. / MWh]
  • Carbon emissions - [tones CO₂eq.]

Installation and usage

pip install mosaik-emissions

If you don't want to install this through PyPI, you can use pip to install the requirements.txt file:

pip install -r requirements.txt # To use this, you have to install at least version 3.2.0 of mosaik.

The simulator uses P[MW] as an input and E[tCO2eq] as an output attribute. For each connected generator or external grid, one of the parameters must be defined: the emission factor, the fuel used, the country, and the state, see the configuration section bellow. You can also use the method option, which is callable, directly transforms input data to output, and takes precedence over other options. Thus, each emissions model can be configured while creation by using model_params:

  • method - callable that directly transforms input data to output
  • co2_emission_factor - float number that directly represents conversion factor [tones CO₂eq. / MWh]
  • fuel - string that matches with a certain type of fuel used to produce electricity
  • state - string that matches with a certain state of the country to filter the carbon intensity database out, it shuld be defined along with the country
  • country - string that matches with a country to filter the carbon intensity database out
  • coefficient - float number that multiplies emissions output, default is 1.0
    emission_config = {
        'co2_emission_factor' : 0.385, 
        'fuel' : 'Natural Gas Liquids',
        'country' : 'Germany',
        'state' : 'SN', # it shuld be defined along with the country if so
        'coefficient' : 2.0 # multiplies total emissions output
    }

    em = em_sim.Emission.create(1, **emission_config)

Note: the model applies the first option defined according to the order described, e.g. if co2_emission_factor is defined, it does not check fuel or country.

Specify simulators configurations within your scenario script:

sim_config = {
    'Grid': {
         'python': 'mosaik_components.pandapower:Simulator'
    },
    'Emissions': {
         'python': 'mosaik_components.emissions:Simulator'
    },
    ...
}

Initialize the pandapower grid and emissions simulator:

    gridsim = world.start('Grid', step_size=STEP_SIZE)
    em_sim = world.start('Emissions')

Instantiate model entities:

    grid = gridsim.Grid(json=GRID_FILE)
    em = em_sim.Emission.create(1, **emission_config)

Connect and run:

    gens = [e for e in grid.children if e.type in ['Gen', 'ControlledGen']]
    world.connect(gens[0], em[0], 'P[MW]')
    world.run(until=END)

You can see the demo scenario in the demo folder.

Possible configuration

To relate to an emission factor derived from the country's energy mix, the full name of the country should be provided (see OurWorldInData), e.g.:

  • Germany
  • Greece
  • Iceland
  • ...

For Germany certain states are available (see co2map.de): DE (country average), BB, BW, BY, HE, MV, NI, NW, RP, SH, SL, SN, ST, TH

To relate to certain fuel type, the fuel name should be provided (see Stationary Combustion, Table 2.2):

  • Crude Oil
  • Natural Gas Liquids
  • Natural Gas
  • Charcoal
  • Gas/Diesel Oil
  • Ethane
  • ...

Developer notes

Note that emission factor and carbon intensity of electricity values for specific fuels and countries are stored in data/data.csv with the units specified in the source and are converted internally once been called.

Raw data files and data.csv preparation notebook can be found in the misc folder.

Sources and References

  • Ember - Yearly Electricity Data (2023); Ember - European Electricity Review (2022); Energy Institute - Statistical Review of World Energy (2023) – with major processing by Our World in Data. “Carbon intensity of electricity generation” [dataset]. Ember, “Yearly Electricity Data”; Ember, “European Electricity Review”; Energy Institute, “Statistical Review of World Energy” [original data]. Retrieved February 27, 2024 from https://ourworldindata.org/grapher/carbon-intensity-electricity

  • Hourly consumption-based CO2 emissions intensity in Germany / co2map.de, INATECH, University of Freiburg. Retrieved February 27, 2024 from https://api.co2map.de/docs Changelog =========

0.1.1 - 2024-05-14

  • Examples were extended
  • Minor corrections

0.1.0 - 2024-04-08

  • Carbon intensity from co2map.de was added
  • Restructured as a mosaik component
  • Readme and examples are added
  • Initial release of version implemented by Danila Valko

Authors

The adapter was initially developed by Danila Valko.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mosaik_emissions-0.1.1.tar.gz (2.4 MB view details)

Uploaded Source

Built Distribution

mosaik_emissions-0.1.1-py3-none-any.whl (2.6 MB view details)

Uploaded Python 3

File details

Details for the file mosaik_emissions-0.1.1.tar.gz.

File metadata

  • Download URL: mosaik_emissions-0.1.1.tar.gz
  • Upload date:
  • Size: 2.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/5.15.154+

File hashes

Hashes for mosaik_emissions-0.1.1.tar.gz
Algorithm Hash digest
SHA256 49655999362c2bea8c3511f102843af04fe8493adb24ab3a1844a57cf20a88dd
MD5 5a5053151faa85a37f91060e90d90b44
BLAKE2b-256 667a5a699f92e82d4fe2bc1b1bee1aac41b1d2ba2810feede1e7792db9e2e360

See more details on using hashes here.

File details

Details for the file mosaik_emissions-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mosaik_emissions-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.14 Linux/5.15.154+

File hashes

Hashes for mosaik_emissions-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 75726dad6583dd143932802d30d5f8c1d02dc10266c522348148d0cdf12e5696
MD5 e9f55fe662fade6ba8f5daf42c726d1b
BLAKE2b-256 9a499acdf7a981ce9dbaf1b6f2d56b9bd75ec128b2970196e4e75bf4e7ad1a2c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page