Greybox ODE coefficients estimation error
Show older comments
Hi all, I've been trying for about two weeks to better estimate some coefficients of a nonlinear ODE that represents the dynamics of a Wind Turbine.
For that I made a 1000 seconds simulation from a medium fidelity model for the wind turbine called FAST and used this measured data to estimate the coefficients.
There are 3 inputs for the model (Angle of pitch, Torque and wind speed) and 2 outputs (rotor speed and generator speed)
load('datatoFit.mat');
t = OutData(:,1);
ut = t;
y = [(pi/30)*OutData(:,10) (pi/30)*OutData(:,11)];
u = [OutData(:,8) 1000*OutData(:,39) OutData(:,2)];
Ts = 0.00625;
z = iddata(y, u, Ts);
z.InputName = {'Pitch', 'Torque', 'Wind'};
z.InputUnit = {'Degrees', 'N.m', 'm/s'};
z.OutputName = {'wr', 'wg'};
z.OutputUnit = {'rad/s', 'rad/s'};
z.Tstart = 0;
z.TimeUnit = 's';
After that I created a function to be my ODE, the main difference from a normal one here is the fact that I need access to a table of values to compute the necessary power coefficient based on the pitch angle and tip speed ratio (TSR).
function [dx,y] = ModeloReduzidoInput(t,x,u,Jr,Ks,Ds,Jg,kcp,varargin)
% wr = x(1), wg = x(2), Teta = u(1), Tg = u(2), v = u(3)
% Output equations
y = [x(1);
x(2)];
% State equations
rho = 1.225;
Rm = 63;
Ng = 97;
Pw = (1/2)*rho*pi*(Rm^2)*(u(3)^3);
load('CpCubic29052017.mat');
TetaCp = 0:0.1:30;
TSRCp = 0:0.1:18;
TSR = x(1)*Rm/u(3);
Cp = interp2(TetaCp,TSRCp,Cpq,u(1),TSR);
Pr = Pw*Cp*kcp;
dx = [((Pr/(x(1)*Jr))-(x(1)*Ds/Jr)+(x(2)*Ds/(Jr*Ng))-(x(3)*Ks/Jr));
((x(1)*Ds/(Ng*Jg))-(x(2)*Ds/((Ng^2)*Jg))+(x(3)*Ks/(Jg*Ng))-(u(2)/Jg));
(x(1)-(x(2)/Ng))];
end
Following some guides on the MATLAB website I made a idnlgrey object and tried to use the "Compare" function, getting an "Infeasible" error, although I can easily run my function by using ODE15s.
Jr = 3.8768E7; %kg.m²
Ks = 867.637E6; %N.m/rad
Ds = 6.215E6; %N.m/rad.s
Jg = 534.116; %kg.m²
kcp = 0.965;
wgInitial = 122.9096;
wr0 = wgInitial/97;
wg0 = wgInitial;
InitialStates = [wr0; wg0; 0];
Order = [2 3 3];
Parameters = [Jr;Ks;Ds;Jg;kcp];
nlgr = idnlgrey('ModeloReduzidoInput', Order, Parameters, InitialStates, 0);
set(nlgr, 'InputName', {'Pitch', 'Torque', 'Wind'}, ...
'InputUnit', {'Degrees', 'N.m', 'm/s'}, ...
'OutputName', {'wr', 'wg'}, ...
'OutputUnit', {'rad/s', 'rad/s'}, ...
'TimeUnit', 's');
nlgr = setinit(nlgr, 'Name', {'Rotor velocity' 'Generator velocity' 'Torsion'});
nlgr = setinit(nlgr, 'Unit', {'rad/s' 'rad/s' '-'});
nlgr = setpar(nlgr, 'Name', {'Jr' 'Ks' 'Ds' 'Jg' 'kcp'});
nlgr = setpar(nlgr, 'Unit', {'kg.m²' 'N.m/rad' 'N.m/rad.s' 'kg.m²' '-'});
nlgr.SimulationOptions.AbsTol = 1e-6;
nlgr.SimulationOptions.RelTol = 1e-5;
compare(z, nlgr);
The error:
Warning: Model simulation infeasible. Check parameter values.
> In ctrlMsgUtils.warning (line 25)
In idnlgrey/getSimResult (line 99)
In idnlgrey/getError (line 54)
In idnlgrey/configureOptimizationOptions (line 20)
In idestimatorpack.lsqnonlin/setOptimizationOptions (line 57)
In idestimatorpack.estimator/initialize (line 11)
In idpack.createEstimator (line 56)
In idnlgrey/pem_ (line 73)
In idnlgrey/pem (line 110)
In pem (line 61)
In idnlgrey/predict_ (line 152)
In predict (line 93)
In idpack.compareResp (line 148)
In plotpack.idsimsource/compare (line 32)
In wavepack.waveform/draw (line 25)
In wrfc.plot/draw (line 17)
In nlutilspack.PredictionHorizonDialog/createLayout>localSim (line 125)
Warning: System response could not be computed because of the
following error:
The specified model parameters or states are infeasible for
simulation. Verify that the model"s ODE file ("ModeloReduzidoInput")
can be simulated with the given parameters and initial states values.
> In wavepack.waveform/draw (line 65)
In wrfc.plot/draw (line 17)
In nlutilspack.PredictionHorizonDialog/createLayout>localSim (line 125)
Thanks in advance!
1 Comment
randoano
on 18 Jun 2018
Have you got any solution?
Answers (0)
Categories
Find more on Nonlinear Grey-Box Models in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!