4.24. Insulation Measurement Device
Several different Insulation Measurement Devices (IMD) are supported.
A superimposed state machine is implemented that interacts with the actual IMD implementation. There a different reasons for the state machine to transition between the states. Generally three cases can happen:
an external request to the state machine is received to either initialize the IMD or to start/stop the insulation resistance measurement
the IMD implementation request a transition e.g., when the initialization is finished
inherent determined transitions e.g.,
IMD_FSM_STATE_HAS_NEVER_RUNtransitions to state
The state machine consists of the following states:
The transitions between the main states of the IMD state machine is depicted below.
These transitions will either be performed automatically or on request. The following requests can be made to the state machine:
4.24.4. Brief state machine description
The state machine trigger function
IMD_Trigger() is called periodically
from the 100|_||ms| task.
It starts in state
IMD_FSM_STATE_HAS_NEVER_RUN after startup and
transitions with the next call automatically to state
The state machine waits in this state until the
IMD_STATE_INITIALIZE_REQUEST has been submitted to the state machine
during the startup phase from the sys module.
The state machine transitions to state
IMD_FSM_STATE_IMD_ENABLE after a
successful initialization of the required peripherals and the software modules
of the selected IMD driver implementation in state
Now, the state machine waits again to receive the
IMD_STATE_SWITCH_ON_REQUEST from the application state machine activate the
IMD device and begin with the insulation resistance measurement and the
evaluation of the measurement results from IMD.
The state machine continuously monitors the insulation resistance of the
battery system in this state until the
submitted to the state machine.
This can be necessary to prevent a mutual interference if multiple insulation
monitoring devices would be monitoring the battery system, e.g., when a vehicle
is connected to a charging station.
4.24.5. Description of the IMD state machine
In the following, the implementations of all cases are explained in detail.
This is the default state after the startup of the BMS. The state machine will
immediately transition to state
IMD_FSM_STATE_UNINITIALIZED with the next
The state machine will wait until an
This request is submitted from the
sys state machine during the startup
phase of the BMS.
IMD_FSM_STATE_INITIALIZATION state is responsible to only initialize
the required peripherals and the software module of the selected IMD to prepare
the module for the measurement.
The actual measurement of the IMD shall not be started.
The state machine will switch to
IMD_FSM_STATE_ERROR in case an error is
detected during the initialization. The interface is utilized using function
This state is responsible to activate the IMD device and start the insulation
measurement after a successful initialization.
Before this is done, the state request
IMD_STATE_SWITCH_ON_REQUEST need to
be submitted to the state machine.
In the default software, this will be done by the
bms state machine during
its initialization phase.
imd state machine will switch to
IMD_FSM_STATE_ERROR in case an
error is detected during the activation.
The state machine will switch to
IMD_FSM_STATE_RUNNING once the IMD is
IMD_ProcessEnableState provides the required interface for the
The insulation measurement and the IMD are switched off in this case using the
If this this successful, state
IMD_FSM_STATE_IMD_ENABLE is executed next,
otherwise a transition into state
IMD_FSM_STATE_ERROR will be done.
This the main state of the superimposed IMD state machine.
This state acquires the measurement results from the selected IMD implementation
using the function
IMD_ProcessRunningState() and evaluates the measurement
results in function
This way the evaluation is encapsulated from the insulation measurement
performed by the IMD.
Additionally, the state machine will react on a
request and subsequently switch to state
This section of the documentation is not yet complete.
4.24.6. Interfaces for IMD driver implementation
The following functions are used to interface the actual IMD implementation:
2 * @brief Processes the initialization state
3 * @details This function needs to be implemented in the dedicated driver. This
4 * function initializes the required SW modules and peripherals but
5 * does not start the actual IMD measurement.
6 * @return #IMD_FSM_STATE_INITIALIZATION if initialization not finished and
7 * another call is required. #IMD_FSM_STATE_IMD_ENABLE if
8 * initialization is finished and #IMD_FSM_STATE_ERROR if an error is
9 * detected that prohibits a working IMD driver.
11extern IMD_FSM_STATES_e IMD_ProcessInitializationState(void);
14 * @brief Processes the IMD enable state
15 * @details This function needs to be implemented in the dedicated driver. This
16 * function enables the actual IMD device to start the insulation
17 * measurement. Functionality need to be fulfilled after one call.
18 * @return #IMD_FSM_STATE_RUNNING if startup has been completed. Returns #IMD_FSM_STATE_ERROR if an error is
19 * detected that prohibits a working IMD driver.
21extern IMD_FSM_STATES_e IMD_ProcessEnableState(void);
24 * @brief Processes the running state
25 * @details This function needs to be implemented in the dedicated driver
26 * @param pTableInsulationMonitoring pointer to insulation monitoring
27 * database entry
28 * @return #IMD_FSM_STATE_RUNNING if measurement works as expected, otherwise
29 * #IMD_FSM_STATE_ERROR if an error is detected that prohibits a
30 * further execution of the IMD driver.
32extern IMD_FSM_STATES_e IMD_ProcessRunningState(DATA_BLOCK_INSULATION_MONITORING_s *pTableInsulationMonitoring);
35 * @brief Processes the shutdown state
36 * @details This function needs to be implemented in the dedicated driver. This
37 * function disables the actual IMD device to stop the insulation
38 * measurement.
39 * @return #IMD_FSM_STATE_SHUTDOWN if shutdown state is not finished and
40 * another call is required. #IMD_FSM_STATE_IMD_ENABLE if shut down
41 * has been completed and #IMD_FSM_STATE_ERROR if an error is detected
42 * that prohibits a working IMD driver.
44extern IMD_FSM_STATES_e IMD_ProcessShutdownState(void);