next up previous contents index
Next: Circuit 7: MOS Convergence Up: Example Data Files Previous: Circuit 5: Transmission Line   Contents   Index

Circuit 6: Function and Table Demo

Below is a file which illustrates some features exclusive to WRspice for specifying the output of sources.

    WRspice function and table demo
    *
    * WRspice allows arbitrary functional dependence in sources.  This
    * file demonstrates some of the capability.
    *
    * v1 is numerically equal to the exponentiation of
    * 2 times the sine.  "x" is replaced by the time variable.
    v1 1 0 exp(2*sin(6.28e9*x))
    r1 1 0 1
    *
    * v2 obtains values from table t1
    v2 2 0 table(t1, time)
    r2 2 0 1
    .table t1 0 0 100p .1 500p 0 750p .2 1000p 0
    *
    * v3 is a 0-1 ramp
    v3 3 0 pwl(0 0 1n 1)
    r3 3 0 1
    *
    * e1 illustrates use of sub-tables.  x is the voltage from v3
    e1 4 0 3 0 table(t2, x)
    * below is an alternative equivalent form for e1
    *e1 4 0 t2(v(3))
    r4 4 0 1
    .table t2 0 table t3 .5 table t4 .75 .75 1 0
    .table t3 0 0 .25 1 .5 0
    .table t4 0 0 .5 0 .625 1 .75 .75, x)
    *
    * e2 produces the same output as e1, but uses a PWL statement.
    * when the controlling nodes are given, pwl uses the control source,
    * and not time when used in e,f,g,h sources
    e2 5 0 3 0 pwl(0 0 .25 1 .5 0 .625 1 .75 .75 1 0)
    r5 5 0 1
    *
    .tran 1p 1n
    * type "run", then "plot v(1) v(2) v(3) v(4)"
    .end



Stephen R. Whiteley 2017-03-28