Simulink errors out when multiple definitions of the same variable are found in referenced data dictionaries

57 Ansichten (letzte 30 Tage)
I have a top-level model which has two model references A and B. Both models have their own data dictionaries a.sldd and b.sldd. Both data dictionaries have a variable called "Speed_Limit" defined in them, but they have different values. When I compile the model, I get the following error.
The symbol 'Speed_Limit' has more than one definition, and there are inconsistencies:
Caused by:
- value=200 for Speed_Limit in a.sldd (Use this definition)
- value=100 for Speed_Limit in b.sldd (Use this definition)
How do I fix this error?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 7 Jun. 2023
Bearbeitet: MathWorks Support Team am 7 Jun. 2023
This is expected behavior as data dictionaries are used to define variables with global scope.
Consider one of the following workarounds:
(1) Move the variables to the model workspace of the individual models. This will eliminate the conflicts on the top-level model.
(2) Starting in R2022a, there is the possibility to disable "EnforceDataConsistency" for a top-level model, which then disables this error and leads to each model reference only using the variable as defined in their data dictionaries. This can be done programmatically using 
 >> set_param(bdroot,'EnforceDataConsistency','off');
From R2022b there is an additional interactive way of disabling this parameter using the "Enforce consistent data definitions across referenced models" check box in Model Properties > External Data.
However, there are limitations to this approach. When "EnforceDataConsistency" is disabled, the following won't work (as of R2023a):
•    Code Generation
•    Simulation in SIL and PIL mode
•    Simulation of a protected model
Verify the limitations for your release in the "Data Used by Model References" section at the following documentation: https://www.mathworks.com/help/releases/R2023a/simulink/ug/migrate-models-to-use-dictionary.html#bu0qxhf-1 (adjust the URL to match your release).

Weitere Antworten (0)

Kategorien

Mehr zu Manage Design Data finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by