Simulation error when using global data store and code generation

4 visualizaciones (últimos 30 días)
Thomas de Saintignon
Thomas de Saintignon el 28 de Ag. de 2024
Respondida: MULI el 10 de Sept. de 2024
I am using referenced models on a project that uses an embedded coder for code generation. I want to use datastore blocks across the referenced models, so I declared them using a simulink data dictionary, and appear as (global) when called by a "read datastore" or "write datastore" block. Up to now only one of the referenced models used these data store, and it was referenced multiple times without any problem. When adding a second referenced model capable of reading the global datastore I get either :
  • Blocked forever in the "Initialization" step of simulation
  • A simulation error stating the following :
Code generation assertion '(mdlBlk->mdlBlkTreatedAsExportFcns() && rateSpec.isInherited()) || (!mdlBlk->mdlBlkTreatedAsExportFcns() && (!rateSpec.isInherited() || mdlBlk->getSlMdlRefCompTgt().getModelRefTsInheritanceAllowed() || mdlref::IsFcnCallModelRefBlock(block) || SlCondExecModelBlockMgr::isBlockSyntForCondExecModelBlock(block)))' failed in 'B:\matlab\src\sl_compile\dsm\DSMNameClash.cpp:105'.
Component:Simulink | Category:Model error
Thank you for your help
  1 comentario
Abhaya
Abhaya el 4 de Sept. de 2024
Hi Thomas, Could you please provide the model and the specific steps where you're encountering the issue?

Iniciar sesión para comentar.

Respuestas (1)

MULI
MULI el 10 de Sept. de 2024
Hi Thomas,
I understand that you are facing challenges when integrating a second referenced model that accesses global data stores in a Simulink project utilizing Embedded Coder for code generation.
The error message mdlBlkTreatedAsExportFcns() and rateSpec.isInherited(), indicates an issue with models treated as export functions and their sample time settings.
To resolve this issue, you may consider these suggestions:
  • Make sure all your models are set to work on the same timing schedule. Don’t let them automatically inherit timing settings if it causes problems.
  • Verify your model settings to ensure they aren't set as "export functions", unless you specifically need them to be.
  • Ensure any settings related to calling functions are the same in all models to avoid conflicts.
  • Double-check that no local data stores have the same name as your global data stores to prevent mix-ups.
You may refer this link for more information on “Referenced Model Sample Times”

Categorías

Más información sobre Deployment, Integration, and Supported Hardware en Help Center y File Exchange.

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by