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.

답변 (1개)

Archit Dhanani
Archit Dhanani 2019년 7월 29일

카테고리

Help CenterFile Exchange에서 Simulink에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by