Battery#

class impacthpc.src.Battery(embodied_impacts: Impacts | None = None, capacity: ReplicableValue | None = None, server_consumption: ReplicableValue | None = None, battery_duration: ReplicableValue | str | None = None, battery_type: str | None = None, allocation_method: AllocationMethod | None = None)#

Bases: HasEmbodiedImpacts

Represents the emergency batteries and is used to compute their embodied impacts .

Either capacity or both server_consumption and battery_duration must be defined.

embodied_impacts#

The embodied impacts of the battery. If the value is known, estimate_embodied_impacts() returns it, otherwise an estimation is done based on other attributes. Defaults to None.

Type:

Impacts | str | None, optional

capacity#

The battery capacity. If None, it will be estimated from server_consumption and battery_duration.

Type:

ReplicableValue | None, optional

server_consumption#

The consumption of the server. Defaults to None.

Type:

ReplicableValue | None, optional

battery_duration#

The battery’s expected duration with a consumption of server_consumption. Defaults to the value in the config file under default_values_battery > duration.

Type:

ReplicableValue | str | None, optional

battery_type#

The type of the battery, which can be VRLA, LFP, LTO, LMO, NCM, NCA, NaNiCl, or VRFB. Defaults to the value in the config file under default_values_battery > type.

Type:

str | None, optional

allocation_method#

The Allocation Method used to attribute a part of the battery’s embodied impacts to a specific job. Defaults to naive_allocation(), where the lifetime is the value in the config file under default_values_battery > lifetime.

Type:

AllocationMethod | None, optional

Methods Summary

Methods Documentation

_battery_density() ReplicableValue#

Calculate the Battery density:, i.e., the energy that can be contained in 1 kilogram of battery.

Raises:

ValueError – Raised if battery_type is not one of VRLA, LFP, LTO, LMO, NCM, NCA, NaNiCl, or VRFB.

Returns:

The energy contained in 1 kilogram of battery.

Return type:

ReplicableValue

_impact_per_kg(battery_type: str) Impacts#

Estimate the impact of 1 kilogram of battery, based on the battery type.

Parameters:

battery_type (str) – The battery type, which can be VRLA, LFP, LTO, LMO, NCM, NCA, NaNiCl, or VRFB.

Raises:

ValueError – If the battery type is not known.

Returns:

The impacts of 1 kilogram of battery.

Return type:

Impact

estimate_embedded_impacts(job_duration: ReplicableValue)#

Estimate the Embedded impacts of the batteries for the job.

Internally uses estimate_embodied_impacts() and passes it the allocation_method with the job_duration.

Parameters:

job_duration (ReplicableValue) – The duration of the job we want to allocate the embodied impacts to.

Returns:

The Embedded impacts of the batteries for the job.

Return type:

Impact

estimate_embodied_impacts() Impacts#

Estimate the embodied impacts of the battery.

If embodied_impacts is not None, this method only returns it.

Otherwise, the formula used is: impact_per_kilo * weight, where:

Returns:

The embodied impacts of the Battery.

Return type:

Impact