Unique Block Parameters for Multiple Instances of the Same Referenced Subsystem or Custom Library Subsystem?

5 views (last 30 days)
Hi All,
I'm hoping to do some hierarchical modeling of power systems using Specialized Power Systems library. Unfortunately, it seems that physical signals (i.e. Simscape signals) cannot cross Referenced Model boundaries, so that leaves Referenced Subsystems or Custom Libraries (as far as I know). I know that you could use controlled V/I sources and V/I measurements to somewhat make conversions to Simulink signals, but I don't want to create algebraic loops or introduce delays to break them. My question is:
Is there a way to programmatically change and save the block parameters of a single instance of a Referenced Subsystem without updating all instances of the same Referenced Subsystem? For custom libraries: is there a way to do the same with an instance of a library subsystem without affecting the link to the library (as in preventing the need to restore the original block parameters or push an update to the library subsystem block parameters)?
I guess another way to say this: is there a way to create model block structure dependency without also creating model block parameter dependency?
My goal is to be able to develop a single model file (say for a battery energy storage system) and then place multiple instances of the model in the top level model and modify the block parameters to achieve different model output behavior (say energy storage capacities). Later, if a structural change was made to the model file (say a new control loop is added), then that would propagate to model instances.
I'd like to avoid creating separate Referenced Subsystems or separate Library Subsystems for each model with different block parameters if that's possible.
Thanks in advance!

Accepted Answer

Paul
Paul on 26 Sep 2021
Parameterize Instances of a Reusable Referenced Model might be useful doc page, if I understand the question correctily.
  4 Comments
Paul
Paul on 26 Sep 2021
Sorry, I don't use SimScape and so don't know about interactions between SimScape signals and Model blocks. But I thought there was a means to convert SimScape signals into ordinary Simulink signals, and those should be able to go into the Model blocks as usual.
Yes, masks are a typical approach to set parameters of subsystems, whether as referenced from a subsystem file or from a library. Whether or not you actually need to change the mask dialog parameters programatically depends on how you set up your model. For example, supposed the model has two copies of the masked subsystem (whether from a subsystem file or a library, for example) and the mask parameter is Gain. You can set the dialog parameters in the two copies to Gain1 and Gain2 respectively, and then you just need to control the values of Gain1 and Gain2 in whatever way you're controlling the values of the model parameters (base workspace, SimulationInput object, model workspace, etc.). In otherwords, it might not be necessary to change the mask parameters programatically.
Jan Westman
Jan Westman on 26 Sep 2021
I forgot that the mask parameters themselves can be named variables so I think you're right and a better approach would be to modify the dialog box parameters upon instantiation to reference different variables in a workspace.
To the point about Simscape to Simulink signal conversion - I should have been more specific. I seems that Specialized Power Systems (SPS) signals are treated differently than the base Simscape Electrical (SE) signals and so you would first need to convert from SPS to SE and then from SE to simulink. However, the SPS to SE conversion requires using low pass filtering to break the algebraic loop created by the blocks that you use to do that conversion: Current-Voltage Simscape Interface

Sign in to comment.

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!