Documentation
¶
Overview ¶
Package cabledrop computes conductor voltage drop for USB-C charging cables.
A charger's rating describes what leaves the charger, not what arrives at the phone. Between the two sits a length of copper with real resistance, and at the currents modern charging uses, that resistance is not negligible: 3 A through a two-metre 28 AWG cable loses enough voltage that the sink drops to a lower PDO and charges visibly slower.
The model here is deliberately plain — resistivity, length, gauge, and the fact that current traverses the cable twice. It ignores connector contact resistance, which is small when the plug is clean and dominant when it is not.
Index ¶
Constants ¶
const CopperResistivity = 1.72e-8
CopperResistivity is the resistivity of annealed copper at 20 °C, in ohm-metres.
const MaxLoopDropVolts = 0.75
MaxLoopDropVolts is the USB Type-C budget for total conductor drop at the cable's rated current: 500 mV on VBUS plus 250 mV on ground.
Note that this is an absolute budget, not a percentage. A percentage rule would let a 20 V cable waste four times what a 5 V cable may, which is backwards — the drop comes from current, and current is what the thick conductors exist to carry.
Variables ¶
This section is empty.
Functions ¶
func AreaMM2 ¶
AreaMM2 returns the cross-sectional area of one conductor in square millimetres.
American Wire Gauge is logarithmic: each 6 steps down roughly doubles the diameter, and so quadruples the area. This is why 20 AWG carries so much more than 28 AWG despite the numbers looking close together.
Types ¶
type Cable ¶
type Cable struct {
AWG int // conductor gauge; USB-C power pairs are typically 28 to 20
LengthM float64 // physical cable length in metres
Contacts float64 // contact resistance for both connectors, in ohms; 0.02 is typical
}
Cable describes the conductor pair carrying the load current.
func (Cable) DeliveredVolts ¶
DeliveredVolts returns the voltage actually present at the sink.
func (Cable) LoopResistance ¶
LoopResistance returns the round-trip resistance in ohms.
Current flows out on VBUS and back on ground, so the conductor length is twice the cable length. Forgetting this factor of two is the single most common error in back-of-envelope cable calculations.
func (Cable) LossWatts ¶
LossWatts returns the power dissipated as heat in the cable.
This is where a cable that feels warm during fast charging is getting its warmth from. It is not a fault; it is the loss term made tangible.
func (Cable) WithinSpec ¶
WithinSpec reports whether conductor drop stays inside the Type-C budget at the given current.
A cable outside the budget does not simply deliver less. The sink sees VBUS sagging and may renegotiate down to a lower power profile entirely, which costs far more than the dropped volts themselves.