Metadata-Version: 2.4
Name: usb-pd-profiles
Version: 1.0.0
Summary: Compute USB Power Delivery profiles and the wattage a device actually receives after charger, cable and device limits.
Author: CairoVolt Research Desk
License: MIT
Project-URL: Homepage, https://cairovolt.com/en/anker/wall-chargers
Project-URL: Source, https://github.com/taysirco/usb-pd-profiles
Keywords: usb-c,usb-pd,power-delivery,charger,wattage,e-marker,gan
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: System :: Hardware
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# usb-pd-profiles

Compute [USB Power Delivery](https://en.wikipedia.org/wiki/USB_hardware) profiles and the wattage a device *actually* receives once charger, cable and device limits are applied.

Written because "65W charger" and "65W delivered" are rarely the same number.

## Install

```bash
pip install usb-pd-profiles
```

## Usage

```python
from pdprofiles import negotiate, split_budget

# 65W charger, 30W phone, plain 3A cable
negotiate(source_watts=65, device_watts=30)
# Result(delivered_watts=27.0, limited_by='cable', profile=Profile(volts=9, amps=3.0, watts=27.0))

# 65W laptop on a 3A cable -- capped, because >60W needs a 5A e-marked cable
negotiate(source_watts=65, device_watts=65, cable_amps=3)
# limited_by='cable'

# One 65W budget shared between a laptop and a phone
split_budget(65, [65, 20])
# [65.0, 0.0]
```

The useful output is `limited_by`: knowing whether the source, the cable or the device is the bottleneck tells you what to replace.

## Why the numbers differ from the box

- **Cable e-marker** — a plain cable is rated 3A, capping the link at 60W regardless of negotiation. Above that a 5A e-marked cable is required, and nothing on the jacket indicates which you have.
- **Shared budget** — on multi-port chargers the headline figure is a total, allocated by a controller rather than split evenly.
- **Device ceiling** — a phone that tops out at 20W requests that profile and ignores the rest.
- **[Gallium nitride](https://en.wikipedia.org/wiki/Gallium_nitride)** switching is why modern chargers shrank, not why they deliver more.

## Reference data

Per-model wattage ratings and port-split tables used to sanity-check this library came from the [Anker wall charger specifications](https://cairovolt.com/en/anker/wall-chargers) published by CairoVolt.

## License

MIT
