How to share the same Referenced Configs on Multi-rate systems

14 views (last 30 days)
I am working on a project with different Software Components in Simulink. The Components are intended to share the same Configuration. However the Sampling time can differ. For this purpose, the Sampling time is defined as a variable "Ts". Every Software component has, on its own data dictionary, a variable "Ts" .
However, when I try to place both Software components (as referenced subsystems) on a model (for Model in Loop simulation), I get the following error:
Symbol 'Ts' has multiple inconsistent definitions:
Caused by:
value=0.2 in Model1.sldd (Update others to match)
value=0.025 in Model2.sldd (Update others to match)
Component:Simulink | Category:Model error
Is it possible to still use the same referenced configuration for all the models, in a way that simulations with two or more Software Components with different data rates still work?

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 6 Jan 2026
I think you can use Model Reference, not Subsystem Reference.
  6 Comments
Marcelo
Marcelo on 9 Jan 2026
Thank you very much for looking into it. Removing the "Enforce Consistent data definition ..." from Model1 and Model2 properties allowed me to set the "Ts" variable on each data dictionary separatelly, and to run the MiL model correctly.
Small remark - If the MiL model needs to reference the Model1 and Model2 data dictionaries (e.g. to use any enumeration or busses), the issue is still present. In this case, I split the data dictionaries Model1.sldd and Model2.sldd into two each - Model<N>_private.sldd (containing my Ts variable) and Model<N>_public.sldd (containing the definitions used at the interface). My MiL data dictionary just reference to the public definitions. This way everything works.
Marcelo
Marcelo on 12 Jan 2026
Edited: Marcelo on 12 Jan 2026
When trying to generate code with the answer above, I run into an issue: Code generation is not allowed if "enforce consistent data definitions across referenced systems" is unchecked. More details are described in this ticket:
I had to add callbacks to my MiL model Pre-load and Stop functions to enable/disable this parameter.
set_param('Model1', 'EnforceDataConsistency', 'off');
set_param('Model2', 'EnforceDataConsistency', 'off');

Sign in to comment.

More Answers (0)

Categories

Find more on Manage Design Data in Help Center and File Exchange

Tags

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!