Only algebraic system equations in Model Predictive Control Toolbox?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
My goal ist to use Model Predictive Control (MPC) for high-level planning. Instead of having differential equations I want to use only algebraic equations in the state function.
The equations would be in the form
. Is there a way to define the MPC state functions as such?

Preferably I would use the nonlinear version of MPC.
Thank you very much.
Best regards,
Martin
2 Commenti
Risposte (1)
SAI SRUJAN
il 13 Ago 2024
Hi Martin,
I understand that you are facing an issue with finding an example that shows the correct setup of the 'nlmpc' objects.
Refer to the following code sample to proceed further,
function dx = myModel(x, u)
% x: differential states
% u: inputs
% Define the algebraic equation f(u, x)
f = @(u, x) x^2 + u; % Example algebraic function
% Compute the state update based on x = u - f(u, x)
dx = u - f(u, x);
end
% Number of states, inputs, and outputs
nx = 1; % Number of differential states
nu = 1; % Number of inputs
ny = 1; % Number of outputs
Ts = 0.1; % Sample time
% Create nlmpc object
nlobj = nlmpc(nx, ny, nu);
nlobj.Ts = Ts;
% Specify the model function
nlobj.Model.StateFcn = @myModel;
% Define the output function (for simplicity, let's assume output is x)
nlobj.Model.OutputFcn = @(x, u) x;
% Define constraints and weights (optional)
nlobj.Weights.ManipulatedVariables = 0.1;
nlobj.Weights.ManipulatedVariablesRate = 0.1;
nlobj.Weights.OutputVariables = 1;
% Validate the model
validateFcns(nlobj, rand(nx,1), rand(nu,1));
For a comprehensive understanding of the "nlmpc" function in MATLAB, please refer to the following documentation.
I hope this helps!
0 Commenti
Vedere anche
Categorie
Scopri di più su Controller Creation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!