# Models

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

## Properties

**Count**: The amount of instances in the model

## Methods

**Add**(*Instance*): Adds an instance to the model **Remove**(*Instance*): Remove an instance from the model **Has**(*Instance*): Returns true if the model has this instance **Find**(*string*): Find an instance by name

## Analysis methods

**Setup**(*Circuit*): Setup the model and its instances before starting a simulation. Nodes are resolved, and states are reserved by each instance.
**PzSetup**(*Circuit*): Not used (Setup for Pole-Zero analysis) **SenSetup**(*Circuit*): Not used (setup for Sensitivity analysis) **Temperature**(*Circuit*): Do temperature-dependent calculations, the results are used later
**Load**(*Circuit*): 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*): Load the circuit for AC analysis. The small-signal parameters calculated in the
**Load**() function are typically used here. **PzLoad**(*Circuit*): Load the circuit for Pole-Zero analysis. Not used.
**SenUpdate**(*Circuit*): Used for sensitivity analysis. Not used. **Accept**(*Circuit*): 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*): Used for sensitivity analysis. Not used. **Distortion**(*Circuit*): Used for distortion analysis. Not used. **NoiseLoad**(*Circuit*, *Noise.OutputMode*, *Noise.Operation*,
*NoiseData*, ref double): Calculate noise sources and store them in the *Circuit*
**CurrentNoiseData**-property. **SetIc**(*Circuit*): Set initial conditions. **IsConvergent**(*Circuit*): This method gives the model a final chance of checking convergence. The circuit will check for convergence in a general way, so this might not be necessary.

**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.

All of these methods are virtual and have a default implementation.

**Load**,

**AcLoad**,

**PzLoad** and

**SenLoad** will just iterate over all Instances in the model and call their respective functions. The other methods just do nothing by default (they have no effect).