How do I create a Protected Simscape Model with tunable parameters?

I am trying to create a protected model with tunable parameters. My model uses Simscape blocks, and I have not managed to make them tunable so far.
How do I create tunable parameters for my protected Simscape model?

 Accepted Answer

A Simscape model can also have tunable parameters. Although the approach to protecting Simscape models is largely the same, there is one minor difference. To use Simscape parameters as tunable run-time parameters, you need to first enable run-time configurability.  By doing so, the parameters are tunable in both protected and non-protected versions of the Simscape model. 
To better understand the workflow, please find the example below.
Example:
The example here is a simple voltage divider in which both resistors' resistances are meant to be tunable. The first step is to prepare the model properly to use Simscape parameters as tunable parameters. To do so, you first need to enable run-time configurability. The next step is to define a model workspace parameter for the parameters you later want to be tunable.
(1) Specify "Run-time" configurability:
(2) Create Model Workspace parameters and enable the "Arguments" checkbox:
You can now protect your model using the Protected Model Creator.
When importing the protected model into another model, you can now specify/ tune the parameter. To do so, right-click the protected model and select "Block Parameters." In the "Instance Parameters" Section, you can now specify the values of the Parameters either by directly inserting the required value or by specifying a parameter:

More Answers (0)

Categories

Products

Release

R2026b

Community Treasure Hunt

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

Start Hunting!