Masking a variant subsystem using Label control
3 views (last 30 days)
Show older comments
Aseem Routray
on 21 Aug 2019
Answered: Naveen Venkata Krishnan
on 10 Oct 2019
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
Kindly help
0 Comments
Accepted Answer
Naveen Venkata Krishnan
on 10 Oct 2019
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.
The value of varaible G has to be given in the command prompt.
when G==1
when G==2
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!