%$Id: pwl.tex,v 25.95 2006/08/26 01:26:53 al Exp $ -*- LaTeX -*-
% man behavior pwl .
% 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 PWL}: Piecewise linear function}
%------------------------------------------------------------------------
\subsection{Syntax}
\begin{verse}
{\tt PWL} {\it x1,y1 x2,y2 ...}
\end{verse}
%------------------------------------------------------------------------
\subsection{Purpose}

Defines a piecewise linear transfer function or time dependent value.
%------------------------------------------------------------------------
\subsection{Comments}

This is similar to, but not exactly the same as, the Berkeley SPICE
PWL for fixed sources.

For fixed sources, it defines voltage or current as a function of
time.

The meaning of the {\tt x} and {\tt y} values depends on the component type:

\begin{tabular}{|c|c|c|}
\hline 
component	&X		&Y		\\\hline\hline 
C (capacitor)	&voltage	&charge 	\\\hline 
E (VCVS)	&voltage	&voltage	\\\hline
F (CCCS)	&current	&current	\\\hline 
G (VCCS)	&voltage	&current	\\\hline 
H (CCVS)	&current	&voltage	\\\hline 
I (current source) &time	&current	\\\hline
L (inductor)	&current	&flux		\\\hline
R (resistor)	&current	&voltage	\\\hline
V (voltage source) &time	&voltage	\\\hline
Y (admittance)	&voltage	&current	\\\hline
VCCAP		&voltage	&capacitance	\\\hline 
VCG		&voltage	&conductance	\\\hline 
VCR		&voltage	&resistance	\\\hline 
trans-capacitor	&voltage	&charge		\\\hline 
\end{tabular}

The values of {\it x} must be in increasing order.

Outside the specified range, the behavior depends on the type of
element.  For fixed sources, the output (voltage or current) is
constant at the end value.  This is compatible with SPICE.  For other
types, the last segment is extended linearly.  If you want it to
flatten, specify an extra point so the slope of the last segment is
flat.
%------------------------------------------------------------------------
\subsection{Parameters}

There are no additional parameters, beyond those that apply to all.
%------------------------------------------------------------------------
\subsection{Example} 

\begin{description}

\item[{\tt C1 (2 0) pwl (-5,-5u 0,0 1,1u 4,2u 5,2u)}]
This ``capacitor'' stores 5 microcoulombs at -5 volts (negative,
corresponding to the negative voltage, as expected.  The charge varies
linearly to 0 at 0 volts, acting like a 1 microfarad capacitor.  (C =
dq/dv).  This continues to 1 volt.  The 0,0 point could have been left
out.  The charge increases only to 2 microcoulombs at 4 volts, for an
incremental capacitance of 1u/3 or .3333 microfarads.  The same charge
at 5 volts indicates that it saturates at 2 microcoulombs.  For
negative voltages, the slope continues.

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