Skip to content

Commit 23a383c

Browse files
committed
more units
1 parent 7e55a9d commit 23a383c

File tree

2 files changed

+194
-85
lines changed

2 files changed

+194
-85
lines changed

quantities/units/power.py

Lines changed: 55 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,63 @@
33

44
from quantities.units.unitquantity import UnitQuantity
55
from quantities.units.energy import Btu, J
6-
from quantities.units.time import s, h
6+
from quantities.units.time import s, h, min
77
from quantities.units.electromagnetism import A, V
8+
from quantities.units.length import ft
9+
from quantities.units.force import lbf
810

911

10-
W = watt = watts = \
11-
UnitQuantity('W', J/s)
12-
mW = milliwatt = milliwatts = \
13-
UnitQuantity('mW', W/1000)
14-
kW = kilowatt = kilowatts = \
15-
UnitQuantity('kW', 1000*W)
16-
MW = megawatt = megawatts = \
17-
UnitQuantity('MW', 1000*kW)
18-
VA = voltampere = voltamperes = \
19-
UnitQuantity('VA', 1000*kW)
20-
boiler_horsepower = boiler_horsepowers = \
21-
UnitQuantity('boiler_horsepower', 9.80950e3*W)
22-
hp = horsepower = horsepowers = \
23-
UnitQuantity('hp', 7.456999e2*W)
24-
metric_horsepower = metric_horsepowers = \
25-
UnitQuantity('metric_horsepower', 7.35499*W)
26-
electric_horsepower = electric_horsepowers = \
27-
UnitQuantity('electric_horsepower', 7.460000e2*W)
28-
water_horsepower = water_horsepowers = \
29-
UnitQuantity('water_horsepower', 7.46043e2*W)
30-
UK_horsepower = UK_horsepowers = \
31-
UnitQuantity('UK_horsepower', 7.4570e2*W)
32-
refrigeration_ton = refrigeration_tons = ton_of_refrigeration = \
33-
UnitQuantity('refrigeration_ton', 12000*Btu/h)
12+
W = watt = volt_ampere = UnitQuantity(
13+
'watt',
14+
J/s,
15+
symbol='W',
16+
aliases=['watts', 'volt_ampere', 'volt_amperes', 'VA']
17+
)
18+
mW = milliwatt = UnitQuantity(
19+
'milliwatt',
20+
W/1000,
21+
symbol='mW',
22+
aliases=['milliwatts']
23+
)
24+
kW = kilowatt = UnitQuantity(
25+
'kilowatt',
26+
1000*W,
27+
symbol='kW',
28+
aliases=['kilowatts']
29+
)
30+
MW = megawatt = UnitQuantity(
31+
'megawatt',
32+
1000*kW,
33+
symbol='mW',
34+
aliases=['megawatts']
35+
)
36+
hp = horsepower = UK_horsepower = British_horsepower = UnitQuantity(
37+
'horsepower',
38+
33000*ft*lbf/min,
39+
symbol='hp',
40+
aliases=['UK_horsepower', 'British_horsepower']
41+
)
42+
boiler_horsepower = UnitQuantity(
43+
'boiler_horsepower',
44+
33475*Btu/h
45+
)
46+
metric_horsepower = UnitQuantity(
47+
'metric_horsepower',
48+
0.73549875*kW
49+
) # exact
50+
electric_horsepower = UnitQuantity(
51+
'electric_horsepower',
52+
746*W
53+
)
54+
water_horsepower = UnitQuantity(
55+
'water_horsepower',
56+
746.043*W
57+
) # exact
58+
59+
refrigeration_ton = ton_of_refrigeration = UnitQuantity(
60+
'refrigeration_ton',
61+
12000*Btu/h,
62+
aliases=['ton_of_refrigeration']
63+
)
3464

3565
del UnitQuantity, Btu, J, s, h, A, V

quantities/units/pressure.py

Lines changed: 139 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,149 @@
33

44
from quantities.units.unitquantity import UnitQuantity
55
from quantities.units.acceleration import gravity
6-
from quantities.units.mass import kg, pound
6+
from quantities.units.mass import g, kg, pound
77
from quantities.units.length import m, mm, cm, inch, ft
88
from quantities.units.force import N, kip
99

1010

