def check_standard_compliance(standard, **kwargs): params = dict() params["standard"] = standard for key, value in kwargs.items(): params[key] = value if params["standard"] == "utci": for key, value in params.items(): if key == "v" and (value > 17 or value < 0.5): warnings.warn( "UTCI wind speed applicability limits between 0.5 and 17 m/s", UserWarning, ) if params["standard"] == "ankle_draft": for key, value in params.items(): if key == "met" and value > 1.3: warnings.warn( "The ankle draft model is only valid for met <= 1.3", UserWarning, ) if key == "clo" and value > 0.7: warnings.warn( "The ankle draft model is only valid for clo <= 0.7", UserWarning, ) elif params["standard"] == "ashrae": # based on table 7.3.4 ashrae 55 2020 for key, value in params.items(): if key in ["tdb", "tr"]: if key == "tdb": parameter = "dry-bulb" else: parameter = "mean radiant" if value > 40 or value < 10: warnings.warn( f"ASHRAE {parameter} temperature applicability limits between 10 and 40 °C", UserWarning, ) if key in ["v", "vr"] and (value > 2 or value < 0): warnings.warn( "ASHRAE air speed applicability limits between 0 and 2 m/s", UserWarning, ) if key == "met" and (value > 2 or value < 1): warnings.warn( "ASHRAE met applicability limits between 1.0 and 2.0 met", UserWarning, ) if key == "clo" and (value > 1.5 or value < 0): warnings.warn( "ASHRAE clo applicability limits between 0.0 and 1.5 clo", UserWarning, ) if key == "v_limited" and value > 0.2: raise ValueError( "This equation is only applicable for air speed lower than 0.2 m/s" ) elif params[ "standard"] == "fan_heatwaves": # based on table 7.3.4 ashrae 55 2020 for key, value in params.items(): if key in ["tdb", "tr"]: if key == "tdb": parameter = "dry-bulb" else: parameter = "mean radiant" if value > 50 or value < 30: warnings.warn( f"{parameter} temperature applicability limits between 30 and 50 °C", UserWarning, ) if key in ["v", "vr"] and (value > 4.5 or value < 0.1): warnings.warn( "Air speed applicability limits between 0.4 and 4.5 m/s", UserWarning, ) if key == "met" and (value > 2 or value < 0.7): warnings.warn( "Met applicability limits between 0.7 and 2.0 met", UserWarning, ) if key == "clo" and (value > 1.0 or value < 0): warnings.warn( "Clo applicability limits between 0.0 and 1.0 clo", UserWarning, ) elif params["standard"] == "iso": # based on ISO 7730:2005 page 3 for key, value in params.items(): if key == "tdb" and (value > 30 or value < 10): warnings.warn( "ISO air temperature applicability limits between 10 and 30 °C", UserWarning, ) if key == "tr" and (value > 40 or value < 10): warnings.warn( "ISO mean radiant temperature applicability limits between 10 and 40 °C", UserWarning, ) if key in ["v", "vr"] and (value > 1 or value < 0): warnings.warn( "ISO air speed applicability limits between 0 and 1 m/s", UserWarning, ) if key == "met" and (value > 4 or value < 0.8): warnings.warn( "ISO met applicability limits between 0.8 and 4.0 met", UserWarning, ) if key == "clo" and (value > 2 or value < 0): warnings.warn( "ISO clo applicability limits between 0.0 and 2 clo", UserWarning, ) elif params["standard"] == "ISO7933": # based on ISO 7933:2004 Annex A if params["tdb"] > 50 or params["tdb"] < 15: warnings.warn( "ISO 7933:2004 air temperature applicability limits between 15 and 50 °C", UserWarning, ) p_a = p_sat(params["tdb"]) / 1000 * params["rh"] / 100 rh_max = 4.5 * 100 * 1000 / p_sat(params["tdb"]) if p_a > 4.5 or p_a < 0: warnings.warn( f"ISO 7933:2004 t_r - t_db applicability limits between 0 and {rh_max} %", UserWarning, ) if params["tr"] - params["tdb"] > 50 or params["tr"] - params[ "tdb"] < 0: warnings.warn( "ISO 7933:2004 t_r - t_db applicability limits between 0 and 60 °C", UserWarning, ) if params["v"] > 3 or params["v"] < 0: warnings.warn( "ISO 7933:2004 air speed applicability limits between 0 and 3 m/s", UserWarning, ) if params["met"] > 450 or params["met"] < 100: warnings.warn( "ISO 7933:2004 met applicability limits between 100 and 450 met", UserWarning, ) if params["clo"] > 1 or params["clo"] < 0.1: warnings.warn( "ISO 7933:2004 clo applicability limits between 0.1 and 1 clo", UserWarning, )
def test_p_sat(): assert (p_sat(tdb=25)) == 3169.2 assert (p_sat(tdb=50)) == 12349.9