Jak vypočítat hodnotu rezistoru z napětí a proudu v Pythonu pomocí UliEngineering

Můžete snadno vypočítat hodnotu rezistoru vzhledem k napětí a proudu pomocí Ohmova zákona s knihovnou UliEngineering v Pythonu:

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 *

# Výpočet hodnoty rezistoru pro 5V při 5mA
resistor = resistor_by_voltage_and_current("5V", "5mA")
print(f"Resistor for 5V at 5mA: {format_value(resistor, 'Ω')}")

# Výpočet hodnoty rezistoru pro 3.3V při 33mA
resistor = resistor_by_voltage_and_current("3.3V", "33mA")
print(f"Resistor for 3.3V at 33mA: {format_value(resistor, 'Ω')}")

Příklad výstupu

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

Hodnota rezistoru se počítá pomocí Ohmova zákona: $R = \frac{V}{I}$

Související příspěvky


Podívejte se na podobné články podle kategorie: Calculators, Electronics, Python