# Under Control: A Control Theory Introduction for Computer Scientists

Quentin Guilloteau, Sophie Cerf, Eric Rutten, Raphaël Bleuse, Bogdan Robu

<figure><img src="image_1.png" /></figure>

## To cite this version:

Quentin Guilloteau, Sophie Cerf, Eric Rutten, Raphaël Bleuse, Bogdan Robu. Under Control: A Control Theory Introduction for Computer Scientists. 2023, pp.1-11. hal-04460285

HAL Id: hal-04460285

https://hal.science/hal-04460285v1

Submitted on 15 Feb 2024

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>
# Under Control: A Control Theory Introduction for Computer Scientists

Session @ VELVET 2023

Quentin GUILLOTEAU¹, Sophie CERF², Eric RUTTEN¹,
Raphaël BLEUSE¹, Bogdan ROBU³

¹Univ. Grenoble Alpes, Inria, CNRS, LIG
 Earname.Lastname@inria.fr

²Univ. Lille, Inria, Central Lille, CRISTAL
Sophie.Cerf@inria.fr

³Univ. Grenoble Alpes, CNRS, G-INP, Gipsa Lab
Bogdan Robu@grenoble-inp.fr

2023-12-13
# Goal of this tutorial

* Present the need for regulation of computing systems

* Show how computing systems can benefit from the Feedback loop approach

* Show what Control Theory can bring

* Quick presentation of the methodology

* Let you implement some Control Theory controllers!
# The need for Regulation

* Complex systems

* Crazy software stacks on crazy hardware

* Many sources of unpredictability

* ~ need for dynamic management

* **Usual approaches:**

* simple rules

* *if this then that*

* very arbitrary constants

* no guarantee

* or model as much as possible

* then solve "optimally"

* very complex

* guarantee only if model stands

**We need another approach (guarantees + simplicity)**
# The Feedback Loop

## The idea

Use the knowledge about the current state of the system to respond

## Autonomic Computing (IBM 2003)

<figure><img src="image_3.png" /><figcaption>Figure: MAPE-K Loop</figcaption></figure>

- auto-*

- configuration

- healing

- optimization

- protection

- main tool: MAPE-K loop

- Separation of concerns

- ≠ implementations of AC (rules, AI, control)
Some Examples

Regulate the **heat of a processor** based on its frequency

Sensor: CPU thermometer

Actuator: DVFS

Reference: Desired CPU temperature

Regulate the **waiting time of users** based on the number of available servers

Sensor: Waiting time of a request

Actuator: Number of servers to add/remove

Reference: Mean waiting time for the requests

Regulate the **FPS of an online video rendering** based on the quality

Sensor: FPS

Actuator: depth of computation

Reference: 60 FPS
# Control Theory

## Goal

Act on dynamic system to reach desired behavior with guarantees

<figure><img src="image_4.png" /><figcaption>Figure: Control Loop</figcaption></figure>

- Proven Guarantees

- Stability

- Robustness

- Precision

- Long history in physical systems

- Only recent for CS

- Reusable methodology
<figure><img src="image_5.png" /><figcaption>Figure: Control Theory Methodology</figcaption></figure>
# The (famous) PID Controller (discretized)

First, a **Model** ... (i.e., how does the system behave (Open-Loop))

$$y(k + 1) = \sum_{i=0}^{k} a_i y(k - i) + \sum_{j=0}^{k} b_j u(k - j)$$

... then a **PID Controller** (i.e., the Closed-Loop behavior)

$$u_k = K_p \times Error_k + K_i \times \sum_k Error_k + K_d \times (Error_k - Error_{k-1})$$

## Sensors & Actuators

- Actuator: **u**

- Sensor: **y**

- Error: Reference - Sensor

## Method

1. Open-Loop expe (predefined **u**)

2. Model parameters ($a_i, b_j$)

3. Choice controller behavior ($K_*$)
# Settling Time, Overshoot and Error

<figure><img src="image_6.png" /></figure>

Figure: Closed Loop Behavior

The controller gains define this behavior!
# Controllers

## Goal

Map the error to the next action to reach desired system state with guarantees

## Many (many) types of Controllers

- Feedback (PID, MFC, RST, etc.)

- Feedforward (proactive reaction to disturbances)

- Adaptive (change behavior at runtime)

- Model Predictive

- Event Based

- Optimal

- and more!
# Your turn!

## What you will do now

1. Play with a dummy system

2. Implement a naive Threshold-based controller

3. First introduction with Control Theory: P Controller

4. Implement a more precise controller (PI)

5. Perform an identification phase

6. Implement a PI controller on a "real" system

## Starting Point

https://tinyurl.com/Control4ComputingVELVET