Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#Using pandas for resistance calculations
import pandas as pd

A_wall = 15 #area of wall [m^2]
A_unit = 0.25 #unit area ((H_brick+T_p2*2)*W_wall)
T_1 = 20 #indoor temperature
T_2 = -10 #outdoor temperature

columns_names = ["type","h","L","k","RValue"]

#For layers in series
RSeries_names=["R_outside","R_foam","R_plaster1","R_plaster2","R_inside"]
R1_list = ["conv",10,None,None,0]
R2_list = ["cond",None,0.03,0.026,0]
R3_list = ["cond",None,0.02,0.22,0]
R4_list = ["cond",None,0.02,0.22,0]
R5_list = ["conv",25,None,None, 0]

Resistances_Series = pd.DataFrame([R1_list,R2_list,R3_list,R4_list,R5_list], index = RSeries_names, columns=columns_names)
#Resistances_Series["RValue"][Resistances_Series["type"]=="conv"] = 1.0/Resistances_Series["h"][Resistances_Series["type"]=="conv"] # Calc R values of conv R=1/h
#Resistances_Series["RValue"][Resistances_Series["type"]=="cond"] = Resistances_Series["L"][Resistances_Series["type"]=="cond"] /Resistances_Series["k"][Resistances_Series["type"]=="cond"] # Calc R values of conv R=L/k
R_conv = 1.0/Resistances_Series["h"][Resistances_Series["type"]=="conv"]
R_cond = Resistances_Series["L"][Resistances_Series["type"]=="cond"] /Resistances_Series["k"][Resistances_Series["type"]=="cond"]
Rtot = sum(R_conv)+sum(R_cond)
Rtot_Series = Rtot/A_unit #Total resistance for series layers

#For Layers in Parallel:
RParallel_names=["R_plaster","R_brick","R_plaster"]
R6_list = ["cond",0.015,0.16,0.22,0]
R7_list = ["cond",0.22,0.16,0.72,0]
R8_list = ["cond",0.015,0.16,0.22,0]

Resistances_Parallel = pd.DataFrame([R6_list,R7_list,R8_list], index = RParallel_names, columns=columns_names)
RValues_parallel=1/(Resistances_Parallel["L"][Resistances_Parallel["type"]=="cond"] /(Resistances_Parallel["k"]
[Resistances_Parallel["type"]=="cond"]*Resistances_Parallel["h"][Resistances_Parallel["type"]=="cond"]))
Rtot_parallel = 1/sum(RValues_parallel) #Total resistance for parallel layers

#Total resistance
R_tot = round(Rtot_Series+Rtot_parallel,4)

# Heat transfer
Q_unit = (T_1 - T_2) / R_tot #total heat transfer through the wall per unit width [W]
Q_wall = round(Q_unit * (A_wall/A_unit),4) #total heat transfer through the wall [W]

print 'The total thermal resistance is '+str(R_tot)+ ' degC/W'
print 'The rate of heat transfer through the wall is '+str(Q_wall)+ ' W'
print '*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*'
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import os
import numpy as np
import pandas as pd
import scipy as sp

os.chdir("C:\Users\jude\Desktop\judes script code\Git\Scientific_Python_Assignments_POLIMI_EETBS\Assignment 8_Dontoh")

Windows_DF= pd.read_csv("windows.csv",sep=";",index_col=0)

BeamIrradiance_ED = pd.read_csv("BeamIrradiance.csv",sep=";",index_col=0)
DiffuseIrradiance_Ed = pd.read_csv("DiffuseIrradiance.csv",sep=";",index_col=0)

exposure = raw_input('please enter the exposure ')
latitude = float(raw_input('please enter the latitude of the location '))


if latitude == BeamIrradiance_ED.columns.tolist():
def PXI_calculator(exposure,latitude):
BeamIrradiance_ED = pd.read_csv("BeamIrradiance.csv",sep=";",index_col=0)
result_BeamIrradiance_ED= BeamIrradiance_ED[latitude][exposure]

DiffuseIrradiance_Ed = pd.read_csv("DiffuseIrradiance.csv",sep=";",index_col=0)
result_DiffuseIrradiance_Ed= DiffuseIrradiance_Ed[latitude][exposure]
PXI= result_BeamIrradiance_ED+result_DiffuseIrradiance_Ed
return PXI


if latitude != BeamIrradiance_ED.columns.tolist():


name_of_columns=BeamIrradiance_ED.columns.get_values()
name_of_columns_as_numbers = name_of_columns.astype(np.int32, copy=False)
ED = sp.interp(latitude,name_of_columns_as_numbers,BeamIrradiance_ED.loc[exposure])

