-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunits2.py
More file actions
28 lines (18 loc) · 719 Bytes
/
units2.py
File metadata and controls
28 lines (18 loc) · 719 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Einfaches Skript zur Umrechnung von Einheiten.
Um die benötigte Bibliothek "pint" [1] zu installieren, bitte das folgende
Kommando ausführen:
pip install pint
[1] https://pint.readthedocs.io/en/latest/
"""
import pint
einheiten = pint.UnitRegistry()
Q_ = einheiten.Quantity
volumen = 0.5 * einheiten.liter
dichte = 1 * einheiten.kilogram / (einheiten.decimeter ** 3)
raumtemperatur = Q_(21.0, einheiten.degC)
endtemperatur = Q_(373.14, einheiten.kelvin)
wärmekapazität = 4.181 * einheiten.kilojoule / (einheiten.kilogram * einheiten.kelvin)
zeit = 10 * einheiten.seconds
leistung = (wärmekapazität * volumen * dichte * (endtemperatur - raumtemperatur)) / zeit
print(leistung.to(einheiten.watt))