Guest User

Untitled

a guest
Jun 20th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.91 KB | None | 0 0
  1. import numpy as np
  2.  
  3. """
  4. Building Comfort Computation Tools
  5.  
  6. A collection of estimation and computation
  7. tools for computing the indices and parameters
  8. required to generate comfort indices.
  9. """
  10.  
  11.  
  12. def mcPhersonEstimate(tpwb, t_air, t_dew):
  13. """Compute Mcpherson WBGT Estimate
  14.  
  15. REFERENCES
  16. ----------
  17. [1] Lemke et. al. - 2012 - Calculating workplace
  18. WBGT from meteorological data: a tool for climate
  19. change assessment, Industrial Health, 2012, 50,
  20. 267-278
  21.  
  22. [2] McPherson MJ (2008) Subsurface Ventilation
  23. and Environmental Engineering, 2nd. Ed. Chapter 17.
  24. Physiological reactors to climatic conditions.
  25. """
  26. ed = 6.106 * np.exp((17.27 * t_dew) / (237.3 + t_dew))
  27. ew = 6.106 * np.exp((17.27 * tpwb) / (237.3 + tpwb))
  28. value = (1556. * ed) - (1.484 * ed * tpwb) - (1556. * ew) + \
  29. (1.484 * ew * tpwb) + 1010 * (t_air - tpwb)
  30. return value
  31.  
  32.  
  33. def wbgt(t_pwb, t_air, v=1.4):
  34. """Compute Wet Bulb Globe Temperature
  35.  
  36. REFERENCES
  37. ----------
  38. [1] Lemke et. al. - 2012 - Calculating workplace
  39. WBGT from meteorological data: a tool for climate
  40. change assessment, Industrial Health, 2012, 50,
  41. 267-278
  42.  
  43. [2] Bernard TE, Pourmoghani M. (1999) - Prediction
  44. of workplace wet bulb global temperature. Appl.
  45. Occup Environ Hyg 14, 126-34.
  46. """
  47. if v > 3:
  48. # At v > 3/ms
  49. wbgt_ind = 0.7 * t_pwb + 0.3 * t_air
  50. elif v >= 0.3 and v <= 3:
  51.  
  52. wbgt_ind = 0.67 * t_pwb + 0.33 * t_air - 0.048 * \
  53. np.log10(v * (t_air - t_pwb))
  54. return wbgt_ind
  55.  
  56.  
  57. def arm_dewPoint(t, rh):
  58. """Compute Dew Point using August-Roche-Magnus Approximation
  59.  
  60. REFERENCES
  61. ----------
  62. [1] Mark G. Lawrence, 2005, The relationship between relative
  63. humidity and the dew point temperature in moist air: a simple
  64. conversion and applications, American Meteorological Society,
  65. February 2005, 225-233
  66. """
  67. dew = 243.04 * (np.log10(rh / 100) + ( (17.625 * t) / (243.04 + t))) / \
  68. (17.625 - np.log10(rh/100) - ((17.625 * t) / (243.04 + t)))
  69. return dew
  70.  
  71.  
  72. def insulationClothing(clo):
  73. # Units: W/m2
  74. return 0.155 * clo
  75.  
  76.  
  77. def clothingFactor(clo):
  78. insulation_factor = insulationClothing(clo)
  79. if insulation_factor <= 0.078:
  80. f_cl = 1 + (1.29 * insulation_factor)
  81. else:
  82. f_cl = 1.05 + (0.645 * insulation_factor)
  83. # --
  84. clothing = namedtuple("CL", "ICL FCL")
  85. result = clothing(insulation_factor, f_cl)
  86. return result
  87.  
  88.  
  89. def MetabolicHeatGeneration(metRate):
  90. # Units: W/m2
  91. return metRate * 58.15
  92.  
  93.  
  94. def ExternalWorkHeatGeneration(workRate):
  95. # Units: W/m2
  96. return workRate * 58.15
  97.  
  98.  
  99. def InternalHeatGeneration(metRate, workRate):
  100. met = MetabolicHeatGeneration(metRate)
  101. work = ExternalWorkHeatGeneration(workRate)
  102. internalHeat = met - work
  103. # --
  104. MW = namedtuple("InternalHeat", "met work mw")
  105. result = MW(met, work, internalHeat)
  106. return result
  107.  
  108.  
  109. def temperatureClothing(temp, vel_air, clothing, h_int):
  110. """Compute Temperature of Cloth"""
  111. # Constants that enable configuration
  112. itr = 0
  113. nmax = 150
  114. tol = 15e-4
  115. # -- Modifying Kelvin Ranges
  116. _temp = temp.get("air")
  117. taa = temp.get("air") + 273
  118. tra = temp.get("radiant") + 273
  119. # Computations
  120. hcf = 12.1 * np.sqrt(vel_air)
  121. # First guess for clothing temperatures
  122. TCLA = taa + (35.5 - _temp) / (3.5 * clothing.ICL + 0.1)
  123. # calculation terms
  124. p1 = clothing.ICL + clothing.FCL
  125. p2 = p1 * 3.96
  126. p3 = p1 * 100
  127. p4 = p1 * taa
  128. p5 = (308.7 - 0.028 * h_int.mw) + (p2 * (tra / 100)**4)
  129. # --
  130. xn = TCLA / 100
  131. xf = TCLA / 50
  132. while (abs(xn - xf) > tol).all():
  133. xf = (xf + xn) / 2
  134. hcn = 2.38 * (abs(100 * xf - taa)**0.25)
  135. # --
  136. if (hcf > hcn).all():
  137. hc = hcf
  138. else:
  139. hc = hcn
  140. # --
  141. xn = (p5 + p4 * hc - p2 * xf**4) / (100 + p3 * hc)
  142. itr += 1
  143. if itr > nmax:
  144. break
  145. # --
  146. Tcl = 100 * xn - 273
  147. # --
  148. out = namedtuple("TemperatureofClothing", "tcl hc")
  149. result = out(Tcl, hc)
  150. return result
  151.  
  152.  
  153. def heatLoss(temp, clothing, air, _hint, tcl):
  154. # Get values
  155. tair = temp.get("air")
  156. trad = temp.get("radiant")
  157. f_cloth = clothing.FCL
  158. pw = air
  159. met = _hint.met
  160. mw = _hint.mw
  161. t_cl = tcl.tcl
  162. hc = tcl.hc
  163. # -- Compute losses
  164. hl_1 = 3.05 * 0.001 * (5733 - (6.99 * mw) - pw)
  165. if mw > 58.15:
  166. hl_2 = 0.42 * (mw - 58.15)
  167. else:
  168. hl_2 = 0
  169. hl_3 = 1.7 * 0.00001 * met * (5867 - pw)
  170. hl_4 = 0.0014 * met * (34 - tair)
  171. xn = (t_cl + 273) / 100
  172. hl_5 = 3.96 * f_cloth * (xn**4 - ((trad + 273) / 100)**4)
  173. hl_6 = f_cloth * hc * (t_cl - tair)
  174. # --
  175. return (hl_1 + hl_2 + hl_3 + hl_4 + hl_5 + hl_6)
  176.  
  177.  
  178. def computePMV(hLoss, ih):
  179. ts = 0.303 * np.exp(-0.036 * ih.met) + 0.028
  180. pmv = ts * (ih.mw - hLoss)
  181. return pmv
  182.  
  183.  
  184. def computePPD(pmv):
  185. ppd = 100 - (95 * np.exp(-0.03353 * pmv**4 - 0.2179 * pmv**2))
  186. return ppd
Add Comment
Please, Sign In to add comment