- 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
1 次查看(过去 30 天)
显示 更早的评论
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 :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/230751/image.png)
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 个评论
回答(1 个)
Danvir Sethi
2019-8-5
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Trimming and Linearization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!