foxBMS - Unit Tests
1.3.0
The foxBMS Unit Tests API Documentation
|
Main driver state machine for insulation monitoring driver. More...
Go to the source code of this file.
Data Structures | |
struct | IMD_INFORMATION_s |
struct | IMD_STATE_s |
Macros | |
#define | IMD_FSM_SHORT_TIME (1u) |
Functions | |
static IMD_RETURN_TYPE_e | IMD_SetStateRequest (IMD_STATE_s *pImdState, IMD_STATE_REQUEST_e stateRequest) |
sets the current state request of the state variable imd_state. More... | |
static IMD_RETURN_TYPE_e | IMD_CheckStateRequest (IMD_STATE_s *pImdState, IMD_STATE_REQUEST_e stateRequest) |
checks the state requests that are made. More... | |
static IMD_STATE_REQUEST_e | IMD_TransferStateRequest (IMD_STATE_s *pImdState) |
transfers the current state request to the state machine. More... | |
static IMD_CHECK_MULTIPLE_CALLS_e | IMD_CheckMultipleCalls (IMD_STATE_s *pImdState) |
check for multiple calls of state machine trigger function More... | |
static void | IMD_SetState (IMD_STATE_s *pImdState, IMD_FSM_STATES_e nextState, IMD_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime) |
Sets the next state, the next substate and the timer value of the state variable. More... | |
static void | IMD_SetSubstate (IMD_STATE_s *pImdState, IMD_FSM_SUBSTATES_e nextSubstate, uint16_t idleTime) |
Sets the next substate and the timer value of the state variable. More... | |
static STD_RETURN_TYPE_e | IMD_RunStateMachine (IMD_STATE_s *pImdState) |
Defines the state transitions. More... | |
static STD_RETURN_TYPE_e | IMD_EvaluateInsulationMeasurement (DATA_BLOCK_INSULATION_MONITORING_s *pTableInsulationMonitoring) |
Evaluates measurement perform by IMD driver. More... | |
IMD_RETURN_TYPE_e | IMD_RequestInitialization (void) |
Request initialization of IMD statemachine. More... | |
IMD_RETURN_TYPE_e | IMD_RequestInsulationMeasurement (void) |
Request to activate the actual IMD measurement. More... | |
IMD_RETURN_TYPE_e | IMD_RequestMeasurementStop (void) |
Request to deactivate the actual IMD measurement. More... | |
bool | IMD_GetInitializationState (void) |
Gets the initialization state. More... | |
STD_RETURN_TYPE_e | IMD_Trigger (void) |
trigger function for the IMD driver state machine. More... | |
Variables | |
static DATA_BLOCK_INSULATION_MONITORING_s | imd_tableInsulationMonitoring |
static IMD_STATE_s | imd_state |
Main driver state machine for insulation monitoring driver.
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:
This superimposed state machine initializes, enables and disables the selected Insulation Monitoring Device. Furthermore, the measurement results are evaluated and saved in the database. Requests are used to control the IMD state machine and with that the behavior of the IMDs.
Definition in file imd.c.
#define IMD_FSM_SHORT_TIME (1u) |
statemachine short time definition in IMD_Trigger calls until next state is processed
Symbolic names to check for multiple calls of IMD_Trigger
Enumerator | |
---|---|
IMD_MULTIPLE_CALLS_NO | no multiple calls, OK |
IMD_MULTIPLE_CALLS_YES | multiple calls, not OK |
enum IMD_FSM_SUBSTATES_e |
Substates of the state machine
|
static |
check for multiple calls of state machine trigger function
The trigger function is not reentrant, which means it cannot be called multiple times. This functions increments the triggerEntry counter once and must be called each time the trigger function is called. If triggerEntry is greater than one, there were multiple calls. For this function to work, triggerEntry must be decremented each time the trigger function is called, even if no processing do because the timer is non-zero.
[in,out] | pImdState | pointer to state variable of IMD state machine |
Definition at line 286 of file imd.c.
|
static |
checks the state requests that are made.
This function checks the validity of the state requests. The results of the checked staterequest is returned immediately.
[in] | stateRequest | state request to be checked |
[in,out] | pImdState | pointer to state variable of IMD state machine |
|
static |
Evaluates measurement perform by IMD driver.
This function evaluates the insulation measurement performed by the selected IMD driver and updates the database entry.
[in,out] | pTableInsulationMonitoring | pointer to insulation monitoring database entry |
Definition at line 457 of file imd.c.
bool IMD_GetInitializationState | ( | void | ) |
IMD_RETURN_TYPE_e IMD_RequestInitialization | ( | void | ) |
Request initialization of IMD statemachine.
Definition at line 508 of file imd.c.
IMD_RETURN_TYPE_e IMD_RequestInsulationMeasurement | ( | void | ) |
Request to activate the actual IMD measurement.
Definition at line 512 of file imd.c.
IMD_RETURN_TYPE_e IMD_RequestMeasurementStop | ( | void | ) |
Request to deactivate the actual IMD measurement.
Definition at line 516 of file imd.c.
|
static |
Defines the state transitions.
This function contains the implementation of the state machine, i.e., the sequence of states and substates. It is called by the trigger function every time the state machine timer has a non-zero value.
[in,out] | pImdState | state of the example state machine |
Definition at line 347 of file imd.c.
|
static |
Sets the next state, the next substate and the timer value of the state variable.
[in,out] | pImdState | state of the example state machine |
[in] | nextState | state to be transferred into |
[in] | nextSubstate | substate to be transferred into |
[in] | idleTime | wait time for the state machine |
Definition at line 299 of file imd.c.
|
static |
sets the current state request of the state variable imd_state.
This function is used to make a state request to the state machine, e.g, initialize state machine or shut-down state machine. It calls IMD_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.
[in] | stateRequest | state request to set |
[in,out] | pImdState | pointer to state variable of IMD state machine |
Definition at line 232 of file imd.c.
|
static |
|
static |
transfers the current state request to the state machine.
This function takes the current state request from imd_state transfers it to the state machine. It resets the value from imd_state to IMD_STATE_NO_REQUEST
[in,out] | pImdState | pointer to state variable of IMD state machine |
Definition at line 277 of file imd.c.
STD_RETURN_TYPE_e IMD_Trigger | ( | void | ) |
trigger function for the IMD driver state machine.
This function contains the sequence of events in the IMD state machine. It must be called time-triggered, every 100ms.
Definition at line 524 of file imd.c.
|
static |
|
static |