# Building and Running a Simulation of a Circuit Design

If you’ve ever taken the time to look at an electrical schematic for a complicated device, it might not be obvious how the circuit behaves when supplied with different signals. Similarly, you might be designing a new circuit and have a good idea of its response, but the output for some types of input signals may not be so obvious.

In days past, when I designed my first circuits with active filters, I wish I had used a simulation package during the design phase as it would have helped me identify the right range for a potentiometer I needed to include in my device. A simulation of a circuit design can help you make smart design decisions and fully optimize your circuit.

## What is a Simulation of a Circuit Design?

In short, a simulation of a circuit design will tell you the electrical behavior of a system for various input signals. The goal is to determine the voltage and current at various locations in the circuit. You could certainly run your simulation by hand, meaning you could calculate the voltage and current throughout the circuit by hand using Kirchoff’s laws and Ohm’s law. However, as circuit designs become more complex, writing out calculations by hand can become intractable for even the most skilled engineers. At that point, you can save yourself a considerable amount of time by using a simulation package.

When your design starts to include active or nonlinear devices, such as a diode, the system becomes complicated even further, and a simulation becomes a necessity rather than an option. Although a simulation package does save you a considerable amount of calculation time and expedites analysis, it can be difficult to glean real insights from your simulation without the right analysis strategy.

Some circuits are designed with multiple functional blocks, where each block takes inputs and produces outputs for other portions of the overall circuit. The circuit for a new device can be simulated as an entire system, or the circuit can be simulated in individual blocks. If you designed your circuit by dividing it into functional blocks, you can run simulations for each block individually. This gives considerable insight into how different portions of the circuit function and how each portion transforms an input signal.

Choosing the right type of simulation (analog vs. digital, time domain vs. frequency sweep) really depends on the functionality of the circuit. What type of input signal will the circuit receive? Are you converting between analog inputs and digital data? Is the output intended to be frequency dependent? Is there feedback involved in any portion of the circuit? The answers to these questions and more will help you determine whether you should work in the time or frequency domain.

## Measurements

With the goal in a simulation of a circuit design being to examine the current and voltage throughout a circuit, you will need to place “probes” at different places in the circuit. These probes are placeholders for a measurement instrument, such as an oscilloscope or multimeter. This gathers a quick measurement of the voltage and current at different points in the circuit. An example is shown in the figure below:

*Probes for measuring the current in L2 and the output voltage across L2*

The simulation package you use should then display the voltage or current (or both) on a graph once your simulation completes. Some simulation packages require you to place probes into the circuit model yourself, while others will simply allow you to select circuit elements or nodes from a list.

When you include SPICE models as part of your simulation, you won’t be able to examine the voltage and current within the model, however you can easily examine how the signal input to the model and its output behave. A comparison of these signals can be helpful for choosing the appropriate model or component to include in your overall circuit.

## When to Use a Time Domain Simulation

With SPICE-based simulators, working in the time domain is the standard method for examining the behavior of an output signal for a given input signal. There are a number of reasons for this. First, working in the time domain allows the current and voltage throughout the circuit to be calculated numerically at each point in time, and this can be easily implemented into iterative Gauss-Jordan or Gauss-Seidel methods.

If you need to examine transient behavior in a circuit to either an impulse (i.e., a delta function input signal) or a step response (i.e., the input voltage switches from off to on), then you’ll want to use a time domain simulation. Most SPICE-based packages have pre-built simulations that incorporate an impulse input signal, making it very easy to examine the transient response to this type of input.

If you want to examine the response of a signal to an arbitrary input signal, then a time domain simulation is also ideal. You can define essentially any input signal you like, and these signals can be a repeating waveform (e.g., sawtooth wave, triangle wave, or digital pulses). You can then overlay the input and output voltage to examine how the circuit manipulates the input signal. As you change the input signal, you can get a better idea of how the circuit works.

*Converting an inverting RC charging-type waveform to a digital switching waveform*

## When to Use a Frequency Domain Simulation

With SPICE-based simulators, working in the time domain is the standard method for examining the behavior of a circuit with an arbitrary input waveform or when the circuit is driven at a single AC frequency. However, your circuit may need to operate at a range of frequencies, and you will need to determine how the circuit responds at each frequency. This requires a frequency domain simulation.

Because SPICE-based simulators are numerical models, they do not base results on an analytical transfer function for a circuit. With very complicated circuit models, the transfer function may not be obvious, especially when active or nonlinear components are included in the model.

In order to analyze the behavior of your circuit with different driving frequencies, you’ll want to use an AC sweep. In this simulation, you are actually sweeping the frequency of a sinusoidal driver over a range of values. The simulator will then compare the amplitude and phase of the output signal and display these on graphs. This gives you all the information you need to construct a transfer function for your circuit.

It should be noted that a circuit which converts between different types of waveforms (e.g., with a Schmitt trigger) should not be analyzed using frequency sweeps (see the graph above for an example time domain simulation). There is a good reason for this. The goal in the simulation should be to analyze the quality of the waveform in the time domain, thus a time domain simulation should be used.

Note, however, that the best SPICE packages will allow you to perform a frequency sweep over an arbitrary spectrum, meaning that you can choose the amplitude and frequency of the input driving signals. This is a good way to examine the behavior of a signal to electrical pulses, distorted digital pulses, or any other arbitrary repeating waveform. Note that, in this case, **you must know the Fourier spectrum of the desired input before running the simulation.** This requires some additional calculations on your part before running a simulation of your circuit design.

A simulation of a circuit design helps you examine its behavior in the temporal and frequency domain, and both analyses are easy when you work with the OrCAD PSpice Simulator from Cadence. This unique package is built for circuit design and analysis in complex PCB designs for any application.

If you want to learn more about the solutions Cadence offers, talk to us and our team of experts.