Signals
Connect blocks with signals, work with data types, shapes and broadcasting, and inspect values during simulation.
A signal represents a quantity used or produced by a model, such as a measured speed, a control command, or an operating mode. Connections carry signals from output ports to input ports and establish the direction of data flow.
Signals and connections
One output can supply several inputs. Each data input accepts one incoming connection. To combine signals, use an operation such as Sum or Mux.
Both branches carry the same source signal. Each receiving block uses it according to its behavior.
Data types
A data type defines the values a signal can represent. Choose sufficient range and precision for the quantity being modeled.
| Category | Types |
|---|---|
| Floating point | float32, float64 |
| Signed integer | int8, int16, int32, int64 |
| Unsigned integer | uint8, uint16, uint32, uint64 |
| Boolean | bool |
| Enumeration | A declared enumeration type |
Blocks may expose a type setting or determine their output type from their inputs. Use a Conversion block for an explicit numeric type change. See the Block Reference for supported types.
User-defined enumeration types
Enumerations give discrete choices meaningful names, such as DriveMode.ECO and DriveMode.SPORT. Declare them in the model’s data definitions.
Shapes and dimensions
Shape specifies the size of each dimension. Rank is the number of dimensions. Modeloop writes dimensions after the data type, as in float64[2, 3] for a matrix with two rows and three columns. A scalar omits the brackets.
Modeloop preserves dimensions of size one. A scalar, [1], and [1, 1] are distinct shapes. A rank one vector such as [3] has no row or column orientation.
Higher rank arrays use the same notation. For example, float64[2, 3, 4] has rank three and 24 elements. Array elements share a data type, and all dimensions are positive integers.
Shapes remain fixed during a simulation run. They describe each signal value, independently of the time axis used to record it.
Broadcasting
Broadcasting combines compatible shapes by reusing values along expanded dimensions. Sum supports it, as does Multiply in Element-wise mode. The source signals keep their original shapes.
Compare dimensions from right to left. Each pair must be equal or include a 1. Missing leading dimensions count as 1, and each result dimension takes the larger size.
Scalar expansion
A scalar applies to every element of an array.
Reuse across rows
A [3] vector aligns with the columns of a [2, 3] matrix and repeats across its rows. Faded values show conceptual repetition.
Vector and column expansion
Combining [3] with [3, 1] produces [3, 3]. To calculate between matching columns instead, reshape the vector to [3, 1] first.
The same rules apply to higher ranks. Equal element counts alone do not establish compatibility.
| First input | Second input | Result |
|---|---|---|
[2, 3] |
[2, 1] |
[2, 3] |
[2, 3, 4] |
[3, 1] |
[2, 3, 4] |
[2, 3] |
[2] |
Incompatible trailing dimensions |
[2, 3] |
[3, 2] |
Incompatible dimensions |
Broadcasting applies where the operation supports it. Model interfaces and other blocks still require values compatible with their declared dimensions.
Elementwise and matrix operations
Multiply supports two modes. Element-wise multiplies corresponding elements after broadcasting. Matrix computes row and column products, so [m, n] multiplied by [n, p] produces [m, p].
In Matrix mode, two matching vectors produce a scalar dot product. For higher rank matrix inputs, leading dimensions follow broadcasting rules. A scalar scales the other input. Division requires Element-wise mode.
Reshape and transpose
Reshape changes dimensions while preserving element order and count. Transpose exchanges axes. The same output shape can therefore contain different value arrangements.
Transposing a rank one vector leaves its shape unchanged. Use Reshape to create a row or column matrix.
Naming signals
Select a connection and edit its name in Properties. Names such as measured_speed_rps identify the quantity and are shared by all branches from the same output. Signals can also remain unnamed.
Inherited names appear in angle brackets and are read only. Rename the source signal to update them. Properties explains unresolved names or conflicts.
Block names and interface labels identify diagram elements and remain separate from signal names.
Signals at boundaries
Model Input and Model Output define a model’s input and output interfaces. Virtual Input and Virtual Output pass signals between nested diagrams and their parents. See Model Hierarchy.
A model can have multiple interfaces. Check their types and shapes when connecting them. Matching names alone do not establish compatibility.
Inspect signal values
Select a connection and open the Measurement section in Properties. Turn on Enable Signal Measurement to include the signal in simulation results. The Measurements tab in the Data Manager lists the selected signals and their exposure settings. Run a scenario in the model’s testing harness to inspect recorded values over time in PlotLab.
For array inputs, scenario profile parameters may use a scalar shared by every element or values matching the declared shape. Matrix grids list elements row by row. Table time points remain separate from each sample’s shape.
See Simulation for running scenarios and Testing for specifying expected results.