Fork of Okra's lightweight embedded state of charge (SoC) algorithm based on extend kalman filter (EKF).
#Install requirements
sudo apt install meson ninja-build build-essential clang-format cmake
#Git clone this repository with `--recursive` option:
git clone --recursive /~https://github.com/mulles/kalman-soc.git
#or run `git submodule update --init --recursive` after normal clone.
#Setup build directory
cd kalman-soc
meson setup build
#Build with ninja
cd build
ninja
#Run unit tests
./run_tests
Backtest a dataset of current and voltage measurements you recorded in the past by running:
./backtest
A dataset is located in /data
and consist of raw_sensor_data.csv
and node_data.csv
as input data.
node_data.csv
(contains 0-1 columns. Column[0] = boolean (lithium[1] or lead[0]) Column[1] = 12 (battery system voltage) as integer)raw_sensor_data.csv
(contains 0-4 columns)example_processed_sensor_data.csv
(contains the input raw sensor data and the calculated SOC in column 5, it is generated by the backtest and namedprocessed_sensor_data.csv
)
On successful run, output on the command line should be:
Finished reading.
Finished writing.
The output file would be processed_sensor_data.csv
.
https://raw.githack.com/mulles/kalman-soc/main/data/EVLKpN_20210817-20210830_SOC_Graph.html
https://raw.githack.com/mulles/kalman-soc/main/data/mppt-1210-hus_2021-05-28T20:10:00.000Z-2021-05-29T02:19:00.000Z_SOC_Graph.html