<< Click to Display Table of Contents >> Navigation: Designing a PCB with DEX > Projects > Circuit Simulation > The Spice Reference Manual > Circuit Description > Circuit Elements and Models > Voltage and Current Sources > Non-Linear Dependent Sources |
General form:
BXXXXXXX N+ N- <I=EXPR> <V=EXPR>
Examples:
B1 0 1 I=cos(v(1))+sin(v(2)) B1 0 1 V=ln(cos(log(v(1,2)^2)))-v(3)^4+v(2)^v(1) B1 3 4 I=17 B1 3 4 V=exp(pi^i(vdd))
N+ is the positive node, and N- is the negative node. The values of the V and I parameters determine the voltages and currents across and through the device, respectively. If I is given then the device is a current source, and if V is given the device is a voltage source. One and only one of these parameters must be given.
The small-signal AC behavior of the nonlinear source is a linear dependent source (or sources) with a proportionality constant equal to the derivative (or derivatives) of the source at the DC operating point.
The expressions given for V and I may be any function of voltages and currents through voltage sources in the system. The following functions of real variables are defined:
abs |
asinh |
cosh |
sin |
acos |
atan |
exp |
sinh |
acosh |
atanh |
ln |
sqrt |
asin |
cos |
log |
tan |
The function "u" is the unit step function, with a value of one for arguments greater than one and a value of zero for arguments less than zero. The function "uramp" is the integral of the unit step: for an input x, the value is zero if x is less than zero, or if x is greater than zero the value is x. These two functions are useful in synthesizing piece-wise non-linear functions, though convergence may be adversely affected.
The following standard operators are defined:
+ - * / ^ unary -
If the argument of log, ln, or sqrt becomes less than zero, the absolute value of the argument is used. If a divisor becomes zero or the argument of log or ln becomes zero, an error will result. Other problems may occur when the argument for a function in a partial derivative enters a region where that function is undefined.
To get time into the expression you can integrate the current from a constant current source with a capacitor and use the resulting voltage (don't forget to set the initial voltage across the capacitor). Non-linear resistors, capacitors, and inductors may be synthesized with the nonlinear dependent source. Non-linear resistors are obvious. Non-linear capacitors and inductors are implemented with their linear counterparts by a change of variables implemented with the nonlinear dependent source. The following sub circuit will implement a nonlinear capacitor:
.Subckt nlcap pos neg
* Bx: calculate f(input voltage)
Bx 1 0 v = f(v(pos,neg))
* Cx: linear capacitance
Cx 2 0 1
* Vx: Ammeter to measure current into the capacitor
Vx 2 1 DC 0Volts
* Drive the current through Cx back into the circuit
Fx pos neg Vx 1
.ends
Non-linear inductors are similar.