foxBMS - Unit Tests
1.3.0
The foxBMS Unit Tests API Documentation
|
Driver for the contactors. More...
Go to the source code of this file.
Functions | |
static CONT_CONTACTOR_INDEX | CONT_ResolveContactorName (const CONT_NAMES_e name) |
Resolves the contactor index from a contactor name. More... | |
static CONT_NAMES_e | CONT_GetContactorName (const CONT_CONTACTOR_INDEX index) |
Gets the contactor name from a contactor index. More... | |
static SPS_CHANNEL_INDEX | CONT_GetSpsChannelIndexFromContactor (const CONT_CONTACTOR_INDEX contactor) |
Returns the sps channel index from a contactor index. More... | |
static void | CONT_SetSpsChannelFromContactor (const CONT_CONTACTOR_INDEX contactor) |
Sets SPS channels according to contactors. More... | |
static void | CONT_InitializationCheckOfContactorRegistry (void) |
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... | |
void | CONT_CheckFeedback (void) |
checks the feedback of the contactors 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... | |
CONT_ELECTRICAL_STATE_TYPE_e | CONT_GetState (uint8_t contactorNumber) |
Gets the current state. More... | |
void | CONT_Initialize (void) |
initializes the contactor module More... | |
void | TEST_CONT_InitializationCheckOfContactorRegistry () |
CONT_CONTACTOR_INDEX | TEST_CONT_ResolveContactorName (const CONT_NAMES_e name) |
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:
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 contactor.c.
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 222 of file contactor.c.
STD_RETURN_TYPE_e CONT_ClosePrecharge | ( | uint8_t | stringNumber | ) |
Closes precharge.
This function makes a close state request to the precharge contactor.
stringNumber | String addressed |
Definition at line 244 of file contactor.c.
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.
stringNumber | String addressed |
Definition at line 227 of file contactor.c.
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 173 of file contactor.c.
|
static |
Gets the contactor name from a contactor index.
[in] | index | index number of the contactor |
Definition at line 120 of file contactor.c.
CONT_ELECTRICAL_STATE_TYPE_e CONT_GetContactorSetValue | ( | const CONT_NAMES_e | name | ) |
Gets the latest value the contactors were set to.
[in] | name | name of the contactor |
Definition at line 167 of file contactor.c.
|
static |
Returns the sps channel index from a contactor index.
Currently this implementation maps simply in ascending order
Definition at line 125 of file contactor.c.
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.
contactorNumber | contactor to be addressed |
Definition at line 297 of file contactor.c.
|
static |
conducts an initialization test of the contactor registry and asserts at failure
Definition at line 146 of file contactor.c.
void CONT_Initialize | ( | void | ) |
initializes the contactor module
Definition at line 302 of file contactor.c.
STD_RETURN_TYPE_e CONT_OpenPrecharge | ( | uint8_t | stringNumber | ) |
Opens precharge.
This function makes an open state request to the precharge contactor.
stringNumber | String addressed |
Definition at line 271 of file contactor.c.
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.
stringNumber | String addressed |
Definition at line 235 of file contactor.c.
|
static |
Resolves the contactor index from a contactor name.
Searches in the contactor index by iteration from front to back for the contactor name and returns the first hit.
[in] | name | Name of the contactor |
Definition at line 101 of file contactor.c.
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.
name | |
requestedContactorState |
Definition at line 193 of file contactor.c.
|
static |
Sets SPS channels according to contactors.
Currently this implementation assumes simple ascending order.
[in] | contactor | index of the contactor that should be set |
Definition at line 130 of file contactor.c.
void TEST_CONT_InitializationCheckOfContactorRegistry | ( | void | ) |
CONT_CONTACTOR_INDEX TEST_CONT_ResolveContactorName | ( | const CONT_NAMES_e | name | ) |