Subsystems

Subsystem Block

Hierarchical block container - encapsulates nested blocks into reusable units

Open Subsystem in BlockWerk →

# Subsystem Block

Overview

The Subsystem block creates a hierarchical encapsulation of blocks, allowing you to group complex control logic into reusable, self-contained units. This is essential for managing large, complex diagrams.

Concept

A Subsystem is a "block within blocks":

┌─────────────────────────────┐
│      Subsystem              │
│  ┌──────────────────────┐   │
│  │  Internal Blocks     │   │
│  │  (PID, Filters, etc) │   │
│  └──────────────────────┘   │
└─────────────────────────────┘

From outside: Subsystem looks like a single block From inside: Contains its own blocks and internal connections

Ports

Subsystem ports are defined by InPort and OutPort blocks placed inside it.

Example Structure

MyController (Subsystem)
├── error [InPort]
├── PID
├── Saturation
├── filter [OutPort]

From outside, you see:

Parameters

subsystemName

Display name for the subsystem.

Default: "MySubsystem"

description

Optional description of subsystem function.

Default: "Hierarchical block container"

How to Use

1. Create Subsystem

2. Enter Subsystem

3. Add Ports

Inside the subsystem, add:

4. Wire Internal Logic

5. Exit & Use

Architecture

Internal Block Scope

State Isolation

Hierarchical Paths

Connection Resolution

Example Workflow

Goal: Create Reusable PID Unit

Step 1: Create Subsystem "PIDUnit"

{
  "id": "pidunit1",
  "type": "Subsystem",
  "params": { "subsystemName": "PIDUnit" }
}

Step 2: Enter and build inside

Kp [constant]
Ki [constant]
Kd [constant]
error [InPort] ──→ × (multiply) ──→ output [OutPort]
          ├────→ integral ────→ ×
          └────→ derivative ──→ ×
                      ↓
                   Sum ──→

Step 3: Exit (breadcrumb click)

Step 4: Use in main diagram

setpoint ──→ −─→ PIDUnit ──→ plant
      ↑________________↓
          feedback

Step 5: Reuse multiple times

Nesting

Subsystems can be nested (subsystem in subsystem):

Control System
├── Estimation Subsystem
│   ├── Kalman Filter
│   └── Sensor Fusion
├── Decision Subsystem
│   ├── Logic Gates
│   └── State Machine
└── Actuation Subsystem
    ├── PID
    └── Limits

Limited depth recommended (3-4 levels) for performance.

Best Practices

✅ DO

❌ DON'T

Ports (InPort/OutPort)

InPort (Input Interface)

OutPort (Output Interface)

Port Mapping

[External Block A]
        ↓
   [External Connection]
        ↓
   [InPort "speed"]
        ↓
   [Internal Connection]
        ↓
   [PID Block]
        ↓
   [Internal Connection]
        ↓
   [OutPort "command"]
        ↓
   [External Connection]
        ↓
[External Block B]

Technical Notes

Simulation Execution

1. Enter subsystem scope 2. Evaluate InPort (pass external → internal) 3. Execute internal blocks 4. Evaluate OutPort (pass internal → external) 5. Exit subsystem scope

State Management

Performance

Remarks

See Also

Known Limitations (Current)

🔄 Implementation Note: Subsystem requires store refactoring to fully enable:

Currently: Block definition ready, WASM execution needs store layer work.