Circuit Elements

This page contains some notes about how various circuit elements are modeled which may be useful for advanced users of CircuitLab.

Any circuit simulation is only as accurate as the model provided to the simulator.

Simulator-Wide Notes

Noise is not currently modeled.

Temperature-dependent effects are not currently modeled.

Behavioral Voltage and Current Sources (experimental)

The normal voltage source and current source elements are usually used as static voltage and current sources. For example, a voltage source with a 'V' parameter set to '5' will simply maintain 5 volts difference between its terminals, regardless of current.

However, voltage and current sources can also be used as arbitrary behavioral sources, allowing a voltage or current to be described algebraically. This is useful for modeling special components, mechanical models, or arbitrary systems with the simulator. Instead of entering a fixed voltage, simply enter an expression. Some examples:

  • "5m*V(A)^2" -- will produce a signal that is proportional to the square of the voltage at node A.
  • "MAX(V(A), 0)" -- will produce a signal that is a perfectly half-wave-rectified version of V(A).
  • "0.5 * ( TANH((V(A)-V(B)) * 1k) + 1 )" -- will produce a TANH-based comparator, evaluating to 1 if V(A) >> V(B), and evaluating to 0 if V(A) << V(B), and transitioning fairly smoothly in between.
  • "LIMIT(I(V1.nA)*100, -1, 1)" -- in a voltage source V1 will make it behave like a non-linear resistance, looking like 100 ohms and then saturating at -1 and +1 volts.
  • "PWL(0,0,1,5,4,5,5,0)" -- will generate a piece-wise-linear pulse with 1-second long edges.
  • "SIN(2*PI*1000*T)*SIN(2*PI*10*T)" -- will generate an amplitude-modulated signal as a function of time

For a full list of expressions which work, see the Expressions documentation page.

Behavioral sources can easily create situations in which the simulator will be unable to find a converged solution to the system. However, if you stick to "gentle" functions which are well-behaved, have no algebraic domain restrictions, are continuous (and even better if they're smooth!), and don't have any feedback within the schematic, they are fairly safe. Polynomials, TANH, etc. tend to work great.

Behavioral sources are currently experimental within CircuitLab, but they are a powerful tool for advanced users and can be great when in experienced hands.

Bipolar Junction Transistors (BJTs)

BJTs are modeled with a modified Gummel-Poon model, including nonlinear charge storage and saturation effects.

Variation in current gain, and variation in base spreading resistance, are not modeled. Junction breakdown is not modeled.

Coupled Inductors

A coupling coefficient can be specified by creating a custom Parameter Element with a name starting with "K" followed by a space-separated list of two or more inductor names, such as "K L1 L2" or "K Lp Ls1 Ls2". The value of this parameter should be between 0 and 1 inclusive, with 1 for the ideal case of perfect coupling, when the magnetic flux of coils is entirely shared (zero leakage).

This technique can be used to simulate transformers, chokes, or other situations where two or more inductors share a magnetic flux if the built-in Transformer elements are not sufficient.

For examples specifying an inductor coupling coefficient, see a 5:1 transformer example or a center-tapped transformer example.

Digital Elements

All digital inputs are ground-relative, and have input hysteresis: VIL=2.0 volts, VIH=3.0 volts.

All digital outputs are ground-relative, and are either 0 or 5V, in series with a 10 Ω output impedance.

These input and output parameters are currently not configurable.

Neither digital inputs nor digital outputs provide the sort of diode-based clamping one would expect to see on any IC's digital I/O pin. If your circuit depends on that, add diodes explicitly.


P-N Junction Diodes are modeled with stored charge, including variable depletion-layer capacitance plus stored charge under forward bias.

Diodes are modeled without reverse breakdown. Zener diodes are modeled separately.

(Piecewise-linear ideal diodes are modeled separately.)

Junction Field Effect Transistors (JFETs)

JFETs as modeled have no stored charge, and no capacitances or dynamic components whatsoever.

Laplace Transfer Function Blocks

Any rational polynomial in 's' can be used as a Laplace transfer function. For example, "1/s" creates an integrator.

Using a transfer function with more zeros than poles is not recommended and may cause simulation issues.

Metal-Oxide Semiconductor Field Effect Transistors (MOSFETs)

A simple three-mode (cutoff, triode, saturation) model of a MOSFET is implemented.

The dependence of capacitances (CISS, CRSS, COSS) on bias is not modeled within a mode of operation.

Weak inversion operation is not modeled.

Operational Amplifiers (Op-Amps)

Op-amps are modeled as single-pole devices in the frequency domain.

When designing with op-amps in the simulator, pay particular attention to input polarity. It is often possible to make a circuit that exhibits DC convergence even when + and - inputs are switched -- in reality, this may in fact be a DC solution to the circuit equations, but it will not necessarily be a stable equilibrium!

Op-amp inputs have no clamping to the op-amp's power supply. If such clamping is important to your circuit's behavior, add explicit diodes.

Op-amps with voltage rails are assumed to have rail-to-rail output. If the op-amp will not be asked to saturate its output at voltage rails, using the op-amp component that doesn't have the rails will lead to faster simulation, and generally "behaves better" in terms of circuit convergence.

Zener Diodes

Zener Diodes model forward diode conduction and reverse breakdown. Zener Diodes as modeled have no stored charge, and no capacitances or dynamic component whatsoever.

« Return to Table of Contents

Search Documentation

About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.