foxBMS  1.1.2
The foxBMS Battery Management System API Documentation
contactor.h File Reference

Headers for the driver for the contactors. More...

#include "contactor_cfg.h"
Include dependency graph for contactor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef enum CONT_POWER_LINE_e CONT_POWER_LINE_e
 Names for connected power paths. More...
 

Enumerations

enum  CONT_STATEMACH_SUB_e {
  CONT_ENTRY , CONT_SET_EDGE_LOW_INIT , CONT_SET_EDGE_HIGH , CONT_SET_EDGE_LOW ,
  CONT_CHECK_REQUESTS
}
 Substates of the CONT state machine. More...
 
enum  CONT_POWER_LINE_e { CONT_POWER_PATH_NONE , CONT_POWER_PATH_0 }
 Names for connected power paths. More...
 

Functions

CONT_ELECTRICAL_STATE_TYPE_e CONT_GetContactorSetValue (const CONT_NAMES_e name)
 Gets the latest value the contactors were set to. More...
 
void CONT_GetContactorFeedback (void)
 Reads the feedback pin of every contactor and returns its current value (CONT_SWITCH_OFF/CONT_SWITCH_ON). More...
 
STD_RETURN_TYPE_e CONT_SetContactorState (const CONT_NAMES_e name, CONT_ELECTRICAL_STATE_TYPE_e requestedContactorState)
 Sets the contactor state to its requested state, if the contactor is at that time not in the requested state. More...
 
CONT_ELECTRICAL_STATE_TYPE_e CONT_GetState (uint8_t contactorNumber)
 Gets the current state. More...
 
STD_RETURN_TYPE_e CONT_CloseString (uint8_t stringNumber)
 Closes the contactor of a string. More...
 
STD_RETURN_TYPE_e CONT_OpenString (uint8_t stringNumber)
 Opens the contactor of a string. More...
 
STD_RETURN_TYPE_e CONT_ClosePrecharge (uint8_t stringNumber)
 Closes precharge. More...
 
STD_RETURN_TYPE_e CONT_OpenPrecharge (uint8_t stringNumber)
 Opens precharge. More...
 
void CONT_CheckFeedback (void)
 checks the feedback of the contactors More...
 
void CONT_Initialize (void)
 initializes the contactor module More...
 

Detailed Description

Headers for the driver for the contactors.

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:

  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-02-11 (date of creation)
Updated
2021-03-24 (date of last update)
Prefix
CONT

Definition in file contactor.h.

Typedef Documentation

◆ CONT_POWER_LINE_e

Names for connected power paths.

Enumeration Type Documentation

◆ CONT_POWER_LINE_e

Names for connected power paths.

Enumerator
CONT_POWER_PATH_NONE 

no power line is connected, contactors are open

CONT_POWER_PATH_0 

power line 0, e.g. used for the power train

Definition at line 113 of file contactor.h.

◆ CONT_STATEMACH_SUB_e

Substates of the CONT state machine.

Enumerator
CONT_ENTRY 
CONT_SET_EDGE_LOW_INIT 
CONT_SET_EDGE_HIGH 
CONT_SET_EDGE_LOW 
CONT_CHECK_REQUESTS 

Definition at line 104 of file contactor.h.

Function Documentation

◆ CONT_CheckFeedback()

void CONT_CheckFeedback ( void  )

checks the feedback of the contactors

makes a DIAG entry for each contactor when the feedback does not match the set value

Definition at line 212 of file contactor.c.

Here is the call graph for this function:

◆ CONT_ClosePrecharge()

STD_RETURN_TYPE_e CONT_ClosePrecharge ( uint8_t  stringNumber)

Closes precharge.

This function makes a close state request to the precharge contactor.

Parameters
stringNumberString addressed

Definition at line 234 of file contactor.c.

Here is the call graph for this function:

◆ CONT_CloseString()

STD_RETURN_TYPE_e CONT_CloseString ( uint8_t  stringNumber)

Closes the contactor of a string.

This function makes a close state request to the contactor of a specific string.

Parameters
stringNumberString addressed

Definition at line 217 of file contactor.c.

Here is the call graph for this function:

◆ CONT_GetContactorFeedback()

void CONT_GetContactorFeedback ( void  )

Reads the feedback pin of every contactor and returns its current value (CONT_SWITCH_OFF/CONT_SWITCH_ON).

If the contactor has a feedback pin the measured feedback is returned. If the contactor has no feedback pin, it is assumed that after a certain time the contactor has reached the requested state.

Definition at line 168 of file contactor.c.

Here is the call graph for this function:

◆ CONT_GetContactorSetValue()

CONT_ELECTRICAL_STATE_TYPE_e CONT_GetContactorSetValue ( const CONT_NAMES_e  name)

Gets the latest value the contactors were set to.

Parameters
[in]namename of the contactor
Returns
returns CONT_SWITCH_OFF or CONT_SWITCH_ON

Definition at line 162 of file contactor.c.

Here is the call graph for this function:

◆ CONT_GetState()

CONT_ELECTRICAL_STATE_TYPE_e CONT_GetState ( uint8_t  contactorNumber)

Gets the current state.

This function is used in the functioning of the CONT state machine.

Parameters
contactorNumbercontactor to be addressed
Returns
current state, taken from CONT_ELECTRICAL_STATE_TYPE_e

Definition at line 286 of file contactor.c.

◆ CONT_Initialize()

void CONT_Initialize ( void  )

initializes the contactor module

Definition at line 291 of file contactor.c.

Here is the call graph for this function:

◆ CONT_OpenPrecharge()

STD_RETURN_TYPE_e CONT_OpenPrecharge ( uint8_t  stringNumber)

Opens precharge.

This function makes an open state request to the precharge contactor.

Parameters
stringNumberString addressed

Definition at line 260 of file contactor.c.

Here is the call graph for this function:

◆ CONT_OpenString()

STD_RETURN_TYPE_e CONT_OpenString ( uint8_t  stringNumber)

Opens the contactor of a string.

This function makes an open state request to the contactor of a specific string.

Parameters
stringNumberString addressed

Definition at line 225 of file contactor.c.

Here is the call graph for this function:

◆ CONT_SetContactorState()

STD_RETURN_TYPE_e CONT_SetContactorState ( const CONT_NAMES_e  name,
CONT_ELECTRICAL_STATE_TYPE_e  requestedContactorState 
)

Sets the contactor state to its requested state, if the contactor is at that time not in the requested state.

If the new state was already requested, but not reached (meaning the measured feedback does not return the requested state), there are two states: it can be still ok (STD_OK), because the contactor has some time left to get physically in the requested state (passed time since the request is lower than the limit) or it can be not ok (STD_NOT_OK), because there is timing violation, i.e. the contactor has surpassed the maximum time for getting in the requested state. It returns STD_OK if the requested state was successfully set or if the contactor was at the requested state before.

Parameters
name
requestedContactorState
Returns
retVal (type: STD_RETURN_TYPE_e)

Definition at line 183 of file contactor.c.

Here is the call graph for this function: