PER Firmware
Loading...
Searching...
No Matches
lv_soc_params.h
Go to the documentation of this file.
1
9#ifndef LV_SOC_PARAMS_H
10#define LV_SOC_PARAMS_H
11
12#include <stdint.h>
13
14#include "lerp_lut/lerp_lut.h"
15#include "soc_ukf/soc_ukf.h"
16
17// Rate the filter is tuned for, the calling task must run at this period
18static constexpr uint32_t LV_SOC_PARAMS_PERIOD_MS = 20;
19
20static constexpr size_t LV_SOC_OCV_TO_SOC_SIZE = 11;
22 {2.811f, 0.0f},
23 {3.096f, 0.1f},
24 {3.286f, 0.2f},
25 {3.439f, 0.3f},
26 {3.570f, 0.4f},
27 {3.690f, 0.5f},
28 {3.829f, 0.6f},
29 {3.906f, 0.7f},
30 {4.040f, 0.8f},
31 {4.085f, 0.9f},
32 {4.171f, 1.0f},
33};
35
36// todo fit the real params
37static constexpr soc_ukf_params_t LV_SOC_PARAMS = {
38 .ecm = {
39 .r0 = 0.015f,
40 .r1 = 0.015f,
41 .r2 = 0.015f,
42 .tau1 = 100.0f,
43 .tau2 = 1000.0f,
44 .Q = 5.0f,
45 },
46 .prediction_dt = (float)LV_SOC_PARAMS_PERIOD_MS / 1000.0f,
47 .Q = {{
48 {1e-6f, 0.0f, 0.0f},
49 {0.0f, 1e-6f, 0.0f},
50 {0.0f, 0.0f, 1e-6f},
51 }},
52 .R = 1e-3f,
53 .alpha = 1.0f,
54 .beta = 2.0f,
55 .kappa = 0.0f,
56};
57
58static constexpr mat3_t LV_SOC_INITIAL_COVARIANCE = {{
59 {2.5e-3f, 0.0f, 0.0f},
60 {0.0f, 4e-4f, 0.0f},
61 {0.0f, 0.0f, 4e-4f},
62}};
63
64#endif // LV_SOC_PARAMS_H
Linear interpolation lookup table (LUT).
#define LERP_LUT_INIT(name, _entries, _size)
Definition lerp_lut.h:23
static const lut_entry_t LV_SOC_OCV_TO_SOC_ENTRIES[LV_SOC_OCV_TO_SOC_SIZE]
Definition lv_soc_params.h:21
static constexpr size_t LV_SOC_OCV_TO_SOC_SIZE
Definition lv_soc_params.h:20
static constexpr mat3_t LV_SOC_INITIAL_COVARIANCE
Definition lv_soc_params.h:58
static constexpr soc_ukf_params_t LV_SOC_PARAMS
Definition lv_soc_params.h:37
static constexpr uint32_t LV_SOC_PARAMS_PERIOD_MS
Definition lv_soc_params.h:18
Unscented Kalman filter for state of charge estimation.
Definition lerp_lut.h:13
Definition linear_algebra.h:19
Definition soc_ukf.h:48