필터 지우기
필터 지우기

Simulink Initialize Function: Use In-Port for init and normal running

조회 수: 9 (최근 30일)
Lionel Pöffel
Lionel Pöffel 2021년 11월 29일
댓글: Lionel Pöffel 2024년 5월 7일
Currently the documentation for initialize functions clearly states
If a model containing an Initialize Function, Reset Function, or Terminate Function block is an export-function model, the signal from the root Inport must not be branched to a Simulink Function block. If the model is not an export-function model, the signal from the root Inport must not be branched to any other block.
Indeed, trying to connect my model inport to the initialize function and to normal blocks in the model will trigger errors.
I have, however, the need to use the same input for initialization as well as, later, during the normal run-time of my model.
I can also not just add an additional port with the same datatype because my model will be used for code generation, and I have to adhere to some standard interface.
Is there any way around this?

답변 (1개)

Suman
Suman 2024년 5월 2일
편집: Suman 2024년 5월 2일
Hi Lionel,
One of the ways you can get around this issue could be to use a data store memory block. The same input that you are using for the root inport can be written to a data memory block and then it can be used during the normal runtime by reading it using a data store read block. This way you can avoid branching the root inport.
I hope that helps!
  댓글 수: 1
Lionel Pöffel
Lionel Pöffel 2024년 5월 7일
Unfortunately this is not a solution for me. The input interface is very wide, and storing it completely inside my library completely violates the strict memory constraints. I just need to modify some static internal data based on the input values during init, and then continue to use the input values during the normal "run" phase.
With hand-written code this is no problem whatsoever.
In any case, because there was no suitable solution we had to do a work-around using hand-written wrappers.

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

카테고리

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

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by