Model Predictive Control for the Quanser Coupled Tanks

Versione 1.0.0 (848 KB) da Quanser
Design and run a Model Predictive Control (MPC) on the Quanser Coupled Tanks two-tank process control model/virtual twin/hardware.
198 download
Aggiornato 13 dic 2022

Visualizza la licenza

The Quanser Coupled Tanks, shown below, is a reconfigurable nonlinear process control experiment. The pump drives the water from the bottom basin up to the top outflow orifices and into tank 1 and/or tank 2. The water level of the tanks is measured using pressure sensors.
Coupled Tanks Hardware
Traditionally, PID-based algorithms are used to control the level of water in the tank. While this can be effective and perform well, using PID control is a model-based design approach. If the model does not accurately represent the system, then the controller may not perform adequately or as expected. For more information about the control challenges and design using PID, please see this previous blog post.
Given the nonlinear dynamics, uncertainties, and actuator limits of the system, Model Predictive Control (MPC) is worth exploring and is often used in process control applications. Here we show how to use the MathWorks® Model Predictive Control Toolbox to design an MPC to perform tracking control of the water level in tank 1.
Before You Run this Example
The Coupled Tanks model predictive control can be simulated in MATLAB and Simulink using a nonlinear model of the system. If you have the Quanser Coupled Tankshardware, or its virtual twin, then you can run the controller on that system as well. The following toolboxes and additional software are required depending on what you want to do:
  1. MathWorks Control System Toolbox to define transfer functions in MATLAB and so on.
  2. MathWorks Model Predictive Control Toolbox. Required to define uncertain parameters that are used when performing the robust control tuning.
  3. [optional] Quanser QLabs Virtual Coupled Tanks experiment. Only needed to run the controller on the Coupled Tanks Virtual Twin. If you don't have QLabs, you can sign up for a free trial here.
  4. [optional] Quanser QUARC Real-Time Control Software is required to run the controllers on the actual Coupled Tanks hardware. If you don’t have the QUARC software, you can sign up for free trial here.
How Does it Work?
The model predictive control is designed using the Model Predictive Control Toolbox™ and the design process is detailed in this Quanser blog. For this experiment, the MPC is designed for the top tank, i.e., tank 1, system. This is a single input single output (SISO) system. The input is the pump outflow, and the output is the water level of tank 1. The Coupled Tanks can be configured as a cascade system (e.g., control tank 2 via tank 1), or a shared input system as well.
Tank 1 configuration diagram
The MPC designed is implemented using the MPC Controller block from the Model Predictive Control Toolbox™, as shown below in the s_tanks_1_mpc.slx Simulink model. This model simulates the MPC control using a nonlinear model of the Quanser Coupled Tanks system.
Simulink model to run MPC on Coupled Tanks model
Here is a sample response.
Simulated tank 1 response
Simulated pump voltage response
As shown in the Tank 1 Level scope, the tracking response improves as the simulation is running, i.e., the steady-state error decreases after each cycle.
How to Run the Example
Go through each section of the Coupled_Tanks_MPC.mlxLive Script. The script designs the model predictive control (MPC) and shows how to run the MPC (1) in the simulation, (2) on the QLabs Virtual Coupled Tanks, and (3) on the Coupled Tanks hardware.

Cita come

Quanser (2024). Model Predictive Control for the Quanser Coupled Tanks (https://www.mathworks.com/matlabcentral/fileexchange/122052-model-predictive-control-for-the-quanser-coupled-tanks), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2021a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.0.0