Overview and Mathematical Basis
Overview and Mathematical Basis
This was a project I took on for the M3 Math Modeling challenge. I took care of Part 1, while my teammates took care of Parts 2 and 3. While we used a diverse set of tools, I found Wolfram to be the most versatile in the end, with my part written completely in WolframLanguage and my teammates’ parts being moved into notebooks.
The goal of the challenge was to create a model to predict temperatures inside a non-air-conditioned dwelling during a heat wave, with temperature data and assorted information about the dwelling provided.
I based my model on Newton’s Law of Cooling and associated equations describing heat transfer. To use these equations, I needed to procedurally to determine (or approximate) the heat transfer coefficient, the total area, and the temperature differential. I did so with a selection of the provided features.
I also incorporate added heat from additional persons in a dwelling and, in determining the heat transfer coefficient, the amount and type of insulation in a home based on its age.
Data Collection
Data Collection
To begin, the dataset is created with select relevant features:
In[]:=
data=;
In[]:=
Dataset[data]
Out[]=
Thermal Conductivity
Thermal Conductivity
To use our known equations for heat transfer, we must know the thermal conductivity (the rate at which heat moves through) of a dwelling.
Now, how do we calculate the thermal conductivity of a house?
We can use the age of the house to calculate the R-value (a measure of conductivity) based on amount and type of insulation:
In[]:=
convertRtoU[r_]:=Module[{ri}, (*R imperial to R metric*) ri=r5.682; (*R metric to U*) 1ri]
We source R-values from an external source (Reference 4,6):
In[]:=
calculateInsulationConductivity[year_Integer,rooms_Integer]:=Module{}, Which year<1965, 0.026, year<1970, convertRtoU[8]2, year<1990, convertRtoU[3.5]3.5, True, convertRtoU[13]3.5
Now, we want to calculate heat transfer into the house from the heat outside.
We have to make a few assumptions:
1
.Each wall is 2.4m tall
2
.Ceilings are insulated
3
.Heat transfer is uniform
We then need to know the area of the house (since area is a factor in our equations) and the number of people (people contribute heat as well), as well as the number of stories and rooms (to help in calculating a more complex area).
Under those assumptions, we can calculate heat transfer using the equations q = hA(T - t) and temp = q/(m*c), where c is the specific heat of air. We also want to take into account heat added by people on the inside, so since a person, on average, gives off 120W of energy (Reference 5), we can find heat given off by each person per hour:
In[]:=
calculateHeatIn[year_,squaremeters_,stories_,rooms_,people_,tout_,tin_]:=Module[{heatTransferCoeff,housePerimeter,totalArea,heatTransfer,qtotal,m,c,deltaT},heatTransferCoeff=calculateInsulationConductivity[year,rooms];housePerimeter=Sqrt[squaremeters/stories]*4;totalArea=housePerimeter*2.4*stories+squaremeters(*fortheceiling*);heatTransfer=heatTransferCoeff*totalArea*(tout-tin)(*inJ/s*)+120/(3600*24)*people;qtotal=heatTransfer*3600(*overonehour*);m=squaremeters*2.4(*volumeofairinhome(m^3)*)*1280(*massofair*);c=1.005;deltaT=qtotal/(m*c)(*changeinheat*);deltaT]
Now that we’ve determined our model, we must test it against our given outside temperatures:
In[]:=
outsideTemps=;
In[]:=
calculateHeats[home_]:=Module[{currentHeat=21(*roomtemp*),allHeats},allHeats={};Table[Module[{},currentHeat=currentHeat+calculateHeatIn[home["Year"],home["Size of unit"],home["Stories"],home["Rooms"],home["Persons"],temp,currentHeat];allHeats=Join[allHeats,{currentHeat}];],{temp,outsideTemps}];allHeats]
In[]:=
out=Table[calculateHeats[h],{h,data}];
In[]:=
Grid[Table[{ListLinePlot[{o,outsideTemps},PlotLegends->{"House Temperature","Outside Temperatures"},ImageSize->100,LabelStyle->5],ListLinePlot[o,PlotLabel->"House Temperatures",ImageSize->100,LabelStyle->5]},{o,out}]]
Out[]=
Conclusions
Conclusions
So, with our final model, we can see that the internal house temperature of each dwelling responds to - but does not entirely match - external temperatures, instead lagging behind. That makes intuitive sense - temperatures take time to adapt - so we conclude that our model is sufficiently accurate.
CITE THIS NOTEBOOK
CITE THIS NOTEBOOK
Calculating temperatures inside non-air-conditioned dwellings during heat waves
by William Choi-Kim
Wolfram Community, STAFF PICKS, March 19, 2025
https://community.wolfram.com/groups/-/m/t/3419710
by William Choi-Kim
Wolfram Community, STAFF PICKS, March 19, 2025
https://community.wolfram.com/groups/-/m/t/3419710