Hi Arthur,
You can use the citation on p. 8 of DiOrio, N.; Dobos, A.; Janzou, S.; Nelson, A.; Lunstrom, B. (2015). Technoeconomic Modeling of Battery Energy Storage in SAM. 32 pp. NREL/TP-6A20-64641 (
PDF 2.6 MB
) to find a description of the rainflow algorithm SAM uses for the battery life model (it is listed as S. Downing and D. Socie, "Simple Rainflow Counting Algorithms," International Journal of Fatigue, 1982.)
The code for SAM's rainflow algorithm is here:
github.com/NREL/ssc/blob/892b81b46a66a81ed6d357bc802dd82318372c4b/shared/lib_battery_lifetime_calendar_cycle.cpp#L119
As of SAM 2021.12.02, SAM uses the hourly depth-of-discharge (DOD) value rather than the average. Note that the rainflow algorithm is based on DOD not state of charge (SOC). In the rainflow algorithm a cycle from 80% to 90% SOC and a cycle from 10% to 20% SOC would both be counted as 10% DOD and cause the same amount of degradation.
If you are using Python for this, the BatteryStateful module of the PySAM package allows for inputting custom rainflow cycle counts (variable name 'cycle_counts') for each single step:
nrel-pysam.readthedocs.io/en/master/modules/BatteryStateful.html.
Best regards,
Paul.