The behavioral source creates a voltage or current source whose value is defined by a mathematical expression. This is part of analog behavioral modeling (ABM).
B<name> <node+> <node-> V={<expression>}
B<name> <node+> <node-> I={<expression>}
| Parameter | Description |
|---|---|
node+, node- |
Terminal nodes |
V={expr} |
Behavioral voltage source |
I={expr} |
Behavioral current source |
* Voltage source: half the input
B1 OUT 0 V={V(IN)*0.5}
* Current source: proportional to voltage
B2 OUT 0 I={V(CTRL)*1m}
* Full-wave rectifier
B3 OUT 0 V={abs(V(IN))}
* Conditional (comparator)
B4 OUT 0 V={if(V(IN)>2.5, 5, 0)}
* Multiplier
B5 OUT 0 V={V(A)*V(B)}
The expression can use:
- Node voltages:
V(node),V(node1, node2) - Branch currents:
I(Vsource) - Mathematical functions:
abs(),sqrt(),exp(),log(),sin(),cos(),if(),min(),max(), etc. - Arithmetic operators:
+,-,*,/,**(power) - Parameters defined with
.PARAM
SpiceSharpParser supports these analog behavioral modeling constructs:
| Form | Description |
|---|---|
VALUE={expr} |
Expression-based source (equivalent to V= or I=) |
TABLE={expr} |
Lookup table with piecewise-linear interpolation |
POLY(n) |
Polynomial transfer function |