Skip to main content

Synapsys

A Python library for modelling, analysis and real-time simulation of linear control systems. Provides a MATLAB-compatible API over SciPy, a multi-agent simulation framework, and a pluggable transport layer (shared memory / ZMQ) for MIL → SIL → HIL workflows.

pippip install synapsys
uvuv add synapsys
devuv sync --extra dev

Overview

Synapsys covers the full control-design workflow — from continuous-time LTI modelling to discrete real-time closed-loop simulation — with a consistent API across all stages.

Transfer functions and state-space — synapsys.api
from synapsys.api import tf, ss, step, bode, feedback, c2d

# Transfer function: G(s) = ωn² / (s² + 2ζωnˢ + ωn²)
wn, zeta = 10.0, 0.5
G = tf([wn**2], [1, 2*zeta*wn, wn**2])

# Closed-loop (negative feedback)
T = feedback(G)

# Frequency and time-domain analysis
w, mag, phase = bode(G)
t, y = step(T)

# Zero-order-hold discretisation at 200 Hz
Gd = c2d(G, dt=0.005)

Simulation Fidelity Ladder

Synapsys is designed for incremental fidelity increases. Only the transport layer changes — the controller algorithm remains identical across all three stages.

MILModel-in-the-LoopSharedMemoryTransport · PlantAgent
SILSoftware-in-the-LoopZMQTransport · separate process
HILHardware-in-the-LoopHardwareAgent · real device

See the HIL / SIL guide for a step-by-step migration example.

AI + Control Systems — Quadcopter MIMO Demo

Any PyTorch, Keras or JAX model plugs directly into a ControllerAgent via a single np.ndarray → np.ndarray callback. Below: a 12-state MIMO quadcopter controlled by a residual Neural-LQR (δu = −K·e + MLP(e)) — the MLP starts zeroed so the system launches as pure LQR and can be fine-tuned via RL without losing stability.

Real-time 3D animation of the quadcopter tracking a figure-8 trajectory

PyVista 3D window (50 Hz) — drone mesh, trajectory trail, reference curve and live HUD.

Live telemetry: top-down x-y trajectory, altitude, Euler angles and control inputs

matplotlib telemetry (10 Hz) — x-y position, altitude, Euler angles and control deviations δu.

Residual Neural-LQRδu = −K·e + MLP(e). Output layer zeroed at init → starts as pure LQR. The residual is trained later via RL or imitation learning.
12-State MIMO PlantLinearised hover model (x, y, z, φ, θ, ψ, ẋ, ẏ, ż, p, q, r) built with ss() + c2d(). LQR gain K∈ℝ⁴ˣ¹² from lqr().
PyTorch / Keras ReadyThe controller is a plain Python callable. Swap in any nn.Module — LSTM, Transformer, diffusion policy — without changing the simulation loop.
Distributed & Real-TimePlant and controller can run in separate processes or machines via SharedMemoryTransport or ZMQTransport — same API, zero code changes.

Full walkthrough: Quadcopter MIMO Neural-LQR example →

3D Simulation Views

Janelas de simulação 3D prontas para usar — conecte qualquer controlador (LQR, PID, rede neural, agente RL) com uma única linha de código.

Cart-Pole 3D simulation
Cart-Polex = [x, ẋ, θ, θ̇]

Inverted pendulum on a cart. 4 states, unstable — the classic benchmark for LQR and RL.

Inverted Pendulum 3D simulation
Inverted Pendulumx = [θ, θ̇]

Single-link pendulum on a fixed base. The simplest unstable system for testing any controller.

Mass-Spring-Damper 3D simulation
Mass-Spring-Damperx = [q, q̇]

Mass-spring-damper with setpoint tracking. LQR with position feed-forward.

Pass any callable as a controller — LQR, PID, neural network or RL agent: CartPoleView(controller=my_model).run() · See examples →

From the Blog

In-depth research articles and practical posts on control systems, AI and Synapsys.

Post

Welcome to the Synapsys Blog

· 3 min read

Introducing the Synapsys Blog — a space for tutorials, research insights, and practical guides for control systems engineers and researchers.

Read full article →
PID with Anti-Windup: Theory, Tuning and Experimental Validation
Article

PID with Anti-Windup: Theory, Tuning and Experimental Validation

· 12 min read

A research-oriented deep-dive into discrete PID with back-calculation anti-windup — from the integral windup problem to experimental step-response validation, with Synapsys code throughout.

Read full article →
Article

MIMO Control of a Quadcopter with Neural-LQR

· 15 min read

How to model a 12-state linearised quadrotor, design a MIMO LQR, augment it with a residual MLP, and simulate the closed-loop in 3D — a research-grade case study using Synapsys.

Read full article →
From Model to Hardware: MIL → SIL → HIL in Three Steps
Post

From Model to Hardware: MIL → SIL → HIL in Three Steps

· 8 min read

A practical guide to the MIL/SIL/HIL development workflow with Synapsys — swap from simulation to real hardware by changing one line, keeping your control algorithm untouched.

Read full article →
Article

Stabilising an Inverted Pendulum with LQR

· 10 min read

A complete walkthrough: derive the linearised state-space model of an inverted pendulum, design an LQR controller, simulate the closed-loop response, and discretise for embedded deployment — all in Python with Synapsys.

Read full article →
Post

Welcome to the Synapsys Blog

· 3 min read

Introducing the Synapsys Blog — a space for tutorials, research insights, and practical guides for control systems engineers and researchers.

Read full article →
PID with Anti-Windup: Theory, Tuning and Experimental Validation
Article

PID with Anti-Windup: Theory, Tuning and Experimental Validation

· 12 min read

A research-oriented deep-dive into discrete PID with back-calculation anti-windup — from the integral windup problem to experimental step-response validation, with Synapsys code throughout.

Read full article →
See all posts →

Full Library Map

Nine focused packages — from LTI mathematics to real-time hardware. Click any card to jump to the API reference.

Package Overview

PackageContentsStatus
synapsys.coreTransferFunction, StateSpace, ZOH discretisationStable
synapsys.apiMATLAB-compatible layer: tf(), ss(), step(), bode()Stable
synapsys.algorithmsDiscrete PID with anti-windup, LQR (ARE solver)Stable
synapsys.agentsPlantAgent, ControllerAgent, SyncEngineFunctional
synapsys.transportSharedMemory (zero-copy), ZMQ PUB/SUB & REQ/REPFunctional
synapsys.viz3D sim views plug-and-play: CartPoleView, PendulumView, MassSpringDamperViewFunctional
synapsys.hwHardwareInterface, MockHardwareInterface (HIL)Interface
synapsys.mpcModel Predictive ControlPlanned