Introducing MDL: Your Models as Text
Inspect and edit models as MDL text, validate changes, and apply them back to the diagram.
Block diagrams are the right tool for designing dynamic systems. Signal flow, feedback loops, and system structure are spatial concepts, and a canvas shows them the way engineers actually think about them.
But some editing is simply faster in text. Renaming a signal, retuning a set of parameters, restructuring an expression — operations that take many careful canvas interactions are a few keystrokes in an editor. And text can be read top to bottom, searched, and copied.
This is what MDL is for. Modeloop’s textual modeling language represents the same model as the canvas. Open the text editor to inspect the diagram, edit the source, and apply valid changes to update the model.
The MDL guide describes the current editor, contextual suggestions, keyboard controls, and syntax. The editor now shows the model body directly, with its name in the header.
What a model looks like as text
Here is a complete MDL document for a PID controller. The in-app editor shows the sections inside component PIDController: with one less level of indentation.
component PIDController:
inputs:
setpoint: float64
feedback: float64
outputs:
command: float64
parameters:
Kp: float64 = 1.2
Ki: float64 = 0.4
Kd: float64 = 0.05
diagram:
error = setpoint - feedback
derivative_error = Derivative(error)
integral_error = Integral(error)
command = Kp * error + Ki * integral_error + Kd * derivative_errorThe structure is Python-like: interfaces are declared with explicit dimensions and data types, and the diagram: section describes the same dataflow you would wire on the canvas — as expressions.
There is no hidden translation layer here. setpoint - feedback is a Sum block; Ki * integral_error is a Multiply block; Integral(error, initial=0.0) is the same Integral block you drag from the library, with the same parameters. Open the diagram after applying this text and you will find the familiar blocks, wired exactly as written. Statement order is free — signals can reference statements that come later, just like connections on a canvas have no reading order.
Feedback loops are written through memory blocks. Inside a diagram body, a discrete low-pass filter can retain its previous result through Unit Delay:
previous = UnitDelay(filtered, initial=0.0)
filtered = (1 - alpha) * previous + alpha * noisyStructure without leaving the text
Hierarchy is written inline. A container declares its boundary and its contents in one statement:
diagram:
clean = container SpeedFilter(noisy=speed):
alpha = 0.1
previous = UnitDelay(filtered, initial=0.0)
filtered = (1 - alpha) * previous + alpha * noisy
output filtered
throttle = Kp * (target - clean)The arguments are the container’s inputs, the targets are its outputs, and the indented body is its inner diagram. The same inline form covers periodic and event callbacks, conditionally executed subsystems, and state machines:
heat_on = fsm HeaterLogic(temp):
state Off initial:
entry: heat_on = 0.0
state Heating:
entry: heat_on = 1.0
Heating -> Off: [temp > 21.0]
Off -> Heating: [temp < 19.0]The chart body defines states, entry actions, and guarded transitions.
One canonical form
Formatting is deterministic. Emitting the same model in the same form produces the same statement order and formatting. Standalone documents include the component declaration; the in-app editor presents its body.
Editing is transactional. MDL validates after you pause typing and reports errors at their source lines. The diagram changes when you select Apply for valid edits. Modeloop matches the text against the current diagram, preserving the identities and layout of matched elements and positioning new ones. Applied changes participate in the model’s Undo and Redo history.
Where you’ll find it
MDL is built into the editor. Select Edit as text (MDL) to open the whole model, including from a nested diagram. Suggest and Ctrl+Space expose sections, block calls, types, and named arguments at the cursor. Signature help identifies the current argument, and snippets provide fields you can move through with Tab.
See MDL for a complete editing workflow and examples. Applying text updates the open model; saving and creating a version-control commit remain separate steps.