From 01de4ce2cf021f501744dcc9436bd6118d150f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20=27MaxMax=27=20M=C3=B6nikes?= Date: Thu, 29 Jun 2023 23:57:29 +0200 Subject: [PATCH] first soap ideals --- Core/Inc/soc_estimation.h | 2 +- Core/Src/soc_estimation.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Core/Inc/soc_estimation.h b/Core/Inc/soc_estimation.h index 237d92e..bf99cf1 100644 --- a/Core/Inc/soc_estimation.h +++ b/Core/Inc/soc_estimation.h @@ -8,7 +8,7 @@ extern uint8_t current_soc; #define N_MODELPARAMETERS 11 #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); diff --git a/Core/Src/soc_estimation.c b/Core/Src/soc_estimation.c index cae26e1..ea07344 100644 --- a/Core/Src/soc_estimation.c +++ b/Core/Src/soc_estimation.c @@ -66,7 +66,15 @@ float soe_update() } void soap_update() { - // + 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)