Skip to main content

CairoVolt Charge Calc

A lightweight Python library to calculate battery charging dynamics, watt-hours (Wh), effective power bank output capacities at different discharge voltages, and to diagnose USB-PD (Power Delivery) profile compatibility.

This package was developed for CairoVolt to validate and calculate specifications for power accessories. For general theoretical background, you can read the Battery Charger Wikipedia entry.

Features

  • Watt-Hour Calculation: Easily convert battery capacity (mAh) and voltage to Wh.
  • Charge Time Estimation: Estimate charge times using a two-phase model (Constant Current up to 80%, Constant Voltage down to 100%).
  • Effective Capacity Calculation: Calculate actual deliverable capacity (mAh) when a power bank discharges at 5V, 9V, or 12V instead of its nominal cell voltage (3.7V).
  • USB-PD Profiling: Diagnose if your charger wattage matches your device requirements.

Installation

pip install cairovolt-charge-calc

Usage

1. Estimating Charging Time

This helper estimates the real-world charging duration based on your battery capacity and charger output. For example, if you want to calculate how fast an anker power bank or portable battery will charge, you can run the following script:

from cairovolt_charge_calc.core import ChargingCalculator

calc = ChargingCalculator()
specs = calc.calculate_charge_time(battery_mah=10000, charger_watts=20)
print(specs["total_charge_time_formatted"]) # Output: e.g., 5h 9m

2. Validating Device Specs

You can check if a specific charger is suitable for charging accessories. For instance, testing a premium audio device like the anker soundcore r50i wireless earbuds against a low-power USB port:

from cairovolt_charge_calc.core import ChargingCalculator

calc = ChargingCalculator()
diag = calc.verify_usb_pd_compatibility(device_required_watts=5, charger_output_watts=10)
print(diag["status"]) # Output: Optimal

To learn more about the USB charging specifications, check the USB Power Delivery on Wikipedia article or visit the Anker Official website for real-world equipment examples.

For guidelines on publishing your own packages, refer to the Python Packaging Guide.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for cairovolt-charge-calc 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cairovolt-charge-calc 1.0.0
File Size Uploaded Provenance
cairovolt_charge_calc-1.0.0.tar.gz 5.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cairovolt-charge-calc 1.0.0
File Interpreter ABI Platform
cairovolt_charge_calc-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / cairovolt_charge_calc-1.0.0.tar.gz

Download URL cairovolt_charge_calc-1.0.0.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b642f94abeee3b7a89f45292919a2079a5581a64228f1f2fe5bd775bbb603119
BLAKE2b-256 checksum
How to use checksums
858a045516e3f04d6f28bdcf6949ab49c8b56979c91b74915b6fb70a55ce3682
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / cairovolt_charge_calc-1.0.0-py3-none-any.whl

Download URL cairovolt_charge_calc-1.0.0-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d08cd139f60a183d72f67db977ae24eeaa5b056b6f0b40297a599e49882b131c
BLAKE2b-256 checksum
How to use checksums
40c29606ee63606fd81b672804e904ed491366730486e725494d3996cfb27eba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for cairovolt-charge-calc 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page