/** * Calculate the number of hours to discharge the battery till the minimum SoC (20%), based on the * current consumption (or maximum discharging rate) * * @param ts evaluation time */ public final double basedOnCurrentCons(final long ts) { double autonomyHrs = 0; if (currentConsumption > 0 && currentSoCPercent > bat.getMinSoC()) { // limit the discharging rate to the maximum rate double power = currentConsumption; if (power > bat.getMaxDischargingRate()) { power = bat.getDischargingEfficiency(); } double toDischarge = getCurrentSoCKWh() - (bat.getMinSoC() * (bat.getCapacityKWh() * 1000.) / 100); autonomyHrs = toDischarge / power; } if (autonomyHrs >= 0) { return autonomyHrs; } return 0; }
/** Dump the report to a Printer. */ public void dump(Printer pw, String prefix) { pw.println(prefix + "type: " + type); pw.println(prefix + "packageName: " + packageName); pw.println(prefix + "installerPackageName: " + installerPackageName); pw.println(prefix + "processName: " + processName); pw.println(prefix + "time: " + time); pw.println(prefix + "systemApp: " + systemApp); switch (type) { case TYPE_CRASH: crashInfo.dump(pw, prefix); break; case TYPE_ANR: anrInfo.dump(pw, prefix); break; case TYPE_BATTERY: batteryInfo.dump(pw, prefix); break; } }
public void writeToParcel(Parcel dest, int flags) { dest.writeInt(type); dest.writeString(packageName); dest.writeString(installerPackageName); dest.writeString(processName); dest.writeLong(time); dest.writeInt(systemApp ? 1 : 0); switch (type) { case TYPE_CRASH: crashInfo.writeToParcel(dest, flags); break; case TYPE_ANR: anrInfo.writeToParcel(dest, flags); break; case TYPE_BATTERY: batteryInfo.writeToParcel(dest, flags); break; case TYPE_RUNNING_SERVICE: runningServiceInfo.writeToParcel(dest, flags); break; } }
private double getCurrentSoCKWh() { return currentSoCPercent * bat.getCapacityKWh() / 100.; }