forked from TanabeLab/JOS-3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a4868fe
Showing
11 changed files
with
2,721 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Yoshito Takahashi | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# jos | ||
|
||
jos is a pyhon package to simulate a human thermoregulation and thermal responses. | ||
|
||
Please cite us if you use this package : Y. Takahashi, A. Nomoto, S. Yoda, R. Hisayama, M. Ogata, Y. Ozeki, S-i. Tanabe,Thermoregulation Model JOS-3 with New Open Source Code, Energy & Buildings (2020), doi: https://doi.org/10.1016/j.enbuild.2020.110575 | ||
|
||
# Requirement | ||
|
||
* python 3 | ||
* numpy | ||
|
||
# Installation | ||
|
||
```bash | ||
pip install jos ?? | ||
``` | ||
|
||
# Usage | ||
|
||
```python | ||
|
||
import pandas as pd | ||
import jos | ||
|
||
model = jos.JOS(height=1.7, weight=60, age=30) # Builds a model | ||
|
||
# Set the first condition | ||
model.To = 28 # Operative temperature [oC] | ||
model.RH = 40 # Relative humidity [%] | ||
model.Va = 0.2 # Air velocity [m/s] | ||
model.PAR = 1.2 # Physical activity ratio [-] | ||
model.simulate(60) # Exposre time = 60 [min] | ||
|
||
# Set the next condition | ||
model.To = 20 # Changes only operative temperature | ||
model.simulate(60) # Additional exposre time = 60 [min] | ||
|
||
df = pd.DataFrame(model.dict_results()) # Make pandas.DataFrame | ||
df.TskMean.plot() # Show the graph of mean skin temp. | ||
``` | ||
|
||
 | ||
|
||
# Author | ||
|
||
* Yoshito Takahashi | ||
* Former master student of Tanabe Laboratory, Waseda University | ||
* [email protected] | ||
|
||
# License | ||
jos is under [MIT license](https://en.wikipedia.org/wiki/MIT_License). |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# -*- coding: utf-8 -*- | ||
import pandas as pd | ||
import jos | ||
|
||
model = jos.JOS(height=1.7, weight=60, age=30) # Builds a model | ||
|
||
# Set the first condition | ||
model.To = 28 # Operative temperature [oC] | ||
model.RH = 40 # Relative humidity [%] | ||
model.Va = 0.2 # Air velocity [m/s] | ||
model.PAR = 1.2 # Physical activity ratio [-] | ||
model.simulate(60) # Exposre time = 60 [min] | ||
|
||
# Set the next condition | ||
model.To = 20 # Change only operative temperature | ||
model.simulate(60) # Additional exposre time = 60 [min] | ||
|
||
df = pd.DataFrame(model.dict_results()) # Make pandas.DataFrame | ||
df.TskMean.plot() # Show the graph of mean skin temp. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
from jos.jos import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
# -*- coding: utf-8 -*- | ||
import math | ||
|
||
def pmv(ta, tr, va, rh, met, clo, wmet=0): | ||
""" | ||
Get PMV value based on the 2017 ASHRAE Handbook—Fundamentals, Chapter 9: | ||
Thermal Comfort, Equations 63 - 68. | ||
Parameters | ||
---------- | ||
ta : float, optional | ||
Air temperature [oC] | ||
tr : float, optional | ||
Mean radiant temperature [oC] | ||
va : float, optional | ||
Air velocity [m/s] | ||
rh : float, optional | ||
Relative humidity [%] | ||
met : float, optional | ||
Metabolic rate [met] | ||
clo : float, optional | ||
Clothing insulation [clo] | ||
wmet : float, optional | ||
External work [met], optional. The default is 0. | ||
Returns | ||
------- | ||
PMV value | ||
""" | ||
|
||
met *= 58.15 # chage unit [met] to [W/m2] | ||
wmet *= 58.15 # chage unit [met] to [W/m2] | ||
mw = met - wmet # heat production [W/m2] | ||
|
||
if clo < 0.5: fcl = 1 + 0.2*clo # clothing area factor [-] | ||
else: fcl = 1.05 + 0.1*clo | ||
|
||
antoine = lambda x: math.e**(16.6536-(4030.183/(x+235))) # antoine's formula | ||
pa = antoine(ta) * rh/100 # vapor pressure [kPa] | ||
rcl = 0.155 * clo # clothing thermal resistance [K.m2/W] | ||
hcf = 12.1 * va**0.5 # forced convective heat transfer coefficience | ||
|
||
hc = hcf # initial convective heat transfer coefficience | ||
tcl = (34 + ta) / 2 # initial clothing temp. | ||
|
||
# Cal. clothing temp. by iterative calculation method | ||
for i in range(100): | ||
# clothing temp. [oC] | ||
tcliter = 35.7 - 0.028 * mw \ | ||
- rcl * (39.6 * 10**(-9) * fcl * ((tcl+273)**4 - (tr+273)**4) \ | ||
+ fcl * hc * (tcl - ta)) # Eq.68 | ||
# new clothin temp. [oC] | ||
tcl = (tcliter + tcl) / 2 | ||
|
||
hcn = 2.38 * abs(tcl - ta)**0.25 # natural convective heat transfer coefficience | ||
|
||
# select forced or natural convection | ||
if hcn > hcf: hc = hcf | ||
else: hc = hcf | ||
|
||
# terminate iterative calculation | ||
if abs(tcliter - tcl) < 0.0001: | ||
break | ||
|
||
# tcl = 35.7 - 0.0275 * mw \ | ||
# - rcl * (mw - 3.05 * (5.73 - 0.007 * mw - pa) \ | ||
# - 0.42 * (mw - 58.15) - 0.0173 * met * (5.87 - pa) \ | ||
# + 0.0014 * met * (34 - ta)) # Eq.64 | ||
|
||
# Heat loss of human body | ||
rad = 3.96 * (10**(-8)) * fcl * ((tcl+273)**4 - (tr+273)**4) # by radiation | ||
conv = fcl * hc * (tcl - ta) # by convction | ||
diff = 3.05 * (5.73 - 0.007 * mw - pa) # by insensive perspiration | ||
sweat = max(0, 0.42 * (mw - 58.15)) # by sweating | ||
res = 0.0173 * met * (5.87 - pa) + 0.0014 * met * (34 - ta) # by repiration | ||
load = mw - rad - conv - diff - sweat - res | ||
|
||
pmv_value = (0.303 * math.exp(-0.036 * met) + 0.028) * load # Eq.63 | ||
|
||
return pmv_value | ||
|
||
def preferred_temp(va=0.1, rh=50, met=1, clo=0): | ||
""" | ||
Calculate operative temperature [oC] at PMV=0. | ||
Parameters | ||
---------- | ||
va : float, optional | ||
Air velocity [m/s]. The default is 0.1. | ||
rh : float, optional | ||
Relative humidity [%]. The default is 50. | ||
met : float, optional | ||
Metabolic rate [met]. The default is 1. | ||
clo : float, optional | ||
Clothing insulation [clo]. The default is 0. | ||
Returns | ||
------- | ||
to : float | ||
Operative temperature [oC]. | ||
""" | ||
|
||
to = 28 # initial temp | ||
for i in range(100): | ||
vpmv = pmv(to, to, va, rh, met, clo) | ||
if abs(vpmv) < 0.001: break | ||
else: to = to - vpmv/3 | ||
return to |
Oops, something went wrong.