如何使用 UliEngineering 在 Python 中查找下一个更大的标准电阻值

你可以使用 UliEngineering Python 库轻松查找下一个更大的标准电阻值:

next_higher_resistor.py
from UliEngineering.Electronics.Resistors import *
from UliEngineering.EngineerIO import *

# 查找 1.5k 的下一个更大的 E96 电阻值
resistor = next_higher_resistor("1.5k")
print(f"Next higher than 1.5k: {format_value(resistor, 'Ω')}")

# 查找 100Ω 的下一个更大的 E24 电阻值
resistor = next_higher_resistor("100Ω", sequence=e24)
print(f"Next higher than 100Ω (E24): {format_value(resistor, 'Ω')}")

示例输出

next_higher_resistor_output.txt
Next higher than 1.5k: 1.58 kΩ
Next higher than 100Ω (E24): 110 Ω

next_higher_resistor() 函数从指定的 E 系列中查找下一个更大的标准电阻值(默认为 E96)。


Check out similar posts by category: Electronics, Python