diff --git a/fluids/pump.py b/fluids/pump.py index 530c94d7..9ce1f28a 100644 --- a/fluids/pump.py +++ b/fluids/pump.py @@ -375,6 +375,10 @@ def CSA_motor_efficiency(P: float, closed: bool=False, poles: int=2, high_effici Several low-efficiency standard high power values were added to allow for easy programming; values are the last listed efficiency in the table. + The high-efficiency standard covers 2, 4, and 6 pole motors only; the + minimum efficiency standard additionally covers 8 pole motors. A + ValueError is raised for unsupported pole counts. + Examples -------- >>> CSA_motor_efficiency(100*hp) @@ -388,6 +392,11 @@ def CSA_motor_efficiency(P: float, closed: bool=False, poles: int=2, high_effici 375 kW). As modified 2015-12-17. https://natural-resources.canada.ca/energy-efficiency/energy-efficiency-regulations/electric-motors-1-500-hp0746-375-kw """ + if high_efficiency: + if poles not in (2, 4, 6): + raise ValueError("Only 2, 4, and 6 pole motors have high-efficiency standard values") + elif poles not in (2, 4, 6, 8): + raise ValueError("Only 2, 4, 6, and 8 pole motors have standard efficiency values") P = P/hp # This could be replaced by a dict and a jump list if high_efficiency: diff --git a/tests/test_pump.py b/tests/test_pump.py index cac96029..7583fa18 100644 --- a/tests/test_pump.py +++ b/tests/test_pump.py @@ -92,6 +92,11 @@ def test_CSA_motor_efficiency(): nema_min_Ps = [0.755, 0.825, 0.84, 0.855, 0.855, 0.875, 0.875, 0.885, 0.895, 0.902, 0.902, 0.91, 0.91, 0.917, 0.924, 0.93, 0.93, 0.936, 0.945, 0.945, 0.95, 0.95, 0.954, 0.954, 0.954, 0.954, 0.954, 0.954, 0.825, 0.84, 0.84, 0.875, 0.875, 0.875, 0.875, 0.895, 0.895, 0.91, 0.91, 0.924, 0.924, 0.93, 0.93, 0.936, 0.941, 0.945, 0.945, 0.95, 0.95, 0.95, 0.95, 0.954, 0.954, 0.954, 0.954, 0.958, 0.8, 0.855, 0.865, 0.875, 0.875, 0.875, 0.875, 0.895, 0.895, 0.902, 0.902, 0.917, 0.917, 0.93, 0.93, 0.936, 0.936, 0.941, 0.941, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.95, 0.74, 0.77, 0.825, 0.84, 0.84, 0.855, 0.855, 0.855, 0.885, 0.885, 0.895, 0.895, 0.91, 0.91, 0.917, 0.917, 0.93, 0.93, 0.936, 0.936, 0.941, 0.941, 0.945, 0.945, 0.945, 0.945, 0.945, 0.945, 0.755, 0.825, 0.84, 0.84, 0.84, 0.855, 0.855, 0.875, 0.885, 0.895, 0.902, 0.91, 0.91, 0.917, 0.924, 0.93, 0.93, 0.93, 0.936, 0.936, 0.945, 0.945, 0.945, 0.95, 0.95, 0.954, 0.958, 0.958, 0.825, 0.84, 0.84, 0.865, 0.865, 0.875, 0.875, 0.885, 0.895, 0.91, 0.91, 0.917, 0.924, 0.93, 0.93, 0.936, 0.941, 0.941, 0.945, 0.95, 0.95, 0.95, 0.954, 0.954, 0.954, 0.954, 0.958, 0.958, 0.8, 0.84, 0.855, 0.865, 0.865, 0.875, 0.875, 0.885, 0.902, 0.902, 0.91, 0.917, 0.924, 0.93, 0.93, 0.936, 0.936, 0.941, 0.941, 0.945, 0.945, 0.945, 0.954, 0.954, 0.954, 0.954, 0.954, 0.954, 0.74, 0.755, 0.855, 0.865, 0.865, 0.875, 0.875, 0.885, 0.895, 0.895, 0.902, 0.902, 0.91, 0.91, 0.917, 0.924, 0.936, 0.936, 0.936, 0.936, 0.936, 0.936, 0.945, 0.945, 0.945, 0.945, 0.945, 0.945] assert_close1d(nema_min_P_calcs, nema_min_Ps) + with pytest.raises(Exception): + CSA_motor_efficiency(100*hp, poles=8, high_efficiency=True) + with pytest.raises(Exception): + CSA_motor_efficiency(100*hp, poles=3) + def test_motor_efficiency_underloaded(): full_efficiencies = [motor_efficiency_underloaded(P*hp, .99) for P in (0.5, 2.5, 7, 12, 42, 90)] assert_close1d(full_efficiencies, [1, 1, 1, 1, 1, 1])