\documentclass[a4paper,10pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{tikz} 
\usetikzlibrary{shapes,snakes}
\usetikzlibrary{shapes.gates.logic.US,trees,positioning,arrows}
\usepackage{subfigure}
\usepackage{amsfonts,amsmath,amsthm}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{lastpage}

\newcommand{\fg}{\em functional~group}
\newcommand{\fgs}{\em functional~groups}
\newcommand{\dc}{\em derived~component}
\newcommand{\dcs}{\em derived~components}
\newcommand{\bc}{\em base~component}
\newcommand{\bcs}{\em base~components}
\newcommand{\irl}{in~real~life}



%\usepackage{glossary}
%opening
\title{Example OPAMP circuits}
\author{Robin}

\begin{document}
\begin{abstract}
Circuits from email conversation.

Not a document to be proof read.

Proof of analysis concept.

Function $fm$ applied to a component returns its failure modes.
\end{abstract}
\maketitle
\tableofcontents    
\listoffigures  



\section{Non-Inverting OPAMP}
Consider a non inverting op-amp designed to amplify
a small positive voltage, typical use would be a thermocouple.
 
 
\begin{figure}[h+]
 \centering
 \includegraphics[width=100pt]{./mvampcircuit.png}
 % mvampcircuit.png: 243x143 pixel, 72dpi, 8.57x5.04 cm, bb=0 0 243 143
 \label{fig:mvampcircuit}
 \caption{positive mV amplifier circuit}
\end{figure}

We can begin by looking for functional groups. 
The resistors would together to perform a fairly common function in electronics, that of the potential divider.
So our first functional group is $\{ R1, R2 \}$. 


\subsection{The Resistor in terms of failure modes}

We can now take the failure modes for the resistors (OPEN and SHORT EN298).


We can express the fialure modes of a component using the function $fm$, thus for the resistor,  $ fm(R) = \{ OPEN, SHORT \}$.


We have two resistors in this circuit and therefore four component failure modes to consider for the potential divider,
we can now examine what effect each of these failures will have on the {\fg} (the potential divider see figure~\ref{fig:pdcircuit}).


\subsection{Analysing a potential divider in terms of failure modes}

\begin{figure}[h+]
 \centering
 \includegraphics[width=100pt,keepaspectratio=true]{./pd.png}
 % pd.png: 361x241 pixel, 72dpi, 12.74x8.50 cm, bb=0 0 361 241
 \label{fig:pdcircuit}
 \caption{Potential Divider Circuit}
\end{figure}
 

\begin{table}[h+]
\begin{tabular}{|| l | l | c | c | l ||} \hline
 \textbf{Failure Scenario} & &  \textbf{Pot Div Effect}  &   & \textbf{Symptom}          \\ 
               \hline
     FS1: R1 SHORT    &  &  $LOW$   &  &  $PDLow$              \\ \hline
     FS2: R1 OPEN     &  &  $HIGH$  &  &  $PDHigh$             \\ \hline
     FS3: R2 SHORT    &  &  $HIGH$  &  &  $PDHigh$             \\ \hline
     FS4: R2 OPEN     &  &  $LOW$   &  &  $PDLow$              \\ \hline
\hline
\end{tabular}
\end{table}

We can now create a {\dc} for the potential divider, $PD$.

 $$ fm(PD) = \{ PDLow, PDHigh \}$$

Let use now consider the op-amp. According to 
FMD-91~\cite{fmd91}[3-116] an op amp may have the following failure modes:
latchup(12.5\%), latchdown(6\%), nooperation(31.3\%), lowslewrate(50\%).


\subsection{Analysing the non-inverting amplifier in terms of failure modes}

$$ fm(OPAMP) = \{L\_{up}, L\_{dn}, Noop, L\_slew \} $$


We can now form a {\fg} with $PD$ and $OPAMP$.

\begin{figure}
 \centering
 \includegraphics[width=300pt]{./non_inv_amp_fmea.png}
 % non_inv_amp_fmea.png: 964x492 pixel, 96dpi, 25.50x13.02 cm, bb=0 0 723 369
\end{figure}


We can collect symptoms from the analysis and cretae a derived component 
to represent the non-inverting amplifier $NI\_AMP$.
We now have can express the failure mode behaviour of this type of amplifier thus:

$$ fm(NI\_AMP) = \{  N\_INVAMP_{lowpass}, N\_INVAMP_{high}, N\_INVAMP_{low} \}.$$




\section{Inverting OPAMP}

\begin{figure}[h]
 \centering
 \includegraphics[width=200pt]{./invamp.png}
 % invamp.png: 378x207 pixel, 72dpi, 13.34x7.30 cm, bb=0 0 378 207
 \caption{Inverting Amplifier Configuration}
 \label{fig:invamp}
\end{figure}

This configuration is interesting from methodology perspective.
There are two ways in which we can tackle this.
One is to do this in two stages, by considing the gain resistors to be a potential divider
and then combining the poential divider with the OPAMP failure mode model.
The other way is to place all three components in a {\fg}.

\subsection{Inverting OPAMP using a Potential Divider {\dc}}
 
\subsection{Inverting OPAMP using three components}

\subsection{Comparison between the two approaches}


\clearpage
\section{Op-Amp circuit 1}

\begin{figure}[h]
 \centering
 \includegraphics[width=200pt]{/home/robin/projects/thesis/opamp_circuits_C_GARRETT/circuit1001.png}
 % circuit1001.png: 420x300 pixel, 72dpi, 14.82x10.58 cm, bb=0 0 420 300
 \caption{Circuit 1}
 \label{fig:circuit1}
\end{figure}


The amplifier in figure~\ref{fig:circuit1} amplifies the difference between 
the input voltages $+V1$ and $+V2$.
It would be desirable to represent this circuit as a derived component called say $DiffAMP$.
We begin by identifying functional groups from the components in the circuit.


\subsection{Functional Group: Potential Divider}

R1 and R2 perform as a potential divider.
Resistors can fail OPEN and SHORT (according to GAS burner standard EN298 Appendix A).
$$ fm(R) = \{ OPEN, SHORT \}$$



\begin{table}[ht]
\caption{Potential Divider $PD$: Failure Mode Effects Analysis: Single Faults} % title of Table
\centering % used for centering table
\begin{tabular}{||l|c|c|l|l||}
\hline \hline
 \textbf{Test} & \textbf{Pot.Div} & \textbf{  } & \textbf{General}   \\
 \textbf{Case} &  \textbf{Effect} & \textbf{  } & \textbf{Symtom Description}   \\
%   R         &    wire        & res +         & res -    & description
\hline
\hline
 TC1: $R_1$ SHORT    &  LOW       &       &  LowPD \\ 
 TC2: $R_1$  OPEN    &  HIGH        &       &  HighPD \\ \hline
 TC3: $R_2$ SHORT    &  HIGH        &      &  HighPD \\  
 TC4: $R_2$ OPEN     &  LOW         &      &  LowPD \\ \hline
\hline
\end{tabular} 
\label{tbl:pdfmea}
\end{table}

By collecting the symptoms in table~\ref{tbl:pdfmea} we can create a derived
component $PD$ to represent the failure mode behaviour
of a potential divider.

Thus for single failure modes, a potential divider can fail
with $fm(PD) = \{PDHigh,PDLow\}$.


The potential divider is used to program the gain of IC1.
IC1 and PD provide the function of buffering
/amplifying the signal $+V1$.
We can now examine IC1 and PD as a functional group.

\pagebreak[3]
\subsection{Functional Group: Amplifier}

Let use now consider the op-amp. According to 
FMD-91~\cite{fmd91}[3-116] an op amp may have the following failure modes:
latchup(12.5\%), latchdown(6\%), nooperation(31.3\%), lowslewrate(50\%).


$$ fm(OPAMP) = \{L\_{up}, L\_{dn}, Noop, L\_slew \} $$


By bringing the $PD$ derived component and the $OPAMP$ into 
a functional group we can analyse its failure mode behaviour.


\begin{table}[ht]
\caption{Non Inverting Amplifier $NI\_AMP$: Failure Mode Effects Analysis: Single Faults} % title of Table
\centering % used for centering table
\begin{tabular}{||l|c|c|l|l||}
\hline \hline
 \textbf{Test} & \textbf{Amplifier} & \textbf{  } & \textbf{General}   \\
 \textbf{Case} &  \textbf{Effect} & \textbf{  } & \textbf{Symtom Description}   \\
%   R         &    wire        & res +         & res -    & description
\hline
\hline
 TC1: $OPAMP$ LatchUP    &  Output High          &      &  AMPHigh \\ 
 TC2: $OPAMP$ LatchDown  &  Output Low : Low gain&      &  AMPLow \\ \hline
 TC3: $OPAMP$ No Operation &  Output Low         &      &  AMPLow \\  
 TC4: $OPAMP$ Low Slew     &  Low pass filtering &      &  LowPass \\ \hline
 TC5: $PD$ LowPD         &   Output High         &      &  AMPHigh \\ \hline
 TC6: $PD$ HighPD        &  Output Low : Low Gain&      &  AMPLow \\ \hline 
 %TC7: $R_2$ OPEN     &  LOW       &      &  LowPD \\ \hline
\hline
\end{tabular} 
\label{ampfmea}
\end{table}


Collecting the symptoms we can see that this amplifier fails
in 3 ways $\{ AMPHigh, AMPLow,  LowPass \}$.
We can now create a derived component, $NI\_AMP$, to represent it.

 
$$ fm(NI\_AMP) = \{ AMPHigh, AMPLow, LowPass \} $$
 



\subsection{The second Stage of the amplifier}

The second stage of this amplifier, following the signal path, is the amplifier
consisting of $R3,R4,IC2$.

This is in exactly the same configuration as the first amplifier, but it is being fed by the first amplifier.
The first amplifier was grounded and received as input `+V1' (presumably
a positive voltage).
This means the junction of R1 R3 is always +ve.
This means the input voltage `+V2' could be lower than this.
This means R3 R4 is not a potential divider with R4 being on the positive side.
It could be on either polarity (i.e. the other way around R4 could be the negative side). 
Here it is more intuitive to model the resistors not as a potential divider, but individually.
%This means we are either going to
%get a high or low reading if R3 or R4 fail.

\begin{table}[ht]
\caption{Differencing Amplifier $D\_AMP$: Failure Mode Effects Analysis: Single Faults} % title of Table
\centering % used for centering table
\begin{tabular}{||l|c|c|l|l||}
\hline \hline
 \textbf{Test} & \textbf{Amplifier} & \textbf{  } & \textbf{General}   \\
 \textbf{Case} &  \textbf{Effect} & \textbf{  } & \textbf{Symtom Description}   \\
%   R         &    wire        & res +         & res -    & description
\hline
\hline
 TC1: $OPAMP$ LatchUP    &  Output High            &      &  AMPHigh \\ 
 TC2: $OPAMP$ LatchDown  &  Output Low : Low gain  &      &  AMPLow \\ \hline
 TC3: $OPAMP$ No Operation &  Output Low           &      &  AMPLow \\  
 TC4: $OPAMP$ Low Slew     &  Low pass filtering   &      &  LowPass \\ \hline
 TC5: $R3\_open$      &  +V2 follower              &      &  AMPIncorrectOutput\\ \hline
 TC6: $R3\_short$     &  Undefined                 &      &  AMPIncorrectOutput \\  
                      & (impedance of IC1 vs +V2)  &      &                     \\ \hline 
 TC5: $R4\_open$      &  High or Low output        &      &  AMPIncorrectOutput \\  
                      &  +V2$>$+V1 $\mapsto$ High    &      & \\  
                      &  +V1$>$+V2 $\mapsto$ Low     &      &  \\ \hline 
 TC6: $R4\_short$     &  +V2 follower              &      &  AMPIncorrectOutput \\ \hline 
 %TC7: $R_2$ OPEN     &  LOW       &      &  LowPD \\ \hline
\hline
\end{tabular} 
\label{ampfmea}
\end{table}

Collecting the symptoms we can see that this amplifier fails
in 4 ways $\{ AMPHigh, AMPLow,  LowPass, AMPIncorrectOutput\}$.
We can now create a derived component, $D\_AMP$, to represent it.

 
$$ fm(D\_AMP) = \{ AMPHigh, AMPLow, LowPass, AMPIncorrectOutput \} $$
 


%Its failure modes are therefore the same. We can therefore re-use
%the derived component for $NI\_AMP$

\pagebreak[4]
\subsection{Modelling the circuit}

For the final stage of this we can create a functional group consisting of
two derived components of the type $NI\_AMP$ and $D\_AMP$.



\begin{table}[ht]
\caption{Difference Amplifier $DiffAMP$ : Failure Mode Effects Analysis: Single Faults} % title of Table
\centering % used for centering table
\begin{tabular}{||l|c|c|l|l||}
\hline \hline
 \textbf{Test} & \textbf{Dual Amplifier} & \textbf{  } & \textbf{General}   \\
 \textbf{Case} &  \textbf{Effect} & \textbf{  } & \textbf{Symtom Description}   \\
%   R         &    wire        & res +         & res -    & description
\hline
\hline
 TC1: $NI\_AMP$ AMPHigh        &  opamp 2 driven high          &      & DiffAMPLow \\ 
 TC2: $NI\_AMP$  AMPLow        &  opamp 2 fdriven low          &      &  DiffAMPHigh \\  
 TC3: $NI\_AMP$ LowPass        &  opamp 2 driven with lag      &      &  DiffAMP\_LP \\  \hline 
 TC4: $D\_AMP$ AMPHigh        &  Diff amplifier high           &      &   DiffAMPHigh\\  
 TC5: $D\_AMP$ AMPLow         &  Diff amplifier low            &      &  DiffAMPLow \\  
 TC6: $D\_AMP$ LowPass        &  Diff amplifier lag/lowpass    &      &  DiffAMP\_LP \\ \hline 
 TC7: $D\_AMP$ IncorrectOutput &  Output voltage               &      &  DiffAMPIncorrect \\  
 TC7: $D\_AMP$                 & $ \neg (V2 - V1) $ &      &   \\ \hline
\hline
\end{tabular} 
\label{ampfmea}
\end{table}



Collecting the symptoms, we can determine the failure modes for this circuit, $\{DiffAMPLow, DiffAMPHigh,  DiffAMP\_LP, DiffAMPIncorrect \}$.


We now create a derived component to represent the circuit in figure~\ref{fig:circuit1}.

$$ fm (DiffAMP) = \{DiffAMPLow, DiffAMPHigh,  DiffAMP\_LP DiffAMPIncorrect\} $$


Its interesting here to note that we can draw a directed graph (figure~\ref{fig:circuit1_dag})
of the failure modes and derived components.
Using this we can trace any top level fault back to 
a component failure mode that could have caused it.
In fact we can re-construct an FTA diagram from the information in this graph.
We merely have to choose a top level event and work down using or gates.

This circuit performs poorly from a safety point of view.
Its failure modes could be indistinguishable from valid readings (especially
wihen it becomes a V2 follower). 

\begin{figure}[h]
 \centering
 \includegraphics[width=400pt]{./circuit1_dag.png}
 % circuit1_dag.png: 797x1145 pixel, 72dpi, 28.12x40.39 cm, bb=0 0 797 1145
 \caption{Directed Acyclic Graph of Circuit1 failure modes}
 \label{fig:circuit1_dag}
\end{figure}




\clearpage
\section{Op-Amp circuit 2}


  \begin{figure}[h]
 \centering
 \includegraphics[width=200pt]{./circuit2002.png}
 % circuit2002.png: 575x331 pixel, 72dpi, 20.28x11.68 cm, bb=0 0 575 331
 \caption{circuit2}
 \label{fig:circuit2}
\end{figure}


\clearpage
\section{Op-Amp circuit 3}

 \begin{figure}[h]
 \centering
 \includegraphics[width=200pt]{/home/robin/projects/thesis/opamp_circuits_C_GARRETT/circuit3003.png}
 % circuit3003.png: 503x326 pixel, 72dpi, 17.74x11.50 cm, bb=0 0 503 326 
\caption{Circuit 3}
 \label{fig:circuit3}
\end{figure}
\clearpage
\section{Standard Non-inverting OP AMP}

\end{document}
