Skip to content

Latest commit

 

History

History
42 lines (37 loc) · 2.67 KB

File metadata and controls

42 lines (37 loc) · 2.67 KB

ngspice Circuit Definition

ngspice Command Overview

  • All command arguments that take units, expect units to be in full SI units. Prefixes may be added to indicate the range.
  • There are three important simulation modes, - Transient Analysis - DC-setpoint analysis - AC analysis
  • All of these analyses need to have an input defined that is scanned over during the analysis. This is defined in the circuit by appending the dc and ac keywords to an voltage source. - the dc keyword sets the DC operating point and the ac X keyword sets the output to be devided by X.

Simulation Commands

  • PULSE(V1, V2, TD, TR, TF, PW, PER) with the following arguments: - V1: starting voltage of the pulse Given in Volts or Amps depending on pulse type - V2: 'peak' height of the pulse Given in Volts or Amps depending on pulse type - TD: Delay time, the duration of time that passes until the pulse begins to rise (given in seconds) - TR: Rise Time, Time it takes for the voltage to go from V1 to V2 (given in seconds) - TF: Fall Time, Time it takes for the pulse to go back from V2 to V1 (given in seconds) - PW: Time the pulse stays at V2 (given in seconds) - PER: Period, duration after which to repeat the sequence wait->Rise->hold->fall, defines the distance between pulses (given in seconds)
  • ac st s f1 f2 is an AC analysis. It sweeps the voltage input defined in the circuits over a range of frequencies. - st: step type, is dec, oct, lin. Defines the type of scan, either the octave is the measurement, the decade or it uses a linear frequency scale - s: samples per step type - f1: start frequency - f2: stop frequncy - ac dec 100 1k 10meg: Command that defines a scan from 1kHz to 10MHz with 100 samples per decade. (The plot is generally logarithmically)
  • ``

Plot Commands

  • the plot command plots data that was just generated by simulation onto a ngspice built-in canvas.
  • The voltages at nodes can be viewed simply by writing the node name behind the plot command, separated by a space.
  • The type of information plotted depends on the type of simulation that was run to generate the data.
  • plot in would plot the voltage at the node in, with the plot type depending on the type of analysis that was just perfomed
  • the plot command can plot output amplitudes in dB when vdb(<node-name>) is specified and cph(<node-name>) is specified, it plots the phase of the node relative to the input.
  • In this the voltage is given in dB. So keep in mind when reading the resulting plots.