Skip to content

Latest commit

 

History

History
97 lines (68 loc) · 3.13 KB

README.md

File metadata and controls

97 lines (68 loc) · 3.13 KB

SCI-O (operational emissions)

Operational emissions refer to the carbon generated by a component while it is in use. It is the product of the energy used by the component in kWh and the grid intensity in gCO2e/kWh. The operational emissions are added to the embodied emissions (calculated using sci-m) to provide an overall SCI score for the component.

Parameters

Plugin config

Not Needed

Inputs

  • energy: energy value in kWh
  • grid/carbon-intensity: intensity value gCO2e/kWh

Returns

  • carbon-operational: the carbon emitted during a applications operation, in gCO2eq

Calculation

To calculate the operational emissions o for a software application, use the following:

O = E * I

where O = operational emissions, E = energy in kWh, and I = grid carbon intensity.

In the IF implementation the calculation is expressed using the following terms:

o = (energy * grid/carbon-intensity)

Read more on operational emissions.

Implementation

IF implements the plugin based on the simple multiplication of the energy and intensity values as inputs. The sci-o plugin expects energy and grid/carbon-intensity to be provided as inputs.

Note that the energy field is added to the manifest by the sci-e plugin only. This means sci-o must always be preceded by sci-e in a plugin pipeline. This is always true, even if there is only a single component of energy such as cpu/energy from teads-curve. sci-e sums all the available components and adds the sum to the manifest as energy.

To run the plugin, you must first create an instance of SciO using SciO(). Then, you can call execute() to return carbon-operational.

Usage

The following snippet demonstrates how to call the sci-o plugin from Typescript.

import {SciO} from '@grnsft/if-plugins';

const sciO = SciO();
const results = await sciO.execute([
  {
    energy: 0.5, // energy value in kWh
    'grid/carbon-intensity': 0.5, // intensity value gCO2e/kWh
  },
]);

Example manifest

IF users will typically call the plugin as part of a pipeline defined in a manifest file. In this case, instantiating the plugin is handled by ie and does not have to be done explicitly by the user. The following is an example manifest that calls sci-o:

name: sci-o
description:
tags:
initialize:
  plugins:
    sci-o:
      method: SciO
      path: '@grnsft/if-plugins'
tree:
  children:
    child:
      pipeline:
        - sci-o
      config:
        sci-o:
      inputs:
        - timestamp: 2023-08-06T00:00
          duration: 3600
          energy: 0.001
          grid/carbon-intensity: 800

You can run this example manifest by saving it as ./examples/manifests/test/sci-o.yml and executing the following command from the project root:

npm i -g @grnsft/if
npm i -g @grnsft/if-plugins
ie --manifest ./examples/manifests/test/sci-o.yml --output ./examples/outputs/sci-o.yml

The results will be saved to a new yaml file in ./examples/outputs.