|
foxBMS-UnitTests
1.0.0
The foxBMS Unit Tests API Documentation
|
Go to the documentation of this file.
63 #if ALGO_TICK_MS > ISA_CURRENT_CYCLE_TIME_MS
64 #define ALGO_NUMBER_AVERAGE_VALUES_CUR_1s ((1000u) / ALGO_TICK_MS)
65 #define ALGO_NUMBER_AVERAGE_VALUES_CUR_5s ((5000u) / ALGO_TICK_MS)
66 #define ALGO_NUMBER_AVERAGE_VALUES_CUR_10s ((10000u) / ALGO_TICK_MS)
67 #define ALGO_NUMBER_AVERAGE_VALUES_CUR_30s ((30000u) / ALGO_TICK_MS)
68 #define ALGO_NUMBER_AVERAGE_VALUES_CUR_60s ((60000u) / ALGO_TICK_MS)
69 #define ALGO_NUMBER_AVERAGE_VALUES_CUR_CFG (MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS / ALGO_TICK_MS)
71 #define ALGO_NUMBER_AVERAGE_VALUES_CUR_1s ((1000u) / ISA_CURRENT_CYCLE_TIME_MS)
72 #define ALGO_NUMBER_AVERAGE_VALUES_CUR_5s ((5000u) / ISA_CURRENT_CYCLE_TIME_MS)
73 #define ALGO_NUMBER_AVERAGE_VALUES_CUR_10s ((10000u) / ISA_CURRENT_CYCLE_TIME_MS)
74 #define ALGO_NUMBER_AVERAGE_VALUES_CUR_30s ((30000u) / ISA_CURRENT_CYCLE_TIME_MS)
75 #define ALGO_NUMBER_AVERAGE_VALUES_CUR_60s ((60000u) / ISA_CURRENT_CYCLE_TIME_MS)
76 #define ALGO_NUMBER_AVERAGE_VALUES_CUR_CFG (MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS / ISA_CURRENT_CYCLE_TIME_MS)
79 #if ALGO_TICK_MS > ISA_POWER_CYCLE_TIME_MS
80 #define ALGO_NUMBER_AVERAGE_VALUES_POW_1s ((1000u) / ALGO_TICK_MS)
81 #define ALGO_NUMBER_AVERAGE_VALUES_POW_5s ((5000u) / ALGO_TICK_MS)
82 #define ALGO_NUMBER_AVERAGE_VALUES_POW_10s ((10000u) / ALGO_TICK_MS)
83 #define ALGO_NUMBER_AVERAGE_VALUES_POW_30s ((30000u) / ALGO_TICK_MS)
84 #define ALGO_NUMBER_AVERAGE_VALUES_POW_60s ((60000u) / ALGO_TICK_MS)
85 #define ALGO_NUMBER_AVERAGE_VALUES_POW_CFG (MOVING_AVERAGE_DURATION_POWER_CONFIG_MS / ALGO_TICK_MS)
87 #define ALGO_NUMBER_AVERAGE_VALUES_POW_1s ((1000u) / ISA_POWER_CYCLE_TIME_MS)
88 #define ALGO_NUMBER_AVERAGE_VALUES_POW_5s ((5000u) / ISA_POWER_CYCLE_TIME_MS)
89 #define ALGO_NUMBER_AVERAGE_VALUES_POW_10s ((10000u) / ISA_POWER_CYCLE_TIME_MS)
90 #define ALGO_NUMBER_AVERAGE_VALUES_POW_30s ((30000u) / ISA_POWER_CYCLE_TIME_MS)
91 #define ALGO_NUMBER_AVERAGE_VALUES_POW_60s ((60000u) / ISA_POWER_CYCLE_TIME_MS)
92 #define ALGO_NUMBER_AVERAGE_VALUES_POW_CFG (MOVING_AVERAGE_DURATION_POWER_CONFIG_MS / ISA_POWER_CYCLE_TIME_MS)
100 #if ALGO_TICK_MS > ISA_CURRENT_CYCLE_TIME_MS
101 #if MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS / ALGO_TICK_MS > 60000u / ALGO_TICK_MS
112 #if (MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS / ISA_CURRENT_CYCLE_TIME_MS) > (60000u / ISA_CURRENT_CYCLE_TIME_MS)
124 #if ALGO_TICK_MS > ISA_POWER_CYCLE_TIME_MS
125 #if (MOVING_AVERAGE_DURATION_POWER_CONFIG_MS / ALGO_TICK_MS) > (60000u / ALGO_TICK_MS)
135 #if (MOVING_AVERAGE_DURATION_POWER_CONFIG_MS / ISA_POWER_CYCLE_TIME_MS) > (60000u / ISA_POWER_CYCLE_TIME_MS)
174 static uint8_t curCounter = 0u;
175 static uint8_t powCounter = 0u;
178 static uint8_t curInit = 0u;
179 static uint8_t powInit = 0u;
180 static uint8_t newValues = 0u;
181 float divider = 0.0f;
182 bool validValues =
true;
192 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
198 if (validValues ==
true) {
202 int32_t packCurrent = 0;
203 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
204 packCurrent += curPow_tab.
current_mA[stringNumber];
226 if ((curInit & 0x01u) == 0x01u) {
235 if ((curInit & 0x02u) == 0x02u) {
244 if ((curInit & 0x04u) == 0x04u) {
253 if ((curInit & 0x08u) == 0x08u) {
262 if ((curInit & 0x10u) == 0x10u) {
271 if ((curInit & 0x20u) == 0x20u) {
309 if (powCounter != curPow_tab.
newPower) {
313 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
318 if (validValues ==
true) {
321 int32_t packPower = 0;
322 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
323 packPower += curPow_tab.
power_W[stringNumber];
345 if ((powInit & 0x01u) == 0x01u) {
354 if ((powInit & 0x02u) == 0x02u) {
363 if ((powInit & 0x04u) == 0x04u) {
372 if ((powInit & 0x08u) == 0x08u) {
381 if ((powInit & 0x10u) == 0x10u) {
390 if ((powInit & 0x20u) == 0x20u) {
425 if (newValues == 1u) {
float movingAveragePower10sInterval_mA
static float * pMovingAveragePower_1s
#define ALGO_NUMBER_AVERAGE_VALUES_POW_5s
static float MEM_EXT_SDRAM curValues[(60000u/ISA_CURRENT_CYCLE_TIME_MS)+1u]
float movingAveragePowerConfigurableInterval_mA
static uint32_t movingAverageCurrentLength
static float MEM_EXT_SDRAM powValues[(60000u/ISA_POWER_CYCLE_TIME_MS)+1u]
#define ALGO_NUMBER_AVERAGE_VALUES_POW_10s
#define ALGO_NUMBER_AVERAGE_VALUES_CUR_1s
uint8_t invalidPowerMeasurement[BS_NR_OF_STRINGS]
@ DATA_BLOCK_ID_MOVING_AVERAGE
#define DATA_WRITE_DATA(...)
#define ISA_POWER_CYCLE_TIME_MS
float movingAverageCurrent30sInterval_mA
#define ALGO_NUMBER_AVERAGE_VALUES_CUR_CFG
static float * pMovingAveragePowerNew
float movingAveragePower60sInterval_mA
float movingAveragePower5sInterval_mA
float movingAveragePower30sInterval_mA
float movingAverageCurrent60sInterval_mA
#define ALGO_NUMBER_AVERAGE_VALUES_POW_30s
int32_t current_mA[BS_NR_OF_STRINGS]
uint8_t invalidCurrentMeasurement[BS_NR_OF_STRINGS]
float movingAverageCurrent5sInterval_mA
#define ALGO_NUMBER_AVERAGE_VALUES_POW_60s
float movingAverageCurrent10sInterval_mA
#define MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS
DATA_BLOCK_HEADER_s header
#define ALGO_NUMBER_AVERAGE_VALUES_CUR_30s
#define ALGO_NUMBER_AVERAGE_VALUES_POW_CFG
static float * pMovingAveragePower_10s
float movingAverageCurrent1sInterval_mA
static float * pMovingAveragePower_5s
static float * pMovingAverageCurrent_5s
#define ALGO_NUMBER_AVERAGE_VALUES_POW_1s
static float * pMovingAverageCurrrent_1s
#define ALGO_NUMBER_AVERAGE_VALUES_CUR_10s
#define MOVING_AVERAGE_DURATION_POWER_CONFIG_MS
static float * pMovingAverageCurrent_10s
static float * pMovingAveragePower_60s
#define DATA_READ_DATA(...)
#define ISA_CURRENT_CYCLE_TIME_MS
static float * pMovingAveragePower_30s
static float * pMovingAverageCurrent_60s
float movingAveragePower1sInterval_mA
static float * pMovingAveragePower_cfg
static float * pMovingAverageCurrent_30s
int32_t power_W[BS_NR_OF_STRINGS]
static uint32_t movingAveragePowerLength
@ DATA_BLOCK_ID_CURRENT_SENSOR
float movingAverageCurrentConfigurableInterval_mA
DATA_BLOCK_HEADER_s header
#define ALGO_NUMBER_AVERAGE_VALUES_CUR_60s
static float * pMovingAverageCurrrentNew
static float * pMovingAverageCurrent_cfg
#define ALGO_NUMBER_AVERAGE_VALUES_CUR_5s