MPC toolbox - Model parameter must be a string

I´m trying to tune a MPC controller.
So, I've created the MPCobject and run the simulation. Until here, no problem. The simulation run perfectly.
When I've created a function to optmize my parameteres, with the 'sim' function inside, I've got the "'model' parameter must be a string" problem inside the function created.
Reading the forum, I discovered that the problem is related to matlab tries to call the simulink sim function. I've tried to use the pathtool command to put MPCtool at the top, but no result.
How can I fix it? It´s freaking my mind!!
Thanks and sorry for the poor english.

Respuestas (1)

Kaustubha Govind
Kaustubha Govind el 13 de Mzo. de 2011

0 votos

What is the exact SIM command that you are using? The error points to the 'model' parameter, which is the first argument to the command. Check the value that you are passing to see if it is valid.

3 comentarios

João
João el 13 de Mzo. de 2011
The SIM command of MPC toolbox.
In the main script, there is no problem with the SIM function. The error arises when I put the SIM function in a new function that i've created for optimization.
Actually, the error is related to 'model' parameter, that is requested to be a string. But in MPC SIM function, this is not true.
I've tried to insert breakpoints in the script to check the parameteres class. And it was correct.
The problem is that the function is calling the Simulink SIM function, that requests the model to be a string.
Is there a way to force the matlab to call the MPC SIM function?
Thanks for the help. But I still do not know what to do.
Kaustubha Govind
Kaustubha Govind el 14 de Mzo. de 2011
When the debugger stops in the breakpoint in your optimization function, try running "which -all sim" at the MATLAB command prompt. Does this list the MPC version?
João
João el 15 de Mzo. de 2011
Thanks, Kaustubha. I solved the problem.
Reading the which help, I discovered that there is a way to indicate what SIM function must be used. But it did not work for me!! Why?
The nem error show me that my function did not recognize my MPCobj. So I put the MPCobj as input for my function and it works.
I realized that only using 'global' my function would get the MPCobj, but not. All parameters inside the fuction must be declared.
So stupid!!
Thanks for your attention.

Iniciar sesión para comentar.

Preguntada:

el 12 de Mzo. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by