101 lines
2.3 KiB
C
101 lines
2.3 KiB
C
/*****************************************************************************
|
|
*
|
|
* AMO Corporation
|
|
*
|
|
* File : calc_soc.h
|
|
* Compiler : IAR C 5.30C Kickstart
|
|
* Revision : $Revision: 1.0 $
|
|
* Date : $Date: 2010 / 7 / 16
|
|
* Updated by : $Author: Jongkwang Woo
|
|
*
|
|
* Support mail : spirit0305@naver.com
|
|
*
|
|
* Target platform : ST32F ARM support
|
|
*
|
|
* AppNote : ST32F BPU Application
|
|
*
|
|
* Description : Header file for calc_soc.c
|
|
*
|
|
****************************************************************************/
|
|
|
|
#ifndef _CALC_SOC_H_
|
|
#define _CALC_SOC_H_
|
|
|
|
#include <stm32f4xx.h>
|
|
|
|
#define SOC_TASK_TIME 1 // 1s TASK
|
|
|
|
#define PWR_CONSUMPTION_BMS 100 // 4W
|
|
#define PWR_CONSUMPTION_RELAY_ON 200 // 13W (250mA)
|
|
|
|
//#define BATTERY_CAPACITY_MAX (u32)(1000 * 60 * 60)
|
|
|
|
#define CHARGE_VOLTAGE_SOC 900 // 10.0%
|
|
#define DICHARGE_VOLTAGE_SOC 100 // 10.0%
|
|
|
|
typedef struct
|
|
{
|
|
s32 Capacity;
|
|
u32 LifeCycle;
|
|
s32 ChargeCapacity;
|
|
s32 DischargeCapacity;
|
|
u32 LifeCycleCapacity;
|
|
s32 bakChargeCapacity;
|
|
s32 bakDischargeCapacity;
|
|
} TCalcSOC, *PCalcSOC;
|
|
|
|
typedef struct
|
|
{
|
|
u16 CountPer10msec;
|
|
u16 CountPer1min;
|
|
u16 CountPer1hour;
|
|
s16 CurrPer10msec;
|
|
} TCalculationSOC, *PCalculationSOC;
|
|
|
|
typedef struct
|
|
{
|
|
u32 CurrPerSecBuf;
|
|
u32 CurrPerSec;
|
|
u32 CurrPerMinBuf;
|
|
u32 CurrPerMin;
|
|
u32 CurrPerHourBuf;
|
|
u32 CurrPerHour;
|
|
} TCurrent, *PCurrent;
|
|
|
|
typedef struct
|
|
{
|
|
TCurrent Charge;
|
|
TCurrent Discharge;
|
|
} TManageSOC, *PManageSOC;
|
|
|
|
typedef struct
|
|
{
|
|
TCalcSOC CalcSOC;
|
|
} TStoreSOC, *PStoreSOC;
|
|
|
|
#define SOC_WAIT_TIME 5
|
|
|
|
extern TCalculationSOC CalculationSOC, disCalculationSOC;
|
|
extern TManageSOC ManageSOC, disManageSOC;
|
|
extern TStoreSOC StoreSOC, disStoreSOC;
|
|
|
|
void Calculation_10ms_Current(u16 tick_ms);
|
|
u16 GetBatteryRemind(u16 id, u16 c_current, u16 d_current, u16 volt);
|
|
void SDisplayCurrentStatus(u8 p);
|
|
void LoadStoreSOC(void);
|
|
s8 Process_DataCcModeSet(u8 *text, u16 size);
|
|
void SetStoreSOC(u16 soc);
|
|
void InitLifeCycleCount(u16 cycle);
|
|
|
|
void SOC_Init(void);
|
|
void SaveStoreSOC(void);
|
|
void dec_soc_tick(u32 tick);
|
|
|
|
void App_TaskSOC(void);
|
|
|
|
void ProcessSOC(void);
|
|
void UpdateSocStatus(void);
|
|
|
|
#endif
|
|
|