Skip to content

Commit 274523b

Browse files
committed
fix(volume_flow): add m3/s-m2 volume-flow unit
- Add new unit - Update tests
1 parent c319c29 commit 274523b

2 files changed

Lines changed: 51 additions & 7 deletions

File tree

ph_units/unit_types/volume_flow.py

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ class MeterCubedPerHour(Base_UnitType):
4949
class MeterCubedPerHourPerMeterSquared(Base_UnitType):
5050
"""M3/HR-M2"""
5151

52-
__symbol__ = "M3/HRM2"
52+
__symbol__ = "M3/HR-M2"
5353
__aliases__ = [
5454
"M3/HR-M2",
55+
"M3/H-M2",
5556
"M3/HRM2",
5657
"M3/HR-M^2",
5758
"M3/HRM^2",
@@ -60,7 +61,32 @@ class MeterCubedPerHourPerMeterSquared(Base_UnitType):
6061
"M3/M²H",
6162
"M³/M²H",
6263
]
63-
__factors__ = {"M3/HRM2": "{}*1", "CFM/FT2": "{}*0.054680665"}
64+
__factors__ = {
65+
"M3/S-M2": "{}/3600",
66+
"M3/HR-M2": "{}*1",
67+
"CFM/FT2": "{}*0.054680665",
68+
}
69+
70+
71+
class MeterCubedPerSecondPerMeterSquared(Base_UnitType):
72+
"""M3/S-M2"""
73+
74+
__symbol__ = "M3/S-M2"
75+
__aliases__ = [
76+
"M3/S-M2",
77+
"M3/SM2",
78+
"M3/S-M^2",
79+
"M3/SM^2",
80+
"M³/M²S",
81+
"M3/M2S",
82+
"M3/M²S",
83+
"M³/M²S",
84+
]
85+
__factors__ = {
86+
"M3/S-M2": "{}*1",
87+
"M3/HR-M2": "{}*3600",
88+
"CFM/FT2": "{}*196.8504",
89+
}
6490

6591

6692
# -- IP
@@ -98,5 +124,15 @@ class FootCubedPerMinutePerFootSqaure(Base_UnitType):
98124
"""CFM/FT2"""
99125

100126
__symbol__ = "CFM/FT2"
101-
__aliases__ = ["CFM/SF", "CFM/FT²", "CFM/SQFT", "CFM/SQFT"]
102-
__factors__ = {"CFM/FT2": "{}*1", "M3/HRM2": "{}*18.288"}
127+
__aliases__ = [
128+
"CFM/SF",
129+
"CFM/FT²",
130+
"CFM/SQFT",
131+
"CFM/SQFT",
132+
"FT3/M-FT2",
133+
]
134+
__factors__ = {
135+
"M3/S-M2": "({}*18.288)/3600",
136+
"M3/HR-M2": "{}*18.288",
137+
"CFM/FT2": "{}*1",
138+
}

tests/test_volume_flow.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,15 @@ def test_M3_per_hour():
3232

3333

3434
def test_M3_per_hour_per_square_meter():
35-
assert convert(72, "M3/HRM2", "M3/HRM2") == 72
36-
assert convert(72, "M3/HRM2", "CFM/FT2") == pytest.approx(3.937007874)
35+
assert convert(72, "M3/HR-M2", "M3/HR-M2") == 72
36+
assert convert(43_200, "M3/HR-M2", "M3/S-M2") == 12
37+
assert convert(72, "M3/HR-M2", "CFM/FT2") == pytest.approx(3.937007874)
38+
39+
40+
def test_M3_per_second_per_square_meter():
41+
assert convert(212.5, "M3/S-M2", "M3/HR-M2") == 765_000
42+
assert convert(43200, "M3/S-M2", "M3/S-M2") == 43200
43+
assert convert(72, "M3/S-M2", "CFM/FT2") == pytest.approx(14_173.228368)
3744

3845

3946
def test_FT3_per_minute():
@@ -54,4 +61,5 @@ def test_FT3_per_hour():
5461

5562
def test_FT3_per_minute_per_FT2():
5663
assert convert(72, "CFM/FT2", "CFM/FT2") == 72
57-
assert convert(72, "CFM/FT2", "M3/HRM2") == pytest.approx(1_316.736)
64+
assert convert(500, "CFM/FT2", "M3/S-M2") == pytest.approx(2.54)
65+
assert convert(72, "CFM/FT2", "M3/HR-M2") == pytest.approx(1_316.736)

0 commit comments

Comments
 (0)