- Create 'primary_ind', 'secondary_ind', and 'coupling' variables which are being referenced by the Simscape blocks in either the base or model workspace. The default values can be specified for these variables in one of these workspaces, which would be overridden by the linearization workflow.
- Due to the known issue (https://www.mathworks.com/support/bugreports/details/2001393), please use:
slLinearizer & parameter variation in Simscape
2 views (last 30 days)
Show older comments
Hello,
I want to do a batch linearisation using slLinearizer on a Simulink model that contain Simscape components.
The linearisation is actualy working, but with for loops and iterations over vectors. That's slow.
The changing parameters coupling & primary_ind are inside of a simscape block :
I can create the batch linearisation interface :
io = getlinio(projectName);
sllin = slLinearizer(projectName,io);
I can create and specify the parameters :
coupling_mat = linspace(a,b,c);
primary_ind_mat = logspace(a,b,c);
[I,C] = ndgrid(primary_ind_mat,coupling_mat);
params(1).Name = 'primary_ind'; % i want here to link the simscape block upside
params(1).Value = I;
params(2).Name = 'coupling'; % same here
params(2).Value = C;
But when i try to update the parameters :
sllin.Parameters = params;
I get this error :
Error using slLinearizer/set.Parameters (line 324)
The expression "input(1).Name", "primary_ind" does
not successfully evaluate in model or base
workspace.
Caused by:
Error using sdo.getValueFromModel (line 94)
The variable 'primary_ind' cannot be resolved by
the model 'teslar2019a'. Make sure that the
variable is defined in the model, base
workspace, or data dictionary.
But as you can see on the first pic, there is a parameter called "primary_ind" in the model, inside a simscape block.
I've read :
- https://fr.mathworks.com/help/slcontrol/ug/sllinearizer.html
- https://fr.mathworks.com/help/slcontrol/batch-linearization.html
- https://fr.mathworks.com/help/slcontrol/ug/ways-to-generate-parameter-samples.html
I don't get how to link the parameters to the simulink model.
Thank you !
0 Comments
Answers (1)
Danvir Sethi
on 5 Aug 2019
Where are the variables 'primary_ind', 'secondary_ind', and 'coupling' which are being referenced by the Simscape blocks defined? Are they defined in a mask workspace, model workspace, base workspace or none of these? Are you able to simulate the model as is?
I think you need a couple of things:
opt = linearizeOptions;
opt.AreParamsTunable = false;
sllin = slLinearizer(projectName,io, options);
0 Comments
See Also
Categories
Find more on Batch Linearization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!