greybox linear model error

2 vues (au cours des 30 derniers jours)
Imisi Jo
Imisi Jo le 11 Juil 2017
Commenté : Imisi Jo le 18 Juil 2017
I get the following error: "The number of inputs and outputs of the model must match that of the data." However, I have ensured the number of outputs are definitely correct - where have I gone wrong?
NB: y= 100x3, u=100x1
load v1v2;
y=[x_store simSoC_TECM];
u=simCurr_TECM;
data = iddata(y,u,1,'Name','Battdata'); %y=O/P (V1,V2), u=I/P (Ibat), Ts=1.
data.OutputName = {'BattV1','BattV2','BattSoc'};
data.OutputUnit = {'V','V','%'};
data.Tstart = 0;
data.TimeUnit = 's';
%%load parameters
load rcbranch
R1=RpTF1mean(5,3);
R2=RpTF2mean(5,3);
T1=TauTF1mean(5,3);
T2=TauTF2mean(5,3);
R0=RoTFmean(5,3);
C1=T1/R1;
C2=T2/R2;
%%construct greybox model
param = {T1;T2;C1;C2;Cnom;R0}
linm = idgrey('batteryeq_lin',param,'c');
function [A,B,C,D] = batteryeq_lin(T1,T2,C1,C2,Cnom,R0,Ts)
A=[-1/T1 0 0;0 -1/T2 0;0 0 0]; %(V1 V2 SOC)
B=[1/C1;1/C2;-1/Cnom];
C=[-1 -1 -1];
D=R0;
%%Specify known and unknown parameters.
for i=1:1:5
linm.Structure.Parameters(i).Free = false;
end
linm.Structure.Parameters(6).Free = true;
linm.Structure.Parameters(6).Minimum = 45e-3;
linm.Structure.Parameters(6).Maximum = 90e-3;
%%Estimate R0.
tic
linm = greyest(data,linm)
toc
Thank you

Réponse acceptée

Prashant Arora
Prashant Arora le 17 Juil 2017
Modifié(e) : Prashant Arora le 17 Juil 2017
Hi Imisi, In your code below
function [A,B,C,D] = batteryeq_lin(T1,T2,C1,C2,Cnom,R0,Ts)
A=[-1/T1 0 0;0 -1/T2 0;0 0 0]; %(V1 V2 SOC)
B=[1/C1;1/C2;-1/Cnom];
C=[-1 -1 -1];
D=R0;
C is defined as a row vector, which implies that the state-space model has only 1 output, as opposed to 3 outputs created with iddata. This is causing a mismatch and results in an error. Essentially C*x + D returns a scalar according to the equations you have specified.
  1 commentaire
Imisi Jo
Imisi Jo le 18 Juil 2017
Ah of course! Thank you.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with System Identification Toolbox dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by