Using non reusable functions for referenced models

9 visualizaciones (últimos 30 días)
Caroline Brandberg
Caroline Brandberg el 15 de Mzo. de 2018
Comentada: Jesús Zambrano el 2 de Feb. de 2022
Hi,
I'm using a Simulink model which contains referenced models and I would like to generate non-reusable functions for all models. It seems like it only works on the "top level". I have the settings "nonreusable function" for all models, but the generated code will be something like the following:
ert_main.c: my_model_step();
my_model.c: my_model_step() { ref_model_f(...); }
ref_model.c: ref_model_f(...) { ... }
Is there any settings which allows the referenced model to have a function declaration without any parameters, i.e., to make them non-reusable?

Respuestas (1)

Jesús Zambrano
Jesús Zambrano el 7 de Feb. de 2020
Hi Caroline,
I suggest you work with atomic subsystems. With them, you will have the option of setting the function packaging to Reusable or Nonreusable.
  21 comentarios
Bogdan Bodnarescu
Bogdan Bodnarescu el 2 de Feb. de 2022
Hello @Jesús Zambrano and thanks for the answer.
Indeed ExportToFile makes the code as I want it, but this is not the solution that I like because of the very high amount of manual work that I have to do to configure all the Inports and Outports manually.
It would have been really nice that the fields in the Property Inspector have a drow down lists from which to select, probably this could be done programatically with a script to set everything up.
Still I am not happy that a separate .c file is generated for the referenced models on the same level where the top model is, for my project this is not happenning.
Honestly I would have prefered to have all my Inports and Outports to be configured as ExportedGlobal and that they are automatically defined in the modules, or at least that there is some easy way to do this.
Could this work if I make a Custom Storage Class?
Jesús Zambrano
Jesús Zambrano el 2 de Feb. de 2022
Yes, you could try with Custom Sotrage Class.
As mentioned before, to get a full and detailed guidance of exactly the solution you want, try with tech support. Another good solution is to contact the MathWorks sales rep. assigned to your company, the IT department at your company surely has this information.
All the best,
Jesús

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by