CBE32338
¶
Chapter 1.0 Introduction to the Temperature Control Laboratory
¶
1.1 The Temperature Control Laboratory
¶
1.1.1 Hardware
Markdown Links
Temperature Control Laboratory
TCLab
README
here
Figure files used
figures/B.00-arduino_lab_kit.png
1.2 The TCLab Python Package
¶
1.2.1 Connecting to the Temperature Control Laboratory
1.2.1.1 Installation
1.2.1.2 Importing
1.2.1.3 Using TCLab with Python's
with
statement
1.2.2 Reading Temperatures
1.2.3 Setting Heaters
1.2.4 Synchronizing with Real Time using
clock
1.2.4.1 Using
clock
with TCLab
1.2.5 The TCLab
Historian
1.2.6 The TCLab
Plotter
1.2.7 Using TCLab Offline
1.2.8 Running Diagnostics
Markdown Links
TCLab
TCLab-sketch
Arduino IDE
Pandas Data Analysis Library
Figure files used
figures/B.00-TCLabOverview.png
1.11 TCLab Lab 1: Coding a relay controller
¶
1.11.1 Procedures
1.11.2 Exercise 1. Download and install TCLab.py
1.11.3 Exercise 2. Verify that your hardware and software are working correctly.
1.11.4 Exercise 3. Turn on the heaters for 120 seconds and log temperature response.
1.11.5 Exercise 4. Code an on-off controller.
1.11.6 Exercise 5. Analysis
Markdown Links
On-Off Control in Section 1.6 of
Feedback Control for Scientists and Engineers
The TCLab Python Package
TCLab Relay Control
TCLab Python Package
Chapter 2.0 Model Identification
¶
2.1 Step Testing
¶
2.1.1 Executing the Step Test
2.1.1.1 Conduct the Experiment
2.1.1.2 Verify the Experimental Data
2.1.1.3 Convert to a DataFrame
2.1.1.4 Save DataFrame as a .csv file
2.1.1.5 Verify the Data File
2.2 Fitting Step Test Data to Empirical Models
¶
2.2.1 Read the Data File
2.2.2 Parameter Estimation
2.2.2.1 Fitting the Step Change Data to a First Order Model
2.2.2.2 Reading Saved Data
2.2.2.3 Estimating Gain and Time Constant
2.2.3 First Order plus Dead Time
2.2.4 Second Order
2.2.5 Fitting a Second Order Model by Least Squares
2.3 First Order Model for a Single Heater
¶
2.3.1 First-order lumped model for heater/sensor device.
2.3.1.1 Steady State
2.3.2 Loading previously saved experimental data
2.3.2.1 Deviation Variables
2.3.2.2 First Order Linear Differential Equations
2.3.2.3 Plotting the Analytical Solution
2.3.3 Matching the Model to Experimental Data
2.3.3.1 Does this solution make sense?
Markdown Figures
images/arduino_comsol.png
Markdown Links
specific heat capacity for solids
2.4 Two-Input, Two-Output Model
¶
2.4.1 Interacting Heaters
2.4.2 Deviation Variables
2.4.3 Steady State
2.4.4 Estimating $U_a$ and $U_b$
2.4.5 Simulation with odeint
2.4.6 Fitting the Model to Measured Step Response Data
2.5 Two State Model for a Single Heater
¶
2.5.1 Dynamics of the Heater/Sensor System
2.5.2 Model in deviation variables
2.5.3 Consequences of this Model
2.6 Four State Model
¶
2.6.1 Multivariable Heater/Sensor System
2.6.2 Deviation variables
2.6.3 State space
2.10 TCLab Lab 2: Model Identification
¶
2.10.1 Procedures
2.10.2 Exercise 1. Verify operation of the temperature control lab.
2.10.3 Exercise 2. Check for steady state
2.10.4 Exercise 3. Step test.
2.10.5 Exercise 4. Verify and save data to a .csv file
2.10.6 Exercise 5. Analysis
2.10 TCLab Lab 2: Model Identification
¶
2.10.1 Procedures
2.10.2 Exercise 1. Verify operation of the temperature control lab.
2.10.3 Exercise 2. Check for steady state
2.10.4 Exercise 3. Step test.
2.10.5 Exercise 4. Verify and save data to a .csv file
2.10.6 Exercise 5. Analysis
2.11 Model Identification: Fitting models to data
¶
2.11.1 Initializations
2.11.1.1 Reading data
2.11.1.2 Plotting function
2.11.2 Empirical Models
2.11.2.1 First-order linear model
2.11.2.2 First-order linear model with time delay
2.11.3 First-principles modeling
2.11.3.1 First-order energy balance for one heater
2.11.3.2 Two State Model
2.11.4 Two heater, four state model
2.11.5 Consequences
2.11.6 State-Space Model
2.11.7 Putting to work
Chapter 3.0 State Estimation
¶
3.1 Open and Closed Loop Estimation
¶
3.1.1 Experiment 1. Open-Loop State Estimation and Relay Control
3.1.1.1 Open Loop Estimation
3.1.1.2 Event Loop
3.1.2 Experiment 2. Closed-Loop State Estimation and Relay Control
3.1.2.1 Review of Closed Loop Estimation
3.1.2.2 Choosing $L$
3.1.3 Question
Chapter 4.0 Feedback Control
¶
4.1 Relay Control
¶
4.1.1 Simple Relay Control
4.1.2 Relay Control with Hysteresis
4.1.3 Multivariable On-Off Control
4.1.4 Exercises
4.3 PID Control
¶
4.3.1 PID Simulation
4.3.2 PID Implementation
Markdown Links
Web version available
4.10 Lab Assignment: PID Control
¶
4.10.1 Part 1. Manual Control
4.10.2 Part 2. Implementing a PID Controller
4.10.3 Part 3. Tuning the PID Controller
4.11 Lab Assignment 4: PI Control
¶
4.11.1 Implementation of a simple PI controller
4.11.2 Exercise 1. Tune the PI control for the Temperature Control Lab
4.11.3 Exercise 2. Hardware testing the PI controller
4.11.4 Exercise 3. Multivariable PI control
Chapter 5.0 Predictive Control and Real Time Optimization
¶
5.1 Simulation, Control, and Estimation using Pyomo
¶
5.1.1 Installations
5.1.1.1 Google Colab
5.1.1.2 MacOS
5.1.1.3 Windows PC
5.1.2 Process Information
5.1.2.1 Process Parameter Values
5.1.2.2 Process Inputs
5.1.3 Pyomo Simulation
5.1.4 Optimal Control with Knowledge of Disturbances
5.1.4.1 Exercise
5.1.5 Estimation/Observation
5.1.6 Coding the Observer as a Python Generator
5.1.7 Coding the Controller as a Python Generator
5.1.8 MPC Demonstration
5.1.9 To be Removed
5.2 Simulation, Control, and Estimation using Pyomo
¶
5.2.1 Installations
5.2.1.1 Google Colab
5.2.1.2 MacOS
5.2.1.3 Windows PC
5.2.2 Process Information
5.2.2.1 Process Parameter Values
5.2.2.2 Process Inputs
5.2.3 Pyomo Simulation
5.2.4 Optimal Control with Knowledge of Disturbances
5.2.4.1 Exercise
5.2.5 Estimation/Observation
5.2.6 Coding the Observer as a Python Generator
5.2.7 Coding the Controller as a Python Generator
Appendix A. A.0 Additional Python
¶
A.1 Coding Controllers with Python Generators
¶
A.1.1 Example: Relay Control with Hysteresis
A.1.1.1 Simulation
A.1.1.2 Experiment
A.1.2 Example: Proportional-Integral Control
A.1.2.1 Simulation
A.1.2.2 Experiment
Markdown Links
here
A.2 Modular Simulation using Python Generators
¶
Markdown Links
Simulation using scipy.integrate.odeint()
Typical Usage
What's Wrong with That?
Python Generators
Yield Statement
Iterators
Two-way communcation with Generators using Send
Example Application: Modeling Gravity-Drained Tanks with Python Generators
Generator for a Gravity-Drained Tank
Simulation of a Single Tank with Constant Inflow
Simulation of Two Tanks in Series
Simulation of Two Tanks in Series with PI Level Control on the Second Tank
Adding a PI Control Generator
Implementing Cascade Control for Two Tanks in Series with Unmeasured Disturbance
Enhancing Modularity with Class Definitions for Process Units
Gravity-Drained Tank Class
PI Controller Class
Modular Simulation of Cascade Control for Two Tanks in Series
generators and iterators
A.3 A Modular Approach to Simulation using Python Generators
¶
Markdown Links
https://github.com/jckantor/CBE30338
Simulation using scipy.integrate.odeint()
Typical Usage
What's Wrong with That?
Python Generators
Yield Statement
Iterators
Two-way communcation with Generators using Send
Example Application: Modeling Gravity-Drained Tanks with Python Generators
Generator for a Gravity-Drained Tank
Simulation of a Single Tank with Constant Inflow
Simulation of Two Tanks in Series
Simulation of Two Tanks in Series with PI Level Control on the Second Tank
Adding a PI Control Generator
Implementing Cascade Control for Two Tanks in Series with Unmeasured Disturbance
Enhancing Modularity with Class Definitions for Process Units
Gravity-Drained Tank Class
PI Controller Class
Modular Simulation of Cascade Control for Two Tanks in Series
generators and iterators
A.4 Animation in Jupyter Notebooks
¶
A.4.1 Summary
A.4.2 Prerequisites
A.4.3 Step-by-Step Approach to Animation with Matplotlib
A.4.3.1 Step 1. Create the background frame.
A.4.3.2 Step 2. Define a function to draw each frame
A.4.3.3 Step 3. Create the Animation Object
A.4.3.4 Step 4. Render the Animation
A.4.4 Example: Phase Plane Animation for an Exothermic Stirred-Tank Reactor
Markdown Links
https://github.com/jckantor/CBE30338
Animating the Lorenz System in 3D
Embedding Matplotlib Animations in Jupyter Notebooks
here