foxBMS
1.5.0
The foxBMS Battery Management System API Documentation
|
SOC module responsible for calculation of SOC. More...
#include "general.h"
#include "soc_counting.h"
#include "bms.h"
#include "database.h"
#include "foxmath.h"
#include "fram.h"
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | SOC_STATE_s |
Macros | |
#define | SOC_MAXIMUM_SOC_perc (100.0f) |
#define | SOC_MINIMUM_SOC_perc (0.0f) |
Functions | |
static float_t | SOC_GetStringSocPercentageFromCharge (uint32_t charge_As) |
calculates string SOC in percentage from passed string charge in As More... | |
static void | SOC_RecalibrateViaLookupTable (DATA_BLOCK_SOX_s *pTableSoc) |
initializes database and FRAM SOC values via lookup table (average, minimum and maximum). More... | |
static void | SOC_SetValue (DATA_BLOCK_SOX_s *pTableSoc, float_t socMinimumValue_perc, float_t socMaximumValue_perc, float_t socAverageValue_perc, uint8_t stringNumber) |
sets SOC value with a parameter between 0.0 and 100.0. More... | |
static void | SOC_CheckDatabaseSocPercentageLimits (DATA_BLOCK_SOX_s *pTableSoc, uint8_t stringNumber) |
Check if all database SOC percentage values are within [0.0, 100.0] Limits SOC values to limit values if outside of this range. More... | |
static void | SOC_UpdateNvmValues (DATA_BLOCK_SOX_s *pTableSoc, uint8_t stringNumber) |
Set SOC-related values in non-volatile memory. More... | |
void | SE_InitializeStateOfCharge (DATA_BLOCK_SOX_s *pSocValues, bool ccPresent, uint8_t stringNumber) |
initializes startup SOC-related values like lookup from nonvolatile ram at startup More... | |
void | SE_CalculateStateOfCharge (DATA_BLOCK_SOX_s *pSocValues) |
periodically called algorithm to calculate state-of-charge (SOC) More... | |
float_t | SE_GetStateOfChargeFromVoltage (int16_t voltage_mV) |
look-up table for SOC initialization More... | |
Variables | |
static SOC_STATE_s | soc_state |
static DATA_BLOCK_CURRENT_SENSOR_s | soc_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR} |
SOC module responsible for calculation of SOC.
SPDX-License-Identifier: BSD-3-Clause
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:
Definition in file soc_counting.c.
#define SOC_MAXIMUM_SOC_perc (100.0f) |
Maximum SOC in percentage
Definition at line 81 of file soc_counting.c.
#define SOC_MINIMUM_SOC_perc (0.0f) |
Minimum SOC in percentage
Definition at line 83 of file soc_counting.c.
|
static |
Check if all database SOC percentage values are within [0.0, 100.0] Limits SOC values to limit values if outside of this range.
[in,out] | pTableSoc | pointer to database struct with SOC values |
[in] | stringNumber | string that is checked |
Definition at line 210 of file soc_counting.c.
|
static |
calculates string SOC in percentage from passed string charge in As
[in] | charge_As | charge in As |
Definition at line 153 of file soc_counting.c.
|
static |
initializes database and FRAM SOC values via lookup table (average, minimum and maximum).
[out] | pTableSoc | pointer to database enty with SOC values |
Definition at line 158 of file soc_counting.c.
|
static |
sets SOC value with a parameter between 0.0 and 100.0.
limits the SOE value to 0.0 respectively 100.0 if a value outside of the allowed SOE range is passed. Updates local fram and database struct but does NOT write them
[out] | pTableSoc | pointer to SOC database entry |
[in] | socMinimumValue_perc | SOC min value to set |
[in] | socMaximumValue_perc | SOC max value to set |
[in] | socAverageValue_perc | SOC average value to set |
[in] | stringNumber | addressed string |
Definition at line 174 of file soc_counting.c.
|
static |
Set SOC-related values in non-volatile memory.
[in] | pTableSoc | pointer to database struct with SOC values |
[in] | stringNumber | addressed string |
Definition at line 234 of file soc_counting.c.
|
static |
state variable for SOC module
Definition at line 87 of file soc_counting.c.
|
static |
local copies of database tables
Definition at line 98 of file soc_counting.c.