Hi Piotr Sawko,
The function 'mymodel_rt_powd_snf' contains the main logic of the model and may have been generated as an external function for direct access.
Case 1:-
If you want to use this model in different models, then generate code separately for these models and integrate the generated code. Then you can try the following suggestions
- The best way is to integrate the models and then generating code for the combined model.
- Edit the generated code to change the scope of the function.
Case 2:-
If you want to use this model multiple times in a same model as a sub model, then you can safely use the model multiple times, this will not cause any problem.
Some general guidelines to generate code for multiple models that can be integrated later:
- Utilize techniques such as model reference hierarchy or interface code for multiple models using a common harness program.
- Pay attention to global data, configuration parameter settings, code reuse, and scheduling complexities when combining code for different models.
- Use unidirectional signal connections between models to manage data flow and timing.
- Ensure consistent configuration of solver modes and handling of continuous states if applicable.
- Manage data logging and external mode support appropriately for each model in the program.
- Generate code for each model, set system target files consistently, compile, combine makefiles, and create a combined simulation engine.
For more information refer the following resorce :- https://www.mathworks.com/help/rtw/ug/combined-models.html