foxBMS-UnitTests  1.0.0
The foxBMS Unit Tests API Documentation
moving_average.c
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2021, Fraunhofer-Gesellschaft zur Foerderung der
4  * angewandten Forschung e.V. All rights reserved.
5  *
6  * BSD 3-Clause License
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  * 1. Redistributions of source code must retain the above copyright notice,
10  * this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  *
30  * We kindly request you to use one or more of the following phrases to refer
31  * to foxBMS in your hardware, software, documentation or advertising
32  * materials:
33  *
34  * ″This product uses parts of foxBMS®″
35  *
36  * ″This product includes parts of foxBMS®″
37  *
38  * ″This product is derived from foxBMS®″
39  *
40  */
41 
42 /**
43  * @file moving_average.c
44  * @author foxBMS Team
45  * @date 2017-12-18 (date of creation)
46  * @updated 2020-07-01 (date of last update)
47  * @ingroup ALGORITHMS
48  * @prefix ALGO
49  *
50  * @brief moving average algorithm
51  *
52  */
53 
54 /*========== Includes =======================================================*/
55 #include "moving_average.h"
56 
57 #include "database.h"
58 
59 /*========== Macros and Definitions =========================================*/
60 /** TODO */
61 #define MEM_EXT_SDRAM
62 
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)
70 #else
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)
77 #endif
78 
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)
86 #else
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)
93 #endif
94 
95 /*========== Static Constant and Variable Definitions =======================*/
96 
97 /* Arrays in extern SDRAM to calculate moving average current and power */
98 
99 /* Check if minimum algo cycle time > current sensor sample time */
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
102 /* If array length of configured time > 60s array take this array size */
105 #else
106 /* Take array size of 60s moving average */
107 static float MEM_EXT_SDRAM curValues[(60000u / ALGO_TICK_MS) + 1u] = {};
108 static uint32_t movingAverageCurrentLength = (60000u / ALGO_TICK_MS) + 1;
109 #endif
110 #else
111 /* If array length of configured time > 60s array take this array size */
112 #if (MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS / ISA_CURRENT_CYCLE_TIME_MS) > (60000u / ISA_CURRENT_CYCLE_TIME_MS)
115  1u;
116 #else
117 /* Take array size of 60s moving average */
118 static float MEM_EXT_SDRAM curValues[(60000u / ISA_CURRENT_CYCLE_TIME_MS) + 1u] = {0.0f};
119 static uint32_t movingAverageCurrentLength = (60000u / ISA_CURRENT_CYCLE_TIME_MS) + 1u;
120 #endif
121 #endif
122 
123 /* Check if minimum algo cycle time > current sensor sample time */
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)
126 /* If array length of configured time > 60s array take this array size */
129 #else
130 /* Take array size of 60s moving average */
131 static float MEM_EXT_SDRAM powValues[(60000u / ALGO_TICK_MS) + 1] = {};
132 static uint32_t movingAveragePowerLength = (60000u / ALGO_TICK_MS) + 1u;
133 #endif
134 #else
135 #if (MOVING_AVERAGE_DURATION_POWER_CONFIG_MS / ISA_POWER_CYCLE_TIME_MS) > (60000u / ISA_POWER_CYCLE_TIME_MS)
136 /* If array length of configured time > 60s array take this array size */
139 #else
140 /* Take array size of 60s moving average */
141 static float MEM_EXT_SDRAM powValues[(60000u / ISA_POWER_CYCLE_TIME_MS) + 1u] = {0.0f};
142 static uint32_t movingAveragePowerLength = (60000u / ISA_POWER_CYCLE_TIME_MS) + 1u;
143 #endif
144 #endif
145 
146 /** Pointer for current moving average calculation @{*/
154 /**@}*/
155 
156 /** Pointer for power moving average calculation @{*/
157 static float *pMovingAveragePowerNew = &powValues[0];
158 static float *pMovingAveragePower_1s = &powValues[0];
159 static float *pMovingAveragePower_5s = &powValues[0];
160 static float *pMovingAveragePower_10s = &powValues[0];
161 static float *pMovingAveragePower_30s = &powValues[0];
162 static float *pMovingAveragePower_60s = &powValues[0];
163 static float *pMovingAveragePower_cfg = &powValues[0];
164 /**@}*/
165 
166 /*========== Extern Constant and Variable Definitions =======================*/
167 
168 /*========== Static Function Prototypes =====================================*/
169 
170 /*========== Static Function Implementations ================================*/
171 
172 /*========== Extern Function Implementations ================================*/
173 extern void ALGO_MovAverage() {
174  static uint8_t curCounter = 0u;
175  static uint8_t powCounter = 0u;
178  static uint8_t curInit = 0u; /* bit0: 1s, bit1: 5s, bit2: 10s, bit3: 30s, bit4: 60s, bit5: cfg */
179  static uint8_t powInit = 0u; /* bit0: 1s, bit1: 5s, bit2: 10s, bit3: 30s, bit4: 60s, bit5: cfg */
180  static uint8_t newValues = 0u;
181  float divider = 0.0f;
182  bool validValues = true;
183 
184  DATA_READ_DATA(&curPow_tab);
185  DATA_READ_DATA(&movingAverage_tab);
186 
187  /* Check if new current value */
188  if (curCounter != curPow_tab.newCurrent) {
189  curCounter = curPow_tab.newCurrent;
190 
191  /* Check if valid values */
192  for (uint8_t stringNumber = 0u; stringNumber < BS_NR_OF_STRINGS; stringNumber++) {
193  if (curPow_tab.invalidCurrentMeasurement[stringNumber] != 0u) {
194  validValues = false;
195  }
196  }
197 
198  if (validValues == true) {
199  /* new Values -> Save later in database */
200  newValues = 1u;
201 
202  int32_t packCurrent = 0;
203  for (uint8_t stringNumber = 0u; stringNumber < BS_NR_OF_STRINGS; stringNumber++) {
204  packCurrent += curPow_tab.current_mA[stringNumber];
205  }
206 
207  /* Add value to array and calculate new moving average values */
208  *pMovingAverageCurrrentNew = packCurrent;
209 
210  /* Calculate new moving average - first add new value */
212  movingAverage_tab.movingAverageCurrent1sInterval_mA += (*pMovingAverageCurrrentNew) / divider;
214  movingAverage_tab.movingAverageCurrent5sInterval_mA += (*pMovingAverageCurrrentNew) / divider;
216  movingAverage_tab.movingAverageCurrent10sInterval_mA += (*pMovingAverageCurrrentNew) / divider;
218  movingAverage_tab.movingAverageCurrent30sInterval_mA += (*pMovingAverageCurrrentNew) / divider;
220  movingAverage_tab.movingAverageCurrent60sInterval_mA += (*pMovingAverageCurrrentNew) / divider;
222  movingAverage_tab.movingAverageCurrentConfigurableInterval_mA += (*pMovingAverageCurrrentNew) / divider;
223 
224  /* Then, increment pointer and substract oldest value when respective window is filled with data */
226  if ((curInit & 0x01u) == 0x01u) {
228  movingAverage_tab.movingAverageCurrent1sInterval_mA -= ((*pMovingAverageCurrrent_1s) / divider);
230  } else {
232  curInit |= 0x01u;
233  }
234  }
235  if ((curInit & 0x02u) == 0x02u) {
237  movingAverage_tab.movingAverageCurrent5sInterval_mA -= (*pMovingAverageCurrent_5s) / divider;
239  } else {
241  curInit |= 0x02u;
242  }
243  }
244  if ((curInit & 0x04u) == 0x04u) {
246  movingAverage_tab.movingAverageCurrent10sInterval_mA -= (*pMovingAverageCurrent_10s) / divider;
248  } else {
250  curInit |= 0x04u;
251  }
252  }
253  if ((curInit & 0x08u) == 0x08u) {
255  movingAverage_tab.movingAverageCurrent30sInterval_mA -= (*pMovingAverageCurrent_30s) / divider;
257  } else {
259  curInit |= 0x08u;
260  }
261  }
262  if ((curInit & 0x10u) == 0x10u) {
264  movingAverage_tab.movingAverageCurrent60sInterval_mA -= (*pMovingAverageCurrent_60s) / divider;
266  } else {
268  curInit |= 0x10u;
269  }
270  }
271  if ((curInit & 0x20u) == 0x20u) {
273  movingAverage_tab.movingAverageCurrentConfigurableInterval_mA -= (*pMovingAverageCurrent_cfg) / divider;
275  } else {
277  curInit |= 0x20u;
278  }
279  }
280 
281  /* Check pointer for buffer overflow */
284  }
287  }
290  }
293  }
296  }
299  }
302  }
303  }
304  }
305 
306  validValues = true;
307 
308  /* Check if new power value */
309  if (powCounter != curPow_tab.newPower) {
310  powCounter = curPow_tab.newPower;
311 
312  /* Check if valid values */
313  for (uint8_t stringNumber = 0u; stringNumber < BS_NR_OF_STRINGS; stringNumber++) {
314  if (curPow_tab.invalidPowerMeasurement[stringNumber] != 0u) {
315  validValues = false;
316  }
317  }
318  if (validValues == true) {
319  newValues = 1u;
320 
321  int32_t packPower = 0;
322  for (uint8_t stringNumber = 0u; stringNumber < BS_NR_OF_STRINGS; stringNumber++) {
323  packPower += curPow_tab.power_W[stringNumber];
324  }
325 
326  /* Add value to array and calculate new moving mean values */
327  *pMovingAveragePowerNew = packPower;
328 
329  /* Calculate new moving means - first add new value */
331  movingAverage_tab.movingAveragePower1sInterval_mA += (*pMovingAveragePowerNew) / divider;
333  movingAverage_tab.movingAveragePower5sInterval_mA += (*pMovingAveragePowerNew) / divider;
335  movingAverage_tab.movingAveragePower10sInterval_mA += (*pMovingAveragePowerNew) / divider;
337  movingAverage_tab.movingAveragePower30sInterval_mA += (*pMovingAveragePowerNew) / divider;
339  movingAverage_tab.movingAveragePower60sInterval_mA += (*pMovingAveragePowerNew) / divider;
341  movingAverage_tab.movingAveragePowerConfigurableInterval_mA += (*pMovingAveragePowerNew) / divider;
342 
343  /* Then, increment pointer and substract oldest value when respective window is filled with data */
345  if ((powInit & 0x01u) == 0x01u) {
347  movingAverage_tab.movingAveragePower1sInterval_mA -= ((*pMovingAveragePower_1s) / divider);
349  } else {
351  powInit |= 0x01u;
352  }
353  }
354  if ((powInit & 0x02u) == 0x02u) {
356  movingAverage_tab.movingAveragePower5sInterval_mA -= ((*pMovingAveragePower_5s) / divider);
358  } else {
360  powInit |= 0x02u;
361  }
362  }
363  if ((powInit & 0x04u) == 0x04u) {
365  movingAverage_tab.movingAveragePower10sInterval_mA -= ((*pMovingAveragePower_10s) / divider);
367  } else {
369  powInit |= 0x04u;
370  }
371  }
372  if ((powInit & 0x08u) == 0x08u) {
374  movingAverage_tab.movingAveragePower30sInterval_mA -= ((*pMovingAveragePower_30s) / divider);
376  } else {
378  powInit |= 0x08u;
379  }
380  }
381  if ((powInit & 0x10u) == 0x10u) {
383  movingAverage_tab.movingAveragePower60sInterval_mA -= ((*pMovingAveragePower_60s) / divider);
385  } else {
387  powInit |= 0x10u;
388  }
389  }
390  if ((powInit & 0x20u) == 0x20u) {
392  movingAverage_tab.movingAveragePowerConfigurableInterval_mA -= ((*pMovingAveragePower_cfg) / divider);
394  } else {
396  powInit |= 0x20u;
397  }
398  }
399 
400  /* Check pointer for buffer overflow */
403  }
406  }
409  }
412  }
415  }
418  }
421  }
422  }
423  }
424 
425  if (newValues == 1u) {
426  newValues = 0;
427 
428  DATA_WRITE_DATA(&movingAverage_tab);
429  }
430 
431  return;
432 }
433 
434 /*========== Externalized Static Function Implementations (Unit Test) =======*/
DATA_BLOCK_MOVING_AVERAGE_s::movingAveragePower10sInterval_mA
float movingAveragePower10sInterval_mA
Definition: database_cfg.h:527
pMovingAveragePower_1s
static float * pMovingAveragePower_1s
Definition: moving_average.c:158
ALGO_NUMBER_AVERAGE_VALUES_POW_5s
#define ALGO_NUMBER_AVERAGE_VALUES_POW_5s
Definition: moving_average.c:88
DATA_BLOCK_CURRENT_SENSOR
Definition: database_cfg.h:209
MEM_EXT_SDRAM
#define MEM_EXT_SDRAM
Definition: moving_average.c:61
curValues
static float MEM_EXT_SDRAM curValues[(60000u/ISA_CURRENT_CYCLE_TIME_MS)+1u]
Definition: moving_average.c:118
DATA_BLOCK_MOVING_AVERAGE_s
Definition: database_cfg.h:514
DATA_BLOCK_MOVING_AVERAGE_s::movingAveragePowerConfigurableInterval_mA
float movingAveragePowerConfigurableInterval_mA
Definition: database_cfg.h:530
movingAverageCurrentLength
static uint32_t movingAverageCurrentLength
Definition: moving_average.c:119
powValues
static float MEM_EXT_SDRAM powValues[(60000u/ISA_POWER_CYCLE_TIME_MS)+1u]
Definition: moving_average.c:141
ALGO_NUMBER_AVERAGE_VALUES_POW_10s
#define ALGO_NUMBER_AVERAGE_VALUES_POW_10s
Definition: moving_average.c:89
ALGO_NUMBER_AVERAGE_VALUES_CUR_1s
#define ALGO_NUMBER_AVERAGE_VALUES_CUR_1s
Definition: moving_average.c:71
DATA_BLOCK_CURRENT_SENSOR::invalidPowerMeasurement
uint8_t invalidPowerMeasurement[BS_NR_OF_STRINGS]
Definition: database_cfg.h:222
DATA_BLOCK_ID_MOVING_AVERAGE
@ DATA_BLOCK_ID_MOVING_AVERAGE
Definition: database_cfg.h:93
DATA_WRITE_DATA
#define DATA_WRITE_DATA(...)
Definition: database.h:82
ISA_POWER_CYCLE_TIME_MS
#define ISA_POWER_CYCLE_TIME_MS
Definition: moving_average.h:66
DATA_BLOCK_MOVING_AVERAGE_s::movingAverageCurrent30sInterval_mA
float movingAverageCurrent30sInterval_mA
Definition: database_cfg.h:522
ALGO_NUMBER_AVERAGE_VALUES_CUR_CFG
#define ALGO_NUMBER_AVERAGE_VALUES_CUR_CFG
Definition: moving_average.c:76
pMovingAveragePowerNew
static float * pMovingAveragePowerNew
Definition: moving_average.c:157
DATA_BLOCK_MOVING_AVERAGE_s::movingAveragePower60sInterval_mA
float movingAveragePower60sInterval_mA
Definition: database_cfg.h:529
DATA_BLOCK_MOVING_AVERAGE_s::movingAveragePower5sInterval_mA
float movingAveragePower5sInterval_mA
Definition: database_cfg.h:526
DATA_BLOCK_MOVING_AVERAGE_s::movingAveragePower30sInterval_mA
float movingAveragePower30sInterval_mA
Definition: database_cfg.h:528
DATA_BLOCK_MOVING_AVERAGE_s::movingAverageCurrent60sInterval_mA
float movingAverageCurrent60sInterval_mA
Definition: database_cfg.h:523
ALGO_NUMBER_AVERAGE_VALUES_POW_30s
#define ALGO_NUMBER_AVERAGE_VALUES_POW_30s
Definition: moving_average.c:90
DATA_BLOCK_CURRENT_SENSOR::current_mA
int32_t current_mA[BS_NR_OF_STRINGS]
Definition: database_cfg.h:214
DATA_BLOCK_CURRENT_SENSOR::invalidCurrentMeasurement
uint8_t invalidCurrentMeasurement[BS_NR_OF_STRINGS]
Definition: database_cfg.h:215
DATA_BLOCK_MOVING_AVERAGE_s::movingAverageCurrent5sInterval_mA
float movingAverageCurrent5sInterval_mA
Definition: database_cfg.h:520
ALGO_NUMBER_AVERAGE_VALUES_POW_60s
#define ALGO_NUMBER_AVERAGE_VALUES_POW_60s
Definition: moving_average.c:91
DATA_BLOCK_MOVING_AVERAGE_s::movingAverageCurrent10sInterval_mA
float movingAverageCurrent10sInterval_mA
Definition: database_cfg.h:521
MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS
#define MOVING_AVERAGE_DURATION_CURRENT_CONFIG_MS
Definition: moving_average.h:62
DATA_BLOCK_CURRENT_SENSOR::header
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:213
ALGO_NUMBER_AVERAGE_VALUES_CUR_30s
#define ALGO_NUMBER_AVERAGE_VALUES_CUR_30s
Definition: moving_average.c:74
ALGO_NUMBER_AVERAGE_VALUES_POW_CFG
#define ALGO_NUMBER_AVERAGE_VALUES_POW_CFG
Definition: moving_average.c:92
pMovingAveragePower_10s
static float * pMovingAveragePower_10s
Definition: moving_average.c:160
DATA_BLOCK_MOVING_AVERAGE_s::movingAverageCurrent1sInterval_mA
float movingAverageCurrent1sInterval_mA
Definition: database_cfg.h:519
pMovingAveragePower_5s
static float * pMovingAveragePower_5s
Definition: moving_average.c:159
pMovingAverageCurrent_5s
static float * pMovingAverageCurrent_5s
Definition: moving_average.c:149
ALGO_TICK_MS
#define ALGO_TICK_MS
Definition: algorithm_cfg.h:66
ALGO_NUMBER_AVERAGE_VALUES_POW_1s
#define ALGO_NUMBER_AVERAGE_VALUES_POW_1s
Definition: moving_average.c:87
pMovingAverageCurrrent_1s
static float * pMovingAverageCurrrent_1s
Definition: moving_average.c:148
ALGO_NUMBER_AVERAGE_VALUES_CUR_10s
#define ALGO_NUMBER_AVERAGE_VALUES_CUR_10s
Definition: moving_average.c:73
MOVING_AVERAGE_DURATION_POWER_CONFIG_MS
#define MOVING_AVERAGE_DURATION_POWER_CONFIG_MS
Definition: moving_average.h:63
pMovingAverageCurrent_10s
static float * pMovingAverageCurrent_10s
Definition: moving_average.c:150
pMovingAveragePower_60s
static float * pMovingAveragePower_60s
Definition: moving_average.c:162
DATA_READ_DATA
#define DATA_READ_DATA(...)
Definition: database.h:72
ISA_CURRENT_CYCLE_TIME_MS
#define ISA_CURRENT_CYCLE_TIME_MS
Definition: moving_average.h:65
DATA_BLOCK_CURRENT_SENSOR::newCurrent
uint8_t newCurrent
Definition: database_cfg.h:216
moving_average.h
moving average algorithm
database.h
Database module header.
pMovingAveragePower_30s
static float * pMovingAveragePower_30s
Definition: moving_average.c:161
pMovingAverageCurrent_60s
static float * pMovingAverageCurrent_60s
Definition: moving_average.c:152
DATA_BLOCK_MOVING_AVERAGE_s::movingAveragePower1sInterval_mA
float movingAveragePower1sInterval_mA
Definition: database_cfg.h:525
pMovingAveragePower_cfg
static float * pMovingAveragePower_cfg
Definition: moving_average.c:163
pMovingAverageCurrent_30s
static float * pMovingAverageCurrent_30s
Definition: moving_average.c:151
DATA_BLOCK_CURRENT_SENSOR::power_W
int32_t power_W[BS_NR_OF_STRINGS]
Definition: database_cfg.h:221
movingAveragePowerLength
static uint32_t movingAveragePowerLength
Definition: moving_average.c:142
DATA_BLOCK_ID_CURRENT_SENSOR
@ DATA_BLOCK_ID_CURRENT_SENSOR
Definition: database_cfg.h:76
DATA_BLOCK_MOVING_AVERAGE_s::movingAverageCurrentConfigurableInterval_mA
float movingAverageCurrentConfigurableInterval_mA
Definition: database_cfg.h:524
DATA_BLOCK_MOVING_AVERAGE_s::header
DATA_BLOCK_HEADER_s header
Definition: database_cfg.h:518
ALGO_NUMBER_AVERAGE_VALUES_CUR_60s
#define ALGO_NUMBER_AVERAGE_VALUES_CUR_60s
Definition: moving_average.c:75
pMovingAverageCurrrentNew
static float * pMovingAverageCurrrentNew
Definition: moving_average.c:147
pMovingAverageCurrent_cfg
static float * pMovingAverageCurrent_cfg
Definition: moving_average.c:153
BS_NR_OF_STRINGS
#define BS_NR_OF_STRINGS
Definition: battery_system_cfg.h:89
ALGO_NUMBER_AVERAGE_VALUES_CUR_5s
#define ALGO_NUMBER_AVERAGE_VALUES_CUR_5s
Definition: moving_average.c:72
DATA_BLOCK_CURRENT_SENSOR::newPower
uint8_t newPower
Definition: database_cfg.h:223
ALGO_MovAverage
void ALGO_MovAverage()
Definition: moving_average.c:173
DATA_BLOCKHEADER::uniqueId
DATA_BLOCK_ID_e uniqueId
Definition: database_cfg.h:109