The controlled generators described by arbitrary functions allow to define the functional or behavioral models of an analog circuit using mathematical equations.

B<name> <node1(+)> <node2(-)> V = <expr>
B<name> <node1(+)> <node2(-)> I = <expr>

Parameters

name

Is the name of the source.

node1(+), node2(-)

Are the positive and negative nodes, respectively. Positive current is assumed to flow from the positive node, through the source, to the negative node.

expr

The expressions given for V and I may be any function of voltages and currents through voltage sources in the system. In an AC analysis, only the DC component of a voltage or current source when the initial operating point was calculated is used. In a transient analysis, any voltages or currents are evaluated at each time point. See also Behavioral modeling expressions.

To reference in an expression the voltage at a node in the circuit:

V(Net1) - The voltage at the node Net1 relative to the ground node.
V(Net1,Net2)  - The voltage difference between nodes Net1 and Net2.

To reference in an expression the currents through voltage sources:

I(Vsrc) - The current flowing in the independent voltage source Vsrc. Positive current flows from the positive node, through the source, to the negative node.

Note Note: 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.

Description

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.

AC Analysis Note

The small-signal AC behaviour of the non-linear 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.

Time Subcircuit

To get time into an expression or represented as a node voltage for other purposes, you can also integrate the current from a constant current source with a capacitor and use the resulting voltage to represent time. Don't forget to set the initial voltage across the capacitor and use UIC in the .TRAN statement. For example, node Tvalue = time:

I1 0 Tvalue 1
C1 Tvalue 0 1 IC=0
R1 Tvalue 0 1E12

Nonlinear Elements

Non-linear resistors, capacitors, and inductors may be synthesised with the non-linear 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 non-linear dependent source. The following subcircuit will implement a non-linear 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.

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))

See also

Behavioral modeling expressions
Non-linear dependent sources instance parameters