Errors occur during grey-box modeling
5 次查看(过去 30 天)
显示 更早的评论
Currently I am trying to build up a thermal model of a lecture theater using grey-box modeling in system identification toolbox. First I specified the model structure in a function file whose content is shown below:
function [A, B, C, D, K, x0] = thermalmdl_ode(R1, R2, R3, R4, C1, C2, Ts) % This function parameterizes the thermal model of the lecture theatre
% R1 is the convective heat transfer resistance of the outside surface of
% the wall and roof
% R2 is half of the conductive heat transfer resistance of the wall and
% roof
% R3 is the conductive heat transfer resistance of the window
% R4 is the convective heat transfer resistance of the inside surface of
% the wall and roof
% C1 is the heat capacity of the wall and roof
% C2 is the heat capacity of the lecture theatre
% Define some useful variables a=1/R1+1/R2+1/R3; b=1/R2+1/R3+1/R4; c=R3^2*a*b-1;
% A matrix
A=zeros(2,2);
A(1, 1)=(1-b*R4)/(C2*b*R4^2);
A(1, 2)=(1+R3*a)*R3/(C2*R2*R4*c);
A(2, 1)=(c+b)/(b*c*R4*C1);
A(2, 2)=(2*R3+R3^2*(a+b)-2*c)/(R2*C1*c);
% B matrix
B=zeros(2,2);
B(1, 1)=R3/(R1*R4*c);
B(1, 2)=R3/(R4*C2*c);
B(2, 1)=R3*(b*R3-1)/(R1*R2*C1*c);
B(2, 2)=R3*(1+b*R3)/(C1*c);
% C matrix
C=[1 0];
% D matrix
D=zeros(2, 2);
% K matrix
K=[-1/C2; 0];
% Initial state
x0=[298.15; 298.15];
end
The input and state of my model are both a 2*1 matrices, the output is a scalar.
Then I tried to create a grey-box model object with idgrey command, but errors occurred:
thermalmdl=idgrey('thermalmdl_ode', {0.000133; 0.000114; 0.0000212;0.000133; 638645.04; 4456.38}, 'cd', {}, 60)
Error using pmodel.LinearODE/checkOutputArgConsistency (line 214)
The sizes of the matrices returned by the ODE function must be consistent with the input/output size and order of the model. Create a new model if you need to change the sizes.
Error in pmodel.LinearODE/checkDataType (line 195)
M = checkOutputArgConsistency(M, Ts, Nargout);
Error in idgrey (line 376)
Structure = checkDataType(pmodel.LinearODE(Orders, Fcn, FcnType, Par, Extras), Ts);
Anyone has any ideas what is going on here?
0 个评论
回答(1 个)
Rajiv Singh
2013-4-16
D matrix is 2-by-2 suggesting that the number of inputs (nu) = number of outputs (ny) = 2. However, C is 1-by-2 implying ny = 1. Also K is 2-by-1 implying ny=1. It seems likely that your C and K equations need to be fixed.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Model Identification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!