-
-
Notifications
You must be signed in to change notification settings - Fork 40
Real time provider TCLab
Peter Corke edited this page Aug 19, 2026
·
2 revisions
This page documents TCLab usage through the serial provider.
Current status:
- Driver is implemented in code.
- Not yet hardware-validated in this repo.
Implementation module: src/bdsim/blocks/io_tclab.py.
Use serial provider with a TCLab device entry in bdsim.toml.
from bdsim.realtime import BDRealTime
rt = BDRealTime(
io_provider="serial",
io_provider_kwargs={"config_path": "bdsim.toml"},
)- Commands:
VER,T1,T2,Q1 <pct>,Q2 <pct>(space-separated,\n-terminated — not comma-separated) - Inputs:
T1,T2 - Outputs:
Q1,Q2in percent - Typical baud: 115200
The driver sets safe state on startup/shutdown (heaters to zero).
[io]
config_version = 1
default_provider = "serial"
[providers.serial]
type = "serial"
shutdown_on_signal = true
safe_shutdown_timeout_s = 0.5
[devices.tclab0]
provider = "serial"
driver = "tclab"
port = "/dev/ttyACM0"
baud = 115200
startup_probe = true
startup_timeout_s = 2.0
[devices.tclab0.channels.t1]
direction = "in"
kind = "analog"
address = "T1"
eng_units = "C"
scale = 1.0
offset = 0.0
[devices.tclab0.channels.t2]
direction = "in"
kind = "analog"
address = "T2"
eng_units = "C"
scale = 1.0
offset = 0.0
[devices.tclab0.channels.q1]
direction = "out"
kind = "analog"
address = "Q1"
eng_units = "%"
eng_min = 0.0
eng_max = 100.0
safe = 0.0
[devices.tclab0.channels.q2]
direction = "out"
kind = "analog"
address = "Q2"
eng_units = "%"
eng_min = 0.0
eng_max = 100.0
safe = 0.0clock = bd.clock(0.1, name="main")
t1 = bd.ANALOGIN(clock=clock, device="tclab0", channel="t1", name="T1")
q1 = bd.ANALOGOUT(clock=clock, device="tclab0", channel="q1", name="Q1")- Verify serial connectivity first; see Real-time provider: Serial transport setup.
- Start with a low heater limit and short run.
- Confirm shutdown drives
Q1andQ2to zero. - Add telemetry while tuning.
Use:
python examples/eg_tclab_rt.py- Always include output saturation in the controller path.
- Keep
safe = 0.0for heater channels. - Use conservative gain values for first run.
Copyright (c) Peter Corke 2020-
- Home
- API reference (Sphinx)
- Block catalog
- Control Systems Magazine article
- Adding blocks to your model
- Block path
- Connecting blocks
- Compiling
- Running
- Watching a simulation variable
- Simulation results
- Runtime options
- Environment variables
- Discrete-time blocks
- Subsystems
- Figures
- Notebook animation
- Animation and movies
- PID control
- Coding patterns
- Block methods and attributes
- Time stepping: integration, animation & events
- Blocks, wires and plugs
- Graphics blocks
- Evaluation
- Runtimes and simulator state
- Creating a new block
- Related packages
Under development on feat/realtime branch, planned for release before end of 2026.