# Chapter 4  Behavioral modeling

Gnucap behavioral modeling is in a state of transition, so this is subject to change in a future release.

All simple components can have a behavioral description, with syntax designed as an extension of the Spice time dependent sources. They are not necessarily physically realizeable. Some only work on particular types of analysis, or over a small range of values. Some can be used together, some cannot.

All simple components are considered to have simple transformations. A function returns one parameter as a function of one other, as an extension of their linear behavior.

Linear behavior:
Capacitor
q = C v
Inductor
ϕ = L i
Resistor
v = I r
i = Y v
VCVS
vo = E vi
VCCS
io = G vi
CCVS
vo = E ii
CCCS
io = G ii
Sources are defined as functions of time:
Voltage source
v = f(t)
Current source
i = f(t)
For behavioral modeling / nonlinear values, replace the constant times input by an arbitrary function:
Capacitor
q = f(v)
Inductor
ϕ = f(i)
Resistor
v = f(r)
i = f(v)
VCVS
vo = f(vi)
VCCS
io = f(vi)
CCVS
vo = f(ii)
CCCS
io = f(ii)

### Conditionals

AC
AC analysis only.
DC
OP
OP analysis.
TRAN
Transient analysis.
FOUR
Fourier analysis only.
ELSE
Anything not listed.
ALL
All modes.

### Functions

COMPLEX
Complex (re, im) value.
EXP
Spice Exp source. (time dependent value).
FIT
Fit a curve with splines.
GENERATOR
Value from Generator command.
POLY
Polynomial (Spice style).
POSY
Posynomial (Like poly, non-integer powers).
PULSE
Spice Pulse source. (time dependent value).
PWL
Piece-wise linear.
SFFM
Spice Frequency Modulation (time dependent value).
SIN
Spice Sin source. (time dependent value).
TANH
Hyperbolic tangent xfer function.

### Model Functions

TABLE
Fit a curve with splines.
Cap
Spice semiconductor “capacitor” model.
Res
Spice semiconductor “resistor” model.