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

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?

 採用された回答

Fangjun Jiang
Fangjun Jiang 2026 年 1 月 6 日

0 投票

I think you can use Model Reference, not Subsystem Reference.

6 件のコメント

Marcelo
Marcelo 2026 年 1 月 6 日
Thank you for the suggestion. I've tried using the Model Reference block, bus still got the same issue.
Fangjun Jiang
Fangjun Jiang 2026 年 1 月 6 日
If using Model Reference, you can define Ts in the model workspace and then establish it as a model parameter.
Then you can pass in "Ts in Model1.sldd" and "Ts in Model2.sldd" as the value for the model parameter.
Marcelo
Marcelo 2026 年 1 月 8 日
編集済み: Marcelo 2026 年 1 月 8 日
Thanks for the suggestion. Still can't make it run. If I create the Simulink.Parameter called Ts on the model workspace, then the referenced configuration can't find it.
I've added a sample code to exemplify the issue. The goal is to be able to run the simulation MiL.slx, while still being able to compile / generate code for the individual models Model1 and Model2.
Fangjun Jiang
Fangjun Jiang 2026 年 1 月 8 日
The model workspace variable didn't workout. I have to study it further. I thought model workspace always took priority over SLDD.
But your current solution worked out, with some modifications. The most important one is to un-check the "Enforce consistent data ..." option for the two models. There are other changes needed too. Attached is the updated ZIP file which contains all the working files.
  1. Open Model1 and run simulation. No error. Check the data log "out". It shows Ts is 0.1
  2. Open Model2 and run simulation. No error. Check the data log "out". It shows Ts is 0.2
  3. Open MiL.slx and run simulaiton. No error. Sample color shows Model1 is running at 0.1 and Model2 is running at 0.2
With this, you can try to see if it works for referenced subsystems. I'd like to know that.
Marcelo
Marcelo 2026 年 1 月 9 日
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 2026 年 1 月 12 日
編集済み: Marcelo 2026 年 1 月 12 日
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');

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Component-Based Modeling についてさらに検索

製品

リリース

R2024b

タグ

質問済み:

2026 年 1 月 6 日

編集済み:

2026 年 1 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by