Skip to main content

Scoring Algorithm

Unfortunately, we can't display every part of the power grid on one light, but we can “summarise” that information into one metric. That summarisation process is called a Scoring Algorithm. That metric is configurable, and there are lots of options. Here's my favourite two:

Cumulative CO2e Emissions

This is the default metric used for your Micro-Indicator

The total CO2e being released by New Zealand's grid at this moment, in Tonnes/hour. Heavily influenced by the current power output of the grid, making it cycle on a daily basis. It shows how "strained" the power-grid currently is.

Co2eTotalBar.png

CO2e Intensity

The amount of extra CO2e emitted by the grid if you turned on an appliance, in gCO2e/kwh. Heavily influenced by sources of power and the operational status of power-plants, meaning it has much longer cycles than the Cumulative Output.
Co2eIntensityBar.png

Changing the Scoring Algorithm

To change how your light reacts tofrom the powerdefault  grid,Cumulative CO2e Emissions metric, you'll need to start by looking in src/powerstations.cpp line 71, and swap it from the calcualting from the emissions data, to the intensity data.

Changing:

// Calculate colour using new scoring algorithm

DoubleRange scoring_range =  { CO2E_EMISSIONS_RANGE_MIN, CO2E_EMISSIONS_RANGE_MAX };
double scoring_datum = this->co2e_emissions;

// DoubleRange scoring_range =  { CO2E_INTENSITY_RANGE_MIN, CO2E_INTENSITY_RANGE_MAX };
// double scoring_datum = this->co2e_intensity;

To:

// Calculate colour using new scoring algorithm

// DoubleRange scoring_range =  { CO2E_EMISSIONS_RANGE_MIN, CO2E_EMISSIONS_RANGE_MAX };
// double scoring_datum = this->co2e_emissions;

DoubleRange scoring_range =  { CO2E_INTENSITY_RANGE_MIN, CO2E_INTENSITY_RANGE_MAX };
double scoring_datum = this->co2e_intensity;

When you re-upload your code, your device will now show the CO2e Intensity colour scale.

The scoring_range is calculated in this Juypter Notebook, and uses the max/min values from August 2022 -> August 2023