Hi,
So I have a SIMULINK model which has a MPC controller made from the MPC toolbox block and it works perfectly fine in SIMULINK. My question is how do I get the computation time of this MPC block in SIMULINK? (So like in MATLAB script, quadprog gives you compuation time, is there a way to get the same time for the MPC toolbox block?).
Thanks a lot for your help.

답변 (2개)

Yogesh
Yogesh 2022년 9월 9일

0 개 추천

tic;
sim(Model_name);
toc;
tic/toc functions are like stopwatch to measure the time. You can use sim() to run simulation of a Simulink model at the command line.

댓글 수: 1

Syed Adil Ahmed
Syed Adil Ahmed 2022년 9월 9일
Hi,
I think this will just measure total time of simulation. I want just computation time for each time step of the simulation. Like if my discrete solver time step is 0.1s, the MPC will have a certain computation time for each of these 0.1s ticks of the solver.

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

Steven Lord
Steven Lord 2022년 9월 9일

0 개 추천

If you're trying to analyze the performance of your Simulink model (to identify bottlenecks?) consider using Simulink Profiler.

댓글 수: 1

Syed Adil Ahmed
Syed Adil Ahmed 2022년 9월 11일
This can help me in like a simulink only simulation, so this is a good start.
But, Is simulink profiler like code generateable ? Like I want to compile this model I have into a C++ code for some other hardware to get computation time of the MPC block. Will this profiler work on another hardware ?

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

카테고리

도움말 센터File Exchange에서 Controller Creation에 대해 자세히 알아보기

질문:

2022년 9월 6일

댓글:

2022년 9월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by