Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
D_ins = Rins * Insulation.thermalCond #depth of insulatino
if D_ins > 0.01:
thickness = [0.01,D_ins,0.0127]
layers = [Wood,Insulation,Gypsum]
else:
thickness = [0.01,0.0127]
layers = [Wood,Gypsum]
wall = Element(0.22,0.92,thickness,layers,0.,293.,0.,"WoodFrameWall")
# If wood frame wall, assume wooden floor
alb = 0.2
emis = 0.9
thickness = [0.05,0.05]
wood = Material(1.31, 2240.0*836.8)
mass = Element(alb,emis,thickness,[wood,wood],0.,293.,1.,"WoodFloor")
elif TypeWall[j][k] == "SteelFrame":
# 1" stucco, 8" concrete, tbd insulation, 1/2" gypsum
Rbase = 0.271087 # based on stucco, concrete, gypsum
Rins = RvalWall[j][k] - Rbase
D_ins = Rins * Insulation.thermalCond
if D_ins > 0.01:
thickness = [0.0254,0.0508,0.0508,0.0508,0.0508,D_ins,0.0127]
layers = [Stucco,Concrete,Concrete,Concrete,Concrete,Insulation,Gypsum]
else: # If insulation is too thin, assume no insulation
thickness = [0.0254,0.0508,0.0508,0.0508,0.0508,0.0127]
layers = [Stucco,Concrete,Concrete,Concrete,Concrete,Gypsum]
wall = Element(0.15,0.92,thickness,layers,0.,293.,0.,"SteelFrame")
# If mass wall, assume mass foor
nightStart = 18. # arbitrary values for begin/end hour for night setpoint
nightEnd = 8.
maxdx = 250. # max dx (m)
self.geoParam = Param(self.h_ubl1, self.h_ubl2, self.h_ref, self.h_temp, self.h_wind, self.c_circ,
self.maxDay, self.maxNight, self.latTree, self.latGrss, self.albVeg, self.vegStart, self.vegEnd,
nightStart, nightEnd, self.windMin, self.WGMAX, self.c_exch, maxdx, self.G, self.CP, self.VK, self.R,
self.RV, self.LV, math.pi, self.SIGMA, self.WATERDENS, self.LVTT, self.TT, self.ESTT, self.CL,
self.CPV, self.B, self.CM, self.COLBURN)
self.UBL = UBLDef(
'C', self.charLength, self.weather.staTemp[0], maxdx, self.geoParam.dayBLHeight, self.geoParam.nightBLHeight)
# Defining road
emis = 0.93
asphalt = Material(self.kRoad, self.cRoad, 'asphalt')
road_T_init = 293.
road_horizontal = 1
# fraction of surface vegetation coverage
road_veg_coverage = min(self.vegCover/(1-self.bldDensity), 1.)
# define road layers
road_layer_num = int(math.ceil(self.d_road/0.05))
# 0.5/0.05 ~ 10 x 1 matrix of 0.05 thickness
thickness_vector = [0.05 for r in range(road_layer_num)]
material_vector = [asphalt for r in range(road_layer_num)]
self.road = Element(self.alb_road, emis, thickness_vector, material_vector, road_veg_coverage,
road_T_init, road_horizontal, name="urban_road")
self.rural = copy.deepcopy(self.road)
self.rural.vegCoverage = self.rurVegCover
#Not defined in the constructor
B.heatCap = (HEAT[j][k]*1000.0)/AreaFloor[j] # heating Capacity converted to W/m2 by era, climate type
B.Type = BLDTYPE[i]
B.Era = BUILTERA[j]
B.Zone = ZONETYPE[k]
refDOE[i][j][k] = B
# Define wall, mass(floor), roof
# Reference from E+ for conductivity, thickness (reference below)
# Material: (thermalCond, volHeat = specific heat * density)
Concrete = Material (1.311, 836.8 * 2240,"Concrete")
Insulation = Material (0.049, 836.8 * 265.0, "Insulation")
Gypsum = Material (0.16, 830.0 * 784.9, "Gypsum")
Wood = Material (0.11, 1210.0 * 544.62, "Wood")
Stucco = Material(0.6918, 837.0 * 1858.0, "Stucco")
# Wall (1 in stucco, concrete, insulation, gypsum)
# Check TypWall by era, by climate
if TypeWall[j][k] == "MassWall":
#Construct wall based on R value of Wall from refDOE and properties defined above
# 1" stucco, 8" concrete, tbd insulation, 1/2" gypsum
Rbase = 0.271087 # R val based on stucco, concrete, gypsum
Rins = RvalWall[j][k] - Rbase #find insulation value
D_ins = Rins * Insulation.thermalCond # depth of ins from m2*K/W * W/m*K = m
if D_ins > 0.01:
thickness = [0.0254,0.0508,0.0508,0.0508,0.0508,D_ins,0.0127]
layers = [Stucco,Concrete,Concrete,Concrete,Concrete,Insulation,Gypsum]
else:
#if it's less then 1 cm don't include in layers
thickness = [0.0254,0.0508,0.0508,0.0508,0.0508,0.0127]
if len(materials.layerThickness) > 1:
for j in range(len(materials.layerThickness)):
# Break up each layer that's more than max thickness (0.05m)
if materials.layerThickness[j] > max_thickness:
nlayers = math.ceil(materials.layerThickness[j]/float(max_thickness))
for i in range(int(nlayers)):
newmat.append(Material(k[j], Vhc[j], name=materials._name))
newthickness.append(materials.layerThickness[j]/float(nlayers))
# Material that's less then min_thickness is not added.
elif materials.layerThickness[j] < min_thickness:
print("WARNING: Material '{}' layer found too thin (<{:.2f}cm), ignored.").format(
materials._name, min_thickness*100)
else:
newmat.append(Material(k[j], Vhc[j], name=materials._name))
newthickness.append(materials.layerThickness[j])
else:
# Divide single layer into two (uwg assumes at least 2 layers)
if materials.layerThickness[0] > max_thickness:
nlayers = math.ceil(materials.layerThickness[0]/float(max_thickness))
for i in range(int(nlayers)):
newmat.append(Material(k[0], Vhc[0], name=materials._name))
newthickness.append(materials.layerThickness[0]/float(nlayers))
# Material should be at least 1cm thick, so if we're here,
# should give warning and stop. Only warning given for now.
elif materials.layerThickness[0] < min_thickness*2:
newthickness = [min_thickness/2., min_thickness/2.]
newmat = [Material(k[0], Vhc[0], name=materials._name),
Material(k[0], Vhc[0], name=materials._name)]
mass = Element(alb,emis,thickness,[Concrete,Concrete],0.,293.,1.,"MassFloor")
elif TypeWall[j][k] == "MetalWall":
# metal siding, insulation, 1/2" gypsum
alb = 0.2
emis = 0.9
D_ins = max((RvalWall[j][k] * Insulation.thermalCond)/2, 0.01) #use derived insul thickness or 0.01 based on max
thickness = [D_ins,D_ins,0.0127]
materials = [Insulation,Insulation,Gypsum]
wall = Element(alb,emis,thickness,materials,0,293,0,"MetalWall")
# Mass (assume 4" concrete);
alb = 0.2
emis = 0.9
thickness = [0.05, 0.05]
concrete = Material(1.31, 2240.0*836.8)
mass = Element(alb,emis,thickness,[concrete,concrete],0.,293.,1.,"MassFloor")
# Roof
if TypeRoof[j][k] == "IEAD": #Insulation Entirely Above Deck
# IEAD-> membrane, insulation, decking
alb = 0.2
emis = 0.93
D_ins = max(RvalRoof[j][k] * Insulation.thermalCond/2.,0.01);
roof = Element(alb,emis,[D_ins,D_ins],[Insulation,Insulation],0.,293.,0.,"IEAD")
elif TypeRoof[j][k] == "Attic":
# IEAD-> membrane, insulation, decking
alb = 0.2
emis = 0.9
D_ins = max(RvalRoof[j][k] * Insulation.thermalCond/2.,0.01)
roof = Element(alb,emis,[D_ins,D_ins],[Insulation,Insulation],0.,293.,0.,"Attic")
nlayers = math.ceil(materials.layerThickness[0]/float(max_thickness))
for i in range(int(nlayers)):
newmat.append(Material(k[0], Vhc[0], name=materials._name))
newthickness.append(materials.layerThickness[0]/float(nlayers))
# Material should be at least 1cm thick, so if we're here,
# should give warning and stop. Only warning given for now.
elif materials.layerThickness[0] < min_thickness*2:
newthickness = [min_thickness/2., min_thickness/2.]
newmat = [Material(k[0], Vhc[0], name=materials._name),
Material(k[0], Vhc[0], name=materials._name)]
print("WARNING: a thin (<2cm) single material '{}' layer found. May cause error.".format(
materials._name))
else:
newthickness = [materials.layerThickness[0]/2., materials.layerThickness[0]/2.]
newmat = [Material(k[0], Vhc[0], name=materials._name),
Material(k[0], Vhc[0], name=materials._name)]
return newmat, newthickness
#Not defined in the constructor
B.heatCap = (HEAT[j][k]*1000.0)/AreaFloor[j] # heating Capacity converted to W/m2 by era, climate type
B.Type = BLDTYPE[i]
B.Era = BUILTERA[j]
B.Zone = ZONETYPE[k]
refDOE[i][j][k] = B
# Define wall, mass(floor), roof
# Reference from E+ for conductivity, thickness (reference below)
# Material: (thermalCond, volHeat = specific heat * density)
Concrete = Material (1.311, 836.8 * 2240,"Concrete")
Insulation = Material (0.049, 836.8 * 265.0, "Insulation")
Gypsum = Material (0.16, 830.0 * 784.9, "Gypsum")
Wood = Material (0.11, 1210.0 * 544.62, "Wood")
Stucco = Material(0.6918, 837.0 * 1858.0, "Stucco")
# Wall (1 in stucco, concrete, insulation, gypsum)
# Check TypWall by era, by climate
if TypeWall[j][k] == "MassWall":
#Construct wall based on R value of Wall from refDOE and properties defined above
# 1" stucco, 8" concrete, tbd insulation, 1/2" gypsum
Rbase = 0.271087 # R val based on stucco, concrete, gypsum
Rins = RvalWall[j][k] - Rbase #find insulation value
D_ins = Rins * Insulation.thermalCond # depth of ins from m2*K/W * W/m*K = m
if D_ins > 0.01:
thickness = [0.0254,0.0508,0.0508,0.0508,0.0508,D_ins,0.0127]
layers = [Stucco,Concrete,Concrete,Concrete,Concrete,Insulation,Gypsum]
else:
#if it's less then 1 cm don't include in layers
thickness = [0.0254,0.0508,0.0508,0.0508,0.0508,0.0127]
layers = [Stucco,Concrete,Concrete,Concrete,Concrete,Gypsum]