Files
LFP_48V_mBMS_FW/APP_R3221/App/Source/calc_soc.h

98 lines
3.1 KiB
C

/**
******************************************************************************
* @file calc_soc.h
* @author AMG Energy Solution Team
* @version V1.0.0
* @date 07-Feb-2022
* @brief This file provides all the headers of calculation SOC functions.
******************************************************************************
* @attention
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>&copy; COPYRIGHT 2022 AMG</center></h2>
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef _CALC_SOC_H_
#define _CALC_SOC_H_
/* Includes ------------------------------------------------------------------*/
#include "hc32_ddl.h"
/* Exported types ------------------------------------------------------------*/
typedef struct {
int32_t Capacity; // 4
uint32_t LifeCycle; // 4
int32_t ChargeCapacity; // 4
int32_t DischargeCapacity; // 4
uint32_t LifeCycleCapacity; // 4
int32_t bakChargeCapacity; // 4
int32_t bakDischargeCapacity; // 4
} TCalcSOC, *PCalcSOC;
typedef struct {
uint16_t CountPer10msec;
uint16_t CountPer1min;
uint16_t CountPer1hour;
int16_t CurrPer10msec;
} TCalculationSOC, *PCalculationSOC;
typedef struct {
uint32_t CurrPerSecBuf;
uint32_t CurrPerSec;
uint32_t CurrPerMinBuf;
uint32_t CurrPerMin;
uint32_t CurrPerHourBuf;
uint32_t CurrPerHour;
} TCurrent, *PCurrent;
typedef struct {
TCurrent Charge;
TCurrent Discharge;
} TManageSOC, *PManageSOC;
typedef struct {
TCalcSOC CalcSOC;
} TStoreSOC, *PStoreSOC;
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported extern variables -------------------------------------------------*/
extern TCalculationSOC CalculationSOC, disCalculationSOC;
extern TManageSOC ManageSOC, disManageSOC;
extern TStoreSOC StoreSOC, disStoreSOC;
/* Exported functions ------------------------------------------------------- */
void SOC_Init(void);
void SaveStoreSOC(void);
void dec_soc_tick(uint32_t tick);
void App_TaskSOC(void);
void ProcessSOC(void);
void UpdateSocStatus(void);
void LoadStoreSOC(void);
void SetStoreSOC(uint16_t soc);
void InitLifeCycleCount(uint16_t cycle);
void Calculation_10ms_Current(uint16_t tick_ms);
uint16_t GetBatteryRemind(uint16_t id, uint16_t c_current, uint16_t d_current, uint16_t volt);
#ifdef CONSOLE_DEBUG
void SDisplayCurrentStatus(uint8_t p);
int8_t Process_DataCcModeSet(uint8_t *text, uint16_t size);
#endif /* CONSOLE_DEBUG */
#endif
/*******************(C)COPYRIGHT 2022 AMG ********************END OF FILE******/