bs_bcu_app/app/app_soc.h

73 lines
1.7 KiB
C
Raw Normal View History

2024-11-10 15:22:55 +08:00
#ifndef BMS_SOX_H_
#define BMS_SOX_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "kit_macro.h"
typedef enum
{
kSocStatus_Start = 0,
kSocStatus_Normal = kSocStatus_Start,
kSocStatus_Full,
kSocStatus_Empty,
kSocStatus_End,
}SocStatus;
// Ams 转换为 AH(0.1Ah/Bit)
#define SOX_CONVERT_AMS_TO_AH(value) (((value) + 180000u) / 360000u)
// (0.1Ah/Bit) Ah 转换为 Ams
#define SOX_CONVERT_AH_TO_AMS(value) ((uint64_t)(value) * 360000u)
typedef enum
{
kCumulateData_DayDisTime,
kCumulateData_DayChgTime,
kCumulateData_SigDisTime,
kCumulateData_SigDisCap,
kCumulateData_SigDisEnergy,
kCumulateData_SigChgTime,
kCumulateData_SigChgCap,
kCumulateData_SigChgEnergy,
kCumulateData_DayDisCap,
kCumulateData_DayDisEnergy,
kCumulateData_DayChgCap,
kCumulateData_DayChgEnergy,
kCumulateData_AccDisTime,
kCumulateData_AccDisCap,
kCumulateData_AccDisEnergy,
kCumulateData_AccChgTime,
kCumulateData_AccChgCap,
kCumulateData_AccChgEnergy,
kCumulateData_End,
}CumulateData;
void bms_init_soc(void);
void bms_integral_soc(int32_t current, uint16_t base_time);
void bms_poll_soh(uint32_t base_time);
SocStatus bms_get_soc_status(void);
void bms_set_soc_status(SocStatus st);
uint16_t bms_get_soc(void);
uint16_t bms_get_show_soc(void);
uint16_t bms_get_cycle_flag(void);
void bms_set_soc(uint16_t value);
uint16_t bms_get_soh(void);
uint16_t bms_get_cycle(void);
uint8_t bms_get_stat_day(void);
void bms_set_cycle(uint16_t value);
uint32_t bms_get_cumulate_data(CumulateData idx);
void bms_set_cumulate_data(CumulateData idx, uint32_t value);
uint16_t soh_init(uint16_t cycle, uint32_t dis_cap, uint32_t charge_cap);
#ifdef __cplusplus
}
#endif
#endif