Compare commits

...

4 Commits

Author SHA1 Message Date
Max 'MaxMax' Mönikes 01de4ce2cf first soap ideals 2023-06-29 23:57:29 +02:00
Max 'MaxMax' Mönikes 75b9136a1d fixed soe function declaration 2023-06-29 23:45:03 +02:00
Max 'MaxMax' Mönikes 484de3f7d9 Added State of Energy LUT 2023-06-29 23:35:08 +02:00
Max 'MaxMax' Mönikes 6c0bbb83f6 My own algo Branch with Blackjack and Hookers 2023-06-29 23:17:41 +02:00
5 changed files with 30 additions and 14 deletions

1
.gitignore vendored
View File

@ -3,3 +3,4 @@
/.cache/
.clangd
TouchGFX/build
.gitmodules

2
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "Core/Lib/can-halal"]
path = Core/Lib/can-halal
url = ssh://git@git.fasttube.de:313/FaSTTUBe/can-halal.git
url = https://git.fasttube.de/FaSTTUBe/can-halal.git

View File

@ -7,12 +7,12 @@ extern uint8_t current_soc;
#define N_MODELPARAMETERS 11
#define BATTERYCAPACITYAs (21000.0*3600) //TODO Check if value is correct Cap in Ah * 3600 (Convert to As)
#define BATTERYCAPACITYAs (20000.0*3600) //TODO Check if value is correct Cap in Ah * 3600 (Convert to As)
#define SOAP_MINIMUM_VOLTAGE 2.5
void soc_init();
void soc_update(int32_t shunt_current);
void soe_update();
float soe_update();
void soap_update();
#endif // INC_SOC_ESTIMATION_H

View File

@ -13,7 +13,7 @@ const float R0[N_MODELPARAMETERS]={0.0089,0.0087,0.0090,0.0087,0.0087,0.0087,0.0
const float R1[N_MODELPARAMETERS]={0.0164,0.0063,0.0050,0.0055,0.0051,0.0052,0.0057,0.0048,0.0059,0.0055,0.0061};
const float C1[N_MODELPARAMETERS]={2.5694,0.2649,0.2876,0.2594,0.2415,0.2360,0.2946,0.2558,0.2818,0.2605,0.2763};
const float OCV_Data[N_MODELPARAMETERS]={2.762504,3.326231,3.460875,3.57681,3.655326,3.738444,3.835977,3.925841,4.032575,4.078275,4.191449};
const float SOE_Data[N_MODELPARAMETERS]={0.0,0.079358,0.165140,0.256008,0.348836,0.445961,0.549115,0.655642,0.769677,0.875699,1.0};
//---------------------------------------------------------------------------------------------------------------
@ -60,19 +60,34 @@ void soc_update(int32_t shunt_current) {
}
void soe_update()
float soe_update()
{
//TODO
return soc_approxparameterbysoc(current_floatsoc, SOE_Data, N_MODELPARAMETERS);
}
void soap_update()
{
//TODO
float r0 = soc_approxparameterbysoc(current_floatsoc, R0, N_MODELPARAMETERS);
float r1 = soc_approxparameterbysoc(current_floatsoc, R1, N_MODELPARAMETERS);
float ocv = soc_approxparameterbysoc(current_floatsoc, OCV_Data, N_MODELPARAMETERS);
float allowedvoltagedrop = ocv - SOAP_MINIMUM_VOLTAGE;
float rin = r0+r1;
float maxcurrent = allowedvoltagedrop/rin;
//TODO think about how to pass parameters
}
float soc_approxparameterbysoc(float soc,float* lut, uint8_t lutlen)
{
//TODO
return 0;
uint8_t idx = (uint8_t) (soc*(lutlen-1));
if(idx == (lutlen-1))
return lut[lutlen-1];
float linapprox = 10*(soc-(((float)idx)/((float)(lutlen-1))))*(lut[idx+1]-lut[idx]);
linapprox += lut[idx];
return linapprox;
}
float soc_approxsocbyocv(float ocv)

View File

@ -85,7 +85,7 @@ PREFIX = arm-none-eabi-
POSTFIX = "
# The gcc compiler bin path can be either defined in make command via GCC_PATH variable (> make GCC_PATH=xxx)
# either it can be added to the PATH environment variable.
GCC_PATH="/home/jasper/.config/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/arm-none-eabi-gcc/11.3.1-1.1.2/.content/bin
GCC_PATH="c:/Users/max/AppData/Roaming/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/arm-none-eabi-gcc/11.2.1-1.2.2/.content/bin
ifdef GCC_PATH
CXX = $(GCC_PATH)/$(PREFIX)g++$(POSTFIX)
CC = $(GCC_PATH)/$(PREFIX)gcc$(POSTFIX)
@ -241,19 +241,19 @@ $(BUILD_DIR):
# flash
#######################################
flash: $(BUILD_DIR)/$(TARGET).elf
"/home/jasper/.config/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/openocd/0.11.0-5.1/.content/bin/openocd" -f ./openocd.cfg -c "program $(BUILD_DIR)/$(TARGET).elf verify reset exit"
"C:/USERS/MAX/APPDATA/ROAMING/CODE/USER/GLOBALSTORAGE/BMD.STM32-FOR-VSCODE/@XPACK-DEV-TOOLS/OPENOCD/0.11.0-4.1/.CONTENT/BIN/OPENOCD.EXE" -f ./openocd.cfg -c "program $(BUILD_DIR)/$(TARGET).elf verify reset exit"
#######################################
# erase
#######################################
erase: $(BUILD_DIR)/$(TARGET).elf
"/home/jasper/.config/Code/User/globalStorage/bmd.stm32-for-vscode/@xpack-dev-tools/openocd/0.11.0-5.1/.content/bin/openocd" -f ./openocd.cfg -c "init; reset halt; stm32f3x mass_erase 0; exit"
"C:/USERS/MAX/APPDATA/ROAMING/CODE/USER/GLOBALSTORAGE/BMD.STM32-FOR-VSCODE/@XPACK-DEV-TOOLS/OPENOCD/0.11.0-4.1/.CONTENT/BIN/OPENOCD.EXE" -f ./openocd.cfg -c "init; reset halt; stm32f3x mass_erase 0; exit"
#######################################
# clean up
#######################################
clean:
-rm -fR $(BUILD_DIR)
cmd /c rd /s /q $(BUILD_DIR)
#######################################
# custom makefile rules