Info
この質問は閉じられています。 編集または回答するには再度開いてください。
Multi time steps for xPC target
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I am using a controller built with xPC target and Simulink. And I want to have different time steps for the control signal and the sensor sampling. But every time I am trying to compile and download it to the target PC, simulink tells me that for real time control only one single time step is allowed...
Is it possible to have multiple time steps for xPC target realtime control?
Begging for answers~
Cong @ MSC Lab, UC Berkeley
0 件のコメント
回答 (1 件)
Gordon Weast
2011 年 3 月 28 日
You can have multiple different time steps in xPC Target if you set it up correctly.
I assume you are already using the fixed-step solver.
Next, the slower sample time must be an integer multiple of the faster sample time. The slower blocks will run every Nth time the faster blocks run, where N is the multiple. You can even have several different sample times, not just 2 as long as they're all some integer multiple of the fastest time.
Next, you can use single tasking or multi tasking. The difference is how overloads are handled in the slow task.
In single tasking, the slower task runs after the faster task in the same thread. That means the total TET for both must be shorter than the faster sample time.
In multi tasking, the slower task is in a different thread. The TET for the slower task just has to be shorter than the slow sample time. The faster thread will preempt the slow thread if the slow one is still running when the fast sample time hits.
You select the tasking mode on the solver page of the configuration parameters for the model.
This is discussed in our documentation.
Gordon Weast, xPC Target Development
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!