pybop.costs.design_costs#

Classes#

DesignCost

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

GravimetricEnergyDensity

Represents the gravimetric energy density of a battery cell, calculated based

VolumetricEnergyDensity

Represents the volumetric energy density of a battery cell, calculated based

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.

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

Bases: DesignCost

Represents the gravimetric energy density of a battery cell, calculated based on a normalised discharge from upper to lower voltage limits. The goal is to maximise the energy density, which is achieved by setting minimising = False in the optimiser settings.

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.VolumetricEnergyDensity(problem)[source]#

Bases: DesignCost

Represents the volumetric energy density of a battery cell, calculated based on a normalised discharge from upper to lower voltage limits. The goal is to maximise the energy density, which is achieved by setting minimising = False in the optimiser settings.

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