How to parameterize masked subsystems in a for iterator subsystem

5 vues (au cours des 30 derniers jours)
Fabian
Fabian le 9 Juil 2025
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 commentaire
Sam Chak
Sam Chak le 10 Juil 2025
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.

Connectez-vous pour commenter.

Réponse acceptée

Matthew Englehart
Matthew Englehart le 9 Juil 2025
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 commentaires
Fabian
Fabian le 10 Juil 2025
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 le 10 Juil 2025
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".

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Subsystems dans Help Center et File Exchange

Produits


Version

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by