%$Id: ac.tex,v 25.95 2006/08/26 01:26:53 al Exp $ -*- LaTeX -*-
% man commands ac .
% Copyright (C) 2001 Albert Davis
% Author: Albert Davis <aldavis@ieee.org>
%
% This file is part of "Gnucap", the Gnu Circuit Analysis Package
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2, or (at your option)
% any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
% 02110-1301, USA.
%------------------------------------------------------------------------
\section{{\tt AC} command}
\index{ac command}
\index{sine wave analysis}
\index{frequency response}
\index{small signal ac analysis}
%------------------------------------------------------------------------
\subsection{Syntax}
\begin{verse}
{\tt ac} \{{\it options} ...\} {\it start stop stepsize} \{{\it options} ...\}
\end{verse}
%------------------------------------------------------------------------
\subsection{Purpose}

Performs a small signal, steady state, AC analysis.  Sweeps frequency.
%------------------------------------------------------------------------
\subsection{Comments}

\index{nonlinear AC analysis}
The AC command does a linear analysis about an operating point.  {\em
It is absolutely necessary to do an {\tt OP} analysis first on any
nonlinear circuit.  Not doing this is the equivalent of testing it
with the power off.}

Three parameters are normally needed for an AC analysis: start frequency,
stop frequency and step size, in this order.  If all of these are omitted,
the values from the most recent AC analysis are used.

If only one frequency is specified, a single point analysis will be done.

If only a new step size is specified, the old start and stop are kept and
only the step size is changed.  This is indicated by a keyword: {\tt by},
{\tt times}, {\tt decade} or {\tt octave}, or a symbol: {\tt +} or {\tt
*}.

If the start frequency is zero, the program will still do an AC analysis.
The actual frequency can be considered to be the limit as the frequency
approaches zero.  It is, therefore, still possible to have a non-zero
phase angle, but delays are not shown because they may be infinite.

The nodes to look at must have been previously selected by the {\tt print} or
{\tt plot} command.  This is different fron Spice.
%------------------------------------------------------------------------
\subsection{Options}

\begin{description}

\item[{\tt +} {\it stepsize}] Linear sweep.  Add {\it
stepsize} to get the next step.  Same as {\tt by}.

\item[{\tt *} {\it multiplier}] Log sweep.  Multiply by
{\it multiplier} to get the next step.

%%%\item[{\tt <} {\it file}] Get circuit input from {\it file}.

\item[{\tt >} {\it file}] Send results of analysis to {\it file}.

\item[{\tt >>} {\it file}] Append results to {\it file}.

%%%\item[{\tt ACMAx}] Use worst case max values, per last
%%%{\tt AC} analysis.

%%%\item[{\tt ACMIn}] Use worst case min values, per last
%%%{\tt AC} analysis.

\item[{\tt by} {\it stepsize}] Linear sweep.  Add {\it
stepsize} to get the next step.  Same as {\tt +}.

%%%\item[{\tt Compare} {\it file}] Compare simulation results 
%%%to {\it file}.

%%%\item[{\tt DCMAx}] Use worst case max values, per last
%%%{\tt DC} or {\tt OP} analysis.

%%%\item[{\tt DCMIn}] Use worst case min values, per last
%%%{\tt DC} or {\tt OP} analysis.

\item[{\tt decade} {\it steps}] Log sweep.  Use {\it
steps} steps per decade.

\item[{\tt dtemp} {\it degrees}] Temperature offset,
degrees C.  Add this number to the temperature from the {\tt options}
command.  This does not apply to nonlinear components, which will
inherit the temperature from the operating point analysis.

%%%\item[{\tt Echo}] Echo disk reads to console, when input
%%%is from a file, or doing compare.

%%%\item[{\tt LAg}] Use worst case values, for lagging phase,
%%% per {\tt AC} analysis.

%%%\item[{\tt LEad}] Use worst case values, for leading	
%%% phase, per {\tt AC} analysis.

%%%\item[{\tt MAx}] Use worst case max values, per same type
%%%({\tt AC}) analysis.  (Same as {\tt ACMax}, here.)

%%%\item[{\tt MIn}] Use worst case min values, per same type
%%%({\tt AC}) analysis.  (Same as {\tt ACMin}, here.)

%%%\item[{\tt MCarlo} {\it trials}] Monte-Carlo analysis.
%%% Simulate {\it trials} circuits; compile statistics.  Hide
%%% individual trials.

\item[{\tt noplot}] Suppress plotting.

\item[{\tt octave} {\it steps}] Log sweep.  Use {\it
steps} steps per octave.

\item[{\tt plot}] Graphic output, when plotting is
normally off.

\item[{\tt quiet}] Suppress console output.

%%%\item[{\tt Random} {\it trials}] Simulate {\it trials}
%%% circuits using random values.

%%%\item[{\tt TAble}] Tabular output. Override default plot.

\item[{\tt temperature} {\it degrees}] Temperature,
degrees C.  This does not apply to nonlinear components, which will
inherit the temperature from the operating point analysis.

\item[{\tt times} {\it multiplier}] Log sweep.  Multiply
by {\it multiplier} to get the next step.

%%%\item[{\tt WOrstcase} {\it probe}] Worst case analysis, at
%%%{\it probe}.	

\end{description}
%------------------------------------------------------------------------
\subsection{Examples}

\begin{description}

\item[{\tt ac 10m}] A single point AC analysis at 10 mHz.

\item[{\tt ac 1000 3000 100}] Sweep from 1000 Hz to 3000 Hz in 100 Hz steps.

\item[{\tt ac 1000 3000 Octave}] Sweep from 1000 Hz to 3000 Hz in octave
steps.  Since the sweep cannot end at 3000 Hz, in this case, the last step
will really be 4000 Hz.

\item[{\tt ac by 250}] Keep the same limits as before, but use 250 Hz
steps.  In this case, it means to sweep from 1000 to 3000 Hz, because that
it what it was the last time.

\item[{\tt ac 5000 1000 -250}] You can sweep downward, if you want.
Remember that the increment would be negative.

\item[{\tt ac 20 20k *2}] Double the frequency to get the next step.

\item[{\tt ac 20k 20 *.5}] You can do a log sweep downward, too.  A
multiplier of less than one moves it down.

\item[{\tt ac}] Do the same AC sweep again.

\item[{\tt ac >afile}] Save the results in the file {\tt afile}.  The
file will look just like the screen.  It will have all probe points.  It
will be a plot, if plotting is enabled.  It will have the numbers in
abbreviated notation.  (10 nanovolts is {\tt 10.n}.)

\end{description}
%------------------------------------------------------------------------
%------------------------------------------------------------------------
