How to Generate S-Function Block of a model having a initialize block at the top level using rtwsfcn.tlc target?

1 view (last 30 days)
Hello MATLAB experts,
i am facing an issue with code generation(S-function block creation) with my model.
It has one initialize Function block at the top level in which the Event Listener block is there whose Event type parameter is set to initialise.
Whenever i am trying to generate S-function block of my model by selecting System Target file as rtwsfcn.tlc. i am getting the following error.
Code Generation using the rsim, asap2 or RTW S-Function targets are not supported in models such as '' Model_name '', which contain Initialize,Reset or Terminate Function blocks.
Initialize block is necessary for model execution in my case.
So, my doubt here is , how can i generate S-Function block of my model by keeping the Initialize block in it using rtwsfcn.tlc System target File? or is there any other way by which i can create S-function block of my model without using rtwsfcn.tlc.?
Any Kind of help will be appreciated.
Awaiting your quick replies.
Thank you in advance.

Answers (1)

Satwik
Satwik on 25 Sep 2024
Hi Rohit,
To work around this error, consider generating a Protected Model from the Simulink model instead of generating an S-function. Protected Models are a preferred solution for intellectual property protection and allow reuse of the component in other Simulink models. For reference on how to generate code for Protected Model, refer to this documentation:
For more guidance, refer to the following MATLAB Answers post by the MathWorks Support Team:
Additionally, you can check the documentation for more alternatives to the S-Function target here:
Hope this helps!

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!