Emulating a PID Controller with Long Short-term Memory

Emulating a PID Controller with Long Short-term Memory

Emulating a PID Controller with Long Short-term Memory. Using the Temperature Control Lab to create Proportional-Integral-Derivative controller data

Do you ever just get really excited about an idea? Maybe it’s a new DIY project you’re tackling, or a cool assignment at work. Maybe you’re crazy like me and want to hike the Pacific Crest Trail (as I’m moving to Seattle soon, so I can’t help but get excited about the idea of flying down to San Diego and walking home). Well, this project is one of those types of ideas for me, and I hope you enjoy the ride!

Before I get started, though, I want to warn you that this is quite an extensive project, and so I’m breaking it up into parts. They will be as follows:

  1. Using the Temperature Control Lab to create Proportional-Integral-Derivative controller data (this article)
  2. Training a Long Short-term Memory neural network to emulate a PID controller (coming October 2020)
  3. Controlling the Temperature Control Lab with an LSTM (coming October 2020)
  4. Practical applications of temperature control using LSTM controller instead of PID controller (coming November 2020)

Project Framework

While working on a project for work one day, I came across a paper that introduced a novel idea. Some researchers had the idea to emulate the behavior of a model predictive control (MPC) strategy using a neural network. The idea was that some MPC problems are extremely computationally expensive, but the behavior is predictable;** if we could emulate that behavior by training a deep neural network, we could, in theory, replace the computationally expensive MPC with a much faster machine learning model.** The only computationally expensive part of the process would be the model training.

The really neat part of this is that I test the idea here at my desk. The Temperature Control Lab is perfectly designed to prototype this kind of problem. I introduced the TCLab and some basic anomaly detection you can do with machine learning in an earlier post. If you’re new to the TCLab, you can check out my article, or look at the abundant resources at APMonitor.com.

So here’s what I decided to try: I wanted to tune a Proportional-Integral-Derivative (PID) controller so I could set a temperature on the TCLab and the controller would adjust the heater until it hit that setpoint. Then, I wanted to see if I could emulate this behavior with a Long Short-term Memory neural network. If this prototype worked, it would open the doors for not only improving computational speed, but also applications such as anomaly detection.

This series is about the machine learning, so if you’re not familiar with PID controllers or control theory, that’s perfectly fine; we’ll just hit a few highlights so you understand the context. There are some amazing resources at APMonitor.com to help you understand PID controllers and how to tune them. These controllers are ubiquitous in engineering industry, and so the potential applications for this are numerous.

python pid-controller machine-learning lstm

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How To Plot A Decision Boundary For Machine Learning Algorithms in Python

How To Plot A Decision Boundary For Machine Learning Algorithms in Python, you will discover how to plot a decision surface for a classification machine learning algorithm.

How To Get Started With Machine Learning With The Right Mindset

You got intrigued by the machine learning world and wanted to get started as soon as possible, read all the articles, watched all the videos, but still isn’t sure about where to start, welcome to the club.

What is Supervised Machine Learning

What is neuron analysis of a machine? Learn machine learning by designing Robotics algorithm. Click here for best machine learning course models with AI

Python For Machine Learning | Machine Learning With Python

Python For Machine Learning | Machine Learning With Python, you will be working on an end-to-end case study to understand different stages in the Machine Learning (ML) life cycle. This will deal with 'data manipulation' with pandas and 'data visualization' with seaborn. After this an ML model will be built on the dataset to get predictions. You will learn about the basics of scikit-learn library to implement the machine learning algorithm.

Python for Machine Learning | Machine Learning with Python

Python for Machine Learning | Machine Learning with Python, you'll be working on an end-to-end case study to understand different stages in the ML life cycle. This will deal with 'data manipulation' with pandas and 'data visualization' with seaborn. After this, an ML model will be built on the dataset to get predictions. You will learn about the basics of the sci-kit-learn library to implement the machine learning algorithm.