Unintended Sample Time in Simulink

조회 수: 1 (최근 30일)
Sreejith Mana
Sreejith Mana 2022년 9월 15일
댓글: Sreejith Mana 2022년 10월 7일
Hello,
Some of the blocks in simulink don't seem to inherit the global sample time set by Configuration Parameters -> Solver -> Fixed-step size.
Please see the below picture. Can somebody let me know how to change the sample time of these blocks in Green to match with the red?
Also, as seen in the screenshot, many a times, the legends on the right hand side don't show the colour coding. Please let me know how to fix that too.
Thanks in advance.
Best regards,
Sreejith
  댓글 수: 2
Ashu
Ashu 2022년 10월 4일
Hi,
Did you try to create a variable and use that in sample time so that it will be common everywhere.
Thanks & Regards
Sreejith Mana
Sreejith Mana 2022년 10월 4일
Hello,
Thanks for the response.
I didn't understand your question. Could you explain how this definition of sample time and using it globally work?
The blocks shown above are C-Caller blocks and I have mapped C Code for each of those blocks.
The weird thing is, only some of them don't inherit the sample time of the model.
Thanks again.
Best regards,
Sreejith

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

답변 (2개)

Harshit Gupta
Harshit Gupta 2022년 10월 6일
As per my understanding, you want to know why some of the blocks in Simulink don’t seem to inherit the Global Sample Time set by Configuration Parameters -> Solver -> Fixed-step size.
This is because some of the blocks in Simulink have an implicit sample time. You cannot specify implicit sample times. Simulink determines them based on the context of the block in the system. This means that different blocks might get different sample times based on their context in the system.
The Sample Time parameter is not available (cannot be set) for certain blocks because specifying a sample time that is not -1 on blocks such as the Gain, Sum, and n-D Lookup Table causes sample rate transition to be implicitly mixed with block algorithms. This mixing can often lead to ambiguity and confusion in Simulink models.
Please refer to the following documentation links for more information on how sample times work in Simulink:

Sreejith Mana
Sreejith Mana 2022년 10월 6일
Hi Harshit,
Thanks for the detailed explanation.
I udnerstand your point. What is intriguing to me is the fact that the blocks in Red and Green are the same type of bloks - C-Caller. But only some of them inherit sample time of the parent model and some of them don't. I don't understand why.
In terms of the context, I don't see any difference in usage of tehm within the model either.
Best regards,
Sreejith
  댓글 수: 2
Harshit Gupta
Harshit Gupta 2022년 10월 7일
Hi Sreejith,
It seems that C-Caller blocks are inheriting their sample times from the output ports.
Please refer to the new feature on setting sample times for C-Caller blocks since R2022b: https://www.mathworks.com/help/simulink/release-notes.html
Sreejith Mana
Sreejith Mana 2022년 10월 7일
Hi Harshit,
Okay that makes sense. I will have a look into my model.
Cheers.

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

카테고리

Help CenterFile Exchange에서 Deployment, Integration, and Supported Hardware에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by