Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
e_wall = BEM[j].wall.emissivity
T_wall = BEM[j].wall.layerTemp[0]
# calculates the infrared radiation for wall, taking into account radiation exchange from road
_infra_road_, BEM[j].wall.infra = infracalcs(UCM, forc, UCM.road.emissivity, e_wall, UCM.roadTemp, T_wall)
# Update element temperatures
BEM[j].mass.layerTemp = BEM[j].mass.Conduction(simTime.dt, BEM[j].building.fluxMass,1.,0.,BEM[j].building.fluxMass)
BEM[j].roof.SurfFlux(forc,parameter,simTime,UCM.canHum,T_can,max(forc.wind,UCM.canWind),1.,BEM[j].building.fluxRoof)
BEM[j].wall.SurfFlux(forc,parameter,simTime,UCM.canHum,T_can,UCM.canWind,1.,BEM[j].building.fluxWall)
# Note the average wall & roof temperature
UCM.wallTemp = UCM.wallTemp + BEM[j].frac*BEM[j].wall.layerTemp[0]
UCM.roofTemp = UCM.roofTemp + BEM[j].frac*BEM[j].roof.layerTemp[0]
# Update road infra calc (assume walls have similar emissivity, so use the last one)
UCM.road.infra, _wall_infra = infracalcs(UCM,forc,UCM.road.emissivity,e_wall,UCM.roadTemp,UCM.wallTemp)
UCM.road.SurfFlux(forc,parameter,simTime,UCM.canHum,T_can,UCM.canWind,2.,0.)
UCM.roadTemp = UCM.road.layerTemp[0]
# Sensible & latent heat flux (total)
if UCM.latHeat != None:
UCM.latHeat = UCM.latHeat + UCM.latAnthrop + UCM.treeLatHeat + UCM.road.lat*(1.-UCM.bldDensity)
# ---------------------------------------------------------------------
# Advective heat flux to UBL from VDM
#
# Note: UWG_Matlab code here is modified to compensate for rounding errors
# that occur when recursively adding forDens, intAdv1, and intAdv2.
# This causes issues in the UBL.advHeat calculatiuon when large (1e5)
# numbers are subtracted to produce small numbers (1e-10) that can
# differ from equivalent matlab calculations by a factor of 2.
# Values this small are ~ 0, but for consistency's sake Kahan Summation
for j in range(len(BEM)):
# Building energy model
BEM[j].building.BEMCalc(UCM, BEM[j], forc, parameter, simTime)
BEM[j].ElecTotal = BEM[j].building.ElecTotal * BEM[j].fl_area # W m-2
# Update roof infra calc
e_roof = BEM[j].roof.emissivity
T_roof = BEM[j].roof.layerTemp[0]
BEM[j].roof.infra = e_roof * (forc.infra - sigma * T_roof**4.)
# update wall infra calc (road done later)
e_wall = BEM[j].wall.emissivity
T_wall = BEM[j].wall.layerTemp[0]
# calculates the infrared radiation for wall, taking into account radiation exchange from road
_infra_road_, BEM[j].wall.infra = infracalcs(UCM, forc, UCM.road.emissivity, e_wall, UCM.roadTemp, T_wall)
# Update element temperatures
BEM[j].mass.layerTemp = BEM[j].mass.Conduction(simTime.dt, BEM[j].building.fluxMass,1.,0.,BEM[j].building.fluxMass)
BEM[j].roof.SurfFlux(forc,parameter,simTime,UCM.canHum,T_can,max(forc.wind,UCM.canWind),1.,BEM[j].building.fluxRoof)
BEM[j].wall.SurfFlux(forc,parameter,simTime,UCM.canHum,T_can,UCM.canWind,1.,BEM[j].building.fluxWall)
# Note the average wall & roof temperature
UCM.wallTemp = UCM.wallTemp + BEM[j].frac*BEM[j].wall.layerTemp[0]
UCM.roofTemp = UCM.roofTemp + BEM[j].frac*BEM[j].roof.layerTemp[0]
# Update road infra calc (assume walls have similar emissivity, so use the last one)
UCM.road.infra, _wall_infra = infracalcs(UCM,forc,UCM.road.emissivity,e_wall,UCM.roadTemp,UCM.wallTemp)
UCM.road.SurfFlux(forc,parameter,simTime,UCM.canHum,T_can,UCM.canWind,2.,0.)
UCM.roadTemp = UCM.road.layerTemp[0]
# Sensible & latent heat flux (total)