AI-generated worked example, checked by executing the JavaScript. Charger allocations below are fictional.
A charger can advertise 100 W in total while allocating 65 W to a laptop port in one configuration and 45 W in another. A hardware comparison should keep the allocation for each documented port combination. A laptop that needs 60 W under sustained use can pass the first calculation and fail the second even though the charger and cable stay the same.
Keep one row per documented port state
For this example, assume the same 20 V profile is documented for both known states, the cable is rated at 5 A, and the laptop accepts up to 65 W. The third combination has no published allocation. Leave that entry unknown. Do not borrow a wattage from a different port combination.
const cableWatts = 20 * 5; const deviceWatts = 65; const neededWatts = 60; const states = [ { ports: 'Laptop only', portWatts: 65 }, { ports: 'Laptop plus phone', portWatts: 45 }, { ports: 'Laptop plus two accessories', portWatts: null }, ]; const results = states.map(({ ports, portWatts }) => { if (portWatts === null) return { ports, ceiling: null, result: 'unknown' }; const ceiling = Math.min(portWatts, cableWatts, deviceWatts); const result = ceiling >= neededWatts ? 'within budget' : 'below target'; return { ports, ceiling, result }; }); console.table(results); The output is 65 W, 45 W, and unknown. “Within budget” means the stated limits leave enough arithmetic headroom. It says nothing about whether the devices will negotiate that profile in practice. Check that the voltage and the specific port combination are documented before comparing the rows. If the voltage changes with the port state, use the documented voltage for each state as well.
Once you have a documented allocation, TIHMLO’s USB-C power-budget worksheet checks that single charger, cable, and device path. Keep the table of simultaneous ports in your comparison so a reader can reproduce your input.