11-
Hg = hg = mercury = conventional_mercury = \
12-
UnitQuantity('Hg', gravity*13595.10*kg/m**3)
13-
mercury_0C = mercury_32F = \
14-
UnitQuantity('mercury_0C', gravity*13595.1*kg/m**3)
15-
mercury_60F = \
16-
UnitQuantity('mercury_60F', gravity*13556.8*kg/m**3)
17-
H2O = h2o = water = conventional_water = \
18-
UnitQuantity('H2O', gravity*1000*kg/m**3)
19-
water_4C = water_39F = \
20-
UnitQuantity('water_4C', gravity*999.972*kg/m**3)
21-
water_60F = \
22-
UnitQuantity('water_60F', gravity*999.001*kg/m**3)
11+
Hg = mercury = conventional_mercury = UnitQuantity(
12+
'conventional_mercury',
13+
gravity*13.59510*g/cm**3
14+
)
15+
mercury_60F = UnitQuantity('mercury_60F', gravity*13556.8*kg/m**3)
16+
H2O = h2o = water = conventional_water = UnitQuantity('H2O', gravity*1000*kg/m**3)
17+
water_4C = water_39F = UnitQuantity('water_4C', gravity*999.972*kg/m**3)
18+
water_60F = UnitQuantity('water_60F', gravity*999.001*kg/m**3)
2319

