Boavizta / boaviztapi

đź›  Giving access to BOAVIZTA reference data and methodologies trough a RESTful API
GNU Affero General Public License v3.0
73 stars 24 forks source link

Adding device usage component (scope 2) #21

Closed da-ekchajzer closed 2 years ago

da-ekchajzer commented 2 years ago

Epic

Usage

US

As an external user I can retrieve the scope2 impact of devices With device usage and characteristics

Usage object

usage attributes

{
"max_power": float,
"yearly_electrical_consumption": float
"life_duration": int,
"usage_location": string,
"idle_time_ratio": float,
"workload_ratio": float,
"carbon_intensity": float,
"adp_factor": float
}

Yearly electrical consumption

yearly_electrical_consumption is given by the user or smart complete depending on the type of component or device (see below)

GWP

gwp = yearly_electrical_consumption*life_duration*carbon_intensity_factor

PE

pe = (yearly_electrical_consumption*life_duration) * primary_energy_factor

ADP

adp = (yearly_electrical_consumption*life_duration) * abiotic_depletion_potential_factor

da-ekchajzer commented 2 years ago

Impact factors

Carbon intensity

https://ourworldindata.org/grapher/carbon-intensity-electricity from https://www.bp.com/en/global/corporate/energy-economics/statistical-review-of-world-energy.html (BP) TODO : Validate data

Primary energy factor

TODO : Find electricity primary energy factor by country (per year)

ADP energy factor

TODO : Find electricity abiotic depletion potential factor by country (per year)

da-ekchajzer commented 2 years ago

Device yearly consumption

Electrical consumption

yearly_electrical_consumption = ((max_power*(1-idle_time_ratio)*medium_workload) + (idle_time_ratio * idle_power))*365*24

Default server data

From Dell R640 LCA

Capture

_DEFAULT_IDLE_RATIO = 2.4/24 = 10%

_DEFAULT_IDLE_PERCENTAGE_MAX_POWER = 201/510 = 40%

_DEFAULT_MEDIUM_WORKLOAD = (100*3.6 + 50*13.2 + 10*4.8)/(24-2.4) = 50%

_DEFAULT_MAX_POWER = 510

if we apply the formula to the Dell R740:

yearly_electrical_consumption_dellR740 

= ((_DEFAULT_MAX_POWER *(1-_DEFAULT_IDLE_RATIO )*medium_workload) +
(_DEFAULT_IDLE_RATIO * (_DEFAULT_IDLE_PERCENTAGE_MAX_POWER *_DEFAULT_MAX_POWER))
)*365*24

= 2189 kwh/year < 3081 kwh/year (Dell data)
github-benjamin-davy commented 2 years ago

I'm wondering what would be the most common situation from an API user POV when not having the electrical consumption (that would be most of the cases):

I think the ideal for us would be to compute for each server configuration the P (power consumption) values we see in the Dell example and then simply calculate the consumption based on the parameters or fall back to something we can define (365 days running an average load).

da-ekchajzer commented 2 years ago

For cloud we will do an other process with a bottom-up approach per component #29 but the same problems occurs with the load

For server something like that :

Power per load

LOAD high (100%) medium (50%) low (10%) idle off
Power (W) X X X X 0

1 - I have the different power per load -> Use it 2 - I only have the max power -> Can medium, low and idle be retrieve has function of max power ? 3 - I have nothing -> Use Dell R740 power per load

Time ratio per load

LOAD high (100%) medium (50%) low (10%) idle off
Time_ratio (% of day per year or hour per day) X X X X X

1 - I have the different time ratio per load -> Use it 2 - I only have the medium workload -> what can we do ? 3 - I have nothing -> Use Dell R740 power per load

Equation

yearly_electrical_consumption = [power(high) * time_ratio(high) + power(medium) * time_ratio(medium) + power(low) * time_ratio(low) + power(idle) * time_ratio(idle) + power(off) * time_ratio(off)]*24*365

Future dev

I think it is ok to use Dell R740 for now because in the future you will be able to select an archetype (#1). All the missing datas will be set with the value of this archetype and not the value of the default configuration.

github-benjamin-davy commented 2 years ago

Thanks,

For: "2 - I only have the max power -> Can medium, low and idle be retrieved as function of max power ?" we can define some heuristics based on existing data (to be discussed), maybe @bpetit would have some interesting thoughts on this from Scaphandre and we can reuse AWS bare-metal power profiles data on top of Dell's.

For: "3 - I have nothing -> Use Dell R740 power per load" Ok to use Dell as a first step and then the closest archetype profile available, to be discussed in (#1) but we can easily generate profiles like for example: 1 low TDP (<100W) CPU + 128 Gb memory etc.

da-ekchajzer commented 2 years ago

Following today's meeting