How to parameterize masked subsystems in a for iterator subsystem

7 ビュー (過去 30 日間)
Fabian
Fabian 2025 年 7 月 9 日
コメント済み: Matthew Englehart 2025 年 7 月 10 日
Hi all,
I have the following issue: I want to control 10 different signals with 10 different controllers, but the same type of controller. For each controller I have different parameters. The controller is implemented in a model reference. I was thinking to use a for iterator subsystem for each signal to control. The problem is the parameterization of each controller, as the parameters are different in every loop. How can i implement this, without implementing 10 different control blocks ?
  1 件のコメント
Sam Chak
Sam Chak 2025 年 7 月 10 日
Generally, you should implement the block(s) in Simulink in the same way as the 10 controllers would be implemented in real-world applications. Additionally, it is also possible to implement a single Masked Subsystem block in Simulink that functions like a Siemens PLC, outputting 10 different control signals via 10 separate output ports.

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

採用された回答

Matthew Englehart
Matthew Englehart 2025 年 7 月 9 日
Hi Fabian, rather than using a For Iterator subsystem, you should use a For Each subsystem.
  • The controller parameter should be made an argument of the controller model.
  • Put the controller model into the For Each subsystem in the parent model; it will have to specify the simulation mode as "Accelerator" (a current limitation)
  • you will need to put a mask on the For Each subsystem
  • add a parameter to the mask, which will represent the entire ensemble of parameters for the ensemble of controllers
  • specify that mask parameter as the value of the argument on the controller model block
  • on the dialog of the ForEach block inside the For Each subsystem, specify a partition for the mask parameter so that each iteration of the subsystem - each invocation of controller - uses a slice of the mask parameter that represents the entire ensemble of parameters
For example, consider this bottom model with scalar model argument "K" which is used by the Gain block:
Now suppose this bottom model is placed inside a ForEach subsystem in a parent model and we assign a parameter value "P" to the model argument "K":
As I mentioned, we need to mask the For Each subsystem and add a mask parameter corresponding to "P". Suppose I do this, and the value of the mask parameter is set to "M", in the model workspace of the parent model. "M" has value [1x10] corresponding to the need to run 10 instances of the controller.
We also need to configure the For Each subsystem to partition the mask parameter "P":
When all of this is done, we can simulate the top model and we see the effect of running a collection of controller models on the ensemble of parameters provided via the mask of the For Each subsystem:
  6 件のコメント
Fabian
Fabian 2025 年 7 月 10 日
this is exactly what I have. I attached the .slx test file. Maybe you can give me some hint where my mistake may occure.
Another question: How do I have to change the system if I want to simulate each signal with only one control parameterization? Meaning, 10 signals producing only ten outputs?
Thank you so much in advance!
Matthew Englehart
Matthew Englehart 2025 年 7 月 10 日
Hi @Fabian, you didn't attach the submodel "Subsystem1" but it is the model that needs to have K in the model workspace, registered as an argument, not the top model "test".

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSubsystems についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by