foxBMS - Unit Tests
1.5.0
The foxBMS Unit Tests API Documentation
|
bms driver header More...
#include "battery_system_cfg.h"
#include "bms_cfg.h"
#include "contactor.h"
#include "fstd_types.h"
#include <stdbool.h>
#include <stdint.h>
#include "database.h"
Go to the source code of this file.
Data Structures | |
struct | BMS_STATE_s |
bms driver header
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 bms.h.
enum BMS_CANSTATE_e |
enum BMS_CHECK_e |
enum BMS_RETURN_TYPE_e |
Possible return values when state requests are made to the BMS state machine
enum BMS_STATE_REQUEST_e |
enum BMS_STATEMACH_e |
States of the SYS state machine
enum BMS_STATEMACH_SUB_e |
Substates of the SYS state machine
BMS_CURRENT_FLOW_STATE_e BMS_GetBatterySystemState | ( | void | ) |
Returns current battery system state (charging/discharging, resting or in relaxation phase)
BMS_CURRENT_FLOW_STATE_e BMS_GetCurrentFlowDirection | ( | int32_t | current_mA | ) |
Get current flow direction, current value as function parameter.
[in] | current_mA | current that is flowing |
STD_RETURN_TYPE_e BMS_GetInitializationState | ( | void | ) |
Gets the initialization state.
This function is used for getting the BMS initialization state.
uint8_t BMS_GetNumberOfConnectedStrings | ( | void | ) |
BMS_STATEMACH_e BMS_GetState | ( | void | ) |
bool BMS_IsStringClosed | ( | uint8_t | stringNumber | ) |
bool BMS_IsStringPrecharging | ( | uint8_t | stringNumber | ) |
bool BMS_IsTransitionToErrorStateActive | ( | void | ) |
BMS_RETURN_TYPE_e BMS_SetStateRequest | ( | BMS_STATE_REQUEST_e | statereq | ) |
sets the current state request of the state variable bms_state.
This function is used to make a state request to the state machine, e.g, start voltage measurement, read result of voltage measurement, re-initialization. It calls BMS_CheckStateRequest() to check if the request is valid. The state request is rejected if is not valid. The result of the check is returned immediately, so that the requester can act in case it made a non-valid state request.
statereq | state request to set |
Definition at line 811 of file bms.c.
void BMS_Trigger | ( | void | ) |
trigger function for the BMS driver state machine.
This function contains the sequence of events in the BMS state machine. It must be called time-triggered, every 10 milliseconds. This function needs to be adapted to be adapted to the behavior the batter system shall provide to the target application.
Definition at line 825 of file bms.c.
uint8_t TEST_BMS_CheckCanRequests | ( | void | ) |
void TEST_BMS_CheckOpenSenseWire | ( | void | ) |
STD_RETURN_TYPE_e TEST_BMS_CheckPrecharge | ( | uint8_t | stringNumber, |
DATA_BLOCK_PACK_VALUES_s * | pPackValues | ||
) |
uint8_t TEST_BMS_CheckReEntrance | ( | void | ) |
BMS_RETURN_TYPE_e TEST_BMS_CheckStateRequest | ( | BMS_STATE_REQUEST_e | statereq | ) |
int32_t TEST_BMS_GetAverageStringCurrent | ( | DATA_BLOCK_PACK_VALUES_s * | pPackValues | ) |
uint8_t TEST_BMS_GetClosestString | ( | BMS_CONSIDER_PRECHARGE_e | precharge, |
DATA_BLOCK_PACK_VALUES_s * | pPackValues | ||
) |
uint8_t TEST_BMS_GetHighestString | ( | BMS_CONSIDER_PRECHARGE_e | precharge, |
DATA_BLOCK_PACK_VALUES_s * | pPackValues | ||
) |
uint8_t TEST_BMS_GetLowestString | ( | BMS_CONSIDER_PRECHARGE_e | precharge, |
DATA_BLOCK_PACK_VALUES_s * | pPackValues | ||
) |
void TEST_BMS_GetMeasurementValues | ( | void | ) |
int32_t TEST_BMS_GetStringVoltageDifference | ( | uint8_t | string, |
DATA_BLOCK_PACK_VALUES_s * | pPackValues | ||
) |
bool TEST_BMS_IsAnyFatalErrorFlagSet | ( | void | ) |
STD_RETURN_TYPE_e TEST_BMS_IsBatterySystemStateOkay | ( | void | ) |
BMS_STATE_REQUEST_e TEST_BMS_TransferStateRequest | ( | void | ) |
void TEST_BMS_UpdateBatsysState | ( | DATA_BLOCK_PACK_VALUES_s * | pPackValues | ) |