Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- """
- Building Comfort Computation Tools
- A collection of estimation and computation
- tools for computing the indices and parameters
- required to generate comfort indices.
- """
- def mcPhersonEstimate(tpwb, t_air, t_dew):
- """Compute Mcpherson WBGT Estimate
- REFERENCES
- ----------
- [1] Lemke et. al. - 2012 - Calculating workplace
- WBGT from meteorological data: a tool for climate
- change assessment, Industrial Health, 2012, 50,
- 267-278
- [2] McPherson MJ (2008) Subsurface Ventilation
- and Environmental Engineering, 2nd. Ed. Chapter 17.
- Physiological reactors to climatic conditions.
- """
- ed = 6.106 * np.exp((17.27 * t_dew) / (237.3 + t_dew))
- ew = 6.106 * np.exp((17.27 * tpwb) / (237.3 + tpwb))
- value = (1556. * ed) - (1.484 * ed * tpwb) - (1556. * ew) + \
- (1.484 * ew * tpwb) + 1010 * (t_air - tpwb)
- return value
- def wbgt(t_pwb, t_air, v=1.4):
- """Compute Wet Bulb Globe Temperature
- REFERENCES
- ----------
- [1] Lemke et. al. - 2012 - Calculating workplace
- WBGT from meteorological data: a tool for climate
- change assessment, Industrial Health, 2012, 50,
- 267-278
- [2] Bernard TE, Pourmoghani M. (1999) - Prediction
- of workplace wet bulb global temperature. Appl.
- Occup Environ Hyg 14, 126-34.
- """
- if v > 3:
- # At v > 3/ms
- wbgt_ind = 0.7 * t_pwb + 0.3 * t_air
- elif v >= 0.3 and v <= 3:
- wbgt_ind = 0.67 * t_pwb + 0.33 * t_air - 0.048 * \
- np.log10(v * (t_air - t_pwb))
- return wbgt_ind
- def arm_dewPoint(t, rh):
- """Compute Dew Point using August-Roche-Magnus Approximation
- REFERENCES
- ----------
- [1] Mark G. Lawrence, 2005, The relationship between relative
- humidity and the dew point temperature in moist air: a simple
- conversion and applications, American Meteorological Society,
- February 2005, 225-233
- """
- dew = 243.04 * (np.log10(rh / 100) + ( (17.625 * t) / (243.04 + t))) / \
- (17.625 - np.log10(rh/100) - ((17.625 * t) / (243.04 + t)))
- return dew
- def insulationClothing(clo):
- # Units: W/m2
- return 0.155 * clo
- def clothingFactor(clo):
- insulation_factor = insulationClothing(clo)
- if insulation_factor <= 0.078:
- f_cl = 1 + (1.29 * insulation_factor)
- else:
- f_cl = 1.05 + (0.645 * insulation_factor)
- # --
- clothing = namedtuple("CL", "ICL FCL")
- result = clothing(insulation_factor, f_cl)
- return result
- def MetabolicHeatGeneration(metRate):
- # Units: W/m2
- return metRate * 58.15
- def ExternalWorkHeatGeneration(workRate):
- # Units: W/m2
- return workRate * 58.15
- def InternalHeatGeneration(metRate, workRate):
- met = MetabolicHeatGeneration(metRate)
- work = ExternalWorkHeatGeneration(workRate)
- internalHeat = met - work
- # --
- MW = namedtuple("InternalHeat", "met work mw")
- result = MW(met, work, internalHeat)
- return result
- def temperatureClothing(temp, vel_air, clothing, h_int):
- """Compute Temperature of Cloth"""
- # Constants that enable configuration
- itr = 0
- nmax = 150
- tol = 15e-4
- # -- Modifying Kelvin Ranges
- _temp = temp.get("air")
- taa = temp.get("air") + 273
- tra = temp.get("radiant") + 273
- # Computations
- hcf = 12.1 * np.sqrt(vel_air)
- # First guess for clothing temperatures
- TCLA = taa + (35.5 - _temp) / (3.5 * clothing.ICL + 0.1)
- # calculation terms
- p1 = clothing.ICL + clothing.FCL
- p2 = p1 * 3.96
- p3 = p1 * 100
- p4 = p1 * taa
- p5 = (308.7 - 0.028 * h_int.mw) + (p2 * (tra / 100)**4)
- # --
- xn = TCLA / 100
- xf = TCLA / 50
- while (abs(xn - xf) > tol).all():
- xf = (xf + xn) / 2
- hcn = 2.38 * (abs(100 * xf - taa)**0.25)
- # --
- if (hcf > hcn).all():
- hc = hcf
- else:
- hc = hcn
- # --
- xn = (p5 + p4 * hc - p2 * xf**4) / (100 + p3 * hc)
- itr += 1
- if itr > nmax:
- break
- # --
- Tcl = 100 * xn - 273
- # --
- out = namedtuple("TemperatureofClothing", "tcl hc")
- result = out(Tcl, hc)
- return result
- def heatLoss(temp, clothing, air, _hint, tcl):
- # Get values
- tair = temp.get("air")
- trad = temp.get("radiant")
- f_cloth = clothing.FCL
- pw = air
- met = _hint.met
- mw = _hint.mw
- t_cl = tcl.tcl
- hc = tcl.hc
- # -- Compute losses
- hl_1 = 3.05 * 0.001 * (5733 - (6.99 * mw) - pw)
- if mw > 58.15:
- hl_2 = 0.42 * (mw - 58.15)
- else:
- hl_2 = 0
- hl_3 = 1.7 * 0.00001 * met * (5867 - pw)
- hl_4 = 0.0014 * met * (34 - tair)
- xn = (t_cl + 273) / 100
- hl_5 = 3.96 * f_cloth * (xn**4 - ((trad + 273) / 100)**4)
- hl_6 = f_cloth * hc * (t_cl - tair)
- # --
- return (hl_1 + hl_2 + hl_3 + hl_4 + hl_5 + hl_6)
- def computePMV(hLoss, ih):
- ts = 0.303 * np.exp(-0.036 * ih.met) + 0.028
- pmv = ts * (ih.mw - hLoss)
- return pmv
- def computePPD(pmv):
- ppd = 100 - (95 * np.exp(-0.03353 * pmv**4 - 0.2179 * pmv**2))
- return ppd
Add Comment
Please, Sign In to add comment