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

Můžete snadno vypočítat požadovanou hodnotu rezistoru vzhledem k napětí a rozptylovanému výkonu pomocí knihovny 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
W
resistor_value_by_voltage_and_power.py
from UliEngineering.Electronics.Resistors import *
from UliEngineering.EngineerIO import *

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

# Výpočet rezistoru pro 12V při 0.5W
resistor = resistor_value_by_voltage_and_power("12V", "0.5W")
print(f"Resistor for 12V at 0.5W: {format_value(resistor, 'Ω')}")

Příklad výstupu

resistor_value_by_voltage_and_power_output.txt
Resistor for 5V at 1W: 25.0 Ω
Resistor for 12V at 0.5W: 288 Ω

Hodnota rezistoru se počítá pomocí vzorce: $R = \frac{V^2}{P}$

Související příspěvky


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