{ "cells": [ { "cell_type": "markdown", "metadata": { "nbpages": { "level": 0, "link": "[](https://jckantor.github.io/cbe30338-2021/03.06-Lab-Assignment-PI-Control.html)", "section": "" } }, "source": [ "\n", "*This notebook contains material from [cbe30338-2021](https://jckantor.github.io/cbe30338-2021);\n", "content is available [on Github](https://github.com/jckantor/cbe30338-2021.git).*\n" ] }, { "cell_type": "markdown", "metadata": { "nbpages": { "level": 0, "link": "[](https://jckantor.github.io/cbe30338-2021/03.06-Lab-Assignment-PI-Control.html)", "section": "" } }, "source": [ "\n", "< [3.5 Practical Proportional (P) and Proportional-Integral (PI) Control](https://jckantor.github.io/cbe30338-2021/03.05-Proportional-Integral-Control.html) | [Contents](toc.html) | [Tag Index](tag_index.html) | [3.7 Integral Windup and Bumpless Transfer](https://jckantor.github.io/cbe30338-2021/03.07-Integral-Windup-and-Bumpless-Transfer.html) >
"
]
},
{
"cell_type": "markdown",
"metadata": {
"nbpages": {
"level": 1,
"link": "[3.6 Lab Assignment 3: Relay and PI Control](https://jckantor.github.io/cbe30338-2021/03.06-Lab-Assignment-PI-Control.html#3.6-Lab-Assignment-3:-Relay-and-PI-Control)",
"section": "3.6 Lab Assignment 3: Relay and PI Control"
}
},
"source": [
"# 3.6 Lab Assignment 3: Relay and PI Control\n",
"\n",
"This lab assignment introduces the use of relay, proportional (P), and proportional-integral (PI) control for the Temperature Control Laboratory. In this assignment you will \n",
"\n",
"1. implement and test a relay control for the dual heater/sensor system\n",
"2. implement and test a proportional-integral (PI) control algorithm for a single heater/sensor"
]
},
{
"cell_type": "markdown",
"metadata": {
"nbpages": {
"level": 2,
"link": "[3.6.1 Exercise 1. Relay (or On-Off) control](https://jckantor.github.io/cbe30338-2021/03.06-Lab-Assignment-PI-Control.html#3.6.1-Exercise-1.-Relay-(or-On-Off)-control)",
"section": "3.6.1 Exercise 1. Relay (or On-Off) control"
}
},
"source": [
"## 3.6.1 Exercise 1. Relay (or On-Off) control\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"nbpages": {
"level": 2,
"link": "[3.6.1 Exercise 1. Relay (or On-Off) control](https://jckantor.github.io/cbe30338-2021/03.06-Lab-Assignment-PI-Control.html#3.6.1-Exercise-1.-Relay-(or-On-Off)-control)",
"section": "3.6.1 Exercise 1. Relay (or On-Off) control"
}
},
"source": [
"Create a notebook to implement a relay control for the Temperature Control Lab subject the following requirements:\n",
"\n",
"* Simultaneous control of sensor temperatures T1 and T2.\n",
"* Use a tolerance value $d$ of 0.5 deg C.\n",
"* Set the minimum and maximum values of the heater to 0 and 100%, respectively. lab.P1 and lab.P2 should be left at their default values.\n",
"* Show the results of an experiment in which the setpoints are adjusted as follows:\n",
" * SP1 is initially ambient temperature. SP1 increases to 35 deg at time t=20 and remains constant.\n",
" * SP2 is initially ambient temperature. SP2 increases linearly to 45 deg C beginning at t=120 with the transition complete at time t=220.\n",
" * Run the experiment until you reach a steady oscillation about the final operating point, and for no shorter than 600 sec.\n",
" \n",
" \n",
"Questions:\n",
"\n",
" 1. After the system has settled to a steady oscillation about the final operating point, what is the maximum deviation from the setpoints?\n",
" 2. What is the approximate switching frequency of the manipulated variables?"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"nbpages": {
"level": 2,
"link": "[3.6.1 Exercise 1. Relay (or On-Off) control](https://jckantor.github.io/cbe30338-2021/03.06-Lab-Assignment-PI-Control.html#3.6.1-Exercise-1.-Relay-(or-On-Off)-control)",
"section": "3.6.1 Exercise 1. Relay (or On-Off) control"
}
},
"outputs": [],
"source": [
"%matplotlib inline\n",
"from tclab import TCLab, clock, Historian, Plotter\n",
"\n",
"# insert code below"
]
},
{
"cell_type": "markdown",
"metadata": {
"nbpages": {
"level": 2,
"link": "[3.6.2 Exercise 2. Implementing a PI Controller](https://jckantor.github.io/cbe30338-2021/03.06-Lab-Assignment-PI-Control.html#3.6.2-Exercise-2.-Implementing-a-PI-Controller)",
"section": "3.6.2 Exercise 2. Implementing a PI Controller"
}
},
"source": [
"## 3.6.2 Exercise 2. Implementing a PI Controller"
]
},
{
"cell_type": "markdown",
"metadata": {
"nbpages": {
"level": 2,
"link": "[3.6.2 Exercise 2. Implementing a PI Controller](https://jckantor.github.io/cbe30338-2021/03.06-Lab-Assignment-PI-Control.html#3.6.2-Exercise-2.-Implementing-a-PI-Controller)",
"section": "3.6.2 Exercise 2. Implementing a PI Controller"
}
},
"source": [
"Create a notebook to implement PI for the Temperature Control Lab.\n",
"\n",
"* Using the simulation mode, create an implementaton of PI control and, by trail and error, find values for Kp and Ki, that provide a fast and accurate acquisitioni of the desired setpoint.\n",
"\n",
"* Show the results of an experiment in which the setpoints are adjusted as follows:\n",
" * SP1 is initially ambient temperature. SP1 increases linearly to 45 deg C beginning at t=20 with the transition complete at time t=120.\n",
" * Run the experiment until you reach a steady oscillation about the final operating point, and for no shorter than 600 sec.\n",
" \n",
" \n",
"Questions:\n",
"\n",
" 1. After the system has settled to a steady oscillation about the final operating point, what is the maximum deviation from the setpoints?\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"nbpages": {
"level": 2,
"link": "[3.6.2 Exercise 2. Implementing a PI Controller](https://jckantor.github.io/cbe30338-2021/03.06-Lab-Assignment-PI-Control.html#3.6.2-Exercise-2.-Implementing-a-PI-Controller)",
"section": "3.6.2 Exercise 2. Implementing a PI Controller"
}
},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {
"nbpages": {
"level": 2,
"link": "[3.6.2 Exercise 2. Implementing a PI Controller](https://jckantor.github.io/cbe30338-2021/03.06-Lab-Assignment-PI-Control.html#3.6.2-Exercise-2.-Implementing-a-PI-Controller)",
"section": "3.6.2 Exercise 2. Implementing a PI Controller"
}
},
"source": [
"\n",
"< [3.5 Practical Proportional (P) and Proportional-Integral (PI) Control](https://jckantor.github.io/cbe30338-2021/03.05-Proportional-Integral-Control.html) | [Contents](toc.html) | [Tag Index](tag_index.html) | [3.7 Integral Windup and Bumpless Transfer](https://jckantor.github.io/cbe30338-2021/03.07-Integral-Windup-and-Bumpless-Transfer.html) >
"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}