\documentclass{report}

\input{preamble}
\input{macros}
\input{letterfonts}

\title{\Huge{Systems and Control}}
\author{\huge{Aidan Sharpe}}
\date{}

\begin{document}

\maketitle
\newpage% or \cleardoublepage
% \pdfbookmark[<level>]{<title>}{<dest>}
\pdfbookmark[section]{\contentsname}{toc}
\tableofcontents
\pagebreak

\chapter{Control Systems: Introduction, Applications, Definitions}
$$\text{Input} \to \boxed{\text{System}} \to \text{Output}$$

To a system to a desired state, compare the current state with the objective, pass the difference to a controller, and pass the output of the controller back to the system.

\section{Basic Definitions \& Lingo}

\dfn{System Modelling}
{
    A mathematical or input/output description of the behavior of a system.
}

\dfn{Control}
{
    The use of information to affect the operation of a device, machine, or system of any kind.
}

Feedback is important to ensure that the objectives of the system are met.

\dfn{Plant}
{
    The physical objective to control, impact or influence.
}

\dfn{Control Objective}
{
    The desired behavior of a system.
}

\dfn{Input}
{
    The signals used to control a plant.
}

\dfn{Output}
{
    The measurements, data, and what is being sensed.
}

\dfn{Process}
{
    The internal behavior of the plant as a result of the inputs.
}

\dfn{Model}
{
    A mathematical description of the physics of the system.
}
Modelling is a useful tool for the engineering of a system. It can help to determine desired inputs, outputs, and processes.

\dfn{Disturbances}
{
    Anything preventing the plant from achieving the desired output.
}
Every system will have external disturbances to deal with. The real world is never the same as the ideal world.

\ex{Traffic Control}
{
    \textbf{Plant}: The transportation network---movement of cars, roads, connectivity, highways, physics of the network.

    \textbf{Processes}: the movement of cars, switching of traffic lights

    \textbf{Control Objective}: minimizing traffic

    \textbf{Input}: The changing of the traffic light signals

    \textbf{Output}: The movement of the cars

    \textbf{Disturbances}: Accidents, snow, bad drivers
}

\section{Control Strategies}
Two common control strategies are the black box strategy and the model-based strategy. 

\dfn{Black Box Strategy}
{
If the processes of a system are unknown, we can learn about the system by applying inputs and taking note of the outputs. While analysis is not possible on black box systems, there is no need for physical knowledge of the system.
}

\dfn{Model-Based Strategy}
{
    Model-based strategies use mathematical models to describe the behavior of a system. Compared to the black box strategy, more knowledge of the system is required, but having this knowledge makes deeper analysis possible.
}

Using a model-based strategy, two control methods can be applied: the open loop method and the closed-loop method. The open loop method has no feedback mechanism, and is therefore susceptible to disturbances; however, open loop control systems are much simpler to build and model. On the other hand, closed loop systems have a feedback mechanism to reduce the impacts of disturbances. This mechanism adds complexity to the system, which makes modelling more difficult.

\chapter{Laplace Transforms, Transfer Functions, \& ODEs}

\section{Laplace Transforms}
The Laplace transform is a mathematical tool used to take a function of time, $t$, and transform it into a function of the complex frequency variable, $s$. The one-sided Laplace tranform is of the form:

$$F(s) = \mathcal{L}\lt[f(t)\rt] = \int\limits_0^\infty f(t) e^{-st} dt$$

Unfortunately, for some values of $s$, this integral is undefined.

\dfn{Abscissa of Absolute Convergence}
{
    The \emph{abscissa of absolute convergece} is the region in which there 
}

\dfn{Unit Impulse Function}
{
    The \emph{unit impulse function}, $\delta(t)$ is given by:
    $$\delta(t) = \begin{cases}
        1 & t = 0 \\
        0 & \text{elsewhere}
    \end{cases}$$
    The unit impulse function has the Laplace transform:
    $$\mathcal{L}\lt[\delta(t)\rt] = \int_0^\infty \delta(t)e^{-st} dt = 1$$
}

