Thevenin (moirae.models.thevenin)#

Interface to the Thevenin package

class moirae.models.thevenin.TheveninModel(isothermal: bool = False)#

Bases: CellModel

Connection between Moirae and an ECM model implemented via Thevenin.

Parameters:

isothermal – Whether to treat the system as isothermal

calculate_terminal_voltage(new_inputs: InputQuantities, transient_state: TheveninTransient, asoh: TheveninASOH) OutputQuantities#

Compute expected output (terminal voltage, etc.) of the cell.

Parameters:
  • new_inputs – Inputs at the current time step

  • transient_state – Current transient state

  • asoh – Health parameters of the cell

Returns:

Estimates for all measurable outputs of a cell

update_transient_state(previous_inputs: TheveninInput, new_inputs: TheveninInput, transient_state: TheveninTransient, asoh: TheveninASOH) TheveninTransient#

Update the transient state of a chemical cell

Parameters:
  • previous_inputs – Inputs at the last time step

  • new_inputs – Inputs at the current time step

  • transient_state – Current transient state

  • asoh – Health parameters of the cell

Returns:

A new transient state

Transient and State of Health (moirae.models.thevenin.state)#

Representations for the parameters of a Thenevin model

pydantic model moirae.models.thevenin.state.TheveninASOH#

Bases: HealthVariable

Parameters which describe the parameters of a Thevenin circuit

These parameters match the parameters required to build a thevenin.Model.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Config:
  • arbitrary_types_allowed: bool = True

  • use_attribute_docstrings: bool = True

Fields:
Validators:
  • _check_rc_elements » all fields

field a_therm: _encode_ndarray, return_type=PydanticUndefined, when_used=json-unless-none)] = 1#

Heat loss area (m^2)

Constraints:
  • func = <function _encode_ndarray at 0x7fa95a3bb0a0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = json-unless-none

Validated by:
field c: Tuple[SOCTempDependentVariable, ...] [Optional]#

Capacitance in all RC elements (C)

Validated by:
field c_p: _encode_ndarray, return_type=PydanticUndefined, when_used=json-unless-none)] = 1150.0#

Specific heat capacity (J/kg/K)

Constraints:
  • func = <function _encode_ndarray at 0x7fa95a3bb0a0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = json-unless-none

Validated by:
field capacity: _encode_ndarray, return_type=PydanticUndefined, when_used=json-unless-none)] = 1.0#

Maximum battery capacity (A-hr)

Constraints:
  • func = <function _encode_ndarray at 0x7fa95a3bb0a0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = json-unless-none

Validated by:
field ce: _encode_ndarray, return_type=PydanticUndefined, when_used=json-unless-none)] = 1.0#

Coulomb efficiency

Constraints:
  • func = <function _encode_ndarray at 0x7fa95a3bb0a0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = json-unless-none

Validated by:
field gamma: _encode_ndarray, return_type=PydanticUndefined, when_used=json-unless-none)] = 50.0#

Hysteresis approach rate

Constraints:
  • func = <function _encode_ndarray at 0x7fa95a3bb0a0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = json-unless-none

Validated by:
field h_thermal: _encode_ndarray, return_type=PydanticUndefined, when_used=json-unless-none)] = 12#

Convective coefficient (W/m^2/K)

Constraints:
  • func = <function _encode_ndarray at 0x7fa95a3bb0a0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = json-unless-none

Validated by:
field m_hyst: SOCDependentVariable [Optional]#

Maximum magnitude of hysteresis (V)

Validated by:
field mass: _encode_ndarray, return_type=PydanticUndefined, when_used=json-unless-none)] = 0.1#

Total battery mass of a battery (kg)

Constraints:
  • func = <function _encode_ndarray at 0x7fa95a3bb0a0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = json-unless-none

Validated by:
field ocv: SOCDependentVariable [Optional]#

Open circuit voltage (V)

Validated by:
field r: Tuple[SOCTempDependentVariable, ...] [Optional]#

Resistance all resistors, including both the series resistor and those in RC elements (Ohm)

Constraints:
  • min_length = 1

Validated by:
property num_rc_elements: int#
pydantic model moirae.models.thevenin.state.TheveninTransient#

Bases: GeneralContainer

Transient state of the ECM circuit

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Config:
  • arbitrary_types_allowed: bool = True

Fields:
field eta: _encode_ndarray, return_type=PydanticUndefined, when_used=json-unless-none)] = ()#

Overpotential for the RC elements (units: V)

