Как вычислить сопротивление резистора по напряжению и току на Python с помощью UliEngineering

Можно легко вычислить сопротивление резистора по заданным напряжению и току, используя закон Ома, с помощью библиотеки 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
resistor_by_voltage_and_current.py
from UliEngineering.Electronics.Resistors import *
from UliEngineering.EngineerIO import *

# Вычислить сопротивление резистора для 5 В при 5 мА
resistor = resistor_by_voltage_and_current("5V", "5mA")
print(f"Resistor for 5V at 5mA: {format_value(resistor, 'Ω')}")

# Вычислить сопротивление резистора для 3.3 В при 33 мА
resistor = resistor_by_voltage_and_current("3.3V", "33mA")
print(f"Resistor for 3.3V at 33mA: {format_value(resistor, 'Ω')}")

Пример вывода

resistor_by_voltage_and_current_output.txt
Resistor for 5V at 5mA: 1.00 kΩ
Resistor for 3.3V at 33mA: 100 Ω

Сопротивление резистора вычисляется по закону Ома: $R = \frac{V}{I}$

Связанные записи


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