PER Firmware
Loading...
Searching...
No Matches
soc_ukf.c File Reference

Unscented Kalman filter for state of charge estimation. More...

#include "soc_ukf.h"
#include <math.h>
#include "lerp_lut.h"
Include dependency graph for soc_ukf.c:

Functions

 LERP_LUT_INIT (SOC_2_OCV, SOC_2_OCV_ENTRIES, SOC_2_OCV_SIZE)
 
static void SOC_UKF_mean_weights (const soc_ukf_t *ukf, float mean_weights[NUM_SIGMA_POINTS])
 
static void SOC_UKF_covariance_weights (soc_ukf_t *ukf, const soc_ukf_params_t *params)
 
void SOC_UKF_init (soc_ukf_t *ukf, const soc_ukf_params_t *params, vec3_t x0, mat3_t P0)
 Initialize the SoC filter.
 
static void SOC_UKF_sigma_points (const soc_ukf_t *ukf, vec3_t points[NUM_SIGMA_POINTS])
 
void SOC_UKF_predict (soc_ukf_t *ukf, float current)
 Predict the next state and covariance.
 
void SOC_UKF_update (soc_ukf_t *ukf, float voltage, float current)
 Correct the predicted state using measured voltage.
 

Variables

static constexpr size_t SOC_2_OCV_SIZE = 11
 
static const lut_entry_t SOC_2_OCV_ENTRIES [SOC_2_OCV_SIZE]
 

Detailed Description

Unscented Kalman filter for state of charge estimation.

Author
Irving Wang (irvin.nosp@m.gw@p.nosp@m.urdue.nosp@m..edu)

Function Documentation

◆ LERP_LUT_INIT()

LERP_LUT_INIT ( SOC_2_OCV ,
SOC_2_OCV_ENTRIES ,
SOC_2_OCV_SIZE  )

◆ SOC_UKF_covariance_weights()

static void SOC_UKF_covariance_weights ( soc_ukf_t * ukf,
const soc_ukf_params_t * params )
static
Here is the caller graph for this function:

◆ SOC_UKF_init()

void SOC_UKF_init ( soc_ukf_t * ukf,
const soc_ukf_params_t * params,
vec3_t x0,
mat3_t P0 )

Initialize the SoC filter.

Parameters
ukfFilter instance to initialize
paramsCell model and filter parameters
x0Initial state [SoC, V1, V2]
P0Initial state covariance ! P0 must be SPD
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SOC_UKF_mean_weights()

static void SOC_UKF_mean_weights ( const soc_ukf_t * ukf,
float mean_weights[NUM_SIGMA_POINTS] )
static
Here is the caller graph for this function:

◆ SOC_UKF_predict()

void SOC_UKF_predict ( soc_ukf_t * ukf,
float current )

Predict the next state and covariance.

Parameters
ukfFilter instance
currentEquivalent cell current in amps. Positive current = discharge
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SOC_UKF_sigma_points()

static void SOC_UKF_sigma_points ( const soc_ukf_t * ukf,
vec3_t points[NUM_SIGMA_POINTS] )
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SOC_UKF_update()

void SOC_UKF_update ( soc_ukf_t * ukf,
float voltage,
float current )

Correct the predicted state using measured voltage.

Parameters
ukfFilter instance.
voltageEquivalent measured cell terminal voltage
currentCell current in amps Positive current = discharge
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ SOC_2_OCV_ENTRIES

const lut_entry_t SOC_2_OCV_ENTRIES[SOC_2_OCV_SIZE]
static
Initial value:
= {
{0.0f, 2.811f},
{0.1f, 3.096f},
{0.2f, 3.286f},
{0.3f, 3.439f},
{0.4f, 3.570f},
{0.5f, 3.690f},
{0.6f, 3.829f},
{0.7f, 3.906f},
{0.8f, 4.040f},
{0.9f, 4.085f},
{1.0f, 4.171f}
}

◆ SOC_2_OCV_SIZE

size_t SOC_2_OCV_SIZE = 11
staticconstexpr