UWP 计算充电时间
UWP calculate time until charged
我可以访问 UWP 的电池 API,并且可以显示与系统百分比相同的当前电池百分比。但是,我想知道windows如何计算充满电的时间?
我对电子学中的公式和计量单位知之甚少
我查找了不同的公式,但它们再次使用了我不理解的单位,我真的不明白电池 class 给我的是什么。
我的最大值 -> 64250 毫瓦时
率 -> 8516
所以 64250/8516 = ~7.544
大约 7.5 分钟,在这种情况下 Windows UI 是错误的?
Windows 报告剩余 5 分钟
下面是一些代码:
if (report.Status == BatteryStatus.Charging)
{
var report = sender.GetReport(); //<-- where sender is Type<Battery>
//(double)TryGetValue(report.FullChargeCapacityInMilliwattHours)
//(double)TryGetValue(report.ChargeRateInMilliwatts) <-- I don't understand how to use this with the max value of the battery to get the rate at which is is charging per Hr, Min, etc.
var rate = //Formula goes here
var remainingTime = DateTime.Now;
}
您必须找到您的电池的速率(charging/discharging 当前)charged/discharged(以便找到电池的剩余时间)以及电池的总容量来估计剩余时间。如果你有这两个参数,那么计算起来就很简单了。
time left is seconds = (capacity to be charged in mA * 60 * 60)/(charging current in mA).
WH 的情况类似。
我可以访问 UWP 的电池 API,并且可以显示与系统百分比相同的当前电池百分比。但是,我想知道windows如何计算充满电的时间?
我对电子学中的公式和计量单位知之甚少
我查找了不同的公式,但它们再次使用了我不理解的单位,我真的不明白电池 class 给我的是什么。
我的最大值 -> 64250 毫瓦时 率 -> 8516
所以 64250/8516 = ~7.544 大约 7.5 分钟,在这种情况下 Windows UI 是错误的?
Windows 报告剩余 5 分钟
下面是一些代码:
if (report.Status == BatteryStatus.Charging)
{
var report = sender.GetReport(); //<-- where sender is Type<Battery>
//(double)TryGetValue(report.FullChargeCapacityInMilliwattHours)
//(double)TryGetValue(report.ChargeRateInMilliwatts) <-- I don't understand how to use this with the max value of the battery to get the rate at which is is charging per Hr, Min, etc.
var rate = //Formula goes here
var remainingTime = DateTime.Now;
}
您必须找到您的电池的速率(charging/discharging 当前)charged/discharged(以便找到电池的剩余时间)以及电池的总容量来估计剩余时间。如果你有这两个参数,那么计算起来就很简单了。
time left is seconds = (capacity to be charged in mA * 60 * 60)/(charging current in mA).
WH 的情况类似。