How to create a LPV model from a given vector of operating points?
1 view (last 30 days)
Show older comments
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)
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);
lpvsys = lpvss(['v' 'X_uu'],@PlantLPV)
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
0 Comments
Accepted Answer
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))
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
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!