Overview

rtint is a Python package that talks to Simulink models running on a real-time target machine, through a Resyst server. It wraps the server’s client API so that the parts of a real-time model (motors, filters, feedback loops, signals and so on) can be used as ordinary Python objects from a script or an interactive session.

It is used at the ESRF to commission and tune mechatronic systems whose control runs on a real-time target. For a graphical front end built on top of it, see rtint-gui.

What it covers

Each part of the real-time model has its own controller object, available as an attribute of the main RtintController:

  • Motors: start, stop, move and read the state.
  • Regulation: switch feedback loops on and off.
  • Filters: read and change filter parameters, for example low-pass, PID and notch filters, and compute their frequency responses.
  • Signals and parameters: read and write model signals and tunable parameters.
  • Acquisition: record signals at the model sampling rate.
  • Signal generators: sine, chirp and other excitation signals, useful for system identification.
  • Triggers, lookup tables, EtherCAT slaves and 2D scans.

Most objects can print a summary table of their state in the terminal.

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
from rtint.rtint_hardware import RtintController

config = {
    "server": "my-server-hostname",
    "port": 8080,
}

controller = RtintController("my_target", config)
controller._run_model("my_model")

# Access hardware components
controller.motor.start()
controller.regul.on()
controller.filter.low_pass(wn=100, xi=0.707)

Installation

1
pip install rtint

Python 3.9 to 3.13 is supported. The package depends on resyst-client, numpy, scipy, matplotlib, gevent, treelib and tabulate. A running Resyst server and a real-time model are needed to do anything useful with it.

  • rtint-gui: desktop application built on this package.