how to change simulink block properties from matlab pogram?

조회 수: 8 (최근 30일)
Harish Balaga
Harish Balaga 2013년 5월 15일
I have created a simulink model in which there are two 3-phase fault blocks. i want to change the fault block properties (like faulty phase, fault resistance..etc) from matlab program (m file) and run the model.. How to do that?

채택된 답변

Harish Balaga
Harish Balaga 2013년 5월 15일
I found the answer myself from matlab help. it can be set or reset using "set_param" command. an example is given below
open('MyModel.mdl');
set_param('MyModel/3-Phase Fault', 'FaultA', 'on');
here "3-Phase Fault" is the name i gave to the block in "MyModel.mdl". "FaultA" is the parameter name (Default). To check the type & name the of parameter (checkbox in my case, so on & off are the parameter values), one may use the following command to open the model in editable code form.
edit('MyModel.mdl');
and then search for the block name.

추가 답변 (2개)

Valmir Sadiku
Valmir Sadiku 2013년 5월 15일
Hello,
One possible way are that you use parameter in your 3-phase fault block. Then write an M-File in which you can generate/change the values of this parameter (which are now stored in the Workspace) and open the Simulink model from matlab with the command:
results = sim('myFaultyModel');
regards V.Sadiku
  댓글 수: 3
Valmir Sadiku
Valmir Sadiku 2013년 5월 15일
as i already wrote above you can modify your parameter on the M-File simply, e.g. :
parameter_1 = 12.1;
parameter_2 = 1.05;
......
parameter_x = 0.1;
..
now you can the call the model, which runs with changed parameter values
sim('myFaultyModel');
then maybe with another parameter again:
parameter_1 = 12.8;
parameter_2 = 1.0;
......
parameter_x = 0.18;
..
and call the model again and so on.
Harish Balaga
Harish Balaga 2013년 5월 15일
thank you for the answer but it seems you didn't get my question clearly. What is the name of the phase A, B, C values of the 3-phase fault block of the model? how to know that? How to set (tick mark) or reset the check box of each phase through program? is there any syntax like
faultmodel.faultblock1.phaseA=1; %to set
and after some time
faultmodel.faultblock1.phaseA=0; % to reset
??
i need to check or uncheck the check box in the properties window (window that appears when we double click on any block in Simulink) of the fault block

댓글을 달려면 로그인하십시오.


Valmir Sadiku
Valmir Sadiku 2013년 5월 15일

카테고리

Help CenterFile Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by