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, update_capacity=False)[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.

parameter_setobject)

The set of parameters from the problem’s model.

dtfloat

The time step size used in the simulation.

abstract _evaluate(x, grad=None)[source]#

Computes the value of the cost function.

This method must be implemented by subclasses.

Parameters:
  • x (array) – The parameter set for which to compute the cost.

  • grad (array, optional) – Gradient information, not used in this method.

Raises:

NotImplementedError – If the method has not been implemented by the subclass.

update_simulation_data(initial_conditions)[source]#

Updates the simulation data based on the initial conditions.

Parameters:

initial_conditions (array) – The initial conditions for the simulation.

class pybop.costs.design_costs.GravimetricEnergyDensity(problem, update_capacity=False)[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 minimizing the negative energy density reported by this class.

Inherits all parameters and attributes from DesignCost.

_evaluate(x, grad=None)[source]#

Computes the cost function for the energy density.

Parameters:
  • x (array) – The parameter set for which to compute the cost.

  • grad (array, optional) – Gradient information, not used in this method.

Returns:

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

Return type:

float

class pybop.costs.design_costs.VolumetricEnergyDensity(problem, update_capacity=False)[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 minimizing the negative energy density reported by this class.

Inherits all parameters and attributes from DesignCost.

_evaluate(x, grad=None)[source]#

Computes the cost function for the energy density.

Parameters:
  • x (array) – The parameter set for which to compute the cost.

  • grad (array, optional) – Gradient information, not used in this method.

Returns:

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

Return type:

float