/tclab_jupyter

A jupyter based application to explore different control techniques of a simple temperature plant

Primary LanguagePythonMIT LicenseMIT

License: MIT

tclab_jupyter

A jupyter based application to explore different control techniques of a simple temperature plant

Overview

This code was written to showcase an Arduino based Temperature Control Lab (https://apmonitor.com/pdc/index.php/Main/ArduinoTemperatureControl) for a Lecture on Advanced Control Techniques.

The TCLab system is built with two temperature sensors and two heaters. A Matlab or Python interface is provided to read the temperature data from the board and control the heaters power output. Two classes were created, one that aims to control the Arduino System (control_arduino.py) and another one replacing the Arduino interface with a simulator (control_demo.py), so the app can be used without the real hardware, as a demonstration.

This project implements four different control techniques (Manual, On-Off, PID and MPC) so the user can test and visualize the differences between them.

There is also a configurations window that presents some parameters that can be adjusted for the whole simulation or for each control technique.

The interface was build using ipywidgets and bqplot. The dynamic plant simulation is done using scipy odeint function, whilst the MPC is implemented using the gekko library. For more information regarding the MPC options refer to the gekko documentation (https://gekko.readthedocs.io/en/latest/).

Dependencies

Currently this code will not work on Mac OS due to limitations on the gekko library. This limitation can be overcomed by running Python from a docker container (or using a regular linux VM).

Usage

Just download the control_demo.py to your system and create a Jupyter Notebook file (.ipynb) on the same folder.

Import the module and create an object as shown below.

import control_demo as cd
demo = cd.GUI()

To open the main window, call the app function.

demo.app()

App Screenshot

To open the configurations window, call the config function.

demo.config()

Config Screenshot