Container
Organize a diagram behind named ports. Define the interface in Properties, wire the blocks inside, and connect the Container to its parent.
A Container puts related blocks inside a named sub-diagram. The parent canvas shows only its inputs and outputs; double-click the block to work inside it. Use one to make a growing diagram easier to read.
Build a magnitude function
Create a Container named Magnitude: it receives signal, calculates its absolute value, and returns magnitude. An input of -3 produces 3.
All steps in text
- Drag Container from the block library onto the canvas. Select it and set its name to
Magnitudein the property panel. - Expand Interface. Choose + Add input and name it
signal. Choose + Add output and name itmagnitude, then choose Apply interface. Modeloop creates the corresponding Virtual Input and Virtual Output inside the Container. - Double-click the Container to enter it. Add an Abs block, then connect Virtual Input
signal→ Abs → Virtual Outputmagnitude. The interface blocks are already there; do not add a second pair. - Use the breadcrumb to return to the parent canvas. Connect your source to
signalon the left and connectmagnitudeon the right to the next block. Try negative, zero, and positive inputs:-3 → 3,0 → 0,3 → 3.
Follow a signal through the boundary
| On the parent canvas | Inside the Container | What to connect |
|---|---|---|
Input signal on the left | Virtual Input signal | Its output feeds the inner calculation |
Output magnitude on the right | Virtual Output magnitude | Feed it the result of the inner calculation |
Each parent port and its inner interface block represent the same signal. The input and output of the Container can have different names: signal enters; magnitude leaves.
Adding an output name creates its Virtual Output block, not the calculation or its wires. Connect a result to that block before using the output on the parent canvas. Use Virtual Input / Output at this boundary; Model Input / Output belong to the model interface.
Change the interface in one place
Select the Container on the parent canvas and edit Interface in Properties.
| Your change | What happens after Apply interface |
|---|---|
| Add an input or output | A parent port and its matching inner Virtual Input or Output are created |
| Rename an existing port | Both names update; existing connections stay attached |
| Remove a port | Its inner interface block and attached connections are removed |
Edits to Virtual Input / Output blocks inside the Container also synchronize back to its parent ports. To rename, edit the existing row rather than removing it and adding another. Undo restores an applied interface edit; Cancel discards unapplied changes.
Use letters, digits, and underscores for port names. Keep input names unique within Inputs and output names unique within Outputs. Clear names such as measured_speed make connections easier to follow.
Group blocks you already have
Select the related blocks and choose Group in the toolbar, or press ⌘G on macOS / Ctrl+G on Windows and Linux. Modeloop moves the selection into a Container and creates Virtual Inputs and Outputs for connections that cross its boundary. Rename the Container and its ports to describe their purpose.
What changes when you use a Container?
The layout becomes hierarchical; execution still follows the surrounding diagram. A Container adds no delay, condition, or separate schedule. Memory blocks inside it keep their own behavior.
For branches that run under different conditions, use a Conditional. For a separate period or event trigger, use a Task.