Como calcular tensão através do resistor em Python usando UliEngineering

Você pode calcular facilmente a queda de tensão através de um resistor usando a lei de Ohm com 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.
Ω
A
voltage_across_resistor.py
from UliEngineering.Electronics.Resistors import *
from UliEngineering.EngineerIO import *

# Calcular tensão através de resistor de 1kΩ a 5mA
voltage = voltage_across_resistor("1k", "5mA")
print(f"Voltage across 1kΩ at 5mA: {format_value(voltage, 'V')}")

# Calcular tensão através de resistor de 100Ω a 33mA
voltage = voltage_across_resistor("100Ω", "33mA")
print(f"Voltage across 100Ω at 33mA: {format_value(voltage, 'V')}")

Exemplo de saída

voltage_across_resistor_output.txt
Voltage across 1kΩ at 5mA: 5.00 V
Voltage across 100Ω at 33mA: 3.30 V

A tensão é calculada usando a lei de Ohm: $V = I \times R$

Posts relacionados


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