Skip to content

Commit

Permalink
Merge pull request #10 from TanabeLab/jos3-dev-0.3.1
Browse files Browse the repository at this point in the history
Bug fix
  • Loading branch information
yoshito-takahashi authored Feb 20, 2022
2 parents 3543bce + 408fd68 commit 4b282c7
Show file tree
Hide file tree
Showing 3 changed files with 216 additions and 6 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ Please cite us if you use this package : Y. Takahashi, A. Nomoto, S. Yoda, R. Hi

# Note

Our work is packed in [pythermalcomfort](https://github.com/CenterForTheBuiltEnvironment/pythermalcomfort).

Please also check pythermalcomfort project: F. Tartarini, S. Schiavon, pythermalcomfort: A Python package for thermal comfort research, SoftwareX (2020), doi: https://doi.org/10.1016/j.softx.2020.100578 .
Please also check [pythermalcomfort](https://github.com/CenterForTheBuiltEnvironment/pythermalcomfort) : F. Tartarini, S. Schiavon, pythermalcomfort: A Python package for thermal comfort research, SoftwareX (2020), doi: https://doi.org/10.1016/j.softx.2020.100578 .


# Requirement
Expand Down
2 changes: 1 addition & 1 deletion src/jos3/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-
from jos3.jos3 import *
__version__ = '0.2.6'
__version__ = '0.3.1'
216 changes: 214 additions & 2 deletions src/jos3/jos3.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class JOS3():
Air temperature [oC].
Tr : float or list
Mean radiant temperature [oC].
To : float or list
Operative temperature [oC].
Va : float or list
Air velocity [m/s].
RH : float or list
Expand All @@ -83,7 +85,10 @@ class JOS3():
Physical activity ratio [-].
This equals the ratio of metaboric rate to basal metablic rate.
PAR of sitting quietly is 1.2.
posture : str
Choose a posture from standing, sitting or lying.
bodytemp : numpy.ndarray (85,)
All segment temperatures of JOS-3
Getter
-------
Expand Down Expand Up @@ -251,7 +256,7 @@ def _reset_setpt(self):
# Set operative temperature under PMV=0 environment
# PAR = 1.25
# 1 met = 58.15 W/m2
met = self.BMR * 1.25 / 58.15 / self.BSA.sum() # [met]
met = self.BMR * 1.25 / 58.15 # [met]
self.To = preferred_temp(met=met)
self.RH = 50
self.Va = 0.1
Expand Down Expand Up @@ -732,20 +737,44 @@ def _set_ex_q(self, tissue, value):

@property
def Ta(self):
"""
Getter
Returns
-------
Ta : numpy.ndarray (17,)
Air temperature [oC].
"""
return self._ta
@Ta.setter
def Ta(self, inp):
self._ta = _to17array(inp)

@property
def Tr(self):
"""
Getter
Returns
-------
Tr : numpy.ndarray (17,)
Mean radiant temperature [oC].
"""
return self._tr
@Tr.setter
def Tr(self, inp):
self._tr = _to17array(inp)

@property
def To(self):
"""
Getter
Returns
-------
To : numpy.ndarray (17,)
Operative temperature [oC].
"""
hc = threg.fixed_hc(threg.conv_coef(self._posture, self._va, self._ta, self.Tsk,), self._va)
hr = threg.fixed_hr(threg.rad_coef(self._posture,))
to = threg.operative_temp(self._ta, self._tr, hc, hr,)
Expand All @@ -757,20 +786,44 @@ def To(self, inp):

@property
def RH(self):
"""
Getter
Returns
-------
RH : numpy.ndarray (17,)
Relative humidity [%].
"""
return self._rh
@RH.setter
def RH(self, inp):
self._rh = _to17array(inp)

@property
def Va(self):
"""
Getter
Returns
-------
Va : numpy.ndarray (17,)
Air velocity [m/s].
"""
return self._va
@Va.setter
def Va(self, inp):
self._va = _to17array(inp)

@property
def posture(self):
"""
Getter
Returns
-------
posture : str
Current JOS3 posture.
"""
return self._posture
@posture.setter
def posture(self, inp):
Expand All @@ -794,20 +847,46 @@ def posture(self, inp):

@property
def Icl(self):
"""
Getter
Returns
-------
Icl : numpy.ndarray (17,)
Clothing insulation [clo].
"""
return self._clo
@Icl.setter
def Icl(self, inp):
self._clo = _to17array(inp)

@property
def PAR(self):
"""
Getter
Returns
-------
PAR : float
Physical activity ratio [-].
This equals the ratio of metaboric rate to basal metablic rate.
PAR of sitting quietly is 1.2.
"""
return self._par
@PAR.setter
def PAR(self, inp):
self._par = inp

@property
def bodytemp(self):
"""
Getter
Returns
-------
bodytemp : numpy.ndarray (85,)
All segment temperatures of JOS-3
"""
return self._bodytemp
@bodytemp.setter
def bodytemp(self, inp):
Expand All @@ -819,21 +898,53 @@ def bodytemp(self, inp):

@property
def BSA(self):
"""
Getter
Returns
-------
BSA : numpy.ndarray (17,)
Body surface areas by local body segments [m2].
"""
return self._bsa.copy()

@property
def Rt(self):
"""
Getter
Returns
-------
Rt : numpy.ndarray (17,)
Dry heat resistances between the skin and ambience areas by local body segments [K.m2/W].
"""
hc = threg.fixed_hc(threg.conv_coef(self._posture, self._va, self._ta, self.Tsk,), self._va)
hr = threg.fixed_hr(threg.rad_coef(self._posture,))
return threg.dry_r(hc, hr, self._clo)

@property
def Ret(self):
"""
Getter
Returns
-------
Ret : numpy.ndarray (17,)
Wet (Evaporative) heat resistances between the skin and ambience areas by local body segments [Pa.m2/W].
"""
hc = threg.fixed_hc(threg.conv_coef(self._posture, self._va, self._ta, self.Tsk,), self._va)
return threg.wet_r(hc, self._clo, self._iclo)

@property
def Wet(self):
"""
Getter
Returns
-------
Wet : numpy.ndarray (17,)
Skin wettedness on local body segments [-].
"""
err_cr = self.Tcr - self.setpt_cr
err_sk = self.Tsk - self.setpt_sk
wet, *_ = threg.evaporation(err_cr, err_sk,
Expand All @@ -842,49 +953,142 @@ def Wet(self):

@property
def WetMean(self):
"""
Getter
Returns
-------
WetMean : float
Mean skin wettedness of the whole body [-].
"""
wet = self.Wet
return np.average(wet, weights=_BSAst)



@property
def TskMean(self):
"""
Getter
Returns
-------
TskMean : float
Mean skin temperature of the whole body [oC].
"""
return np.average(self._bodytemp[INDEX["skin"]], weights=_BSAst)

@property
def Tsk(self):
"""
Getter
Returns
-------
Tsk : numpy.ndarray (17,)
Skin temperatures by the local body segments [oC].
"""
return self._bodytemp[INDEX["skin"]].copy()

@property
def Tcr(self):
"""
Getter
Returns
-------
Tcr : numpy.ndarray (17,)
Skin temperatures by the local body segments [oC].
"""
return self._bodytemp[INDEX["core"]].copy()

@property
def Tcb(self):
"""
Getter
Returns
-------
Tcb : numpy.ndarray (1,)
Core temperatures by the local body segments [oC].
"""
return self._bodytemp[0].copy()

@property
def Tar(self):
"""
Getter
Returns
-------
Tar : numpy.ndarray (17,)
Arterial temperatures by the local body segments [oC].
"""
return self._bodytemp[INDEX["artery"]].copy()

@property
def Tve(self):
"""
Getter
Returns
-------
Tve : numpy.ndarray (17,)
Vein temperatures by the local body segments [oC].
"""
return self._bodytemp[INDEX["vein"]].copy()

@property
def Tsve(self):
"""
Getter
Returns
-------
Tsve : numpy.ndarray (12,)
Superfical vein temperatures by the local body segments [oC].
"""
return self._bodytemp[INDEX["sfvein"]].copy()

@property
def Tms(self):
"""
Getter
Returns
-------
Tms : numpy.ndarray (2,)
Muscle temperatures of Head and Pelvis [oC].
"""
return self._bodytemp[INDEX["muscle"]].copy()

@property
def Tfat(self):
"""
Getter
Returns
-------
Tfat : numpy.ndarray (2,)
Fat temperatures of Head and Pelvis [oC].
"""
return self._bodytemp[INDEX["fat"]].copy()

@property
def bodyname(self):
"""
Getter
Returns
-------
bodyname : list
JOS3 body names,
"Head", "Neck", "Chest", "Back", "Pelvis",
"LShoulder", "LArm", "LHand",
"RShoulder", "RArm", "RHand",
"LThigh", "LLeg", "LHand",
"RThigh", "RLeg" and "RHand".
"""
body = [
"Head", "Neck", "Chest", "Back", "Pelvis",
"LShoulder", "LArm", "LHand",
Expand All @@ -899,6 +1103,14 @@ def results(self):

@property
def BMR(self):
"""
Getter
Returns
-------
BMR : float
Basal metabolic rate [W/m2].
"""
bmr = threg.basal_met(
self._height, self._weight, self._age,
self._sex, self._bmr_equation,)
Expand Down

0 comments on commit 4b282c7

Please sign in to comment.