# Cruise Control

Pretty interesting, the teacher in MATH213 gave a formal introduction to this.

We have a car to moves at a given velocity. We know Newton’s Laws of Motion $f=ma$, so $f(t)=mv_{′}(t)$. Taking into account drag, we’ll get this equation $mv_{′}(t)+bv(t)=f(t)$

- $m$ is the mass
- $b$ is a drag coefficient
- $v(t)$ is the velocity of the car
- $f(t)$ is the velocity forcing term

You should be very comfortable with the Transfer Function.

So if we want the car to go at a certain velocity, we can control $f(t)$.

Breaking down $f(t)$ into 2 parts: $f(t)=u(t)+d(t)$

- $u(t)$ is the control input
- $d(t)$ is the disturbance input

The controller controls $u(t)$.

Now, how does this work exactly? Like if $u(0)=0$, and then $u(0.001)=1000$, does the velocity instantly spike up? like the function has to be differentiable right. It’s a differential equation.

The teacher gets this problem to be solved in frequency space.

In time-domain $mv_{′}(t)+bv(t)=u(t)+d(t)$ In frequency-domain $V(t)=ms+bU(t)+D(t) $

- how the conversion is done is simply through the rules of the Transfer Function

We end up with our first Open Loop Controller.

It’s open-loop because there is no feedback into the system.

In standard form, the transfer function $ms+b1 =(m/b)s+11/b $

#### Proportional Controller

Now, we design our first closed loop controller.

- $R(s)$ is the Laplace transform of
**desired**velocity function $v(t)$

So instead of directly feeding in a control input $u(t)$ blindly, we know first look at the error $e(t)=r(t)−v(t)$, and that is used to dynamically adjust the control input $u(t)$.

Now, we obviously don’t know $C(s)$, but we can define it $C(s)=k_{p}E(s)$. The control input is some proportion to the error term.

We can write

V(s) &= \frac{1}{ms + b} F(s) \\ &= \frac{1}{ms + b} U(s) \quad \text{since D(s) = 0}\\ &= \frac{1}{ms + b} k_p E(s) \\ &= \frac{1}{ms + b} k_p (R(s) - V(s)) \end{align}$$ Therefore, $$V(s) = \frac{\frac{k_p}{ms + b}}{1 + \frac{k_p}{ms + b}} R(s)$$ We write it in [[notes/Standard First Order System|Standard First Order System]]: $$V(s) = \frac{\frac{k_p}{b+k_p}}{\frac{m}{b+k_p}s+1} R(s)$$ We know have our velocity in terms of some reference. But then how does it actually get working in real life?? - I'm confused Alright, so let's go back into time domain by taking the $v(t)$. [[notes/Standard First Order System|Standard First Order System]]. #### Integral Controller For the integral controller, we get that $$V(s) = P(s)C(s)E(s)$$ where - $P(s)$ is the car transfer function, the same as before $P(s) = \frac{1}{ms + b}$ - $C(s)$ is the controller transfer function - $E(s) =(R(s) - V(s))$ Notice how this is where we compose a transfer function. So we get $$V(s) = \frac{P(s)C(s)}{1 + P(s)C(s)} R(s)$$ - Actually, this is a more generic form. For proportional controller, the transfer function $C(s) = k_p$ (because remember we defined $C(s) = k_p E(s)$, for integral controller its a $\frac{k_i}{s}$. ### Next - [[notes/Adaptive Cruise Control|Adaptive Cruise Control]] ### Related - [[notes/Proportional Integral Derivative Control|PID]]