Chapter 6  Adding models

Gnucap has three distinct styles of adding models:
Model Compiler
is the easiest way to add models, but the least flexible. The model compiler generates .cc and .h files using the enhanced subcircuit mode. It is possible to develop models with almost no knowledge of the simulator internals. In most cases, this is the preferred way. The standard MOSFET and diode models are done this way.
Enhanced subcircuit
is less efficient than primitive but has other advantages that make it preferable to primitive when you can use it. The model is defined as a combination of equations and topology. The AC and pole-zero code is inherited from a base class, so you don't need to to it. You need to understand the simulator's internals, and it is not likely to be portable to other simulators.
should be used only when absolutely necessary. If it is done correctly, it will result in the fastest execution, but you need to do everything. It requires thorough knowledge of the simulator internals, including how Gnucap is different from other simulators. If you miss some of the details, it is possible that your model will work but slow down the simulator significantly. Most of the primitive devices (resistors, sources) are done this way. A few device types that have special considerations, like gates and transmission lines, are also done this way.