Blocks — The Operations

Blocks are the computational units of every model: what they are, how to configure and connect them, and the rules that govern them.

A block is the fundamental unit of computation in Modeloop. Each block performs exactly one well-defined operation: it reads values from its input ports, computes, and writes values to its output ports. A model is nothing more — and nothing less — than blocks connected by signals.

This single-responsibility design is deliberate. Because each block has precise, isolated semantics, Modeloop can validate models as you build them and guarantee that a block behaves identically in simulation and in generated code.

Anatomy of a block

Every block consists of:

  • Input ports — where signals enter. A port accepts exactly one incoming connection.
  • Output ports — where results leave. One output can fan out to many destinations.
  • Parameters — configuration values fixed at design time (a constant’s value, a gain, a lookup table). Parameters can be literals or $references to centrally managed data.
  • Control port (optional) — an execution trigger for event-driven execution. Control ports are edge-triggered: execution fires when the boolean control signal transitions.

Block categories

The palette organizes blocks by what they do for you:

CategoryBlocksRole
SourcesConstant, CurveProduce values: fixed constants and lookup tables
MathSum, Multiply, Abs, Power, Sqrt, Exp, Log, Sin, Cos, Tan, Asin, Acos, Atan, Atan2Instantaneous computation: output depends only on the current inputs
MemoryUnit Delay, Integral, DerivativeStateful blocks: output depends on past values
RoutingIf-Then-Else, ComparatorSignal selection and decision logic
InterfaceModel Input/Output, Virtual Input/OutputBoundaries where signals enter and leave a component or a hierarchy level
CompositeContainer, State ChartBlocks that contain a whole diagram of their own

Two distinctions in this table matter more than the others:

  • Math blocks are instantaneous — their output is a pure function of the current inputs. Memory blocks are stateful — their output depends on previous steps, which makes them the only legal way to close a feedback loop (see The Solver).
  • Composite blocks define hierarchy — their inner diagram is a full canvas of its own, and tasks built on them are what the solver schedules.

The main block families

Math blocks

Elementary arithmetic (Sum, Multiply, Abs, Power, Sqrt, Exp, Log) and trigonometry (Sin, Cos, Tan, Asin, Acos, Atan, Atan2). Sum and Multiply accept configurable input counts and per-input signs/inversions, so a subtraction is a Sum with a negated input — no separate block needed.

Source blocks

Constant emits a fixed, typed value. Curve implements a one-dimensional lookup table with interpolation — the standard way to embed calibration maps and nonlinear characteristics.

Memory blocks

  • Unit Delay — outputs the input from the previous step. The workhorse for breaking feedback loops.
  • Integral — discrete-time integration of the input signal.
  • Derivative — discrete-time differentiation.

All memory blocks take an initial condition parameter that defines their output on the very first step.

Routing blocks

  • Comparator — compares two signals and outputs a boolean.
  • If-Then-Else — selects one of two input signals based on a boolean condition. This is signal selection, not control flow: both branches are always well-defined values.

Interface blocks

Interface blocks are the only way data crosses a boundary:

  • Model Input / Model Output — the external interface of a model or task.
  • Virtual Input / Virtual Output — the interface between a container’s inner diagram and its parent level.

Composite blocks

A Container groups a sub-diagram behind virtual ports — pure structure, with no runtime cost of its own. A State Chart contains a finite state machine instead of a data-flow diagram; see State Charts. A container bound to a schedule — periodic or event-triggered — is a task; see Model Hierarchy.

Using blocks on the canvas

  • Placement — drag a block from the palette onto the canvas.
  • Configuration — select the block and edit its parameters in the properties panel. Validation is immediate: out-of-range or ill-typed parameters are flagged before you can save.
  • Connection — drag from an output port to an input port. Modeloop validates the connection live (direction, type compatibility, single-driver rule) and rejects illegal wires with a specific diagnostic.
  • Grouping — select a set of blocks and wrap them in a container to introduce hierarchy at any time; the connections are re-routed through virtual ports automatically.

Design rules

  1. One driver per input. An input port accepts exactly one connection. Outputs may fan out freely.
  2. No dangling semantics. Unconnected inputs are validation errors — a block cannot compute from nothing.
  3. Types must agree. A connection is legal only if the source and destination types are compatible; see Signals.
  4. Loops require memory. Any cycle in the data flow must pass through at least one memory block.

For the complete per-block reference — ports, parameters, and behavior of every block — see the Block Reference.