How to set slower time sample for a subsystem inside of another periodic atomic subsystem

조회 수: 2 (최근 30일)
How can I set a time sample of 1ms for a subsystem 'A' inside of another periodic atomic subsystem 'B' running at 1us?
I do have a Simulink Coder generated S-function that runs at sample rate of 1ms and I cannot edit it. That S-function have to be inside of a subsystem that runs at sample rate of 100us and cannot remove the S-function from that subsystem or modify its time sample. It is not a problem to have the s-function running slower than the parent subsystem, but I cannot make it work. Can sameone help?

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2019년 11월 18일
Put the S-function inside a Triggered Subsystem, which is set to be triggered by Function Call. Use a Function Call Generator to generate the call at every 1ms.
  댓글 수: 2
CLEBER ALBERT
CLEBER ALBERT 2019년 11월 18일
It gives the following error:
'block1ms' has sample time 0.001. Only constant (inf) or inherited (-1) sample times are allowed in triggered subsystem 'block100us'.
Component:Simulink | Category:Blockerror
Fangjun Jiang
Fangjun Jiang 2019년 11월 19일
편집: Fangjun Jiang 2019년 11월 19일
If the sample time of the S-function is fixed in its source code (not a good practice though), then you don't need to put it inside a subsystem that is triggered every 1ms. You can put it anywhere. It will run every 1ms. You just need to resolve all the rate transition issues.
Any block inside a triggered subsystem can not have a specified sample time. The sample time can either be -1 (which means to inherit from the trigger) or inf (means constant).

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Schedule Model Components에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by