foxBMS  1.0.0
The foxBMS Battery Management System API Documentation
soe_counting.c File Reference

SOE module responsible for calculation of SOE. More...

#include "soe_counting.h"
#include "battery_cell_cfg.h"
#include "battery_system_cfg.h"
#include "soe_counting_cfg.h"
#include "bms.h"
#include "database.h"
#include "foxmath.h"
#include "fram.h"
Include dependency graph for soe_counting.c:

Go to the source code of this file.

Data Structures

struct  SOE_STATE_s
 

Functions

static uint32_t SOE_GetStringEnergyFromSoePercentage (float stringSoe_perc)
 calculates string energy in Wh from passed SOE in percentage More...
 
static float SOE_GetStringSoePercentageFromEnergy (uint32_t energy_Wh)
 calculates string SOE in percentage from passed string energy in Wh More...
 
static void SOE_RecalibrateViaLookupTable (void)
 initializes database and FRAM SOE values via lookup table (average, min and max). More...
 
static float SOE_GetFromVoltage (int16_t voltage_mV)
 look-up table for SOE initialization More...
 
static void SOE_SetValue (float soeMinimumValue_perc, float soeMaximumValue_perc, float soeAverageValue_perc, uint8_t stringNumber)
 sets SOE value with a parameter between 0.0 and 100.0. More...
 
static void SOE_CheckDatabaseSoePercentageLimits (DATA_BLOCK_SOX_s *pTableSoe, uint8_t stringNumber)
 Check if all database SOE percentage values are within [0.0, 100.0] Limits SOE values to limit values if outside of this range. More...
 
void SOE_Init (bool ec_present, uint8_t stringNumber)
 initializes startup state-of-energy (SOE) related values More...
 
void SOE_Calculation (void)
 calculates state-of-energy (SOE) More...
 

Variables

static SOE_STATE_s soe_state
 
static DATA_BLOCK_SOX_s soe_tableSoeValues = {.header.uniqueId = DATA_BLOCK_ID_SOX}
 
static DATA_BLOCK_CURRENT_SENSOR_s soe_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR}
 

Detailed Description

SOE module responsible for calculation of SOE.

BSD 3-Clause License Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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:

″This product uses parts of foxBMS®″

″This product includes parts of foxBMS®″

″This product is derived from foxBMS®″

Author
foxBMS Team
Date
2020-10-07 (date of creation)
Updated
2020-10-07 (date of last update)
Prefix
SOE

Definition in file soe_counting.c.

Function Documentation

◆ SOE_Calculation()

void SOE_Calculation ( void  )

calculates state-of-energy (SOE)

Definition at line 331 of file soe_counting.c.

◆ SOE_CheckDatabaseSoePercentageLimits()

static void SOE_CheckDatabaseSoePercentageLimits ( DATA_BLOCK_SOX_s pTableSoe,
uint8_t  stringNumber 
)
static

Check if all database SOE percentage values are within [0.0, 100.0] Limits SOE values to limit values if outside of this range.

Parameters
[in,out]pTableSoepointer to database struct with SOE values
[in]stringNumberstring that is checked

Definition at line 265 of file soe_counting.c.

◆ SOE_GetFromVoltage()

static float SOE_GetFromVoltage ( int16_t  voltage_mV)
static

look-up table for SOE initialization

Parameters
[in]voltage_mVcell voltage of battery cell
Returns
SOE value in percentage [0.0 - 100.0]

Definition at line 195 of file soe_counting.c.

Here is the call graph for this function:

◆ SOE_GetStringEnergyFromSoePercentage()

static uint32_t SOE_GetStringEnergyFromSoePercentage ( float  stringSoe_perc)
static

calculates string energy in Wh from passed SOE in percentage

Parameters
[in]stringSoe_percstring SOE in percentage [0.0, 100.0]
Returns
returns corresponding string energy in Wh

Definition at line 167 of file soe_counting.c.

◆ SOE_GetStringSoePercentageFromEnergy()

static float SOE_GetStringSoePercentageFromEnergy ( uint32_t  energy_Wh)
static

calculates string SOE in percentage from passed string energy in Wh

Parameters
[in]energy_Whstring energy in Wh
Returns
returns corresponding string SOE in percentage [0.0, 100.0]

Definition at line 157 of file soe_counting.c.

◆ SOE_Init()

void SOE_Init ( bool  ec_present,
uint8_t  stringNumber 
)

initializes startup state-of-energy (SOE) related values

Parameters
[in]ec_presenttrue if current sensor EC message received, false otherwise
[in]stringNumberstring addressed

Definition at line 292 of file soe_counting.c.

◆ SOE_RecalibrateViaLookupTable()

static void SOE_RecalibrateViaLookupTable ( void  )
static

initializes database and FRAM SOE values via lookup table (average, min and max).

Definition at line 179 of file soe_counting.c.

Here is the call graph for this function:

◆ SOE_SetValue()

static void SOE_SetValue ( float  soeMinimumValue_perc,
float  soeMaximumValue_perc,
float  soeAverageValue_perc,
uint8_t  stringNumber 
)
static

sets SOE 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

Parameters
[in]soeMinimumValue_percSOE min value to set
[in]soeMaximumValue_percSOE max value to set
[in]soeAverageValue_percSOE average value to set
[in]stringNumberstring addressed

Definition at line 228 of file soe_counting.c.

Here is the call graph for this function:

Variable Documentation

◆ soe_state

SOE_STATE_s soe_state
static
Initial value:
= {
.soeInitialized = false,
}

contains the state of the SOE estimation

Definition at line 85 of file soe_counting.c.

◆ soe_tableCurrentSensor

DATA_BLOCK_CURRENT_SENSOR_s soe_tableCurrentSensor = {.header.uniqueId = DATA_BLOCK_ID_CURRENT_SENSOR}
static

local copies of database tables

Definition at line 92 of file soe_counting.c.

◆ soe_tableSoeValues

DATA_BLOCK_SOX_s soe_tableSoeValues = {.header.uniqueId = DATA_BLOCK_ID_SOX}
static

local copies of database tables

Definition at line 91 of file soe_counting.c.