Clear Filters
Clear Filters

How to create a LPV model from a given vector of operating points?

3 views (last 30 days)
I have a 2 parameter LPV system that I wish to design a PID for it later and I also have the operating points so I don't need to use the linearize function, as most examples do. I don't understand well how the lpvss function works, how can I input my operating points vectors to it? How do I use it to create a system for each point?
Worst case scenario I think I can do it manually for each system, but it would be very nice if I can do it in a more efficient and compact way.
% Parameters
X_u = 0;
m = 5037.7;
V_ops = [20 22 24 26 28 30]* 1.852/3.6;
X_uu_ops = [33.5345 27.7066 23.6158 20.9720 19.3457 18.2671];
% Equilibrium points
operatingPoints = [V_ops; X_uu_ops];
x0 = operatingPoints(1,1);
X_uu = operatingPoints(2,1)
X_uu = 33.5345
u0 = X_u*x0 + X_uu*x0^2 % Propeller thrust in N
u0 = 3.5500e+03
% Linearize system around x0
A = -(X_u/m + 2*X_uu/m*x0)
A = -0.1370
B = 1/m;
C = 1;
D = 0;
% System order
n = size(A,1);
sys_ol = ss(A,B,C,D);
lpvsys = lpvss(['v' 'X_uu'],@PlantLPV)
Error using lpvss (line 184)
Data function could not be evaluated at time T0=0 for the specified test value P0. The error was:

Not enough input arguments.

Make sure that "ParameterName" has the correct number of parameters and that the function call
[A,B,C,D,E,dx0,x0,u0,y0,Delays] = DataFcn(T0,P0)
evaluates without error.
function [A,B,C,D,E,dx0,x0,u0,y0,Delays] = PlantLPV(~,v,X_uu)
X_u = 0;
m = 5037;
A = -(X_u/m + 2*X_uu/m*v);
B = 1/m;
C = 1;
D = 0;
E = [];
u0 = X_u*v + X_uu*v^2;
dx0 = [];
x0 = v;
y0 = v;
Delays = [];
end

Accepted Answer

Sam Chak
Sam Chak on 8 May 2024
I'm not familiar with the dynamics of your original nonlinear system. My focus is to ensure that the code runs without any error messages so that you can proceed with the PID control design task. If 'v' is the scheduling parameter, which represents the state variable of the nonlinear system, then the correct syntax for using 'lpvss' should be as follows:
lpvss('v', @(t, v) PlantLPV(v, X_uu))
Full code:
% Parameters
X_u = 0;
m = 5037.7;
V_ops = [20 22 24 26 28 30]* 1.852/3.6;
X_uu_ops= [33.5345 27.7066 23.6158 20.9720 19.3457 18.2671];
% Equilibrium points
operatingPoints = [V_ops; X_uu_ops];
x0 = operatingPoints(1,1);
X_uu = operatingPoints(2,1);
u0 = X_u*x0 + X_uu*x0^2; % Propeller thrust in N
% Linearize system around x0
A = -(X_u/m + 2*X_uu/m*x0);
B = 1/m;
C = 1;
D = 0;
% System order
n = size(A, 1);
sys_ol = ss(A, B, C, D);
%% Linear Parameter-Varying (LPV) state-space model
lpvsys = lpvss('v', @(t, v) PlantLPV(v, X_uu))
Continuous-time state-space LPV model with 1 outputs, 1 inputs, 1 states, and 1 parameters.
function [A,B,C,D,E,dx0,x0,u0,y0,Delays] = PlantLPV(v, X_uu)
X_u = 0;
m = 5037;
A = -(X_u/m + 2*X_uu/m*v);
B = 1/m;
C = 1;
D = 0;
E = [];
u0 = X_u*v + X_uu*v^2;
dx0 = [];
x0 = v;
y0 = v;
Delays = [];
end

More Answers (0)

Categories

Find more on Linear Model Identification in Help Center and File Exchange

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!