22_custom_sym: creating a custom symbol

Scope

Create a custom diode symbol with an embedded (inline) model card.

The schematics


Click the image to get the sch-rnd sheet

Preparing for simulation

Draw the symbol the usual way, using lines, rectangles and {p t} for placing terminals; select the objects, convert selection to symbol; set the usual attributes (e.g. name on the symbol and on the terminals).

For spice simulation, set the following attributes:

The inline model card option is useful for one-off symbols or for an easy and quick way of tuning model parameters in test-bench schematics.

Raw spice commands

Similar to those used in 10_bjt_amp_tr.

Export and run ngspice

Running ngspice the usual way on the export yields the following graphs:

Using other implementations

gnucap

Gnucap uses a different command syntax. Modify the spice command symbol's spice/command attribute to:

print tran v(out) v(in)
tran 1u 4m > plot.txt

After the export, write the single word spice in the first line of the file (e.g. using a text editor), otherwise gnucap won't know that the file is in spice syntax. Then run gnucap 22_custom_sym.cir and it will dump a text table to plot.txt that can be plotted using a suitable utility, e.g. gnuplot.

The gnucap-modified schematic is also available.

xyce

TODO