\dfn{Unit Step Function}
{
    The \emph{unit step function}, $u(t)$ is defined as:
    $$u(t) = \begin{cases}
        1 & t \ge 0 \\
        0 & t < 0
    \end{cases}$$
    The unit step function has the Laplace transform:
    $$\mathcal{L}\lt[u(t)\rt] = {1\over s}$$
}

\dfn{Unit Ramp Function}
{
    The \emph{unit ramp function}, $v(t)$ is defined as:
    $$v(t) = \begin{cases}
        t & t \ge 0 \\
        0 & t < 0
    \end{cases}$$

    The unit ramp function has Laplace tranform:
    $$\mathcal{L}\lt[v(t)\rt] = {1 \over s^2}$$
}

\ex{}
{
    \begin{enumerate}
        \item Take the Laplace transform of $f(t) = 5 \forall t \ge 0$:
            $$f(t) = 5u(t)$$
            $$F(s) = \mathcal{L}\lt[f(t)\rt] = {5 \over s}$$
        \item Take the Laplace transform of $f(t) = 2t \forall t \ge 0$:
            $$f(t) = 5v(t)$$
            $$F(s) = \mathcal{L}\lt[f(t)\rt] = {2 \over s^2}$$
        \item Take the Laplace transform of $f(t) = e^{-at}$:
            $$f(t) = e^{-at}u(t)$$
    \end{enumerate}
}

\subsection{Linearity}
By definition, Laplace transforms are a linear mapping.
$$\mathcal{L}\lt[a_1 f_1(t) + a_2 f_2(t)\rt] = a_1 F_1(s) + a_2 F_2(s)$$

\pf{Linearity of Laplace Transforms}
{
    $$\mathcal{L}[a_1 f_1(t) + a_2 f_2(t)] = \int\limits_0^\infty \lt(a_1 f_1(t) + a_2 f_2(t)\rt) e^{-st} dt$$

    By the distributive property of multiplication:
    $$(a_1 f_1(t) + a_2 f_2(t))e^{-st} = a_1 f_1(t) e^{-st} + a_2 f_2(t) e^{-st}$$
}

