一种基于电池电压计算电池电量的算法的分析总结

本文总结了一种不依赖库伦计、仅基于电池电压计算电量的方法,适用于低成本移动产品。通过电池厂商提供的电池曲线数据,结合电压采集和处理,最终计算出电池电量。算法考虑了电压的平滑处理,旨在保护电池并提高充电效率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

这种算法应用在低成本的无界面的移动产品上,不依于赖库伦计,纯电压计算电压的方法。

首先,设置一些基本的变量:

struct capacity {
	int capacity;
	int min;
	int max;	
	int offset;
	int hysteresis;
};

struct battery_capacity {
	struct capacity *tables;
	int size;	
};

struct battery {
    ......
    struct device *dev;
    struct wake_lock wlock;
    struct power_supply psy;
    struct battery_monitor monitor;
    struct battery_property props;
    struct battery_parameter params;
    ......
};

再通过电池厂商提供的电池曲线制作成:

static struct capacity battery_capacity_tables[]= {
   /*percentage, min, max, hysteresis*/
	{0, 3306, 3426, 0, 10},
	{1, 3427, 3638, 0, 10},
	{10,3639, 3697, 0, 10},
	{20,3698, 3729, 0, 10},
	{30,3730, 3748, 0, 10},
	{40,3749, 3776, 0, 10},
	{50,3777, 3827, 0, 10},
	{60,3828, 3895, 0, 10},
	{70,3896, 3954, 0, 10},
	{80,3955, 4050, 0, 10},
	{90,4051, 4119, 0, 10},
	{100,4120,4240, 0, 10},
};

此处稍作解释一下:

在选取电压时,厂商提供的电压有OCV/CV两种,我选取的是CV作为上述表中的数据,这样做的目的是可以让电池尽早的充满,同时也保护电池,防止电压过高。但是MTK与高通的制作电池曲线中都是以OCV作为计算基础的。

定义两个全局变量:

......
static struct capacity *battery_capacity_tables = battery_capacity_tables;
static int cap_size = ARRAY_SI
评论 14
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值