What is the proper use of programmatic simulink interface : model(t,x,u,flag)? Can I use it to step forward through a simulation while synchronising it with an external matlab script progress.
1 次查看(过去 30 天)
显示 更早的评论
I am trying to run a controller in simulink, which is to be called by an external matlab script interfacing realtime with a physical system at a fixed sampling period. Since changing everything completely to matlab or completely to Simulink will require lots of code to be rewritten, I expected to use the model(t,x,u,'outputs'), model(t,x,u,'update') commands (as described here: http://www.mathworks.com/help/simulink/slref/model_cmd.html) to get the output of the controller and the updated state of the controller from simulink, then pass it on the external matlab script. However, the controller states do not get updated (they remain constant at their initial values). The computation is happening only for zero execution time, even though I provide an array of times in the 't' argument. Kindly help me understand how I can do this correctly. Using the 'sim' command doesn't seem like the right way to do this as it would restart the simulation on each call which is more time consuming, we just want to step the simulink controller through a fixed time step on each call, i.e., invoke its solver for a time step and maintain the updated state until the next call.
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!