查找并设置几个块的simu金宝applink参数
10次观看(最近30天)
显示较旧的评论
我有一个带有数量子金宝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。
0评论
答案(4)
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
结尾
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,但是该命令行应与每个版本一起使用。
您使用库,口罩吗?