Simulation error when using global data store and code generation

5 Ansichten (letzte 30 Tage)
Thomas
Thomas am 28 Aug. 2024
Beantwortet: MULI am 10 Sep. 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 Kommentar
Abhaya
Abhaya am 4 Sep. 2024
Hi Thomas, Could you please provide the model and the specific steps where you're encountering the issue?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

MULI
MULI am 10 Sep. 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”

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by