pybop.costs.design_costs#

Classes#

DesignCost

Overwrites and extends BaseCost class for design-related cost functions.

GravimetricEnergyDensity

Calculates the gravimetric energy density (specific energy) of a battery cell,

GravimetricPowerDensity

Calculates the gravimetric power density (specific power) of a battery cell,

VolumetricEnergyDensity

Calculates the (volumetric) energy density of a battery cell, when applied to a

VolumetricPowerDensity

Calculates the (volumetric) power density of a battery cell, when applied to a

Module Contents#

class pybop.costs.design_costs.DesignCost(problem)[source]#

Bases: pybop.costs.base_cost.BaseCost

Overwrites and extends BaseCost class for design-related cost functions.

Inherits all parameters and attributes from BaseCost.

Additional Attributes#

problemobject

The associated problem containing model and evaluation methods.

minimising = False[source]#
class pybop.costs.design_costs.GravimetricEnergyDensity(problem)[source]#

Bases: DesignCost

Calculates the gravimetric energy density (specific energy) of a battery cell, when applied to a normalised discharge from upper to lower voltage limits. The goal of maximising the energy density is achieved with self.minimising=False.

The gravimetric energy density [Wh.kg-1] is calculated as

\[\frac{1}{3600 m} \int_{t=0}^{t=T} I(t) V(t) \mathrm{d}t\]

where m is the cell mass, t is the time, T is the total time, I is the current and V is the voltage. The factor of 1/3600 is included to convert from seconds to hours.

Inherits all parameters and attributes from DesignCost.

compute(y: dict, dy: numpy.ndarray = None, calculate_grad: bool = False) float[source]#

Computes the cost function for the given predictions.

Parameters:
  • y (dict) – The dictionary of predictions with keys designating the signals for fitting.

  • dy (np.ndarray, optional) – The corresponding gradient with respect to the parameters for each signal. Note: not used in design optimisation classes.

  • calculate_grad (bool, optional) – A bool condition designating whether to calculate the gradient.

Returns:

The gravimetric energy density or -infinity in case of infeasible parameters.

Return type:

float

class pybop.costs.design_costs.GravimetricPowerDensity(problem, target_time: int | float = 3600)[source]#

Bases: DesignCost

Calculates the gravimetric power density (specific power) of a battery cell, when applied to a discharge from upper to lower voltage limits. The goal of maximising the power density is achieved with self.minimising=False.

The time-averaged gravimetric power density [W.kg-1] is calculated as

\[\frac{1}{3600 m T} \int_{t=0}^{t=T} I(t) V(t) \mathrm{d}t\]

where m is the cell mass, t is the time, T is the total time, I is the current and V is the voltage. The factor of 1/3600 is included to convert from seconds to hours.

Inherits all parameters and attributes from DesignCost.

Additional parameters#

target_timeint

The length of time (seconds) over which the power should be sustained.

compute(y: dict, dy: numpy.ndarray = None, calculate_grad: bool = False) float[source]#

Computes the cost function for the given predictions.

Parameters:
  • y (dict) – The dictionary of predictions with keys designating the signals for fitting.

  • dy (np.ndarray, optional) – The corresponding gradient with respect to the parameters for each signal. Note: not used in design optimisation classes.

  • calculate_grad (bool, optional) – A bool condition designating whether to calculate the gradient.

Returns:

The gravimetric power density or -infinity in case of infeasible parameters.

Return type:

float

target_time = 3600[source]#
class pybop.costs.design_costs.VolumetricEnergyDensity(problem)[source]#

Bases: DesignCost

Calculates the (volumetric) energy density of a battery cell, when applied to a normalised discharge from upper to lower voltage limits. The goal of maximising the energy density is achieved with self.minimising = False.

The volumetric energy density [Wh.m-3] is calculated as

\[\frac{1}{3600 v} \int_{t=0}^{t=T} I(t) V(t) \mathrm{d}t\]

where v is the cell volume, t is the time, T is the total time, I is the current and V is the voltage. The factor of 1/3600 is included to convert from seconds to hours.

Inherits all parameters and attributes from DesignCost.

compute(y: dict, dy: numpy.ndarray = None, calculate_grad: bool = False) float[source]#

Computes the cost function for the given predictions.

Parameters:
  • y (dict) – The dictionary of predictions with keys designating the signals for fitting.

  • dy (np.ndarray, optional) – The corresponding gradient with respect to the parameters for each signal. Note: not used in design optimisation classes.

  • calculate_grad (bool, optional) – A bool condition designating whether to calculate the gradient.

Returns:

The volumetric energy density or -infinity in case of infeasible parameters.

Return type:

float

class pybop.costs.design_costs.VolumetricPowerDensity(problem, target_time: int | float = 3600)[source]#

Bases: DesignCost

Calculates the (volumetric) power density of a battery cell, when applied to a discharge from upper to lower voltage limits. The goal of maximising the power density is achieved with self.minimising=False.

The time-averaged volumetric power density [W.m-3] is calculated as

\[\frac{1}{3600 v T} \int_{t=0}^{t=T} I(t) V(t) \mathrm{d}t\]

where v is the cell volume, t is the time, T is the total time, I is the current and V is the voltage. The factor of 1/3600 is included to convert from seconds to hours.

Inherits all parameters and attributes from DesignCost.

Additional parameters#

target_timeint

The length of time (seconds) over which the power should be sustained.

compute(y: dict, dy: numpy.ndarray = None, calculate_grad: bool = False) float[source]#

Computes the cost function for the given predictions.

Parameters:
  • y (dict) – The dictionary of predictions with keys designating the signals for fitting.

  • dy (np.ndarray, optional) – The corresponding gradient with respect to the parameters for each signal. Note: not used in design optimisation classes.

  • calculate_grad (bool, optional) – A bool condition designating whether to calculate the gradient.

Returns:

The volumetric power density or -infinity in case of infeasible parameters.

Return type:

float

target_time = 3600[source]#