Vehicle Control Unit 0.01
This is the c library for controlling the car.
Loading...
Searching...
No Matches
Classes | Enumerations | Functions
BMS.h File Reference
#include <stdint.h>
#include "../ExternalSystem.h"
#include "../Inc/Systems/Comms/Can/DBCParser.h"
Include dependency graph for BMS.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  Bms
 

Enumerations

enum  BmsChargeStatus { DISCHARGING , CHARGING , IDLE }
 

Functions

void initBms (Bms *bms, int hz, const char *dbcFn)
 Initializes the BMS with the given frequency. More...
 
void updateBms (void *bms)
 Transfers raw BMS data to a BmsData structure. More...
 
void updateBmsTest (void *bms, const char *canDataFn)
 Updates the BMS data. More...
 

Enumeration Type Documentation

◆ BmsChargeStatus

Enumerator
DISCHARGING 
CHARGING 
IDLE 

Definition at line 9 of file BMS.h.

9 {
12 IDLE,
BmsChargeStatus
Definition: BMS.h:9
@ CHARGING
Definition: BMS.h:11
@ DISCHARGING
Definition: BMS.h:10
@ IDLE
Definition: BMS.h:12

Function Documentation

◆ initBms()

void initBms ( Bms bms,
int  hz,
const char *  dbcFn 
)

Initializes the BMS with the given frequency.

Parameters
bmsPointer to the Bms structure to initialize.
hzThe frequency in Hertz at which the BMS operates.
dbcFnThe filename of the dbc file to use to interpret the can data.

Definition at line 7 of file BMS.c.

7 {
8 if (bms == NULL) return;
9
10 initExternalSystem(&bms->extSystem, "Bms", hz, 0);
11
12 bms->packVoltage = 0.0f;
13 bms->packCurrent = 0.0f;
14 bms->stateOfCharge = 0.0f;
15 bms->cellVoltageMin = 0.0f;
16 bms->cellVoltageMax = 0.0f;
17 bms->cellTemperatureMin = 0.0f;
18 bms->cellTemperatureMax = 0.0f;
19 bms->totalPackCapacity = 0.0f;
20 bms->remainingPackCapacity = 0.0f;
21 bms->packHealth = 0.0f;
22 bms->chargeStatus = IDLE;
24}
void updateBms(void *bms)
Transfers raw BMS data to a BmsData structure.
Definition: BMS.c:83
void initExternalSystem(ExternalSystem *external, const char *name, int hz, ExternalType type)
Definition: ExternalSystem.c:3
float cellVoltageMin
Definition: BMS.h:22
float stateOfCharge
Definition: BMS.h:21
float cellVoltageMax
Definition: BMS.h:23
float cellTemperatureMax
Definition: BMS.h:25
float packVoltage
Definition: BMS.h:19
ExternalSystem extSystem
Definition: BMS.h:16
BmsChargeStatus chargeStatus
Definition: BMS.h:29
float totalPackCapacity
Definition: BMS.h:26
float cellTemperatureMin
Definition: BMS.h:24
float remainingPackCapacity
Definition: BMS.h:27
float packHealth
Definition: BMS.h:28
float packCurrent
Definition: BMS.h:20
Updateable updateable
Definition: System.h:18
void(* update)(void *self)
Definition: Updateable.h:26
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateBms()

void updateBms ( void *  bms)

Transfers raw BMS data to a BmsData structure.

Parameters
rawDataPointer to the array of raw data.
Returns
The converted BmsData structure.

Updates the BMS data.

Parameters
bmsPointer to the Bms structure to update.

Definition at line 83 of file BMS.c.

83 {
84// Bms* myBms = (Bms*) bms;
85 printf("BMS Update Not implemented\n");
86 // CanMessage canData = fetchCanData(...);
87 // parseCanData(&canData, canDataFn);
88 //
89 // // Call the transfer function to decode the message
90 // if (!bmsTransferFunction(myBms, &canData)) {
91 // printf("Error: Transfer function failed.\n");
92 // }
93}
Here is the caller graph for this function:

◆ updateBmsTest()

void updateBmsTest ( void *  bms,
const char *  canDataFn 
)

Updates the BMS data.

Warning
For testing and debugging use only
Parameters
bmsPointer to the Bms structure to update.
canDataFnName of file containing can data.

Definition at line 96 of file BMS.c.

96 {
97// Bms* myBms = (Bms*) bms;
98// CanMessage canData;
99// parseCanData(&canData, canDataFn);
100//
101// // Call the transfer function to decode the message
102// if (!bmsTransferFunction(myBms, &canData)) {
103// printf("Update Test Error: Transfer function failed.\n");
104// }
105}
Here is the caller graph for this function: