Inverse Modeling of the Indoor Climate using a 2 State 5
Parameter Model in MatLab
Citation for published version (APA):
Schijndel, van, A. W. M., & Schellen, H. L. (2011). Inverse Modeling of the Indoor Climate using a 2 State 5 Parameter Model in MatLab. In 3rd Annual Meeting of Climate for Culture Project (CfC), EU-FP7-Project no.: 226873, Visby, Sweden, September 2011 (pp. 1-12)
Document status and date: Published: 01/01/2011
Document Version:
Publisher’s PDF, also known as Version of Record (includes final page, issue and volume numbers)
Please check the document version of this publication:
• A submitted manuscript is the version of the article upon submission and before peer-review. There can be important differences between the submitted version and the official published version of record. People interested in the research are advised to contact the author for the final version of the publication, or visit the DOI to the publisher's website.
• The final author version and the galley proof are versions of the publication after peer review.
• The final published version features the final layout of the paper including the volume, issue and page numbers.
Link to publication
General rights
Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights. • Users may download and print one copy of any publication from the public portal for the purpose of private study or research. • You may not further distribute the material or use it for any profit-making activity or commercial gain
• You may freely distribute the URL identifying the publication in the public portal.
If the publication is distributed under the terms of Article 25fa of the Dutch Copyright Act, indicated by the “Taverne” license above, please follow below link for the End User Agreement:
www.tue.nl/taverne
Take down policy
If you believe that this document breaches copyright please contact us at:
openaccess@tue.nl
providing details and we will investigate your claim.
Inverse Modeling of the Indoor Climate using a 2-State-5-Parameters
Model in MatLab
A.W.M. van Schijndel and H.L. Schellen Eindhoven University of Technology (TUE)
Report number: EUCfC_TUE_2011_2
Abstract
This document shows how a simplified dynamic model can be derived from
input-output signals. The input signal contains the external air temperature, relative humidity
and solar irradiation. The output contains the indoor air temperature and relative
humidity. The goal model consists of 2 states and 5 parameters with a physical
meaning.
Conclusion
The approach is very promising finding transfer functions between external and indoor
climates. Furthermore, with this method it seems possible to characterize a single zone building with just 5 physical parameters.
Recommendations
More research is needed to: (a) Investigate whether the method is more general applicable almost all single zone buildings; (b) Improve the model itself with for example more states and more parameters.
Inverse Modeling of the Indoor Climate using a 2-State-5-Parameters Model
in MatLab
Jos van Schijndel
Eindhoven University of Technology, 2011 April
Abstract: This document shows how a simplified dynamic model can be derived from input-output
signals. The input signal contains the external air temperature, relative humidity and solar irradiation. The output contains the indoor air temperature and relative humidity. The goal model consist of two states and 5 parameters with a physical meaning. The method is general applicable.
Step 1: The required input-output data
The inverse modeling method tries to derive a model from existing (measured) input–output data. In this example we use the input-output data that are generated by running the HAMBase model ‘SimpleBuilding1.m’ . (see http://archbps1.campus.tue.nl/bpswiki/index.php/Hamlab )
In Figure 1 the input data (external air temperature, relative humidity and solar irradiation) and the output data (indoor air temperature and relative humidity) are shown (see ClData.txt):
Step 2: Designing the model.
We designed a 2-State-5-Parameter (2S5P) model as follows:
𝐶𝑇𝑑𝑇𝑑𝑡 = GT(Te(t) − T) + fI∗ I(t)
𝐶𝑃𝑑𝑃𝑑𝑡 = GP(Pe(t) − P) Where
Input: Te(t) external air temperature [oC] Pe(t) external air vapor pressure [Pa] I(t) external solar irradiance [W/m2] States: T indoor air temperature [oC]
P indoor air vapor pressure [Pa] Parameters GT heat loss [W/ oC]
CT heat capacity [J/ oC]
fI solar gain surface factor [m2] GP vapor mass loss [kg/Pa.s] CP vapor mass capacity [kg/Pa]
Step 3: Implementing of the ODE derivatives model into MatLab
We implemented the model into the ‘ModelEq.m’ file, to be used by the standard ODE functions of MatLab. More information can be found at the ‘ODE_Solving_Example.pdf’.
Step 4: Simulation of a first guess solution for the (inverse) model parameters
To test the model we simulate a first guess using: GT = ModPar(1)=10 J/sK
CT = ModPar(2)=1e4 J/K fI = ModPar(3)=0.4 m2
GP = ModPar(4)=0.3/3600 kg/sPa CP = ModPar(5)=1; kg/Pa
This can be done by typing ‘Calc_start_1’ in MatLab. The results are displayed in figure 2:
Figure 2 shows the ‘measured’ indoor climate in blue and the simulated indoor climate in red using the above mentioned parameters. The model can be improved by changing the model parameters by hand and simulate it’s result again. Instead of such a trial-and-error method, this can also be done using an optimization function of MatLab. This is explained below.
Step 5: Implementing of the optimization goal function into MatLab
In order to perform optimization calculations, a goal function, to be used with the standard fminsearch function of MatLab, has to be implemented. As a goal function we use the sum of the squares of the differences between each ‘measurement’ and simulation result:
𝑜𝑝𝑡𝑚𝑖𝑛 = ∑ ((𝑇𝑖𝑠𝑖𝑚 − 𝑇𝑖𝑚𝑒𝑎𝑠)𝑛 2+ (𝑅𝐻𝑖𝑠𝑖𝑚 − 𝑅𝐻𝑖𝑚𝑒𝑎𝑠)2)
1
See: ‘SsqFun.m’
Step 6: Optimizing the model parameters
The final step is to start the optimization calculation. Because a lot of simulations are done, this could take quite a time.
To start just type space after the ‘Calc_start_1’ in MatLab. This will start the part of this mfile after the pause command (see appendix B page 2). The result after the optimization is shown in Figure 3:
Figure 3 shows the results after the optimization. The optimal model parameters are also shown: GT = 0.28; CT = 2.97e4 ; fI = 0.012; GP = 1.06e-4; CP =0.51;
Step 7 (optional): Separate heat and moisture model optimization
See ‘Calc_start_2.m’ and accompanying mfiles.
Assuming that the moisture transport has almost no effect on the heat transport, it is possible to optimize the heat model first in a separate heat transfer model.
estT(1)=2.7987; estT(2)=2.6947e+005; estT(3)=0.1192;
Afterwards the moisture transfer model can be optimized using a fixed temperature profile. estP(1)=2.6e-5;
estP(2)=1.6;
These values than can be used as starting values for the combined model (see step 6):
Figure 4 shows this final results. The optimal model parameters are also shown: GT = 2.5468; CT = 3.2617e+005; fI = 0.1087; GP = 2.7148e-005; CP = 1.7442 The improvement, compared to figure 3, is clear.
Appendix A : The accompanying mfiles
%MODELEQ Model differential Equations %
%JvS 2011/03
function xdot=modeleq(t,x)
global ClData ModPar xdot=zeros(2,1);
GT=ModPar(1); % J/sK
CT=ModPar(2); % J/K
fI=ModPar(3); % fraction of sor irrandiance
GP=ModPar(4); % kg/s%
CP=ModPar(5); % kg/%
nClData=size(ClData);
nt=nClData(1); % Number vof time steps
dt=3600; % timestep [s]
tu=0:dt:(nt-1)*dt;
% ClData=[Te RHe Irrad Ti RHi]; Tet=interp1(tu,ClData(:,1),t); RHet=interp1(tu,ClData(:,2),t); Irradt=interp1(tu,ClData(:,3),t); Pet=RHet*psatf(Tet);
xdot(1)=(1/CT )* ( GT*(Tet -(x(1))) + fI*Irradt ); xdot(2)=(1/CP)* ( GP*(Pet -(x(2))) );
Appendix B (page 1):
%CALC_START 1
%Start transfer model parameter optimisation, al, parameters at once %
% JvS 2011/03
clear all
close all
global ClData ModPar
load ClData.txt
% ClData=[Te RHe Irrad Ti RHi]; nClData=size(ClData);
nt=nClData(1); % Number vof time steps
dt=3600; % timestep [s] tu=0:dt:(nt-1)*dt; Te=ClData(:,1); RHe=ClData(:,2); Irrad=ClData(:,3); Ti=ClData(:,4); RHi=ClData(:,5); % initial guess ModPar(1)=10; % J/sK ModPar(2)=1e4; % J/K
ModPar(3)=0.4; % fraction of sor irrandiance
ModPar(4)=0.3/3600; % kg/sPa
ModPar(5)=1; % kg/Pa
%Simulate First trial
x0=[Ti(1) RHi(1)*psatf(Ti(1))]';
[t,x]=ode23('ModelEq',tu,x0);
%Interpolate for hourly steps Tisim=interp1(t,x(:,1),tu); Pisim=interp1(t,x(:,2),tu); RHisim=Pisim./psatf(Tisim); %Plot 1 figure(1) subplot(211) plot(tu,Ti,'b',tu,Tisim,'r') ylabel('Ti')
legend('meas','sim')
subplot(212)
plot(tu,RHi,'b',tu,RHisim,'r')
ylabel('RHi')
xlabel('time [hours]')
Appendix B (page 2):
pause
%Start Optimization using initial guess as input
est=fminsearch('Ssqfun',ModPar);
%Simulate optimal solution ModPar=est;
x0=[Ti(1) RHi(1)*psatf(Ti(1))]';
[t,x]=ode23('ModelEq',tu,x0);
%Interpolate for hourly steps Tisim=interp1(t,x(:,1),tu); Pisim=interp1(t,x(:,2),tu); RHisim=Pisim./psatf(Tisim); %plot figure(2) subplot(211) plot(tu,Ti,'b',tu,Tisim,'r') ylabel('Ti')
legend('meas','sim')
subplot(212)
plot(tu,RHi,'b',tu,RHisim,'r')
ylabel('RHi')
xlabel('time [hours]')
Appendix C :
%SSQFun Sum of Square function %
%JvS 2011/03
function q=ssqfun(p)
global ClData ModPar nClData=size(ClData);
nt=nClData(1); % Number vof time steps
dt=3600; % timestep [s]
tu=0:dt:(nt-1)*dt;
ModPar(1)=p(1); % J/sK
ModPar(2)=p(2); % J/K
ModPar(3)=p(3); % fraction of sor irrandiance
ModPar(4)=p(4); % kg/sPa ModPar(5)=p(5); % kg/Pa Te=ClData(:,1); RHe=ClData(:,2); Irrad=ClData(:,3); Ti=ClData(:,4); RHi=ClData(:,5); x0=[Ti(1) RHi(1)*psatf(Ti(1))]';
[t,x]=ode23('ModelEq',tu,x0);
Tisim=interp1(t,x(:,1),tu'); Pisim=interp1(t,x(:,2),tu'); RHisim=Pisim./psatf(Tisim); figure(1) subplot(211) plot(tu,Ti,'b',tu,Tisim,'r') ylabel('Ti')
legend('meas','sim')
subplot(212)
plot(tu,RHi,'b',tu,RHisim,'r')
ylabel('RHi')
xlabel('time [hours]')
legend('meas','sim')
title(['p1-5= ', num2str(p(1)),' ',num2str(p(2)),' ',num2str(p(3)),'
',num2str(p(4)),' ',num2str(p(5)) ]) drawnow MeanTi=mean(Ti); MeanRHi=mean(RHi); uT=(Tisim-Ti)/mean(Ti); uRH=(RHisim-RHi)/mean(RHi); u=[uT;uRH]; q=sum(sum(u.^2));