SimPowerSystems : How to select motor preset from Matlab script ?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
I used the SimPowerSystem to model the actuation part of a mechatronic device on Simulink. In order to optimize the system, I would like to select motor presets from Matlab code.
For example, for the PMSM actuator we can select 16 different motors in the "Preset model" parameter. Then I would like to change the value of this parameter from the Matlab code in order to use this "parameter" as an optimization parameter.
In other words, if I consider PresetModel as my variable, I wanted that:
- If PresetModel=1 then select motor "01: 0.8 Nm 300 Vdc 3000 RPM - 0.8 Nm"
- If PresetModel=2 then select motor "02: 1.7 Nm 300 Vdc 3750 RPM - 1.7 Nm"
- and so on...
I know there are functions like set_param to change parameters of a Simulink model, but I don't know the name of the parameter related to the "Preset model" block parameter.
Thanks in advance for your help.
Cheers, /DC
댓글 수: 0
답변 (1개)
A Jenkins
2014년 5월 22일
1) First try this so that you know how to do this yourself next time. Use the command
get_param(block_handle,'ObjectParameters')
to see all the posible parameters you can set. You will notice your desired parameter 'PresetModel' is there. Then you can use
get_param(block_handle, 'PresetModel')
to see what values you can set it to. Just change it with the GUI and see what it looks like when you read it.
2) Now your code will look something like this:
preset_model_num=1;
switch preset_model_num
case 1
preset_model_name='01: 0.8 Nm 300 Vdc 3000 RPM - 0.8 Nm';
case 2
preset_model_name='02: 1.7 Nm 300 Vdc 3750 RPM - 1.7 Nm';
case 3
preset_model_name='03: 2.8 Nm 300 Vdc 4250 RPM - 3.2 Nm';
%case 4
%case 5
%...
otherwise
preset_model_name='No';
end
set_param(block_handle,'PresetModel',preset_model_name);
댓글 수: 0
커뮤니티
더 많은 답변 보기: Power Electronics Community
참고 항목
카테고리
Help Center 및 File Exchange에서 Simscape Electrical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!