### Quick Start: Calculate Thermal Comfort Indices (PMV, PPD, UTCI) Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/index Demonstrates a quick start example using pythermalcomfort to calculate PMV and PPD based on the ISO 7730 standard, and UTCI for heat stress assessment. It shows how to import models and pass environmental and personal parameters. ```Python from pythermalcomfort.models import pmv_ppd_iso, utci # Calculate PMV and PPD using ISO 7730 standard result = pmv_ppd_iso( tdb=25, # Dry Bulb Temperature in °C tr=25, # Mean Radiant Temperature in °C vr=0.1, # Relative air speed in m/s rh=50, # Relative Humidity in % met=1.4, # Metabolic rate in met clo=0.5, # Clothing insulation in clo model="7730-2005" # Year of the ISO standard ) print(f"PMV: {result.pmv}, PPD: {result.ppd}") # Calculate UTCI for heat stress assessment utci_value = utci(tdb=30, tr=30, v=0.5, rh=50) print(f"UTCI: {utci_value} °C") ``` -------------------------------- ### Install pythermalcomfort from source Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/installation These commands clone the pythermalcomfort repository from GitHub and install the package locally using pip, allowing for development or custom installations. ```bash git clone https://github.com/CenterForTheBuiltEnvironment/pythermalcomfort.git cd pythermalcomfort pip install . ``` -------------------------------- ### Install pythermalcomfort via pip Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/index Command-line instruction to install the pythermalcomfort Python package using the pip package manager, enabling quick setup for development environments. ```Bash pip install pythermalcomfort ``` -------------------------------- ### Verify pythermalcomfort installation Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/installation This Python code imports the pythermalcomfort package and prints its version, confirming a successful installation. ```python import pythermalcomfort print(pythermalcomfort.__version__) ``` -------------------------------- ### Install pythermalcomfort using pip Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/installation This command installs the pythermalcomfort package from PyPI using the pip package manager. It automatically handles dependencies. ```bash pip install pythermalcomfort ``` -------------------------------- ### Example Usage of JOS3.results() in Python Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/jos3 This Python example demonstrates how to use the `results()` method of the JOS3 model. It initializes a JOS3 model, runs a simulation for a specified duration, and then retrieves the consolidated simulation output. The example shows how to access specific time-series data, such as mean skin temperature and skin temperature for the head, from the returned `JOS3Output` object. ```python from pythermalcomfort.models import JOS3 model = JOS3(height=1.75, weight=70, age=25, sex="female") model.simulate(times=3, dtime=60) output = model.results() print(output.t_skin_mean) print(output.t_skin.head) ``` -------------------------------- ### Python Example: Calculate UTCI and Stress Category Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/documentation/models This example demonstrates how to import the `utci` function, calculate the UTCI for single and multiple dry bulb temperature inputs, and access the resulting UTCI value and stress category. ```python from pythermalcomfort.models import utci result = utci(tdb=25, tr=25, v=1.0, rh=50) print(result.utci) # 24.6 print(result.stress_category) # "no thermal stress" result = utci(tdb=[25, 40], tr=25, v=1.0, rh=50) print(result.utci) # [24.6, 40.6] ``` -------------------------------- ### Python Example: Calculating Clothing Insulation with clo_tout Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/clo_tout Illustrative Python examples demonstrating how to call the `clo_tout` function with both single float and list inputs for outdoor air temperature, and how to access the calculated clothing insulation value. ```python from pythermalcomfort.models import clo_tout result = clo_tout(tout=27) print(result.clo_tout) # 0.46 result = clo_tout(tout=[27, 25]) print(result.clo_tout) # array([0.46, 0.47]) ``` -------------------------------- ### Example Usage of pmv_ppd_ashrae Function Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/documentation/models This Python example demonstrates how to use the `pmv_ppd_ashrae` function along with `v_relative` and `clo_dynamic_ashrae` utilities to calculate PMV and PPD based on given environmental and personal parameters. ```python from pythermalcomfort.models import pmv_ppd_ashrae from pythermalcomfort.utilities import v_relative, clo_dynamic_ashrae tdb = 25 tr = 25 rh = 50 v = 0.1 met = 1.4 clo = 0.5 # calculate relative air speed v_r = v_relative(v=v, met=met) # calculate dynamic clothing ``` -------------------------------- ### Example: Simulate Gagge-Ji Two-Node Model in Python Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/documentation/models This Python example demonstrates how to use the `two_nodes_gagge_ji` function from the `pythermalcomfort` library. It shows how to calculate `vapor_pressure` and `body_surface_area` using utility functions before calling the main model function with various parameters. ```python from pythermalcomfort.models import two_nodes_gagge_ji from pythermalcomfort.utilities import body_surface_area from pythermalcomfort.utilities import p_sat_torr rh = 20 vapor_pressure = rh * p_sat_torr(tdb=36.5) / 100 result = two_nodes_gagge_ji( tdb=36.5, tr=36.5, v=0.25, met=0.95, clo=0.1, vapor_pressure=vapor_pressure, wme=0, body_surface_area=body_surface_area(weight=80.1, height=1.8), p_atm=101325, position="sitting", acclimatized=True, body_weight=80.1, length_time_simulation=120, ) ``` -------------------------------- ### Python examples for calculating ESI with single and multiple inputs Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/esi Illustrates how to invoke the `esi` function from the `pythermalcomfort.models` module. Examples include calculating ESI for a single set of environmental conditions and for multiple sets using lists, demonstrating the function's flexibility. ```python from pythermalcomfort.models import esi result = esi(tdb=30.2, rh=42.2, sol_radiation_global=766) print(result.esi) # 26.2 result = esi( tdb=[30.2, 27.0], rh=[42.2, 68.8], sol_radiation_global=[766, 289] ) print(result.esi) # [26.2, 25.6] ``` -------------------------------- ### Python Example: Calculate PPD for Vertical Temperature Gradient Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/vertical_tmp_grad_ppd Illustrates how to import and use the `vertical_tmp_grad_ppd` function with example thermal comfort parameters to obtain the predicted percentage of dissatisfied (PPD) occupants and their thermal acceptability. ```python from pythermalcomfort.models import vertical_tmp_grad_ppd result = vertical_tmp_grad_ppd( tdb=25, tr=25, vr=0.1, rh=50, met=1.2, clo=0.5, vertical_tmp_grad=7 ) print(result.ppd_vg) # 12.6 print(result.acceptability) # False ``` -------------------------------- ### Python Example: Calculate Clothing Insulation with clo_tout Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/documentation/models This example demonstrates how to use the `clo_tout` function from `pythermalcomfort.models` to calculate clothing insulation. It shows usage for both a single temperature value and a list of temperatures, printing the resulting `clo_tout` attribute. ```Python from pythermalcomfort.models import clo_tout result = clo_tout(tout=27) print(result.clo_tout) # 0.46 result = clo_tout(tout=[27, 25]) print(result.clo_tout) # array([0.46, 0.47]) ``` -------------------------------- ### Python Example: Calculate Discomfort Index (DI) Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/documentation/models This Python example demonstrates how to use the `discomfort_index` function from the `pythermalcomfort` library. It shows calculations for both single and multiple input values, and how to access the calculated DI value and its corresponding discomfort condition from the returned `DI` object. ```Python from pythermalcomfort.models import discomfort_index result = discomfort_index(tdb=25, rh=50) print(result.di) # 22.1 print(result.discomfort_condition) # Less than 50% feels discomfort result = discomfort_index(tdb=[25, 30], rh=[50, 60]) print(result.di) # [22.1, 27.3] print( result.discomfort_condition ) # ['Less than 50% feels discomfort', 'Most of the population feels discomfort'] ``` -------------------------------- ### Python Example: Accessing PMV and PPD Results Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/pmv_ppd_iso Demonstrates how to access and print the calculated PMV and PPD values from the `PMVPPD` object returned by the thermal comfort calculation function. ```python print(result.pmv) # [-0. 0.41] print(result.ppd) # [5. 8.5] ``` -------------------------------- ### Wind Chill Index (WCI) Calculation Function and Examples Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/wci Comprehensive documentation for the `wci` function, including its API specification detailing parameters and return types, the underlying Python implementation, and practical usage examples demonstrating how to calculate the Wind Chill Index for single and multiple input values. ```APIDOC Function: wci Description: Calculates the Wind Chill Index (WCI) in accordance with the ASHRAE 2017 Handbook Fundamentals - Chapter 9 [ashrae2017]_. The wind chill index (WCI) is an empirical index based on cooling measurements taken on a cylindrical flask partially filled with water in Antarctica (Siple and Passel 1945). For a surface temperature of 33°C, the index describes the rate of heat loss from the cylinder via radiation and convection as a function of ambient temperature and wind velocity. This formulation has been met with some valid criticism. WCI is unlikely to be an accurate measure of heat loss from exposed flesh, which differs from plastic in terms of curvature, roughness, and radiation exchange qualities, and is always below 33°C in a cold environment. Furthermore, the equation's values peak at 90 km/h and then decline as velocity increases. Nonetheless, this score reliably represents the combined effects of temperature and wind on subjective discomfort for velocities below 80 km/h [ashrae2017]_. Parameters: tdb (float or list[float]): Dry bulb air temperature, [°C]. v (float or list[float]): Wind speed 10m above ground level, [m/s]. round_output (bool, optional): If True, rounds output value. If False, it does not round it. Defaults to True. Returns: WCI: A dataclass containing the Wind Chill Index. See :py:class:`~pythermalcomfort.classes_return.WCI` for more details. To access the `wci` value, use the `wci` attribute of the returned `WCI` instance, e.g., `result.wci`. ``` ```python from typing import Union import numpy as np from pythermalcomfort.classes_input import WCIInputs from pythermalcomfort.classes_return import WCI def wci( tdb: Union[float, list[float]], v: Union[float, list[float]], round_output: bool = True, ) -> WCI: # Validate inputs using the WCYInputs class WCIInputs( tdb=tdb, v=v, round_output=round_output, ) tdb = np.array(tdb) v = np.array(v) _wci = (10.45 + 10 * v**0.5 - v) * (33 - tdb) # the factor 1.163 is used to convert to W/m^2 _wci = _wci * 1.163 if round_output: _wci = np.around(_wci, 1) return WCI(wci=_wci) ``` ```python from pythermalcomfort.models import wc result = wc(tdb=-5, v=5.5) print(result.wci) # 1255.2 ``` ```python result = wc(tdb=[-5, -10], v=[5.5, 10], round_output=True) print(result.wci) # [1255.2 1603.9] ``` -------------------------------- ### Example Usage: Calculate Apparent Temperature (AT) in Python Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/at This example demonstrates a simple call to the `at` function from the `pythermalcomfort.models` module, showing how to calculate Apparent Temperature with basic parameters (dry bulb temperature, relative humidity, and wind speed) and illustrating the expected output. ```python from pythermalcomfort.models import at at(tdb=25, rh=30, v=0.1) # AT(at=24.1) ``` -------------------------------- ### Example Usage of Adaptive Predicted Mean Vote (aPMV) Function Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/pmv_a Demonstrates how to use the `pmv_a` function from `pythermalcomfort.models` to calculate aPMV. The example also illustrates the use of `v_relative` and `clo_dynamic_iso` utility functions to prepare inputs for `pmv_a`. ```python from pythermalcomfort.models import pmv_a from pythermalcomfort.utilities import v_relative, clo_dynamic_iso v = 0.1 met = 1.4 clo = 0.5 # Calculate relative air speed v_r = v_relative(v=v, met=met) # Calculate dynamic clothing clo_d = clo_dynamic_iso(clo=clo, met=met, v=v) results = pmv_a( tdb=28, tr=28, vr=v_r, rh=50, met=met, clo=clo_d, a_coefficient=0.293, ) print(results) # AdaptivePMV(a_pmv=0.74) print(results.a_pmv) # 0.71 ``` -------------------------------- ### Python Example: Calculate Ankle Draft Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/documentation/models This example demonstrates how to use the `ankle_draft` function from the `pythermalcomfort.models` module. It shows how to pass various environmental and personal parameters to the function and print the returned `AnkleDraft` object, which includes the predicted percentage of dissatisfied occupants and acceptability. ```python from pythermalcomfort.models import ankle_draft results = ankle_draft(25, 25, 0.2, 50, 1.2, 0.5, 0.3, units="SI") print(results) # AnkleDraft(ppd_ad=18.5, acceptability=True) ``` -------------------------------- ### Python Example: Calculating Solar Gain with pythermalcomfort Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/documentation/models This Python example demonstrates how to use the `pythermalcomfort.models.solar_gain.solar_gain` function to calculate solar gain and delta mean radiant temperature. It shows how to pass required parameters and access the `erf` and `delta_mrt` attributes from the returned `SolarGain` object. ```python from pythermalcomfort.models import solar_gain result = solar_gain( sol_altitude=0, sharp=120, sol_radiation_dir=800, sol_transmittance=0.5, f_svv=0.5, f_bes=0.5, asw=0.7, posture="sitting" ) print(result.erf) # 42.9 print(result.delta_mrt) # 10.3 ``` -------------------------------- ### JOS3 Class Constructor (__init__) API Documentation Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/jos3 Documents the initialization process of the JOS3 thermal comfort model, detailing the parameters required to set up a human body model and the internal attributes calculated upon instantiation. It covers validation, calculation of BSA, BFB, CDT, CAP, and initialization of temperatures and environmental factors. ```APIDOC JOS3 Class: __init__(height: float, weight: float, age: int, sex: str, ci: float = 0.1, fat: float = 0.15, bmr_equation: str = 'harris-benedict', bsa_equation: str = 'dubois'): Parameters: bmr_equation (str, optional): The equation used to calculate basal metabolic rate (BMR). Options: "harris-benedict" (for Caucasian data, DOI: doi.org/10.1073/pnas.4.12.370) or "japanese" (for Ganpule's equation, DOI: doi.1038/sj.ejcn.1602645). bsa_equation (str, optional): The equation used to calculate body surface area (BSA). Choose one from pythermalcomfort.utilities.BodySurfaceAreaEquations. height (float): Human body height [m]. weight (float): Human body weight [kg]. age (int): Human body age [years]. sex (str): Human body sex. Options: "male" or "female". ci (float, optional): Cardiac index [L/min/m2]. Default is 0.1. fat (float, optional): Body fat percentage [%]. Default is 0.15. Returns: None. Internal Calculations/Initializations: - Validates body parameters (height, weight, age, body_fat). - Initializes basic attributes (_height, _weight, _fat, _sex, _age, _ci, _bmr_equation, _bsa_equation). - Calculates body surface area (bsa_rate, _bsa). - Calculates basal blood flow (bfb_rate). - Calculates thermal conductance (_cdt). - Calculates thermal capacity (_cap). - Sets initial core and skin temperature set points (cr_set_point, sk_set_point). - Initializes body temperature (_t_body). - Initializes environmental conditions (_tdb, _tr, _rh, _v, _clo, _iclo, _par, _posture, _hc, _hr). - Initializes external heat gain (ex_q). - Sets elapsed time (_time). - Sets model name (model_name = "JOS3"). - Sets model options (nonshivering_thermogenesis, cold_acclimated, shivering_threshold, limit_dshiv/dt, bat_positive, ava_zero, shivering). - Sets shivering threshold (threg.PRE_SHIV = 0). - Initializes history (_history). - Resets set-point temperature and appends initial results to history. ``` -------------------------------- ### Accessing Calculation Results with Dataclass Instances in pythermalcomfort 3.0.0+ Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/documentation/changelog Starting from pythermalcomfort version 3.0.0, functions now return dataclass instances, enhancing the structure and accessibility of calculation results. This example demonstrates how to call the `pmv_ppd_iso` function and access specific attributes, such as `pmv`, from the returned result object. ```python from pythermalcomfort.models import pmv_ppd_iso result = pmv_ppd_iso( tdb=[22, 25], tr=25, vr=0.1, rh=50, met=1.4, clo=0.5, model="7730-2005" ) print(result.pmv) # [-0. 0.41] ``` -------------------------------- ### Run JOS-3 Model Simulation in Python Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/documentation/models Shows how to create a JOS3 instance, run a simulation for a specified duration, and then access the complete simulation results. ```python from pythermalcomfort.models import JOS3 # Create an instance of the JOS3 class jos3_model = JOS3(height=1.75, weight=70, age=25, sex="female") # Run the simulation for 30 loops with a time delta of 60 seconds jos3_model.simulate(times=30, dtime=60) # Access the results results = jos3_model.dict_results() print(results) ``` -------------------------------- ### Build and Configure JOS3 Model Instance in Python Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/jos3 This Python example demonstrates how to create an instance of the JOS3 class, set initial body parameters (height, weight, age, sex, fat, BMR/BSA equations), and configure environmental conditions (air temperature, mean radiant temperature, relative humidity, air velocity) using setter methods. ```python from pythermalcomfort.classes_return import get_attribute_values import numpy as np import pandas as pd import matplotlib.pyplot as plt import os from pythermalcomfort.models import JOS3 from pythermalcomfort.jos3_functions.parameters import ( local_clo_typical_ensembles, ) model = JOS3( height=1.7, weight=60, fat=20, age=30, sex="male", bmr_equation="japanese", bsa_equation="fujimoto", ) # Set environmental conditions such as air temperature, mean radiant temperature using the setter methods. # Set the first condition # Environmental parameters can be input as int, float, list, dict, numpy array format. model.tdb = 28 # Air temperature [°C] model.tr = 30 # Mean radiant temperature [°C] model.rh = 40 # Relative humidity [%] model.v = np.array( # Air velocity [m/s] [ 0.2, # head 0.4, # neck 0.4, # chest 0.1, # back 0.1, # pelvis ``` -------------------------------- ### JOS3 Class Constructor API Reference Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/documentation/models This section provides the API documentation for the `__init__` method of the JOS3 class. It details all available parameters for initializing a JOS3 model instance, including body dimensions, age, sex, and equations for BMR and BSA, along with an example of its usage. ```APIDOC __init__(*height=1.72*, *weight=74.43*, *fat=15*, *age=20*, *sex='male'*, *ci=2.59*, *bmr_equation='harris-benedict'*, *bsa_equation='dubois'*)[[source]](../_modules/pythermalcomfort/models/jos3.html#JOS3.__init__)[#](#pythermalcomfort.models.jos3.JOS3.__init__ "Permalink to this definition") : Initialize a new instance of the JOS3 class, which models and simulates various physiological parameters related to human thermoregulation. This class uses mathematical models to calculate and predict body temperature, basal metabolic rate, body surface area, and other related parameters. Parameters : * **height** (*float, optional*) – Body height in meters. * **weight** (*float, optional*) – Body weight in kilograms. * **fat** (*float, optional*) – Fat percentage. * **age** (*int, optional*) – Age in years. * **sex** (*str, optional*) – Sex (“male” or “female”). * **ci** (*float, optional*) – Cardiac index in liters per minute per square meter. * **bmr_equation** (*str, optional*) – The equation used to calculate basal metabolic rate (BMR). Options are “harris-benedict” for Caucasian data (DOI: doi.org/10.1073/pnas.4.12.370) or “japanese” for Ganpule’s equation (DOI: doi.10.1038/sj.ejcn.1602645). * **bsa_equation** (*str, optional*) – The equation used to calculate body surface area (BSA). Choose one from pythermalcomfort.utilities.BodySurfaceAreaEquations. Returns : *None.* Examples Create an instance of the JOS3 class with optional body parameters: ``` jos3_model = JOS3(height=1.75, weight=70, age=25, sex="female") ``` ``` -------------------------------- ### Python Examples for Cooling Effect Calculation Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/cooling_effect Illustrative Python code examples demonstrating how to use the `cooling_effect` function with single and list inputs, and how to specify units. These examples show how to retrieve the calculated Cooling Effect value. ```python from pythermalcomfort.models import cooling_effect result = cooling_effect(tdb=25, tr=25, vr=0.3, rh=50, met=1.2, clo=0.5) print(result.ce) # 1.68 result = cooling_effect( tdb=[25, 77], tr=[25, 77], vr=[0.3, 1.64], rh=[50, 50], met=[1.2, 1], clo=[0.5, 0.6], units="IP", ) print(result.ce) # [0, 3.95] ``` -------------------------------- ### JOS3 Class API Reference: Attributes and Returns Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/jos3 Detailed API documentation for the JOS3 class, outlining its purpose, initialization, how to set environmental and body conditions, and the comprehensive set of physiological outputs it provides. Includes descriptions of all attributes and return values. ```APIDOC JOS3: description: > JOS-3 model simulates human thermal physiology including skin temperature, core temperature, sweating rate, etc. for the whole body and 17 local body parts. This model was developed at Shin-ichi Tanabe Laboratory, Waseda University and was derived from 65 Multi-Node model (https://doi.org/10.1016/S0378-7788(02)00014-2) and JOS-2 model (https://doi.org/10.1016/j.buildenv.2013.04.013). To use this model, create an instance of the JOS3 class with optional body parameters such as body height, weight, age, sex, etc. Environmental conditions such as air temperature, mean radiant temperature, air velocity, etc. can be set using the setter methods. (ex. X.tdb, X.tr, X.v) If you want to set the different conditions in each body part, set them as a 17 lengths of list, dictionary, or numpy array format. List or numpy array format input must be 17 lengths and means the order of "head", "neck", "chest", "back", "pelvis", "left_shoulder", "left_arm", "left_hand", "right_shoulder", "right_arm", "right_hand", "left_thigh", "left_leg", "left_foot", "right_thigh", "right_leg" and "right_foot". The model output includes local and mean skin temperature, local core temperature, local and mean skin wettedness, and heat loss from the skin etc. The model output can be accessed using the `dict_results()` method and be converted to a csv file using the `to_csv` method. Each output parameter also can be accessed using getter methods. (ex. X.t_skin, X.t_skin_mean, X.t_core) If you use this package, please cite us as follows and mention the version of pythermalcomfort used: Y. Takahashi, A. Nomoto, S. Yoda, R. Hisayama, M. Ogata, Y. Ozeki, S. Tanabe, Thermoregulation Model JOS-3 with New Open Source Code, Energy & Buildings (2020), doi: https://doi.org/10.1016/j.enbuild.2020.110575 Note: To maintain consistency in variable names for pythermalcomfort, some variable names differ from those used in the original paper. Attributes: tdb : float or list of floats Dry bulb air temperature. tr : float or list of floats Mean radiant temperature. to : float or list of floats Operative temperature. rh : float or list of floats Relative humidity. v : float or list of floats Air velocity. clo : float or list of floats Clothing insulation. posture : str Posture of the subject. par : float Physical activity ratio. t_body : numpy.ndarray Body temperature. bsa : numpy.ndarray Body surface area. r_t : numpy.ndarray Radiative heat transfer coefficient. r_et : numpy.ndarray Evaporative heat transfer coefficient. w : numpy.ndarray Skin wettedness. w_mean : float Mean skin wettedness. t_skin_mean : float Mean skin temperature. t_skin : numpy.ndarray Skin temperature. t_core : numpy.ndarray Core temperature. t_cb : numpy.ndarray Central blood temperature. t_artery : numpy.ndarray Arterial blood temperature. t_vein : numpy.ndarray Venous blood temperature. t_superficial_vein : numpy.ndarray Superficial venous blood temperature. t_muscle : numpy.ndarray Muscle temperature. t_fat : numpy.ndarray Fat temperature. body_names : list of str Names of the body parts. results : dict Dictionary of the simulation results. bmr : float Basal metabolic rate. version : str Version of the JOS3 model. Returns: cardiac_output : cardiac output (the sum of the whole blood flow) [L/h] dt : time step [sec] q_res : ``` -------------------------------- ### JOS3 Method: simulate API Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/jos3 API documentation for the public method `simulate` which runs the JOS-3 model simulation. ```APIDOC simulate(self, times: int, dtime: int | float = 60, output: bool = True) -> None times: Number of loops of the simulation. dtime: Time delta in seconds for each simulation step. Default is 60. output: If True, records the parameters at each simulation step. Default is True. Returns: None ``` -------------------------------- ### Python Example: Calculate Heat Index with heat_index_lu Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/heat_index_lu This example demonstrates how to import and use the `heat_index_lu` function from `pythermalcomfort.models` to calculate the Heat Index for specific temperature and humidity values, and how to access the result. ```python from pythermalcomfort.models import heat_index_lu result = heat_index_lu(tdb=25, rh=50) print(result.hi) # 25.9 ``` -------------------------------- ### Example: Calculate Heat Strain with Fans in Python Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/use_fans_heatwaves This Python example demonstrates how to use the `use_fans_heatwaves` function to calculate heat strain. It shows how to pass input parameters and access a specific result attribute, `e_skin`. ```python from pythermalcomfort.models import use_fans_heatwaves result = use_fans_heatwaves( tdb=35, tr=35, v=1.0, rh=50, met=1.2, clo=0.5 ) print(result.e_skin) # 63.0 ``` -------------------------------- ### Initialize JOS3 Class Instance in Python Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/jos3 Demonstrates how to create an instance of the JOS3 class, providing essential body parameters like height, weight, age, and sex. This initializes the model with default and specified values for thermal comfort calculations. ```python jos3_model = JOS3(height=1.75, weight=70, age=25, sex="female") ``` -------------------------------- ### JOS3 Class Constructor API Documentation Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/jos3 API documentation for the `__init__` method of the `JOS3` class. This constructor initializes a new instance of the JOS3 class, which is designed to model and simulate various physiological parameters related to human thermoregulation. It allows for setting initial human body characteristics and calculation methods. ```APIDOC class JOS3: __init__( height: float = Default.height, weight: float = Default.weight, fat: float = Default.body_fat, age: int = Default.age, sex: str = Default.sex, ci: float = Default.cardiac_index, bmr_equation: str = Default.bmr_equation, bsa_equation: str = Default.bsa_equation ) Parameters: height : float, optional Body height in meters. weight : float, optional Body weight in kilograms. fat : float, optional Fat percentage. age : int, optional Age in years. sex : str, optional Sex ("male" or "female"). ci : float, optional Cardiac index in liters per minute per square meter. bmr_equation : str, optional Equation to use for Basal Metabolic Rate calculation. bsa_equation : str, optional Equation to use for Body Surface Area calculation. ``` -------------------------------- ### Example: Calculate Heat Strain with pythermalcomfort.models.use_fans_heatwaves Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/documentation/models This Python example demonstrates how to use the `use_fans_heatwaves` function to calculate heat strain parameters given environmental and physiological inputs. It shows how to access a specific result attribute, `e_skin`. ```python from pythermalcomfort.models import use_fans_heatwaves result = use_fans_heatwaves( tdb=35, tr=35, v=1.0, rh=50, met=1.2, clo=0.5 ) print(result.e_skin) # 63.0 ``` -------------------------------- ### APIDOC: JOS-3 Model `_run` Method API Reference Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/jos3 This API documentation provides a detailed reference for the `_run` method of the JOS-3 model. It specifies the method's signature, its purpose, and a comprehensive breakdown of all parameters including their types, default values, and descriptions. Additionally, it outlines the structure and content of the `JOS3Output` dictionary returned by the method, which contains various simulation results. ```APIDOC _run(self, dtime=60, passive=False, output=True) Description: Run a single cycle of the JOS-3 model simulation. This method calculates various thermoregulation parameters using the input data, such as convective and radiative heat transfer coefficients, operative temperature, heat resistance, and blood flow rates. It also computes thermogenesis by shivering and non-shivering, basal thermogenesis, and thermogenesis by work. The function constructs and solves matrices to determine the new body temperature distribution. Parameters: dtime: int or float, optional Time step in seconds for the simulation. Default is 60. passive: bool, optional If True, the set-point temperature for thermoregulation is set to the current body temperature, simulating a passive model. Default is False. output: bool, optional If True, returns a dictionary of the simulation results. Default is True. Returns: JOS3Output A dictionary containing the simulation results, including parameters such as model time, mean skin temperature, skin temperature, core temperature, mean skin wettedness, skin wettedness, weight loss by evaporation and respiration, cardiac output, total thermogenesis, respiratory heat loss, and total heat loss from the skin to the environment. ``` -------------------------------- ### Python: Example Usage of utci Function Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/utci This Python code snippet demonstrates how to use the `utci` function from the `pythermalcomfort.models` module. It shows examples of calculating UTCI for both single and multiple input values, and how to access the resulting UTCI value and its corresponding stress category. ```python from pythermalcomfort.models import utci result = utci(tdb=25, tr=25, v=1.0, rh=50) print(result.utci) # 24.6 print(result.stress_category) # "no thermal stress" result = utci(tdb=[25, 40], tr=25, v=1.0, rh=50) print(result.utci) # [24.6, 40.6] ``` -------------------------------- ### Run pythermalcomfort Development Checks and Documentation Builder with Tox Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/contributing These commands utilize `tox` to run various development checks, including unit tests and documentation building, for the pythermalcomfort project. `tox` creates isolated environments to ensure consistent test results across different Python versions and dependencies. ```bash tox tox -e docs tox -e py312 ``` -------------------------------- ### Simulating Human Thermoregulation with JOS3 Model in Python Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/documentation/models This Python snippet demonstrates how to initialize and run simulations using the JOS3 human thermoregulation model. It covers setting initial physiological parameters, environmental conditions, running multiple simulation steps, and visualizing results like skin temperature using pandas and matplotlib. ```Python 0.1, # right leg 0.1, # right foot ] ) model.clo = get_attribute_values( local_clo_typical_ensembles[ "briefs, socks, undershirt, work jacket, work pants, safety shoes" ]["local_body_part"] ) # par should be input as int, float. model.par = ( 1.2 # Physical activity ratio [-], assuming a sitting position ) # posture should be input as int (0, 1, or 2) or str ("standing", "sitting" or "lying"). # (0="standing", 1="sitting" or 2="lying") model.posture = "sitting" # Posture [-], assuming a sitting position # Run JOS-3 model model.simulate( times=30, # Number of loops of a simulation dtime=60, # Time delta [sec]. The default is 60. ) # Exposure time = 30 [loops] * 60 [sec] = 30 [min] # Set the next condition (You only need to change the parameters that you want to change) model.to = 20 # Change operative temperature model.v = { # Air velocity [m/s], assuming to use a desk fan "head": 0.2, "neck": 0.4, "chest": 0.4, "back": 0.1, "pelvis": 0.1, "left_shoulder": 0.4, "left_arm": 0.4, "left_hand": 0.4, "right_shoulder": 0.4, "right_arm": 0.4, "right_hand": 0.4, "left_thigh": 0.1, "left_leg": 0.1, "left_foot": 0.1, "right_thigh": 0.1, "right_leg": 0.1, "right_foot": 0.1, } # Run JOS-3 model model.simulate( times=60, # Number of loops of a simulation dtime=60, # Time delta [sec]. The default is 60. ) # Additional exposure time = 60 [loops] * 60 [sec] = 60 [min] # Set the next condition (You only need to change the parameters that you want to change) model.tdb = 30 # Change air temperature [°C] model.tr = 35 # Change mean radiant temperature [°C] # Run JOS-3 model model.simulate( times=30, # Number of loops of a simulation dtime=60, # Time delta [sec]. The default is 60. ) # Additional exposure time = 30 [loops] * 60 [sec] = 30 [min] # The easiest way to access the results is to use the `results` method results = model.results() # you can then use dot notation to access the results print( results.t_skin_mean ) # Print the mean skin temperature or you can use print(results['t_skin_mean']) # some attributes have results for each body part, you can access them by using the body part name print(results.t_skin.head) # Print the skin temperature of the head # You can also save the results as a pandas dataframe and plot them df = pd.DataFrame( [results.t_skin.head, results.t_skin.pelvis] ).transpose() # Make pandas.DataFrame df.plot() # Plot time series of local skin temperature. plt.legend(["Head", "Pelvis"]) # Reset the legends plt.ylabel( "Skin temperature [°C]" ) # Set y-label as 'Skin temperature [°C]' plt.xlabel("Time [min]") # Set x-label as 'Time [min]' plt.show() # Show the plot ``` -------------------------------- ### Python Examples: Using humidex for Single and Multiple Inputs Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/humidex These examples demonstrate how to use the `humidex` function with both single float inputs and lists of floats. It shows how to access the `humidex` value and `discomfort` category from the returned `Humidex` instance, and how to control output rounding. ```python from pythermalcomfort.models import humidex result = humidex(tdb=25, rh=50) print(result.humidex) # 28.2 print(result.discomfort) # Little or no discomfort result = humidex(tdb=[25, 30], rh=[50, 60], round_output=False) print(result.humidex) # [28.2, 39.1] print(result.discomfort) # ['Little or no discomfort', 'Evident discomfort'] ``` -------------------------------- ### Python: Example Usage of two_nodes_gagge Function Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/two_nodes_gagge Illustrates how to call the `two_nodes_gagge` function with both single and list-based inputs for environmental and personal parameters. The examples demonstrate accessing specific attributes from the returned `GaggeTwoNodes` object, such as skin wettedness (`w`) and evaporative heat loss from skin (`e_skin`). ```Python from pythermalcomfort.models import two_nodes_gagge result = two_nodes_gagge(tdb=25, tr=25, v=0.1, rh=50, clo=0.5, met=1.2) print(result.w) # 100.0 ``` ```Python from pythermalcomfort.models import two_nodes_gagge result = two_nodes_gagge( tdb=[25, 25], tr=25, v=0.3, rh=50, met=1.2, clo=0.5 ) print(result.e_skin) # [100.0, 100.0] ``` -------------------------------- ### Example Usage of two_nodes_gagge_ji Function Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/two_nodes_gagge_ji Demonstrates how to import and use the `two_nodes_gagge_ji` function, including how to calculate `vapor_pressure` and `body_surface_area` using utility functions from `pythermalcomfort`. It shows a typical call with various parameters and how to access the returned results. ```python from pythermalcomfort.models import two_nodes_gagge_ji from pythermalcomfort.utilities import body_surface_area from pythermalcomfort.utilities import p_sat_torr rh = 20 vapor_pressure = rh * p_sat_torr(tdb=36.5) / 100 result = two_nodes_gagge_ji( tdb=36.5, tr=36.5, v=0.25, met=0.95, clo=0.1, vapor_pressure=vapor_pressure, wme=0, body_surface_area=body_surface_area(weight=80.1, height=1.8), p_atm=101325, position="sitting", acclimatized=True, body_weight=80.1, length_time_simulation=120, ) ``` -------------------------------- ### Example: Calculate Solar Gain with pythermalcomfort Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/solar_gain This example demonstrates how to import and utilize the `solar_gain` function from `pythermalcomfort.models`. It shows how to pass required parameters and access the calculated `erf` (Effective Radiant Field) and `delta_mrt` (delta mean radiant temperature) values from the returned `SolarGain` object. ```python from pythermalcomfort.models import solar_gain result = solar_gain( sol_altitude=0, sharp=120, sol_radiation_dir=800, sol_transmittance=0.5, f_svv=0.5, f_bes=0.5, asw=0.7, posture="sitting", ) print(result.erf) # 42.9 print(result.delta_mrt) # 10.3 ``` -------------------------------- ### Python Imports for pythermalcomfort.models.pmv_ppd_ashrae Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/_modules/pythermalcomfort/models/pmv_ppd_ashrae Imports necessary modules and classes for the `pmv_ppd_ashrae` function, including type hints, numpy, and internal `pythermalcomfort` components required for thermal comfort calculations. ```Python from typing import Union import numpy as np from pythermalcomfort.classes_input import PMVPPDInputs from pythermalcomfort.classes_return import PMVPPD from pythermalcomfort.models._pmv_ppd_optimized import _pmv_ppd_optimized from pythermalcomfort.models.cooling_effect import cooling_effect from pythermalcomfort.shared_functions import mapping from pythermalcomfort.utilities import ( Models, Units, _check_standard_compliance_array, units_converter, ) ``` -------------------------------- ### Initialize JOS3 Model in pythermalcomfort Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/genindex This method is the constructor for the JOS3 model within the pythermalcomfort library. It is part of the pythermalcomfort.models.jos3.JOS3 class. ```APIDOC pythermalcomfort.models.jos3.JOS3.__init__() ``` -------------------------------- ### Example: Calculate PPD for Vertical Temperature Gradient (Python) Source: https://pythermalcomfort.readthedocs.io/en/latest/documentation/index.html/documentation/models This Python example demonstrates how to use the `vertical_tmp_grad_ppd` function from the `pythermalcomfort.models` module. It shows how to pass environmental and personal parameters and then access the calculated predicted percentage of dissatisfied (PPD) and acceptability values from the returned `VerticalTGradPPD` object. ```Python from pythermalcomfort.models import vertical_tmp_grad_ppd result = vertical_tmp_grad_ppd( tdb=25, tr=25, vr=0.1, rh=50, met=1.2, clo=0.5, vertical_tmp_grad=7 ) print(result.ppd_vg) # 12.6 print(result.acceptability) # False ```