24-
Pa = pascal = \
25-
UnitQuantity('Pa', N/m**2)
26-
kPa = kilopascal = kilopascals = \
27-
UnitQuantity('kPa', 1000*Pa)
28-
MPa = megapascal = megapascals = \
29-
UnitQuantity('MPa', 1000*kPa)
30-
GPa = gigapascal = gigapascals = \
31-
UnitQuantity('GPa', 1000*MPa)
32-
bar = bars = UnitQuantity('bar', 1e5*pascal)
33-
kbar = kilobar = kilobars = \
34-
UnitQuantity('kbar', 1000*bar)
35-
Mbar = kilobar = kilobars = \
36-
UnitQuantity('Mbar', 1000*kbar)
37-
Gbar = gigabar = gigabars = \
38-
UnitQuantity('Gbar', 1000*Mbar)
39-
atm = atmosphere = atmospheres = standard_atmosphere =standard_atmospheres = \
40-
UnitQuantity('atm', 1.01325e5*pascal)
41-
at = technical_atmosphere = technical_atmospheres = \
42-
UnitQuantity('at', kg*gravity/cm**2)
43-
inch_H2O_39F = \
44-
UnitQuantity('inch_H2O_39F', inch*water_39F)
45-
inch_H2O_60F = \
46-
UnitQuantity('inch_H2O_60F', inch*water_60F)
47-
inch_Hg_32F = \
48-
UnitQuantity('inch_Hg_32F', inch*mercury_32F)
49-
inch_Hg_60F = \
50-
UnitQuantity('inch_Hg_60F', inch*mercury_60F)
51-
millimeter_Hg_0C = \
52-
UnitQuantity('millimeter_Hg_0C', mm*mercury_0C)
53-
footH2O = \
54-
UnitQuantity('footH2O', ft*water)
55-
cmHg = \
56-
UnitQuantity('cmHg', cm*Hg)
57-
cmH2O = \
58-
UnitQuantity('cmH2O', cm*water)
59-
inHg = in_Hg = inch_Hg = \
60-
UnitQuantity('inHg', inch*Hg)
61-
torr = torrs = mmHg = mm_Hg = millimeter_Hg = \
62-
UnitQuantity('torr', mm*Hg)
63-
foot_H2O = ftH2O = \
64-
UnitQuantity('foot_H2O', ft*water)
65-
psi = \
66-
UnitQuantity('psi', pound*gravity/inch**2)
67-
ksi = \
68-
UnitQuantity('ksi', kip/inch**2)
69-
barie = baries = barye = baryes = \
70-
UnitQuantity('barie', 0.1*N/m**2)
20+
Pa = pascal = UnitQuantity(
21+
'pascal',
22+
N/m**2,
23+
symbol='Pa',
24+
aliases=['pascals']
25+
)
26+
kPa = kilopascal = UnitQuantity(
27+
'kilopascal',
28+
1000*Pa,
29+
symbol='kPa',
30+
aliases=['kilopascals']
31+
)
32+
MPa = megapascal = UnitQuantity(
33+
'megapascal',
34+
1000*kPa,
35+
symbol='MPa',
36+
aliases=['megapascals']
37+
)
38+
GPa = gigapascal = UnitQuantity(
39+
'gigapascal',
40+
1000*MPa,
41+
symbol='GPa',
42+
aliases=['gigapascals']
43+
)
44+
bar = UnitQuantity(
45+
'bar',
46+
100000*pascal,
47+
aliases=['bars']
48+
)
49+
kbar = kilobar = UnitQuantity(
50+
'kilobar',
51+
1000*bar,
52+
symbol='kbar',
53+
aliases=['kilobars']
54+
)
55+
Mbar = kilobar = UnitQuantity(
56+
'megabar',
57+
1000*kbar,
58+
symbol='Mbar',
59+
aliases=['megabars']
60+
)
61+
Gbar = gigabar = UnitQuantity(
62+
'gigabar',
63+
1000*Mbar,
64+
symbol='Gbar',
65+
aliases=['Gbar']
66+
)
67+
atm = atmosphere = standard_atmosphere = UnitQuantity(
68+
'standard_atmosphere',
69+
101325*pascal,
70+
symbol='atm',
71+
aliases=['atmosphere', 'atmospheres', 'standard_atmospheres']
72+
)
73+
at = technical_atmosphere = UnitQuantity(
74+
'technical_atmosphere',
75+
kg*gravity/cm**2,
76+
symbol='at',
77+
aliases=['technical_atmospheres']
78+
)
79+
torr = UnitQuantity(
80+
'torr',
81+
atm/760
82+
)
83+
psi = pound_force_per_square_inch = UnitQuantity(
84+
'pound_force_per_square_inch',
85+
pound*gravity/inch**2,
86+
symbol='psi'
87+
)
88+
ksi = kip_per_square_inch = UnitQuantity(
89+
'kip_per_square_inch',
90+
kip/inch**2,
91+
symbol='ksi'
92+
)
93+
barye = barie = barad = barad = barrie = baryd = UnitQuantity(
94+
'barye',
95+
0.1*N/m**2,
96+
symbol='Ba',
97+
aliases=[
98+
'barie', 'baries', 'baryes', 'barad', 'barad', 'barrie', 'baryd',
99+
'baryed'
100+
]
101+
)
102+
103+
mmHg = mm_Hg = millimeter_Hg = millimeter_Hg_0C = UnitQuantity(
104+
'millimeter_Hg',
105+
mm*mercury,
106+
symbol='mmHg',
107+
aliases=['mmHg', 'millimeter_Hg'],
108+
note='''
109+
"the pressure exerted at the base of a column of fluid exactly 1 mm high,
110+
when the density of the fluid is exactly 13.5951 g/cm^3, at a place where
111+
the acceleration of gravity is exactly 9.80665 m/s^2"
112+
http://en.wikipedia.org/wiki/Conventional_millimeter_of_mercury'''
113+
)
114+
cmHg = cm_Hg = centimeter_Hg = UnitQuantity(
115+
'cmHg',
116+
cm*Hg,
117+
aliases=['cm_Hg', 'centimeter_Hg']
118+
)
119+
inHg = in_Hg = inch_Hg = inch_Hg_32F = UnitQuantity(
120+
'inHg',
121+
inch*Hg,
122+
aliases=['in_Hg', 'inch_Hg', 'inch_Hg_32F']
123+
)
124+
inch_Hg_60F = UnitQuantity(
125+
'inch_Hg_60F',
126+
inch*mercury_60F
127+
)
128+
129+
inch_H2O_39F = UnitQuantity(
130+
'inch_H2O_39F',
131+
inch*water_39F
132+
)
133+
inch_H2O_60F = UnitQuantity(
134+
'inch_H2O_60F',
135+
inch*water_60F
136+
)
137+
footH2O = UnitQuantity(
138+
'footH2O',
139+
ft*water
140+
)
141+
cmH2O = UnitQuantity(
142+
'cmH2O',
143+
cm*water
144+
)
145+
foot_H2O = ftH2O = UnitQuantity(
146+
'foot_H2O',
147+
ft*water,
148+
aliases=['ftH2O']
149+
)
71150

72151
del UnitQuantity, gravity, kg, pound, m, mm, cm, inch, ft, N, kip

0 commit comments

Comments
 (0)