name_of_columns=DiffuseIrradiance_Ed.columns.get_values()
name_of_columns_as_numbers = name_of_columns.astype(np.int32, copy=False)
Ed = sp.interp(latitude,name_of_columns_as_numbers,DiffuseIrradiance_Ed.loc[exposure])
PXI= ED+Ed
print "PXI value is " +str(PXI)

#Calculation for PXI for RLF example 1 - Piacenza

latitude_location= "45"

PXI_values=[]
for index in Windows_DF.index.tolist():
print index
print Windows_DF["Direction"][index]
PXI_values = np.append(PXI_values,PXI_calculator(Windows_DF["Direction"][index],latitude_location))
print PXI_values

Windows_DF["PXI"] = PXI_values
Windows_DF.to_csv("windows_completed_withPXI.csv",sep=";")
Windows_DF.to_html("Window_Completed_withPXI.html")


Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>Direction</th>
<th>width</th>
<th>Height</th>
<th>Area</th>
<th>Window_ID</th>
<th>Frame_type</th>
<th>Frame_material</th>
<th>U</th>
<th>SHGC</th>
<th>HF</th>
<th>Q heating</th>
<th>SLF</th>
<th>Doh</th>
<th>Xoh</th>
<th>Fshd</th>
<th>IntShading_ID</th>
<th>IntShading_closeness</th>
<th>IAC_cl</th>
<th>IAC</th>
<th>Tx</th>
<th>Ed</th>
<th>ED</th>
<th>PXI</th>
<th>FFs</th>
<th>C_value</th>
<th>CF</th>
<th>Qcooling</th>
</tr>
<tr>
<th>Name</th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th>east</th>
<td>E</td>
<td>8</td>
<td>1.8</td>
<td>0</td>
<td>5c</td>
<td>Fixed</td>
<td>Wood</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0.9</td>
<td>0.3</td>
<td>0</td>
<td>DrapesLightOpen</td>
<td>0.4</td>
<td>0</td>
<td>0</td>
<td>1.00</td>
<td>0</td>
<td>0</td>
<td>747.0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<th>west</th>
<td>W</td>
<td>8</td>
<td>1.8</td>
<td>0</td>
<td>5c</td>
<td>Fixed</td>
<td>Wood</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0.9</td>
<td>0.3</td>
<td>0</td>
<td>DrapesLightOpen</td>
<td>0.4</td>
<td>0</td>
<td>0</td>
<td>1.00</td>
<td>0</td>
<td>0</td>
<td>747.0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<th>south-Fixed</th>
<td>S</td>
<td>2</td>
<td>1.8</td>
<td>0</td>
<td>5c</td>
<td>Fixed</td>
<td>Wood</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0.9</td>
<td>0.3</td>
<td>0</td>
<td>DrapesLightOpen</td>
<td>0.4</td>
<td>0</td>
<td>0</td>
<td>1.00</td>
<td>0</td>
<td>0</td>
<td>557.0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<th>south-Operable</th>
<td>S</td>
<td>2</td>
<td>1.8</td>
<td>0</td>
<td>5c</td>
<td>Operable</td>
<td>Wood</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0.9</td>
<td>0.3</td>
<td>0</td>
<td>DrapesLightOpen</td>
<td>0.4</td>
<td>0</td>
<td>0</td>
<td>0.64</td>
<td>0</td>
<td>0</td>
<td>557.0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
</tr>
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Name;Direction;width;Height;Area;Window_ID;Frame_type;Frame_material;U;SHGC;HF;Q heating;SLF;Doh;Xoh;Fshd;IntShading_ID;IntShading_closeness;IAC_cl;IAC;Tx;Ed;ED;PXI;FFs;C_value;CF;Qcooling
east;E;8;1.8;0;5c;Fixed;Wood;0;0;0;0;0;0.9;0.3;0;DrapesLightOpen;0.4;0;0;1.0;0;0;747.0;0;0;0;0
west;W;8;1.8;0;5c;Fixed;Wood;0;0;0;0;0;0.9;0.3;0;DrapesLightOpen;0.4;0;0;1.0;0;0;747.0;0;0;0;0
south-Fixed;S;2;1.8;0;5c;Fixed;Wood;0;0;0;0;0;0.9;0.3;0;DrapesLightOpen;0.4;0;0;1.0;0;0;557.0;0;0;0;0
south-Operable;S;2;1.8;0;5c;Operable;Wood;0;0;0;0;0;0.9;0.3;0;DrapesLightOpen;0.4;0;0;0.64;0;0;557.0;0;0;0;0