44 lines
1.2 KiB
C
44 lines
1.2 KiB
C
/*
|
|
* b_cccv_algo.h
|
|
*
|
|
* Created on: 16.06.2023
|
|
* Author: max
|
|
*/
|
|
#include <stdint.h>
|
|
#include "stm32h7xx_hal.h"
|
|
|
|
#ifndef INC_B_CCCV_ALGO_H_
|
|
#define INC_B_CCCV_ALGO_H_
|
|
|
|
#define I_GAIN 4
|
|
#define P_GAIN 10
|
|
#define CHARGE_CURRENT_LIMIT 10.0
|
|
#define SIMULINKTEST
|
|
#undef SIMULINKTEST
|
|
|
|
|
|
typedef enum{
|
|
NO_CHARGING,
|
|
CHARGING_IN_PROGRESS,
|
|
CHARGING_COMPLETED
|
|
} CCCV_CONTROL_STATE;
|
|
|
|
#ifdef SIMULINKTEST
|
|
CCCV_CONTROL_STATE cccvloop(float maxcellvoltage, float voltagesetpoint, float maxcurrent, float*ccurrent);
|
|
#else
|
|
|
|
CCCV_CONTROL_STATE cccvloop(float maxcellvoltage, float voltagesetpoint, float maxcurrent);
|
|
void setchargecurrent(float chargecurrent);
|
|
void setchargevoltage(uint8_t numberofcells,float maximumcellvoltage);
|
|
float getMaximumCellVoltage();
|
|
void chargingloop(float maximumcellvoltage);
|
|
void startcharging(float endvoltage);
|
|
void initChargerAlgo(uint8_t numberofcells, float maximumcellvoltage);
|
|
void setchargevoltage(uint8_t numberofcells,float maximumcellvoltage);
|
|
void stopcharging();
|
|
#endif
|
|
|
|
float matlabvalidationwrapper(float maxcellvoltage, float voltagesetpoint, float maxcurrent);
|
|
|
|
#endif /* INC_B_CCCV_ALGO_H_ */
|