Triggered Subsystems: Executes one step each time the appropriate signal is applied to
the trigger input. You can configure the trigger input to react to a rising edge, a falling
edge or both edges.
Resettable Subsystems: Executes at every time step but conditionally resets the states of
blocks within it to their initial conditions when a trigger event occurs at the reset port.
13
Masked Subsystems
A mask is special type of subsystem. It offers a custom interface for a subsystem and hides the
content, making it appear as a built in ‘base’ block with its own icon and custom parameter dialog
box. It simplifies the graphical appearance of a model and controls access to the block content.
Consider an example subsystem below which simply produces a straight line
𝑦 = 𝑚𝑥 + 𝑐
where
𝑥
is the simulation time steps and
𝑚
and
𝑐
are defined by Gain and Constant blocks respectively. To
edit
𝑚
and
𝑐
you would normally have to open the subsystem, and interact with each of the block
parameters (this involved multiple windows and clicks).
If we instead turn this subsystem into a mask (right click -> Mask -> Create Mask) then we could
create a custom dialog block. Whenever we click on this new masked susbsytem, we would get
one dialog box where we can conveniently set
𝑚
and
𝑐
.
For information on creating your own masks, see this video:
https://uk.mathworks.com/videos/creating-a-mask--masking-fundamentals-1480968643715.html
Program Control: For, While, If and Case
Within the Ports and Subsystems library, you will see subsystems that perform the Simulink
equivalent of For and While loops and If and Case statements. The For and While loops will
perform a number of loops for each step of the simulation. They each contain a control block that
allows you to configure how many loops are performed. It takes two sorts of block to implement
an If statement:
The If block itself is used to perform the test that determines what is going to happen.
It produces two control signals: one for true the other for false.
The control signals go to If Action subsystems. You put the blocks required for each
condition into the appropriate Action subsystem.
The case statement is performed in a similar way. There are two different blocks. The Case block
itself determines which of the Case Action subsystems to perform.
|