Como calcular potência a partir de corrente e tensão em Python usando UliEngineering

Você pode calcular facilmente potência elétrica a partir de corrente e tensão usando a biblioteca Python UliEngineering:

TechOverflow calculators:
You can enter values with SI suffixes like 12.2m (equivalent to 0.012) or 14k (14000) or 32u (0.000032).
The results are calculated while you type and shown directly below the calculator, so there is no need to press return or click on a Calculate button.
V
A
power_by_current_and_voltage.py
from UliEngineering.Electronics.Power import *
from UliEngineering.EngineerIO import *

# Calcular potência para 5V a 1A
power = power_by_current_and_voltage("5V", "1A")
print(f"Power for 5V at 1A: {format_value(power, 'W')}")

# Calcular potência para 12V a 0.5A
power = power_by_current_and_voltage("12V", "0.5A")
print(f"Power for 12V at 0.5A: {format_value(power, 'W')}")

Exemplo de saída

power_by_current_and_voltage_output.txt
Power for 5V at 1A: 5.00 W
Power for 12V at 0.5A: 6.00 W

A potência é calculada usando a fórmula: $P = V \times I$

Posts relacionados


Check out similar posts by category: Calculators, Electronics, Python