SimPowerSystems : How to select motor preset from Matlab script ?

2 Ansichten (letzte 30 Tage)
Didier
Didier am 22 Mai 2014
Beantwortet: A Jenkins am 22 Mai 2014
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

Antworten (1)

A Jenkins
A Jenkins am 22 Mai 2014
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);

Communitys

Weitere Antworten in  Power Electronics Control

Kategorien

Mehr zu Simscape Electrical finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by