How to adjust internal sample time of MPC?
Ältere Kommentare anzeigen
In Simulink I'm using an MPC Controller block. As a parameter in this block, I'm using an mpc object from my workspace, which I then design using the MPC Designer.
My goal is to generate C++ code for this MPC Controller for an embedded system.
When I set the sample time in the MPC Designer to 0.1 (seconds) and generate C++ code of this MPC Controller, generated comments in the code tell me to call the step() function every 0.1 seconds.
But I want these two sample times to be different from each other. For example:
I want the MPC Controller to simulate his internal plant using a sample time of 0.1 seconds, but I want to call the step() function in the generated C++ code every 0.005 seconds.
Why do I want this?
The rest of my system has a sample time of 0.005 seconds, so I would like to use the MPC Controller every 0.005 seconds as well. But setting the MPC internal sample time to 0.005 seconds forces me to set a really large prediction horizon. That's why I want to have a rather rough sampling time inside the MPC just for his simulation activities.
So how can I decouple the internal MPC simulation sample time and the actual sample time of calling the step() function in the C++ code?
Thank you for your effort in helping me here:)
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Linear Plant Specification finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!