|
foxBMS-UnitTests
1.0.0
The foxBMS Unit Tests API Documentation
|
Go to the documentation of this file.
68 #define FAKE_CELL_VOLTAGE_mV (BC_VOLTAGE_NOMINAL_mV)
71 #define FAKE_CELL_TEMPERATURE_ddegC ((BC_TEMPERATURE_MAX_CHARGE_MOL_ddegC + BC_TEMPERATURE_MIN_CHARGE_MOL_ddegC) / 2u)
77 #define FAKE_FSM_SHORT_TIME (1u)
83 #define FAKE_FSM_MEDIUM_TIME (5u)
89 #define FAKE_FSM_LONG_TIME (10u)
123 .firstMeasurementFinished =
false,
222 bool reentrance =
false;
239 bool earlyExit =
false;
241 pFakeState->
timer = idleTime;
250 if (earlyExit ==
false) {
270 pFakeState->
timer = idleTime;
282 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
340 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
348 return successfullSave;
355 for (uint8_t stringNumber = 0u; stringNumber <
BS_NR_OF_STRINGS; stringNumber++) {
363 return successfullSave;
368 static uint8_t waitForDataSaving = 0;
381 if (waitForDataSaving == 0u) {
388 }
else if (waitForDataSaving == 1u) {
390 waitForDataSaving = 0u;
510 return ranStateMachine;
520 bool returnValue =
false;
529 bool earlyExit =
false;
539 if (earlyExit ==
false) {
540 if (pFakeState->
timer > 0u) {
541 if ((--pFakeState->
timer) > 0u) {
549 if (earlyExit ==
false) {
557 #ifdef UNITY_UNIT_TEST
571 FAKE_SetState(pFakeState, nextState, nextSubstate, idleTime);
DATA_BLOCK_CELL_TEMPERATURE_s * cellTemperature
Implementation of the tasks used by the system, headers.
STD_RETURN_TYPE_e TEST_FAKE_SaveFakeVoltageMeasurementData(FAKE_STATE_s *pFakeState)
FAKE_FSM_STATES_e nextState
#define BS_NR_OF_BAT_CELLS
void TEST_FAKE_SetState(FAKE_STATE_s *pFakeState, FAKE_FSM_STATES_e nextState, FAKE_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime)
FAKE_FSM_SUBSTATES_e nextSubstate
static DATA_BLOCK_BALANCING_FEEDBACK_s fake_balancingFeedback
DATA_BLOCK_CELL_VOLTAGE_s * cellVoltage
#define BS_NR_OF_TEMP_SENSORS
uint8_t ioValueIn[BS_NR_OF_MODULES]
static void FAKE_SetFirstMeasurementCycleFinished(FAKE_STATE_s *pFakeState)
Sets the indicator that one full measurement cycles was successfull.
uint8_t eepromValueWrite[BS_NR_OF_MODULES]
static DATA_BLOCK_ALL_GPIO_VOLTAGES_s fake_allGpioVoltage
void TEST_FAKE_SetFirstMeasurementCycleFinished(FAKE_STATE_s *pFakeState)
#define FAKE_FSM_SHORT_TIME
DATA_BLOCK_BALANCING_FEEDBACK_s * balancingFeedback
#define BS_NR_OF_MODULES
number of modules in battery pack
static DATA_BLOCK_OPEN_WIRE_s fake_openWire
@ DATA_BLOCK_ID_BALANCING_FEEDBACK_BASE
@ DATA_BLOCK_ID_CELL_TEMPERATURE_BASE
static STD_RETURN_TYPE_e FAKE_RunStateMachine(FAKE_STATE_s *pFakeState)
Defines the state transitions.
DATA_BLOCK_ALL_GPIO_VOLTAGES_s * allGpioVoltages
FAKE_FSM_STATES_e previousState
@ DATA_BLOCK_ID_OPEN_WIRE_BASE
uint32_t eepromWriteAddressToUse
enum STD_RETURN_TYPE STD_RETURN_TYPE_e
#define FAKE_CELL_TEMPERATURE_ddegC
enum FAKE_CHECK_MULTIPLE_CALLS FAKE_CHECK_MULTIPLE_CALLS_e
enum FAKE_FSM_SUBSTATES FAKE_FSM_SUBSTATES_e
uint8_t eepromValueRead[BS_NR_OF_MODULES]
uint16_t gpioVoltages_mV[BS_NR_OF_STRINGS][BS_NR_OF_MODULES *BS_NR_OF_GPIOS_PER_MODULE]
@ FAKE_MULTIPLE_CALLS_YES
STD_RETURN_TYPE_e FAKE_TriggerMeasurementIc(FAKE_STATE_s *pFakeState)
Trigger function for the driver, called to advance the state machine.
DATA_BLOCK_BALANCING_CONTROL_s * balancingControl
#define DATA_WRITE_DATA(...)
static void FAKE_SetState(FAKE_STATE_s *pFakeState, FAKE_FSM_STATES_e nextState, FAKE_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime)
Sets the next state, the next substate and the timer value of the state variable.
int32_t packVoltage_mV[BS_NR_OF_STRINGS]
@ FAKE_FSM_SUBSTATE_INITIALIZATION_FINISH_FIRST_MEASUREMENT
@ FAKE_FSM_SUBSTATE_INITIALIZATION_EXIT
enum FAKE_FSM_STATES FAKE_FSM_STATES_e
uint32_t eepromWriteAddressLastUsed
Configuration of the battery system (e.g., number of battery modules, battery cells,...
static DATA_BLOCK_CELL_TEMPERATURE_s fake_cellTemperature
@ FAKE_FSM_SUBSTATE_RUNNING_SAVE_VOLTAGE_MEASUREMENT_DATA
@ DATA_BLOCK_ID_SLAVE_CONTROL
#define BS_NR_OF_CELLS_PER_MODULE
number of battery cells per battery module (parallel cells are counted as one)
static STD_RETURN_TYPE_e FAKE_SaveFakeTemperatureMeasurementData(FAKE_STATE_s *pFakeState)
Write temperature measurement data.
FAKE_FSM_SUBSTATES_e previousSubstate
uint32_t eepromReadAddressLastUsed
@ FAKE_FSM_SUBSTATE_DUMMY
bool FAKE_IsFirstMeasurementCycleFinished(FAKE_STATE_s *pFakeState)
return whether the first measurement cycle is finished
DATA_BLOCK_HEADER_s header
#define FAS_ASSERT(x)
Assertion macro that asserts that x is true.
#define FAKE_CELL_VOLTAGE_mV
@ FAKE_FSM_SUBSTATE_ENTRY
void OS_ExitTaskCritical(void)
Exit Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
DATA_BLOCK_HEADER_s header
@ FAKE_FSM_STATE_UNINITIALIZED
@ FAKE_FSM_STATE_HAS_NEVER_RUN
@ DATA_BLOCK_ID_CELL_VOLTAGE_BASE
DATA_BLOCK_OPEN_WIRE_s * openWire
@ FAKE_FSM_SUBSTATE_RUNNING_SAVE_TEMPERATURE_MEASUREMENT_DATA
bool firstMeasurementFinished
static FAKE_FSM_STATES_e FAKE_ProcessInitializationState(FAKE_STATE_s *pFakeState)
Processes the initialization state.
@ FAKE_FSM_STATE_INITIALIZATION
@ DATA_BLOCK_ID_ALL_GPIO_VOLTAGES_BASE
static void FAKE_SetSubstate(FAKE_STATE_s *pFakeState, FAKE_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime)
Sets the next substate and the timer value of the state variable.
void OS_EnterTaskCritical(void)
Enter Critical interface function for use in FreeRTOS-Tasks and FreeRTOS-ISR.
DATA_BLOCK_HEADER_s header
DATA_BLOCK_HEADER_s header
Configuration of the battery cell (e.g., minimum and maximum cell voltage)
int16_t cellVoltage_mV[BS_NR_OF_STRINGS][BS_NR_OF_BAT_CELLS]
uint32_t eepromReadAddressToUse
DATA_BLOCK_SLAVE_CONTROL_s * slaveControl
@ FAKE_FSM_SUBSTATE_INITIALIZATION_FIRST_MEASUREMENT_FINISHED
static DATA_BLOCK_CELL_VOLTAGE_s fake_cellVoltage
@ DATA_BLOCK_ID_BALANCING_CONTROL
uint8_t balancingState[BS_NR_OF_STRINGS][BS_NR_OF_BAT_CELLS]
uint8_t openwire[BS_NR_OF_STRINGS][BS_NR_OF_MODULES *(BS_NR_OF_CELLS_PER_MODULE+1)]
uint16_t value[BS_NR_OF_STRINGS][BS_NR_OF_MODULES]
static STD_RETURN_TYPE_e FAKE_SaveFakeVoltageMeasurementData(FAKE_STATE_s *pFakeState)
Write voltage measurement data.
#define NULL_PTR
Null pointer.
FAKE_FSM_STATES_e currentState
static bool FAKE_CheckMultipleCalls(FAKE_STATE_s *pFakeState)
check for multiple calls of state machine trigger function
FAKE_DATABASE_ENTRIES_s data
FAKE_CHECK_MULTIPLE_CALLS
static FAKE_FSM_STATES_e FAKE_ProcessRunningState(FAKE_STATE_s *pFakeState)
Processes the running state.
#define BS_NR_OF_GPIOS_PER_MODULE
Number of GPIOs on the LTC IC.
STD_RETURN_TYPE_e TEST_FAKE_SaveFakeTemperatureMeasurementData(FAKE_STATE_s *pFakeState)
Header for the driver of the fake measurement IC driver.
uint8_t ioValueOut[BS_NR_OF_MODULES]
bool TEST_FAKE_CheckMultipleCalls(FAKE_STATE_s *pFakeState)
#define FAS_TRAP
Define that evaluates to essential boolean false thus tripping an assert.
DATA_BLOCK_HEADER_s header
STD_RETURN_TYPE_e FAKE_Initialize(void)
initialize driver
DATA_BLOCK_HEADER_s header
#define FAKE_FSM_LONG_TIME
DATA_BLOCK_HEADER_s header
FAKE_FSM_SUBSTATES_e currentSubstate
static DATA_BLOCK_BALANCING_CONTROL_s fake_balancingControl
int16_t cellTemperature_ddegC[BS_NR_OF_STRINGS][BS_NR_OF_TEMP_SENSORS]
static DATA_BLOCK_SLAVE_CONTROL_s fake_slaveControl
uint8_t externalTemperatureSensor[BS_NR_OF_MODULES]