%$Id: param.tex,v 25.95 2006/08/26 01:26:53 al Exp $ -*- LaTeX -*-
% man commands param .
% Copyright (C) 2006 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 PARAMETER} command}
\index{parameter command}
%------------------------------------------------------------------------
\subsection{Syntax}
\begin{verse}
{\tt param}\\
{\tt parameter}\\
{\tt param} {\it param-name value} ... \\
{\tt parameter} {\it param-name value} ...
\end{verse}
%------------------------------------------------------------------------
\subsection{Purpose}

Set and view parameters.
%------------------------------------------------------------------------
\subsection{Comments}

The bare command {\tt param} lists all defined parameters and their values.

The value may be a number or the name of another parameter.  If it is
another parameter, eventually it must resolve to a number.  This depth
can be set by the {\tt option recursion} which has a default value of
20.  The depth is limited to prevent infinite recursion.

In a future release, full expressions will be accepted, but this is
not working yet.

All component values, numeric lists such as in {\tt PWL}, component
and model parameters can be defined using {\tt param}.

If the same parameter is set more than once, the most recent one
prevails.  All instances of the parameter will take the new value.

When a parameter name is used as a value, it may be enclosed by quotes
or curly braces.
%------------------------------------------------------------------------
%------------------------------------------------------------------------
\subsection{Examples}

Suppose we have this circuit:

\begin{verbatim}
Vpower (vcc 0) dc vcc
Vin    (in  0) generator
Q1 (c b e) small
Rc (vcc c) rc
Re (e 0) re
Rb1 (vcc b) rb1
Rb2 (b 0)   rb2
.model small npn (bf=beta)
\end{verbatim}

If I try to simulate it now, it will not be very useful.  We need to
give our circuit some values:

\begin{verbatim}
gnucap> param vcc=10 beta=100 rc=10k re=1k rb1=100k rb2=rc
\end{verbatim}

Let's see what it does:

\begin{verbatim}
gnucap> print op v(nodes)
gnucap> op
#           v(b)       v(c)       v(e)       v(in)      v(vcc)    
 27.        0.8941     8.3513     0.16652    0.         10.       
\end{verbatim}

What happens if I change beta?

\begin{verbatim}
gnucap> param beta=200
gnucap> op
#           v(b)       v(c)       v(e)       v(in)      v(vcc)    
 27.        0.90128    8.2822     0.17264    0.         10.       
\end{verbatim}

Not much changes.  Let's try to lower v(c).  About 6 should be better.

\begin{verbatim}
gnucap> param rb1=68k
gnucap> op
#           v(b)       v(c)       v(e)       v(in)      v(vcc)    
 27.        1.2602     4.9866     0.50385    0.         10.       
\end{verbatim}

Too low, try again:

\begin{verbatim}
gnucap> param rb1=82k
gnucap> op
#           v(b)       v(c)       v(e)       v(in)      v(vcc)    
 27.        1.0724     6.7437     0.32726    0.         10.       
\end{verbatim}

Too high...


\begin{verbatim}
gnucap> param rb1=75k
gnucap> op
#           v(b)       v(c)       v(e)       v(in)      v(vcc)    
 27.        1.1586     5.9433     0.4077     0.         10.       
\end{verbatim}

Close enough.
%------------------------------------------------------------------------
%------------------------------------------------------------------------
