MATLAB Answers

Masking a variant subsystem using Label control

8 ビュー (過去 30 日間)
I want to mask a variant subsystem consisting of two subsystems using mask initialization and the following code derived from "slexMaskingExample". I want to set the mode to speed or torque control and thereby use either of the speed or torque controllers to fulfil my purpose. I expect this to reduce my simulation time as the other block shoudl be inactive during the simulation as described by the Label Mode Active Variant in the Block parameters of the Variant subsystem.
But the problem is the underlying code does not make the other controller inactive while simulation. During simulation, both the subsystems are runnning. DUring editing, the results are as desired.
The mask initialization code is as follows:
simulationStatus = get_param(bdroot,'SimulationStatus');
choice = get_param(gcb,'Mode');
Blk = gcb;
if strcmp(choice,'Speed')
set_param(Blk, 'LabelModeActiveChoice', 'SpeedC');
else
set_param(Blk, 'LabelModeActiveChoice', 'TorqueC');
end
query1.PNG query2.PNG
Kindly help

  0 件のコメント

サインインしてコメントする。

採用された回答

Naveen Venkata Krishnan
Naveen Venkata Krishnan 2019 年 10 月 10 日
Hello ,
As far as I understood, you have a problem in implementing a variant subsystem. I have attached a simple model of implementing a variant subsysyem.
Once all the subsystems in the variant model are designed then we need to define the corresponding conditions. Which can be done as shown. In the example that i have attached,l have two subsytems and I have named it as "Gain=20", "Gain=10" . My condition is if variable G == 1, then subsystem "Gain=10" will be active and if G==2 subsytem "Gain=20" will be active. In both cases the other substem will be inactive.
variants-1.png
The value of varaible G has to be given in the command prompt.
when G==1
g1.png
when G==2
g2.png

  0 件のコメント

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by