State and Output Function of a nonlinear dynamics to use is NMPC

10 views (last 30 days)
Hello,
So far I simulated a dynamic equation based on real data inputs in Simullink. I also estimated my coefficients to getting as close as possible to the real data.
My dynamic equation belongs to an axial-flow pump intended to use for pacients with heart desease is as below:
a,b,c,d, and L are coefficients which I tuned.
and omega(refrence speed), H(head pressure) and Q(flow) are inputs from test data.
My intention is to build a nonlinear MPC for this dynamics. but the problem is I don't know how to write State and Output functions for it.
On this dynamics, I can contorl Omega and H and the output is flow. I want to control the flow.
Thank you for your time in Advance!
Best Regarsd

Accepted Answer

Sam Chak
Sam Chak on 21 Jul 2022
Edited: Sam Chak on 25 Jul 2022
The axial-flow pump system is governed by this equation:
.
So, the State variable in this equation is Q, and the Output that you want is the flow, which is also Q.
The State function refers to the uncontrolled dynamics of the pump system. That means you don't need to supply the any math equation to the inputs ω and H because I think the NMPC calculate for you without requiring you to understand the behavior of the system at all. For example, here is the code for myStateFunction, where x , u(1) , and u(2) .
function z = myStateFunction(x, u)
a = 276.73;
b = -0.2703;
c = 17.5260;
d = -1.5806e-06;
L = -11.7480;
z = b/L*u(1) + c/L*u(2) + (d/L*u(1)^2 + a/L)*x;
end
If the output is also the state, then the code for myOutputFunction is given by
function y = myOutputFunction(x, u)
y = x;
end
NMPC-free method:
If you can manipulate the angular speed ω and the pressure head H, then you can probably control the flow Q without using the NMPC. Here is an example:
tspan = [0 10];
initv = 1;
[t, Q] = ode45(@odefcn, tspan, initv);
plot(t, Q, 'linewidth', 1.5), grid on, xlabel('t'), ylabel('Q'), ylim([0.5 2.5])
function dQdt = odefcn(t, Q)
a = 276.73;
b = -0.2703;
c = 17.5260;
d = -1.5806e-06;
L = -11.7480;
k = 1; % affects the rate of convergence
Qref = 2; % desired flowrate
omega = - (L/b)*k*(Q - Qref); % <--- correction % angular Speed
H = - (L/c)*((d/L*omega^2 + a/L)*Q); % pressure Head
dQdt = b/L*omega + c/L*H + (d/L*omega^2 + a/L)*Q; % ODE
endf
  5 Comments
seyyed Erfan ghoreyshipour
Dear @Sam Chak,
Sorry for the delay. I am progressing with jacobian functions.
Thank you for your help. This helped me a lot!
I am currently writing state and output jacobian functions. If you have any idea about that please let me know.
Best Regards

Sign in to comment.

More Answers (4)

Robbie
Robbie on 24 Aug 2022
Thanks for the solution. That works!

Anna
Anna on 26 Oct 2022
Thank you so much. It worked for my issue well. I appreciate that a lot Godskin Apostle

ann lily
ann lily on 20 Oct 2023
The article about is very good, thank you for sharing! cuphead

emily
emily on 4 Dec 2025 at 2:31
Interesting Simulink simulation for your axial-flow pump! For your MPC state-space representation, consider defining states as functions of Q (flow) and its derivatives. Your output function would simply be y = Q, since you're controlling flow. Have you explored using a simpler model, like a linearized version, initially for MPC development? This sounds like navigating challenging terrain, like riding a virtual Snow Rider !

Categories

Find more on Model Predictive Control Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!