# Cascade Compensation

One easy way to control the plant is to cascade a controller before the plant like in Figure 9.

![Figure 9: Cascade Feedback Compensation](/files/-MQilxVg5Ch8l95uT9qH)

We can design the controller H(s) to alter the behavior of our system.

## Proportional Integral (PI) Control

{% hint style="info" %}

#### Definition 35

A proportional integral controller applies an input which is a linear combination of the scaled and integrated error signal.

$$H(s) = K\_p+\frac{K\_i}{s} = K\_p \frac{s + \frac{K\_i}{K\_p}}{s}$$
{% endhint %}

What a PI Controller effectively does is place a new pole at $$s=0$$ and a new zero at $$s=-\frac{K\_i}{K\_p}$$. Because of the pole at zero, adding a PI controller enables the system to track a step input perfectly. However, because the pole is placed at zero, it can slow down the time response unless the zero can cancel it out.

## Proportional Derivative (PD) Control

{% hint style="info" %}

#### Definition 36

A proportional derivative controller applies an input which is a linear combination of the scaled and differentiated error signal.

$$H(s) = K\_p + K\_ds = K\_d\left(s + \frac{K\_p}{K\_d}\right)$$
{% endhint %}

Adding a PD controller introduces a new zero into the system. By carefully choosing where we place the zero, we can shape the time-response of the system. If we want our dominant second order poles to be at a particular location, then we can use the angle rule to find the location of the zero $$s=-\frac{K\_p}{K\_d}$$. Since differentiation is an unstable operations, sometimes we instead also place a pole very far in the left half plane, and the transfer function becomes

$$H(s) =K\_d \frac{s+\frac{K\_p}{K\_d}}{s+p}.$$

## Proportional Integral Derivative (PID) Control

{% hint style="info" %}

#### Definition 37

A proportional integral derivative controller applies an input which is a linear combination of the scaled, differentated, and integrated error signals.

$$H(s) = K\_p+K\_ds + \frac{K\_i}{s} = K\_d \frac{s^2 + \frac{K\_p}{K\_d}s + \frac{K\_i}{K\_d}}{s}$$
{% endhint %}

A PID controller is used where we need to both eliminate steady-state error and shape the time response. We need to choose two different zero locations and set the total gain of the system.

## Lag Compensation

{% hint style="info" %}

#### Definition 38

A lag compensator is a controller with the transfer function

$$H(s) = K \frac{s+z\_c}{s+p\_c},\quad p\_c < z\_c.$$
{% endhint %}

The purpose of a lag network is to reduce steady state error by increasing the gains at low frequency and maintaining the gain at higher frequencies. This keeps the phase margin the same. We can achieve this because of the frequency response of the lag network (shown by its bode plot in Figure 10).

![Figure 10: Lag Network](/files/-MQilxVmpzdDAd9hjtQ4)

We can place the pole and zero carefully to control how much the phase decreases by. The design procedure is as follows:

1. Set gain $$K$$ to the value that satisfies the SSE specification and plot the Bode diagram at that gain.
2. Find $$\omega\_{PM}$$ such that $$\phi\_M$$ is 5˚to 12˚larger than required.
3. Let the high frequency asymptote be $$-20\log K\_{PM}$$ db at $$\omega\_{PM}$$ where $$K\_{PM} = |G(j\omega\_{PM})|$$.
4. Choose the upper break frequency to be $$\frac{\omega\_{PM}}{10}$$.
5. Set the low frequency asymptote to be 0 db and locate the lower break frequency.
6. Reset the system gain K to compensate for attenuation.

## Lead Controller

{% hint style="info" %}

#### Definition 39

A Lead Controller is a compensator with the transfer function

$$H(s) = k\frac{s+z\_c}{s+p\_c} = \frac{k}{\beta}\frac{s+\frac{1}{T}}{s+\frac{1}{\beta T}} \quad z\_c > p\_c, \beta < 1.$$
{% endhint %}

A lead controller is used to change the phase margin and alter the time perfomance metrics of the step response. It has a peak phase $$\phi\_{max}$$ which is related to the pole and zero by

$$\omega\_{max} = \frac{1}{T\sqrt{\beta}}\quad, \phi\_{max} = \sin^{-1}\frac{1-\beta}{1+\beta}, \quad |G\_c(j\omega\_{max})| = \frac{1}{\sqrt{\beta}}.$$

Its frequency response looks like in Figure 11.

1. Set gain $$K$$ of the uncompensated system to a value satisfying SSE requirement.
2. Plot bode diagram for system with gain $$K$$ and determine $$\phi\_M$$.
3. Find $$\phi\_{M}$$ needed to meet requirements and evaluate additional phase contribution from compenstor.
4. Determine $$\beta$$.
5. Determine $$|G\_c(j\omega\_{max})|$$.
6. Determine $$\omega\_{PM}$$ where $$|G(j\omega)| = -20\log|G\_c(j\omega\_{max})|$$.
7. Find the break frequencies.
8. Reset the gain.
9. Simulate and tweak.

![Figure 11: Lead Network](/files/-MQilxVvW7bq9TRdjS3J)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://aparande.gitbook.io/berkeley-notes/ee128-0/ee128-5.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
