(B) Function-Based Source Statement

Function-based sources allow you to define the output voltage or current using arbitrary expressions. The output can depend on node voltages, device currents, time, and parameters.

Voltage Source

Bname pos neg V={function body}

Either the curly braces or the equal sign can be skipped.

B1 pos neg V=1+2
B2 pos neg V {1+2}

Certain other letters can be used to define a function-based source. Some of these only allow a table function.

Ename pos neg VALUE={function body}
Hname pos neg VALUE={function body}
Ename pos neg TABLE {expr} a0 b0 a1 b1 ...  ; table with x={expr}
Ename pos neg nc+ nc- TABLE a0 b0 a1 b1 ... ; table with x={V(nc+,nc-)}

Current Source

Bname pos neg I={function body}

Either the curly braces or the equal sign can be skipped.

B1 pos neg I=1+2
B2 pos neg I {1+2}

Certain other letters can be used to define a function-based source. Some of these only allow a table function.

Gname pos neg VALUE={function body}
Fname pos neg VALUE={function body}
Gname pos neg TABLE {expr} a0 b0 a1 b1 ...  ; table with x={expr}
Gname pos neg nc+ nc- TABLE a0 b0 a1 b1 ... ; table with x={V(nc+,nc-)}

The evaluated function body may reference the state of the circuit.

Examples

B1 n1 0 I={I(V1) + ddt(V(n4))}
B2 n2 0 V={sin(V(n5, n6))}
V1 n3 0 1