\subsection{Differentiation}
Differentiation is easy with a Laplace transform:
$$\mathcal{L}\lt[f'(t)\rt] = sF(s) - f(0)$$
Where:
\begin{itemize}
    \item[$f(0)$] is the initial condition of the function $f(t)$ at $t=0$
\end{itemize}

\noindent
In general:
$$\mathcal{L}[f^{(n)}] = s^n F(s) - s^{n-1} f(0) - s^{n-2} f'(0) - \cdots - sf^{(n-2)}(0) - f^{(n-1)}(0)$$

\subsection{Final Value Theorem}
Consider $F(s) = {N(s) \over D(s)}$. The poles of $F(s)$ will occur at the roots of $D(s)$, and the zeros of $F(s)$ will occur at the roots of $N(s)$.

\thm{Final Value Theorem}
{
    If all of the poles of $sF(s)$ occur only in the left half plane (LHP):
    $$\lim_{t \to \infty} f(t) = \lim_{s \to 0} s F(s)$$
}

\ex{}
{
    With all zero initial conditions for $y(t)$ and $u(t)$, a system is goverend by this second order ODE:
    $$y''(t) + 3y'(t) + 2y(t) = 2u'(t) + u(t)$$
    Using the final value theorem, find $\lim_{t \to \infty} y(t) \text{ if } u(t) = 1$
    \\
    \\
    Take the Laplace transforms:
    $$\mcL[y''(t)] = s^2Y(s) - sy(0) - y'(0)$$
    $$\mcL[y'(t)] = sY(s) - y(0)$$
    $$\mcL[u'(t)] = sU(s) - u(0)$$

    Plugging back in:
    $$s^2Y(s) + 3sY(s) + 2Y(s) = 2sU(s) + U(s)$$

    $${Y(s) \over U(s)} = {2s + 1 \over s^2 + 3s + 2}$$

    Since $u(t)$ is the unit step, $U(s) = {1\over s}$

    $$Y(s) = {1 \over s}\cdot{2s + 1 \over s^2 + 3s + 2}$$
    
    By the final value theorem of $y(t)$:
    $$\lim_{t \to \infty} y(t) = \lim_{s\to 0} sY(s) = \lim_{s\to0} {2s + 1 \over s^2 + 3s + 2} = {1\over2}$$
}

\subsection{Initial Value Theorem}
\thm{Initial Value Theorem}
{
    $$\lim{t \to 0^+} f(t) = \lim_{s\to\infty} sF(s)$$
    If and only if the limit exists.
}

\subsection{Convolution}
$$f_1(t) * f_2(t) = \int$$

\section{Partial Fraction Expansion}
One way to compute the inverse Laplace transform is with partial fraction expansion. Given a transfer function, $Y(s)$, it can be broken down into the quotient of two simple transfer functions:
$$Y(s) = {N(s) \over D(s)} = {b_0 s^m + b_1 s^{m-1} + b_2 s^{m-2} + \cdots + b_m \over a_0 s^n + a_1 s^{n-1} + a_2 s^{n-2} + \cdots + a_0}$$

\ex{Partial Fraction Expansion: Distinct Roots}
{
    $$F(s) = {1 \over s^2 + 5s + 6}$$
    Factoring the denominator gives:
    $$F(s) = {1 \over (s+3)(s+2)} = {c_1 \over s+3} + {c_2 \over s+2}$$
    Find values for $c_1$ and $c_2$:
    $$c_1 = \lim_{s\to-3} F(s)(s+3) = \lim_{s\to-3}{1\over s+2} = -1$$
    $$c_2 = \lim_{s\to-2} F(s)(s+2) = \lim_{s\to-2}{1\over s+3} = 1$$
    Plugging back in for $F(s)$ gives:
    $$F(s) = {-1 \over s+3} + {1 \over s+2}$$
}

\ex{Partial Fraction Expansion: Repeated Roots}
{
    $$F(s) = {1 \over (s+1)(s+2)^2}$$
    Since the denominator is a third degree polynomial, there will be three partial fractions. Importantly, for repeated roots, there is a term for each power of the root:
    $$F(s) = {c_1 \over s+1} + {c_2 \over s+2} + {c_3 \over (s+2)^2}$$
    Find the values of the constants:
    $$c_1 = \lim_{s\to-1} F(s) (s+1) = \lim_{s\to-1} {1 \over (s+2)^2} = 1$$
    $$c_3 = \lim_{s\to-2} F(s) (s+2)^2 \lim_{s\to-2} {1 \over s+1} = -1$$
    To solve for $c_2$, we must pick some random, preferably easy to work with, number to plug in for $s$:
    $$F(0) = {1\over4} = {c_1 \over 1} + {c_2 \over 2} + {c_3 \over 3}$$
    $${1\over4} = 1 + {c_2 \over 2} + {-1 \over 4}$$
    $$c_2 = -1$$
    To complete the inverse Laplace transform, plug in the constants:
    $$F(s) = {1 \over s+1} - {1 \over s+2} - {1 \over (s+2)^2}$$
    $$f(t) = \lt[e^{-t} - e^{-2t} + te^{-2t}\rt] u(t)$$
}

\ex{Partial Fraction Expansion: Imaginary Roots}
{
    $$F(s) = {1 \over s(s^2 + 2s + 2)}$$
    Convert to partial fractions:
    $$F(s) = {c_1 \over s} + {As + B \over s^2 + 2s + 2}$$
    Solve for constants:
    $$c_1 = \lim_{s\to0} F(s) = {1\over2}$$
    $${1\over s(s^2 + 2s + 2)} = {1 \over 2s} + {As + B \over s^2 + 2s + 2}$$
    $${1 \over s(s^2 + 2s + 2)} = {(s^2 + 2s + 2) + 2s(As + B) \over 2s(s^2 + 2s + 2)}$$
    $$2 = (s^2 + 2s + 2) + 2As^2 + 2Bs$$
    $$2 = (2A + 1)s^2 + 2s(B+1) + 2$$
    $$A = -{1\over2}$$
    $$B = -1$$
    $$F(s) = {1 \over 2s} + {-{1\over2}s - 1 \over s^2 + 2s + 2}$$

}

\section{Solving ODEs Using Laplace Transforms}

\ex{}
{
    $$\ddot{y}(t) - y(t) = t$$
    $$y(0) = \dot{y}(0) = 1$$
    $$\mcL[\ddot{y}(t)] = s^2y(s) - s\dot{y}(0) - y(0)$$
    $$\mcL[y(t)] = y(s)$$
    $$\mcL[t] = {1\over s^2}$$
    $$s^2y(s) - s - 1 - y(s) = {1\over s^2}$$
    $$y(s)[s^2 - 1] = s + 1 + {1\over s^2}$$
    $$y(s)[s^2 -1] = {s^2(s+1) + 1 \over s^2}$$
    $$y(s) = {s^2(s+1) + 1 \over s^2(s^2 - 1)} = {1\over s-1} + {1 \over s^2(s^2 -1)} = {1\over s-1} + {c_1 \over s} + {c_2 \over s^2} + {c_3 \over s-1} + {c_4 \over s+1}$$

}

\chapter{Modeling of Dynamical Systems}

The transfer function of a system is written in the form:
$$F(s) = {Y(s) \over X(s)} = {b_m s^m + b_{m-1}s^{m-1} + \cdots + b_0 \over a_n s^n + b_{n-1} s^{n-1} + \cdots + a_0}$$
The numerator of the system has order $m$, and the denominator has order $n$. We say that the order of the system is the same as the order of the denominator. The roots of the numerator are the zeros of the transfer function and are usually plotted with $\circ$. The roots of the denominator are the poles of the transfer function and are usually plotted as $\times$.
\\
\\
\noindent
The goal of using this transfer function is to find the output, $y(t)$, of the system. Using the definition of the transfer function, this is done quite easily:
$$F(s) = {Y(s) \over X(s)}$$
$$Y(s) = X(s)F(s)$$
$$y(t) = \mathcal{L}^{-1}\lt\{Y(s)\rt\} = \mathcal{L}^{-1}\lt\{X(s)F(s)\rt\}$$
$$y(t) = x(t)f(t)$$
If $x(t)$ is the unit step, $u(t)$, the output is called the step response, if $x(t)$ is the Dirac delta function, $\delta(t)$, the output is called the impulse response, and if $x(t)$ is the ramp function, $v(t)$, the output is called the velocity response.

\chapter{Signal Flow Graphs}
Signal flow graphs are an alternative to block diagrams. They may consist of nodes, paths, gains, and loops. A node is a place on the diagram with a value defined as the sum of its inputs. Nodes may exist as inputs to the system, outputs from the system, or simply a measurable point in the system. Paths connect nodes together, showing the direction that a signal travels. Gains describe how a signal transforms when travelling along a path from one node to another. Loops are a series of at least one path that start and end at the same node.
\\
\\
\noindent
There exist some special types of paths and loops. A forward path connects the input directly to the output with no loops. A feedback path is just a loop, also called a feedback loop. A self-loop is a loop that connects a node back to itself without visiting any other nodes. 
\\
\\
\noindent
Mason's Rule:
$$G(s) = {C(s) \over R(s)} = {\sum_k T_k \Delta_k \over \Delta}$$
where $k$ is the number of forward paths, and $T_k$ is the gain of the $k^\text{th}$ forward-path, $\Delta$ is the determinant of the signal flow graph, and $\Delta_k$ is the associated path factor.
\end{document}

