Blocks
Define model behavior with blocks, configure their parameters, and connect their ports to establish signal flow.
Blocks are the modeling elements used to construct a diagram. A block can perform a calculation, use values from previous executions, route signals, define an interface, or contain another diagram. Its behavior is determined by its block type, parameter values, and connections.
Add blocks from the library, configure them in Properties, and connect their ports to describe the algorithm. The direction of each connection establishes how data flows between operations.
Block elements
The figure illustrates a Sum block configured to calculate an error from a reference and a measured value.
| Element | Purpose |
|---|---|
| Block type | Defines the operation or modeling role, such as Sum, Unit Delay, or Container |
| Name | Identifies this instance in the diagram |
| Input ports | Receive signals used by the block |
| Output ports | Provide signals to other blocks |
| Parameters | Configure behavior, such as signs, limits, or initial conditions |
The available elements depend on the block type. A Constant has an output and no inputs. A Terminator has an input and no outputs. A Container exposes the interface of its nested diagram. Changing a block’s name identifies the instance without changing its operation.
Choose a block
The block library groups blocks by function. Use the search field to locate a block by name.
| Modeling task | Typical blocks |
|---|---|
| Perform numerical calculations | Sum, Multiply, Absolute, Saturation |
| Generate input signals | Constant, Ramp, Step, Sine Wave |
| Use values from previous executions | Unit Delay, Integrator, Derivative |
| Evaluate conditions | Comparator, Boolean Logic |
| Evaluate lookup tables | Curve, Map 2D |
| Arrange or select data | Mux, Demux, Selector, Bus Creator, Bus Selector |
| Transform tensor shapes | Reshape, Transpose, Matrix Get |
| Define model and diagram interfaces | Model Input, Model Output, Virtual Input, Virtual Output |
| Organize behavior | Container, Conditional, State Chart |
The Block Reference describes individual operations. Dedicated guides cover Unit Delay, Container, Conditional, and State Charts.
A Callback defines a separate executable diagram with periodic or event activation. Tasks group callbacks in the build configuration.
Ports and connections
A connection carries a signal from an output port to an input port. One output can supply several inputs. Each data input accepts one incoming connection.
Input ports receive values used in calculations or conditions. Some block types provide additional inputs for selecting a branch or activating execution. The available ports are described in the block’s reference page.
A signal has a data type and a shape. The connected values must satisfy the receiving block’s requirements. Some blocks adapt to their inputs, while others expose explicit data type settings. See Signals for type, shape, and naming rules.
State and direct feedthrough
State represents information retained from earlier executions that influences subsequent behavior. Unit Delay uses state to provide the preceding input value. A Sum calculates its output from the current inputs without retaining their history.
Direct feedthrough describes whether an output depends on an input value from the same execution. For example, a Sum needs the current values of its inputs to calculate its output. Unit Delay provides the preceding input value, so its current output does not depend on its current input.
State and direct feedthrough describe different properties. A block can retain state and also use current inputs to calculate its output. Having state alone does not determine whether a block has direct feedthrough.
These distinctions matter when modeling feedback. A closed path with direct feedthrough throughout creates an algebraic dependency in which current values depend on one another. A delay instead expresses a dependency on an earlier value and changes the modeled behavior. Include a delay when that temporal relationship belongs to the algorithm.
Parameters and initial conditions
Select a block to inspect its settings in Properties. Parameters configure the mathematical operation or execution behavior. For a Sum, the input count and signs determine the expression. For a Saturation, the lower and upper limits define the allowed output range.
Where supported, a parameter can contain a literal value or a reference to a declared parameter, such as $limit. Parameter references allow several blocks to use a shared value. See Parameters for declarations and scope.
An initial condition specifies a starting value for the calculation. Its meaning depends on the block. For Unit Delay, it is the first output. Consult the block’s parameter description before setting it.
Interface blocks
Model Input and Model Output blocks define where signals enter and leave a model. A model can expose multiple input and output interfaces.
Virtual Input and Virtual Output blocks define signal boundaries between a nested diagram and its parent. Interface blocks describe data transfer across a boundary rather than a numerical operation. See Model Hierarchy for nested diagrams and their interfaces.
Work with blocks
- In Edit mode, find a block in the library and drag it onto the canvas.
- Select the block and configure its name and parameters in Properties.
- Drag from an output port to an input port to create a connection.
- Save the model before entering Testing mode.
Review any reported diagnostics when connecting blocks and preparing a simulation.