查找并设置几个块的simu金宝applink参数

10次​​观看(最近30天)
Rashmil Dahanayake
Rashmil Dahanayake 2014年10月17日
回答: Orion 2014年10月17日
我有一个带有数量子金宝app系统的Simulink模型。例如,我在模型中的多个位置使用了Simpower Systems MOSFET。
目前,我使用以下代码。但是限制是,应该知道博克路径/名称。
为了x = 1:4%debug_14.slx是文件名%
modd = sprintf('debug_14/hbridge/mosfet%d',,,,x);
set_param(modd,'Ron',,,,'3');
结尾
现在,如果我有几个MOSFET块,那么很难单独指定块路径。我需要为模型中的所有MOSFET设置RON = 3。如何从编程中搜索MOSFET块和set_param。

答案(4)

Debarati Banerjee
Debarati Banerjee 2014年10月17日
关于这个问题:
在顶部模型中以及子系统中都有多个“增益”块,在其中找到附件的样本模型(trial_model.mdl')。以下命令可以找到模型“ abile_model”中存在的所有“增益”块的路径和名称:
>> block_name = find_system('trial_model',,,,'blocktype',,,,'获得'
Here block_name will be an n*1 cell array containing the names of all the ‘Gain’ blocks present in the model ‘trial_model.mdl’.
Then you can consider to run the following loop to change the parameters of each of the block. You can refer to the following sample code:
>> n =长度(block_name)
为了i=1:1:n
set_param(block_name {i,1},'获得',,,,'15'%%Changing ‘Gain’ of all the ‘Gain’ blocks to 15
结尾
1条评论
Rashmil Dahanayake
Rashmil Dahanayake 2014年10月17日
The problem with MOSFET is it comes with sysmpower systems tool box. The block type appears to be a subsystem. Hence what should I specify for the keyword search for 'Blocktype'. Updated mdl file attached with MOSFETs in top level and subsystems.

登录发表评论。


Rashmil Dahanayake
Rashmil Dahanayake 2014年10月17日
Edited:Rashmil Dahanayake 2014年10月17日
A temporary way around this. Works only if a Tag is specified under block properties.
triph_model;
cc = find_system('trial_model',,,,'regexp',,,,'上',,,,'标签',,,,'Mo(。*)');
为了x=1:length(cc)
block1 = cc {x};
set_param (block1'Ron',,,,'3');
结尾
限制:一旦设置为需要的块

Orion
Orion 2014年10月17日
Edited:Orion 2014年10月17日
你好,
尝试这个
mymosfetblock = find_system('trial_model',,,,'SourceType',,,,'Mosfet'
specific property of your Mosfet block
then you use set_param to change the parameter you want.
1条评论
Rashmil Dahanayake
Rashmil Dahanayake 2014年10月17日
it returns an empty cell array. Which means the search criteria unable to locate mosfets.

登录发表评论。


Orion
Orion 2014年10月17日
我试过了
mymosfetblock = find_system('trial_model',,,,'SourceType',,,,'Mosfet'
with the mdl you attached, and I got the result
mymosfetBlock =
'trial_model/Subsystem/sw1'
'trial_model/Subsystem/sw2'
'trial_model/sw1'
'trial_model/sw2'
我有MATLAB 2014a,但是该命令行应与每个版本一起使用。
您使用库,口罩吗?

下载188bet金宝搏

社区寻宝

在Matlab Central中找到宝藏,发现社区如何为您提供帮助!

Start Hunting!