이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Multi time steps for xPC target
조회 수: 4 (최근 30일)
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
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