State and Output Function of a nonlinear dynamics to use is NMPC
10 views (last 30 days)
Show older comments
seyyed Erfan ghoreyshipour
on 21 Jul 2022
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
0 Comments
Accepted Answer
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
More Answers (4)
Anna
on 26 Oct 2022
Thank you so much. It worked for my issue well. I appreciate that a lot Godskin Apostle
0 Comments
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 !
0 Comments
See Also
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!


