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

조회 수: 11 (최근 30일)
seyyed Erfan ghoreyshipour
seyyed Erfan ghoreyshipour 2022년 7월 21일
답변: emily 2025년 12월 4일 2:31
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

채택된 답변

Sam Chak
Sam Chak 2022년 7월 21일
편집: Sam Chak 2022년 7월 25일
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
Sam Chak
Sam Chak 2022년 7월 25일
Hi @seyyed Erfan ghoreyshipour, I updated to include myStateFunction and the myOutputFunction
seyyed Erfan ghoreyshipour
seyyed Erfan ghoreyshipour 2022년 8월 1일
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

댓글을 달려면 로그인하십시오.

추가 답변 (4개)

Robbie
Robbie 2022년 8월 24일
Thanks for the solution. That works!
  댓글 수: 1
seyyed Erfan ghoreyshipour
seyyed Erfan ghoreyshipour 2022년 8월 24일
편집: seyyed Erfan ghoreyshipour 2022년 8월 24일
Dear @Robbie,
Can you please tell me how did you implement the model?
I am still strugling with it! :)

댓글을 달려면 로그인하십시오.


Anna
Anna 2022년 10월 26일
Thank you so much. It worked for my issue well. I appreciate that a lot Godskin Apostle

ann lily
ann lily 2023년 10월 20일
The article about is very good, thank you for sharing! cuphead

emily
emily 2025년 12월 4일 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 !

카테고리

Help CenterFile Exchange에서 Model Predictive Control Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by