Extractors (moirae.extractors
)#
Model-specific algorithms for quickly extracting parameters and state from informative parts of time series data
Base Classes (m.extractors.base
)#
Interface for extractors
- class moirae.extractors.base.BaseExtractor#
Bases:
object
Base class for tools which determine parameters from special cycles
- check_data(data: BatteryDataset)#
Verify whether data contains features needed for algorithm
- Parameters:
data – Data to be evaluated
- Raises:
(ValueError) If the dataset is missing critical information –
- extract(data: BatteryDataset) HealthVariable #
Determine parameters of a physics model from battery dataset
- Parameters:
data – Data to use for parameter assessment
- Returns:
Part of the parameter set for a model.
ECM (m.extractors.ecm
)#
Extraction algorithms which gather parameters of an ECM
- class moirae.extractors.ecm.MaxCapacityExtractor#
Bases:
BaseExtractor
Estimate the maximum discharge capacity of a battery
Suggested Data: Low current cycles which sample fully charge or discharge a battery
- Algorithm:
Compute the observed capacity each cycle if not available using
CapacityPerCycle
.Find the maximum capacity over all provided cycles
- extract(data: CellDataset) MaxTheoreticalCapacity #
Determine parameters of a physics model from battery dataset
- Parameters:
data – Data to use for parameter assessment
- Returns:
Part of the parameter set for a model.
- class moirae.extractors.ecm.OCVExtractor(capacity: float | MaxTheoreticalCapacity, soc_points: ndarray | int = 11, soc_requirement: float = 0.95, interpolation_style: str = 'linear')#
Bases:
BaseExtractor
Estimate the Open Circuit Voltage (OCV) of a battery as a function of state of charge (SOC)
Suggested data: OCV extraction works best when provided with data for a cycle that samples the entire SOC range (at least a range larger than
soc_requirement
) with a slow charge and discharge rate. Periodic rests are helpful but not required.- Algorithm:
Locate cycle with the lowest average voltage during charge and discharge
Assign an SOC to each measurement based on
capacity
Assign a weights to each point based on \(1 / max(\left| current \right|, 1e-6)\). Normalize weights such that they sum to 1.
Fit an isotonic regressor to the weighted data.
Evaluate the regression at SOC points requested by the user, return as a
OpenCircuitVoltage
object using theinterpolation_style
type of spline.
- Parameters:
soc_points – SOC points at which to extract OCV or (
int
) number of grid points.
- check_data(data: CellDataset)#
Verify whether data contains features needed for algorithm
- Parameters:
data – Data to be evaluated
- Raises:
(ValueError) If the dataset is missing critical information –
- extract(dataset: CellDataset) OpenCircuitVoltage #
Extract an estimate for the OCV of a cell
- Parameters:
dataset – Dataset containing an estimate for the nominal capacity and time series measurements.
- Returns:
An OCV instance with the requested SOC interpolation points,
- interpolate_ocv(cycle: DataFrame) ndarray #
Fit then evaluate a smoothing spline which explains voltage as a function of SOC and current
- Parameters:
cycle – Cycle to use for fitting the spline
- Returns:
An estimate for the OCV at
soc_points
- class moirae.extractors.ecm.R0Extractor(capacity: float | MaxTheoreticalCapacity, soc_points: ndarray | int = 11, soc_requirement: float = 0.95, dt_max: float = 0.02, dInorm_min: float = 0.1)#
Bases:
BaseExtractor
Estimate the Instantaneous Resistance (R0) of a battery as a function of state of charge (SOC)
Suggested data: R0 extraction works best when provided with data for a cycle that samples instantaneous changes in current across the entire SOC range (at least a range larger than
soc_requirement
)- Algorithm:
Locate cycle with jumps in current across SOC range
Assign an SOC to each measurement based on
capacity
Calculate instantanous resistance as dI/dt
Filter for R0 values with dt below the threshold specified by
dt_max
and dI above the threshold specified bydInorm_min
Fit a 1-D smoothing cubic spline for voltage as a function of SOC, placing knots at
soc_points
.Evaluate the spline at SOC points requested by the user, return as a
Resistance
object using theinterpolation_style
type of spline.
- Parameters:
soc_points – SOC points at which to extract R0 or (
int
) number ofpoints. (grid)
- check_data(data: CellDataset)#
Verify whether data contains features needed for algorithm
- Parameters:
data – Data to be evaluated
- Raises:
(ValueError) If the dataset is missing critical information –
- extract(dataset: CellDataset) Resistance #
Extract an estimate for the R0 of a cell
- Parameters:
dataset – Dataset containing time series measurements.
- Returns:
An R0 instance with the requested SOC interpolation points,
- interpolate_r0(cycle: DataFrame) ndarray #
Fit then evaluate a smoothing spline which explains R0 as a function of SOC
- Parameters:
cycle – Cycle to use for fitting the spline
- Returns:
An estimate for the R0 at
soc_points
- class moirae.extractors.ecm.RCExtractor(capacity: float | MaxTheoreticalCapacity, soc_points: ndarray | int = 11, soc_requirement: float = 0.95, n_rc: int = 1, min_rest: float = 600, max_rest_I: float | None = None)#
Bases:
BaseExtractor
Estimate the values of a parallel resistor-capacitor couples (RC) for an ECM of a battery as a function of state of charge (SOC)
Required data: RC extraction requires rest periods of at least
min_rest
seconds across a reasonable SOC range.- Algorithm:
Locate rest periods of at least
min_rest
secondsAssign an SOC to each measurement based on
capacity
Fit
n_rc
exponential models to the IV(t) dataThe scale and power parameters are converted to the RC parameters
Fit a 1-D smoothing cubic spline for voltage as a function of SOC, placing knots at
soc_points
.Evaluate the spline at SOC points requested by the user, return as a
Resistance
object using theinterpolation_style
type of spline.
- Parameters:
capacity (of the) – Best estimate for capacity of the cell (Amp-hours)
soc_points – SOC points at which to extract R0 or (
int
) number ofpoints. (grid)
soc_requirement – Require that dataset samples at least this fraction
capacity
n_rc – Number of RC couples in the ECM
min_rest – Minimum required rest duration in seconds
max_rest_I – Maximum current expected during a rest period (Amps)
- check_data(data: CellDataset)#
Verify whether data contains features needed for algorithm
- Parameters:
data – Data to be evaluated
- Raises:
(ValueError) If the dataset is missing critical information –
- extract(dataset: CellDataset) Tuple[RCComponent, ...] #
Extract an estimate for the RC elements of a cell
- Parameters:
dataset – Dataset containing time series measurements.
- Returns:
An tuple of RC instances with the requested SOC interpolation points
- interpolate_rc(data: CellDataset) ndarray #
Fit then evaluate a smoothing spline which explains RC values as a function of SOC
- Parameters:
cycle – Cycle to use for fitting the spline
- Returns:
An estimate for all RC parameters at
soc_points