This section will talk a little bit about the job of an Instance.


  • Terminals: The nodes this instance is connected to.
  • ModelType: The type of model this instance can be added to. This is checked when adding the instance to a model to avoid errors.


  • Connect(string, ...): Connects the instance to nodes by name. This change is reflected in the Terminals property.

Analysis methods

  • Setup(Circuit,Model,object): Setup the instance. The model and (optional) parameters are passed.
  • PzSetup(Circuit,Model,object): Not used (Setup for Pole-Zero analysis)
  • SenSetup(Circuit,Model,object): Not used (setup for Sensitivity analysis)
  • Temperature(Circuit,Model,object): Do temperature-dependent calculations, the results are used later
  • Load(Circuit,Model,object): This is the main body of any component. This function is called to load the State.Matrix and State.Rhs for solving. It is used in calculating operating points, DC sweeps or transient analysis. At this point, small-signal parameters can be calculated too. Everything is delegated by the Mode property of the circuit.
  • AcLoad(Circuit,Model,object): Load the circuit for AC analysis. The small-signal parameters calculated in the Load() function are typically used here.
  • PzLoad(Circuit,Model,object): Load the circuit for Pole-Zero analysis. Not used.
  • SenUpdate(Circuit,Model,object): Used for sensitivity analysis. Not used.
  • Accept(Circuit,Model,object): This method is called in transient analysis when a new timepoint is accepted as a solution. This is typically used by piece-wise linear sources for setting breakpoints when the solution is expected to follow a smooth trajectory.
  • SenAcLoad(Circuit,Model,object): Used for sensitivity analysis. Not used.
  • Distortion(Circuit,Model,object): Used for distortion analysis. Not used.
  • NoiseLoad(Circuit, Noise.OutputMode, Noise.Operation, NoiseData, ref double,Model,object): Calculate noise sources and store them in the Circuit CurrentNoiseData-property.
  • SetIc(CircuitModel,object): Set initial conditions.

NOTE: The AcLoad and the PzLoad are essentially the same function, except that AcLoad is implemented in the original software to only allow purely imaginary Omega values. PzLoad allows the whole complex plane. Spice.NET implemented the AcLoad function for any complex variable, which in fact makes it almost the same code as the PzLoad method.

Setup, Temperature and Load are abstract methods and have to be implemented per instance class. Most other methods will generate a NotImplementedException.

Helper methods

  • BindNodes(Circuit,NodeType,...): Resolve the terminals of the instance. The first items of the returned array will be the terminals of the device. After that the extra reserved nodes.
  • CreateState(Circuit,int): Reserve a number of states for the instance (typically used in the setup method).
  • pnjlim(...): The method DEVpnjlim() implemented in Spice in the file "lib/dev/devsup.c". PN junctions behave exponentially and tend to be awful for convergence. This method limits how much voltage change you can have from one iteration to the next.
  • fetlim(...): The method DEVfetlim() implemented in Spice in the file "lib/dev/devsup.c".
  • limvds(...): The method DEVlimvds() implemented in Spice in the file "lib/dev/devsup.c".
  • NevalSrc(...): The method NevalSrc() implemented in Spice in the file "lib/ckt/nevalsrc.c". It some standard noise sources: Shot noise, Thermal noise and the gain for 1/f noise.

Last edited Feb 10 at 12:54 PM by SBoulang, version 1