Degradation API¶
The simses.degradation module composes a calendar and cyclic aging sub-model with a half-cycle detector into a single DegradationModel that Battery steps every timestep. For the SoH split, statelessness rule, and virtual-time continuation, see the Degradation concept page.
Degradation model¶
Composer for the two sub-models. Owns the DegradationState accumulators and runs the calendar pass every step, plus a cyclic pass each time a half-cycle completes. Provides calendar_only / cyclic_only factories for isolated studies.
simses.degradation.degradation.DegradationModel
¶
Composes calendar and cyclic degradation with a half-cycle detector.
This is the object that gets passed to Battery(degradation=...).
It owns a :class:~simses.degradation.state.DegradationState that
accumulates all capacity loss and resistance increase components.
Sub-models are stateless and receive the current accumulated values on
each call.
Source code in src/simses/degradation/degradation.py
__init__(calendar, cyclic, initial_soc, initial_state=None)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calendar
|
CalendarDegradation
|
Calendar aging sub-model. |
required |
cyclic
|
CyclicDegradation
|
Cyclic aging sub-model. |
required |
initial_soc
|
float
|
SOC at the start of the simulation in p.u. Seeds
the :class: |
required |
initial_state
|
DegradationState | None
|
Optional pre-existing :class: |
None
|
Source code in src/simses/degradation/degradation.py
calendar_only(calendar, initial_soc, initial_state=None)
classmethod
¶
Create a model with only calendar aging (no cyclic component).
Source code in src/simses/degradation/degradation.py
cyclic_only(cyclic, initial_soc, initial_state=None)
classmethod
¶
Create a model with only cyclic aging (no calendar component).
Source code in src/simses/degradation/degradation.py
step(state, dt)
¶
Run one degradation timestep.
- Calendar aging is applied every timestep.
- The cycle detector checks for SOC direction reversals; when a half-cycle completes, cyclic aging is applied.
Source code in src/simses/degradation/degradation.py
Degradation state¶
Non-negative p.u. accumulators for calendar and cyclic capacity fade and resistance rise. The only place aging state lives — sub-models are stateless.
simses.degradation.state.DegradationState
dataclass
¶
Accumulated degradation components (all values in p.u., non-negative).
This is the authoritative state for a :class:DegradationModel. Calendar
and cyclic sub-models are stateless — they receive the current accumulated
value as an argument to their update method and return deltas, which the
DegradationModel applies here.
Source code in src/simses/degradation/state.py
Calendar degradation¶
Protocol for time-based aging laws (T, SOC, time). Every timestep receives the running accumulated_qloss so non-linear laws can continue correctly under varying stress. See Extending Degradation Models.
simses.degradation.calendar.CalendarDegradation
¶
Bases: Protocol
Protocol for calendar aging models.
Implementations are stateless: all accumulated values live in
:class:~simses.degradation.state.DegradationState (owned by the
:class:~simses.degradation.degradation.DegradationModel). The current
accumulated values are passed in on every call so that models using
virtual-time continuation can compute the correct increments without
maintaining their own internal state.
Source code in src/simses/degradation/calendar.py
update_capacity(state, dt, accumulated_qloss)
¶
Compute incremental calendar capacity loss.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
BatteryState
|
Current battery state. |
required |
dt
|
float
|
Timestep in seconds. |
required |
accumulated_qloss
|
float
|
Calendar capacity loss accumulated so far (p.u., positive), used to seed virtual-time continuation. |
required |
Returns:
| Type | Description |
|---|---|
float
|
delta_qloss — positive increment in p.u. (capacity loss increases). |
Source code in src/simses/degradation/calendar.py
update_resistance(state, dt)
¶
Compute incremental calendar resistance increase.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
BatteryState
|
Current battery state. |
required |
dt
|
float
|
Timestep in seconds. |
required |
Returns:
| Type | Description |
|---|---|
float
|
delta_soh_R — positive increment in p.u. (resistance increases). |
Source code in src/simses/degradation/calendar.py
Cyclic degradation¶
Protocol for throughput-based aging laws. Called on each completed half-cycle with a HalfCycle object carrying the stress factors.
simses.degradation.cyclic.CyclicDegradation
¶
Bases: Protocol
Protocol for cyclic aging models.
Implementations are stateless: all accumulated values live in
:class:~simses.degradation.state.DegradationState (owned by the
:class:~simses.degradation.degradation.DegradationModel). The current
accumulated values are passed in on every call so that models using
virtual-FEC continuation can compute the correct increments without
maintaining their own internal state.
Source code in src/simses/degradation/cyclic.py
update_capacity(state, half_cycle, accumulated_qloss)
¶
Compute incremental cyclic capacity loss for a completed half-cycle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
BatteryState
|
Current battery state. |
required |
half_cycle
|
HalfCycle
|
Stress factors of the completed half-cycle. |
required |
accumulated_qloss
|
float
|
Cyclic capacity loss accumulated so far (p.u., positive), used to seed virtual-FEC continuation. |
required |
Returns:
| Type | Description |
|---|---|
float
|
delta_qloss — positive increment in p.u. (capacity loss increases). |
Source code in src/simses/degradation/cyclic.py
update_resistance(state, half_cycle)
¶
Compute incremental cyclic resistance increase for a completed half-cycle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
BatteryState
|
Current battery state. |
required |
half_cycle
|
HalfCycle
|
Stress factors of the completed half-cycle. |
required |
Returns:
| Type | Description |
|---|---|
float
|
delta_soh_R — positive increment in p.u. (resistance increases). |
Source code in src/simses/degradation/cyclic.py
Cycle detection¶
Rainflow-style detector that watches SOC across timesteps and emits a HalfCycle whenever the direction reverses. Drives the cyclic pass.
simses.degradation.cycle_detector.HalfCycleDetector
¶
Detects half-cycles by tracking SOC direction reversals.
A half-cycle is completed when the SOC changes direction (from charging to discharging or vice versa). Rest periods (unchanged SOC) are ignored and do not trigger a cycle or contribute to elapsed time.
Attributes:
| Name | Type | Description |
|---|---|---|
total_fec |
float
|
Cumulative full equivalent cycles. |
last_cycle |
HalfCycle | None
|
The most recently completed HalfCycle, or None. |
Source code in src/simses/degradation/cycle_detector.py
__init__(initial_soc)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
initial_soc
|
float
|
SOC at the start of the simulation in p.u. The
first :meth: |
required |
Source code in src/simses/degradation/cycle_detector.py
step(soc, dt)
¶
Update the detector with a new SOC value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
soc
|
float
|
Current state of charge in p.u. |
required |
dt
|
float
|
Timestep in seconds. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if a half-cycle was completed (direction reversal detected). |
Source code in src/simses/degradation/cycle_detector.py
simses.degradation.cycle_detector.HalfCycle
dataclass
¶
Stress factors for a completed half-cycle.
Attributes:
| Name | Type | Description |
|---|---|---|
depth_of_discharge |
float
|
Absolute SOC swing of the half-cycle in p.u. |
mean_soc |
float
|
Average SOC during the half-cycle in p.u. |
c_rate |
float
|
Average C-rate during the half-cycle in 1/h. |
full_equivalent_cycles |
float
|
FEC contribution (depth_of_discharge / 2). |