-
Notifications
You must be signed in to change notification settings - Fork 0
/
BoundaryConditions.m
157 lines (121 loc) · 3.35 KB
/
BoundaryConditions.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BOUNDARY CONDITIONS %%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [BC]=BoundaryConditions(filename)
global wuficases;
global elements;
global resistance;
datiMediati=mediaDati(filename);
BC=zeros(12,4);
%Pvap esterne
for i=1:12
te=datiMediati(i,1);
RHe=datiMediati(i,3)*.01;
ti=ContIntTemp(te);
RHi=IntRelHumidity(te,ti,RHe);
estPsat=SatPressure(te)*RHe;
intPsat=SatPressure(ti)*RHi;
BC(i,:)=[te RHe ti RHi];
% BC(i,:)=[te RHe];
endfor
endfunction
function RHi=IntRelHumidity(te,ti,RHe)
c=1;
class_p=1360;
class_pm=200;
switch c
%Internal Vapour Pressure - Continental and Tropical Climates
%Normal Occupancy
case 1
if te<-10
RHi=.35;
elseif te>-10&&te<20
RHi=.35+(te+10)*.01;
else
RHi=.65;
endif
%High Occupancy
case 2
if te<-10
RHi=.4;
elseif te>-10&&te<20
RHi=.4+(te+10)*.01;
else
RHi=.70;
endif
%maritime climates
case 3
if te<0
delta_p=class_p;
elseif te<20 && te>0
delta_p=class_p-te*(class_p-class_pm)/20;
else
delta_p=class_pm;
endif
delta_p;
pe=SatPressure(te)*RHe;
pi=pe+delta_p;
RHi=pi/SatPressure(ti);
endswitch
endfunction
function [datiMediati]=mediaDati(filename)
global wuficases;
global elements;
global resistance;
datiMediati=zeros(12,3);
[date, hour, dry_bulb_temperature,dew_point_temperature,relative_humidity]=EPWopen(filename);
Length=size(dry_bulb_temperature);
datiMediatiTemp=zeros(12,4);
for i=1:Length
mese=date(i,2);
datiMediatiTemp(mese,1) += dry_bulb_temperature(i);
datiMediatiTemp(mese,2) += dew_point_temperature(i);
datiMediatiTemp(mese,3) += relative_humidity(i);
datiMediatiTemp(mese,4)++;
endfor
for i=1:12
datiMediati(i,1)=datiMediatiTemp(i,1)/datiMediatiTemp(i,4);
datiMediati(i,2)=datiMediatiTemp(i,2)/datiMediatiTemp(i,4);
datiMediati(i,3)=datiMediatiTemp(i,3)/datiMediatiTemp(i,4);
endfor
%disp(datiMediati);
endfunction
function ti = ContIntTemp(te)
%Internal Temperature- Continental and Tropical Climates
if te<10
ti=20;
elseif te>10&&te<20
ti=20+.5*(te-10);
else
ti=25;
endif
endfunction
function [date, hour, dry_bulb_temperature,dew_point_temperature,relative_humidity]=EPWopen(filename)
global wuficases;
global elements;
global resistance;
disp('------------- EPW open -----------');
disp(filename);
fid=fopen(filename,'r'); % Open TMY file
if fid == -1
disp(['file not found: ',filename]);
else
tmy = csvread (filename); %read the file
endif
% file header information
date = zeros(8760,3);
hour = zeros(8760,1);
dry_bulb_temperature = ones(8760,1);
dew_point_temperature = ones(8760,1);
relative_humidity = ones(8760,1);
for i=9:8768
date(i-8,1:3) = tmy(i,1:3);
hour(i-8) = tmy(i,4);
dry_bulb_temperature(i-8) = (tmy(i,7));
dew_point_temperature(i-8) = (tmy(i,8));
relative_humidity(i-8) = (tmy(i,9));
endfor
%disp([ date(1) hour(1) dry_bulb_temperature(1) dew_point_temperature(1) relative_humidity(1)]);
endfunction