first soap ideals

This commit is contained in:
Max 'MaxMax' Mönikes 2023-06-29 23:57:29 +02:00
parent 75b9136a1d
commit 01de4ce2cf
2 changed files with 10 additions and 2 deletions

View File

@ -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);

View File

@ -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)