def temprad(t,rh,rshort,rdiffuse,sunelev,albedo): e = (rh/100.0)*(6.105*math.exp((t*17.27)/(237.7+t))) sig = 5.67e-8 emiair = 0.66 + 0.039 * math.sqrtf(e) tsk = t + 273.12 ratio=0.0429*sin(sunelev*rads)+0.345*cos(sunelev*rads) proj=0.308 * cos(rads * (sunelev* (0.998- (math.pow(sunelev, 2.0) / 50000.0)))) temprad= math.pow(273.16 - (emiair * math.pow(tsk, 4.0) + (1-albedo) * (rdiffuse) / (sig* 0.97)+(1-albedo) * proj * ratio* ((rshort-rdiffuse)/(sig*0.97))),0.25)- 273.16 return temprad
def Normalize(self): norm = math.sqrtf(self.a * self.a + self.b * self.b + self.c * self.c) if norm != 0.0: self.a /= norm self.b /= norm self.c /= norm self.d /= norm else: self.Zero()
def pmv_hoppe_iso( t, rh, wind, mtrad, iclo): eta = 0.01; # Mechanical efficiency age = 35.0; # Age mbody = 75.0; # Weigth in kg ht = 1.75; # Heigth in m tcl = 30.005 MAX_LOOP = 200 MAX_LOOP_HALF = MAX_LOOP / 2 tcl_eps = 0.05 eps = 0.97 sigm = 5.67e-8 adu = 0.203 * math.pow(mbody, 0.425) * math.pow(ht, 0.725) metbf = 3.19 * math.pow(mbody, (3.0/4.0)) * (1.0 + 0.004* (30.0- age)+0.018 * ((ht * 100.0/ math.pow(mbody, (1.0/3.0))) - 42.1)) metbm = 3.45 * math.pow(mbody, (3.0/4.0)) * (1.0 + 0.004* (30.0- age)+0.010 * ((ht * 100.0/ math.pow(mbody, (1.0/3.0))) - 43.4)) vpa = (rh / 100) * 6.105 * math.pow(2.718281828, ( 17.27*t / ( 237.7 + t ) )) fcl = 1.0 + iclo * 0.15 metb = metabolism(t) metf = metbf + metb metm = metbm + metb metb = (metf+metm)/2.0 h = metb * (1.0 - eta) aef = 0.71 * fcl * adu p1 = 35.7 - 0.032 * (metb / (adu * 1.16))* (1 - eta) tcl1 = tcl for x in range(0, MAX_LOOP_HALF): if x < MAX_LOOP_HALF: hc = 12.06 * math.sqrtf(wind) abhc = 0.0 else: hc = 2.38 * math.pow(fabsf(tcl1 - t), 4.0) abhc = 0.6 * fabsf(math.pow((tcl1 - t), -0.75)) tcl2 = p1 - 0.155 * iclo * (3.94 * 0.00000001* fcl *(math.pow((tcl1 + 273.2),4.0)- math.pow((mtrad+ 273.2), 4.0))+fcl * hc* (tcl1 - t)) diff = math.abs(tcl1 - tcl2) if diff < tcl_eps: break abtcl = -0.155 * iclo * (4.0 * 3.94* 0.00000001* fcl *math.pow((tcl1+ 273.2),3.0) + fcl * hc- fcl *(tcl1 - t)* abhc)- 1.0 tcl1 = tcl1 - (tcl2 - tcl1) / abtcl difhc = (12.06 * math.sqrt(wind)) - (2.38 * (math.pow(math.abs(t - tcl1), 0.25))) if difhc > 0.0 and i == MAX_LOOP_HALF: break tsk = 35.7 - (0.028 * h / adu) esw = 0.42 * adu * (h / adu - 58.08) if esw < 0.0: esw= 0.0 rsum = aef * eps * sigm * (math.pow((tcl1 + 273.2), 4.0) - math.pow((mtrad + 273.2),4.0)) csum = adu * fcl * hc * (tcl1 - t) erel = 0.0023 * metb * (44.0 - 0.75 * vpa) eres = 0.0014 * metb * (34.0 - t) ed = 0.406 * adu * (1.92 * tsk - 25.3- 0.75 * vpa) load = (h - ed - erel - eres - esw - rsum - csum) / adu ts = (0.303 * math.expf(-0.036 * (metb / adu)) + 0.028) pmv= ts * load return pmv