Add dummy SoC, replace ID
This commit is contained in:
@@ -30,28 +30,28 @@
|
|||||||
|
|
||||||
// Hardware names and limits
|
// Hardware names and limits
|
||||||
#if ENNOID_LV
|
#if ENNOID_LV
|
||||||
#define HW_NAME "ENNOID-LV"
|
#define HW_NAME "CuboBMS-LV"
|
||||||
#define HW_LIM_CELL_BALANCE_MAX_SIMULTANEOUS_DISCHARGE 18
|
#define HW_LIM_CELL_BALANCE_MAX_SIMULTANEOUS_DISCHARGE 18
|
||||||
#define HW_LIM_CELL_MONITOR_IC_COUNT 18
|
#define HW_LIM_CELL_MONITOR_IC_COUNT 18
|
||||||
#define HW_LIM_MIN_NOT_USED_DELAY 5000
|
#define HW_LIM_MIN_NOT_USED_DELAY 5000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENNOID_HV
|
#if ENNOID_HV
|
||||||
#define HW_NAME "ENNOID-HV"
|
#define HW_NAME "CuboBMS-HV"
|
||||||
#define HW_LIM_CELL_BALANCE_MAX_SIMULTANEOUS_DISCHARGE 18
|
#define HW_LIM_CELL_BALANCE_MAX_SIMULTANEOUS_DISCHARGE 18
|
||||||
#define HW_LIM_CELL_MONITOR_IC_COUNT 18
|
#define HW_LIM_CELL_MONITOR_IC_COUNT 18
|
||||||
#define HW_LIM_MIN_NOT_USED_DELAY 5000
|
#define HW_LIM_MIN_NOT_USED_DELAY 5000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENNOID_SS
|
#if ENNOID_SS
|
||||||
#define HW_NAME "ENNOID-SS"
|
#define HW_NAME "CuboBMS-SS"
|
||||||
#define HW_LIM_CELL_BALANCE_MAX_SIMULTANEOUS_DISCHARGE 18
|
#define HW_LIM_CELL_BALANCE_MAX_SIMULTANEOUS_DISCHARGE 18
|
||||||
#define HW_LIM_CELL_MONITOR_IC_COUNT 1
|
#define HW_LIM_CELL_MONITOR_IC_COUNT 1
|
||||||
#define HW_LIM_MIN_NOT_USED_DELAY 5000
|
#define HW_LIM_MIN_NOT_USED_DELAY 5000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENNOID_SS_LITE
|
#if ENNOID_SS_LITE
|
||||||
#define HW_NAME "ENNOID-SS-LITE"
|
#define HW_NAME "CuboBMS-SS-LITE"
|
||||||
#define HW_LIM_CELL_BALANCE_MAX_SIMULTANEOUS_DISCHARGE 18
|
#define HW_LIM_CELL_BALANCE_MAX_SIMULTANEOUS_DISCHARGE 18
|
||||||
#define HW_LIM_CELL_MONITOR_IC_COUNT 1
|
#define HW_LIM_CELL_MONITOR_IC_COUNT 1
|
||||||
#define HW_LIM_MIN_NOT_USED_DELAY 5000
|
#define HW_LIM_MIN_NOT_USED_DELAY 5000
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ void modConfigLoadDefaultConfig(modConfigGeneralConfigStructTypedef *configLocat
|
|||||||
configLocation->externalChargeUnitTable[i][j] = unitTable[i][j];
|
configLocation->externalChargeUnitTable[i][j] = unitTable[i][j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
__NOP();
|
||||||
#elif ENNOID_HV
|
#elif ENNOID_HV
|
||||||
configLocation->noOfCellsSeries = 8; // Total number of cells in series in the battery pack
|
configLocation->noOfCellsSeries = 8; // Total number of cells in series in the battery pack
|
||||||
configLocation->noOfCellsParallel = 10; // Number of cells in parallel
|
configLocation->noOfCellsParallel = 10; // Number of cells in parallel
|
||||||
|
|||||||
@@ -120,7 +120,8 @@ void modStateOfChargeProcess(void){
|
|||||||
|
|
||||||
// Calculate state of charge
|
// Calculate state of charge
|
||||||
// calc percent of we put/take to battery capacity
|
// calc percent of we put/take to battery capacity
|
||||||
modStateOfChargeGeneralStateOfCharge.generalStateOfCharge = modStateOfChargeGeneralStateOfCharge.remainingCapacityAh / modStateOfChargeGeneralConfigHandle->batteryCapacity * 100.0f;
|
modStateOfChargeGeneralStateOfCharge.generalStateOfCharge =
|
||||||
|
modStateOfChargeGeneralStateOfCharge.remainingCapacityAh / modStateOfChargeGeneralConfigHandle->batteryCapacity * 100.0f;
|
||||||
|
|
||||||
if(SoC_Save_Flag == 0) {
|
if(SoC_Save_Flag == 0) {
|
||||||
previous_SoC = modStateOfChargeGeneralStateOfCharge.generalStateOfCharge;
|
previous_SoC = modStateOfChargeGeneralStateOfCharge.generalStateOfCharge;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#include "modStateOfCharge.h"
|
#include "modStateOfCharge.h"
|
||||||
|
|
||||||
|
#include "can_messenger.h"
|
||||||
|
|
||||||
|
|
||||||
// Private types
|
// Private types
|
||||||
@@ -134,6 +134,10 @@ static uint8_t SoC_Save_Flag = 0;
|
|||||||
modCommandsPrintf(" ");
|
modCommandsPrintf(" ");
|
||||||
modCommandsPrintf("Charge Switch State: %s",charge_switch_state ? "ON" : "OFF");
|
modCommandsPrintf("Charge Switch State: %s",charge_switch_state ? "ON" : "OFF");
|
||||||
modCommandsPrintf("Load Switch State: %s",load_switch_state ? "ON" : "OFF");
|
modCommandsPrintf("Load Switch State: %s",load_switch_state ? "ON" : "OFF");
|
||||||
|
modCommandsPrintf("Charge Permission: %s",packState.chargeAllowed ? "YES" : "NO");
|
||||||
|
|
||||||
|
// modCommandsPrintf("dummy: %s",get_dummy_soc() ? "YES" : "NO");
|
||||||
|
|
||||||
//generalConfig->shuntLCFactor
|
//generalConfig->shuntLCFactor
|
||||||
//export_adc_average_res
|
//export_adc_average_res
|
||||||
|
|
||||||
@@ -192,7 +196,11 @@ uint8_t maxChargeCurrent = 0;
|
|||||||
uint8_t maxLoadCurrent = 0;
|
uint8_t maxLoadCurrent = 0;
|
||||||
|
|
||||||
*/
|
*/
|
||||||
} else if (strcmp(argv[0], "setZeroCurrent") == 0) {
|
} else if (strcmp(argv[0], "socJOPA") == 0) { // Dummy SoC = 100%
|
||||||
|
|
||||||
|
can_set_dummy_soc();
|
||||||
|
// modCommandsPrintf("durak");
|
||||||
|
} else if (strcmp(argv[0], "setZeroCurrent") == 0) {
|
||||||
modCommandsPrintf(" ");
|
modCommandsPrintf(" ");
|
||||||
modCommandsPrintf("----- setZeroCurrent -----");
|
modCommandsPrintf("----- setZeroCurrent -----");
|
||||||
|
|
||||||
@@ -365,7 +373,7 @@ uint8_t maxLoadCurrent = 0;
|
|||||||
|
|
||||||
} else if (strcmp(argv[0], "help") == 0) {
|
} else if (strcmp(argv[0], "help") == 0) {
|
||||||
modCommandsPrintf("------- Start of help -------");
|
modCommandsPrintf("------- Start of help -------");
|
||||||
modCommandsPrintf("Valid commands for ENNOID-BMS are:");
|
modCommandsPrintf("Valid commands for CUBO-BMS are:");
|
||||||
modCommandsPrintf("help");
|
modCommandsPrintf("help");
|
||||||
modCommandsPrintf(" Show this help.");
|
modCommandsPrintf(" Show this help.");
|
||||||
modCommandsPrintf("setZeroCurrent");
|
modCommandsPrintf("setZeroCurrent");
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ static volatile CAN_MSG_t can2_tx_buf = {0,}; // Buf for 1 TX packet
|
|||||||
extern modPowerElectronicsPackStateTypedef packState;
|
extern modPowerElectronicsPackStateTypedef packState;
|
||||||
extern modConfigGeneralConfigStructTypedef *generalConfig;
|
extern modConfigGeneralConfigStructTypedef *generalConfig;
|
||||||
|
|
||||||
|
static volatile bool dummy_soc = 0;
|
||||||
|
|
||||||
static volatile bool threshold_request = 0;
|
static volatile bool threshold_request = 0;
|
||||||
static volatile bool active_request = 0;
|
static volatile bool active_request = 0;
|
||||||
|
|
||||||
@@ -47,6 +49,18 @@ void can_msgr_init() {
|
|||||||
RingBuf_Init((void *) &can2_transmit_q_msg, 10, sizeof(CAN_MSG_t), (RINGBUF_t *) &can2_ring);
|
RingBuf_Init((void *) &can2_transmit_q_msg, 10, sizeof(CAN_MSG_t), (RINGBUF_t *) &can2_ring);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Make SoC for charging = 100%
|
||||||
|
*/
|
||||||
|
void can_set_dummy_soc(void){
|
||||||
|
dummy_soc = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool get_dummy_soc(void){
|
||||||
|
return dummy_soc;
|
||||||
|
}
|
||||||
|
|
||||||
void transmitCan1Packet() {
|
void transmitCan1Packet() {
|
||||||
if ((TIM_Clock - can1_transmit_clock) < 1000) {
|
if ((TIM_Clock - can1_transmit_clock) < 1000) {
|
||||||
return;
|
return;
|
||||||
@@ -178,7 +192,7 @@ int getIndexByTemperature() {
|
|||||||
|
|
||||||
u16_t get_table_current() {
|
u16_t get_table_current() {
|
||||||
// sending table current and end-of-charge current command
|
// sending table current and end-of-charge current command
|
||||||
const int socIndex = getIndexBySoc();
|
const int socIndex = dummy_soc ? 10 : getIndexBySoc();
|
||||||
const int temperatureIndex = getIndexByTemperature();
|
const int temperatureIndex = getIndexByTemperature();
|
||||||
float tableCurrent = 0;
|
float tableCurrent = 0;
|
||||||
if (socIndex != -1 && temperatureIndex != -1) {
|
if (socIndex != -1 && temperatureIndex != -1) {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#ifndef BMS_V3_CAN_MESSENGER_H
|
#ifndef BMS_V3_CAN_MESSENGER_H
|
||||||
#define BMS_V3_CAN_MESSENGER_H
|
#define BMS_V3_CAN_MESSENGER_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include "../Core/Inc/main.h"
|
#include "../Core/Inc/main.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,6 +24,9 @@ typedef enum CAN_BMS_ID {
|
|||||||
|
|
||||||
void can_msgr_init();
|
void can_msgr_init();
|
||||||
|
|
||||||
|
void can_set_dummy_soc(void);
|
||||||
|
bool get_dummy_soc(void);
|
||||||
|
|
||||||
void transmitCan1Packet();
|
void transmitCan1Packet();
|
||||||
int getIndexBySoc();
|
int getIndexBySoc();
|
||||||
int getIndexByTemperature();
|
int getIndexByTemperature();
|
||||||
|
|||||||
Reference in New Issue
Block a user