Documentation:https://maxcode123.github.io/property-utils/
Source code:https://github.com/Maxcode123/property-utils
PyPI:https://pypi.org/project/property-utils/
Utilities for programming that involves physical properties
property-utils is a python library that aims at making programming with physical properties easier. It was created to be used by scientists and engineers with little programming experience.
What is provided by property-utils?
You can divide and multiply units to create new units. For example you can create velocity units by dividing length units with time units.
You can easily convert a property from one unit to another by calling a method.
You can add, subtract, divide and multiply properties to create new properties. For example, you can create a density property by dividing a mass property with a volume property.
pip install property-utils
A simple example:
importmathfromproperty_utils.propertiesimportpfromproperty_utils.unitsimport (
BTU,
FOOT,
RANKINE,
HOUR,
CENTI_METER,
METER,
KELVIN,
KILO_WATT,
)
tube_radius=p(12, CENTI_METER)
tube_length=p(2.3, METER)
heat_exchange_area=2*math.pi*tube_length*tube_radiusheat_transfer_coeff=p(150, BTU/RANKINE/FOOT**2/HOUR)
cold_in=p(273, KELVIN)
cold_out=p(300, KELVIN)
hot_in=p(520, KELVIN)
hot_out=p(472, KELVIN)
diff_in=hot_in-cold_indiff_out=hot_out-cold_outtemperature_diff= (diff_in-diff_out) /math.log((diff_in/diff_out).value)
print("Heat transfer coefficient =", heat_transfer_coeff)
print("Heat exchange area =", heat_exchange_area)
print("Temperature difference =", temperature_diff)
heat_duty=heat_transfer_coeff*heat_exchange_area*temperature_diffprint("\nHeat duty =", heat_duty)
print(" =", heat_duty.to_si())
print(" =", heat_duty.to_unit(KILO_WATT))Result:
Heat transfer coefficient = 150 Btu / (ft^2) / hr / °R
Heat exchange area = 1.7341591447815656 (m^2)
Temperature difference = 207.24308513672648 K
Heat duty = 1044588.4611345044 Btu / hr
= 306122.45180469507 J / s
= 306.12245180469506 kW