Constraints:
  • func = <function _encode_ndarray at 0x7fa95a3bb0a0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = json-unless-none

field soc: _encode_ndarray, return_type=PydanticUndefined, when_used=json-unless-none)] = 0.0#

State of charge for the battery system

Constraints:
  • func = <function _encode_ndarray at 0x7fa95a3bb0a0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = json-unless-none

field temp: _encode_ndarray, return_type=PydanticUndefined, when_used=json-unless-none)] = 298.0#

Temperature of the battery (units: K)

Constraints:
  • func = <function _encode_ndarray at 0x7fa95a3bb0a0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = json-unless-none

classmethod from_asoh(asoh: TheveninASOH, soc: float = 0.0, temp: float = 298.0) TheveninTransient#

Create a transient state appropriate for the circuit defined in a TheveninASOH.

Parameters:
  • asoh – Circuit definition

  • soc – Starting SOC

  • temp – Starting temperature (units: K)

Returns:

A state with the desired SOC, temperature, and all RC elements fully discharged.

Components (moirae.models.thevenin.components)#

Classes used to define components of the ASOH

pydantic model moirae.models.thevenin.components.SOCDependentVariable#

Bases: HealthVariable, Callable[[float | ndarray, int], float | ndarray]

A health variable which is dependent on the state of charge

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Config:
  • arbitrary_types_allowed: bool = True

Fields:

Validators:

pydantic model moirae.models.thevenin.components.SOCPolynomialVariable#

Bases: SOCDependentVariable

A parameter whose dependence on SOC is described by a polynomial

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Config:
  • arbitrary_types_allowed: bool = True

Fields:
Validators:

field coeffs: _encode_ndarray, return_type=PydanticUndefined, when_used=json-unless-none)] = 1.0#

Coefficients for the polynomial

Constraints:
  • func = <function _encode_ndarray at 0x7fa95a3bb0a0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = json-unless-none

Validated by:
pydantic model moirae.models.thevenin.components.SOCTempDependentVariable#

Bases: HealthVariable, Callable[[float | ndarray, float | ndarray, int], float | ndarray]

A health variable which is dependent on the state of charge and temperature

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Config:
  • arbitrary_types_allowed: bool = True

Fields:

Validators:

pydantic model moirae.models.thevenin.components.SOCTempPolynomialVariable#

Bases: SOCTempDependentVariable

A parameter where the dependence on SOC and temperature are described by polynomial

The temperature-dependence is described by a polynomial centered on a reference temperature, \(f_T(T) = c_0 + c_1 (T - T_{ref}) + ...\)

The SOC-dependence is described by a polynomial as well, \(f_{SOC}(soc) = c_0 + c_1 * soc + ...\)

The two are added to express dependence in both: \(f(T, SOC) = f_T(T) + f_{SOC}(SOC)\)

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Config:
  • arbitrary_types_allowed: bool = True

Fields:
Validators:

field soc_coeffs: _encode_ndarray, return_type=PydanticUndefined, when_used=json-unless-none)] = 1.0#

Reference parameters for the OCV dependence polynomial

Constraints:
  • func = <function _encode_ndarray at 0x7fa95a3bb0a0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = json-unless-none

Validated by:
field t_coeffs: _encode_ndarray, return_type=PydanticUndefined, when_used=json-unless-none)] = 0.0#

Reference parameters for the temperature dependence polynomial

Constraints:
  • func = <function _encode_ndarray at 0x7fa95a3bb0a0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = json-unless-none

Validated by:
field t_ref: _encode_ndarray, return_type=PydanticUndefined, when_used=json-unless-none)] = 298.0#

Reference temperature for the temperature dependence. Units: K

Constraints:
  • func = <function _encode_ndarray at 0x7fa95a3bb0a0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = json-unless-none

Validated by:

Inputs and Outputs (moirae.models.thevenin.ins_outs)#

Inputs and outputs from a Thevenin model

pydantic model moirae.models.thevenin.ins_outs.TheveninInput#

Bases: InputQuantities

Inputs for the Thevenin model

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Config:
  • arbitrary_types_allowed: bool = True

Fields:
field t_inf: _encode_ndarray, return_type=PydanticUndefined, when_used=json-unless-none)] = 298.0#

Environmental temperature (units: K)

Constraints:
  • func = <function _encode_ndarray at 0x7fa95a3bb0a0>

  • json_schema_input_type = PydanticUndefined

  • return_type = PydanticUndefined

  • when_used = json-unless-none