Preliminary remarks

This section covers some basic points about how to use EasyEDA for simulation.

Please note that the simulation tool in EasyEDA is primarily for analogue circuit simulation.

Whilst there are models for a few small to medium scale integration logic devices available in the Spice Simulation library, it is generally not practical to model the following types of devices in EasyEDA:

  • Analogue to Digital Converters (ADC);

  • Digital to Analogue Converters (DAC);

  • Devices that use Serial Interfaces such as I2C or SPI for communications and configuration;

  • Microprocessors and microcontrollers including Arduino or similar types of modules;

  • FPGA;

  • State Machines;

  • Look Up Tables or ROM;

  • RAM;

  • Large and Very Large Scale Integrated devices and processing functions;

  • IBIS models (unless converted into Spice models by some 3rd party tool).

EasyEDA also does not support any form of code development tools.

Please note that before launching into simulations, we strongly recommend you read - and play with the examples in - the whole of this Simulation Tutorial.

The EasyEDA Simulation eBook

How to find simulatable parts in EasyEDA

How to find spice symbols (which have models already associated with them)

From V4.1.3. - except for the simple passive R, L, C and the voltage and current source devices - most of the schematic symbols for the active devices shown in the left hand panel under the EELib button no longer have spice models associated with them.

Schematic symbols with spice simulation models attached to them can now be found using the:

Libraries button in the left-hand panel

or;

SHIFT+F in any editor window.

then click on SCH Libs, hover the mouse over the System class then slide down and click on any of the grey buttons under the Spice Simulation heading:

image.png

How to find spice models and subcircuits (which may or may not already have a symbol associated with them)

You will find a list of all the spice models (.model) and spice subcircuits (.subckt) currently available for EasyEDA here:

https://docs.google.com/spreadsheets/d/1KM28xzXwgQeUUj3zRMlth9BN-vs6Q98KBk1FHXmf58U/pubhtml

Some of the models in this list are already used by the Spice Simulation symbols referred to above. Some of these models have no dedicated symbols but they can be associated with existing symbols just by editing the symbol names.

Alternate models can be assigned to the Spice Simulation symbols by changing the names of the symbols to that of the new model and also - depending on whether the new model is a .model or a .subckt defined model - by pressing the I key and changing the spice prefix.

You can enter these model names into any approriate Spice Simulation symbol and then set the spice prefix to the prefix approriate for the model (See: Ngspice model types in: .model statements)

The steps to do this are described in:

Device models

but see also:

Schematic symbols: prefixes and pin numbers

What to do for a part that has no model available in EasyEDA but for which a 3rd party model is available

It is also possible to import spice models from 3rd party sources to use with the Spice Simulation symbols from these list.

The steps to do this are described in:

Device models

but see also:

Schematic symbols: prefixes and pin numbers

What to do if there is a 3rd party model available but for which there is no suitable symbol in EasyEDA

In the case of there being a 3rd party model available but for which there is no suitable symbol in EasyEDA then it is quite straightforward to create a spice symbol for it within EasyEDA either by editing an existing symbol or by creating a new one from scratch.

The steps to do this are described in:

Device models

but see also:

Schematic symbols: prefixes and pin numbers

Note that not all 3rd party models are compatible with ngspice syntax. Spice3 versions of models should run out of the box. Pspice models may require modifications to make them work in EasyEDA.

Please post to:

Spice Simulation

in the forums for help on this.

What to do if there is no model available for a part

Not all components have a publically available model. In some instances, a component may not have a model at all.

However, we have created models - unique to EasyEDA - for a number of parts, such as the LDR_EE, ELECTRET_MIC_EE, LM56EE and LM2907EE. So, although it is not always possible or practical to build a model, if there is a part for which you particularly need one then please contact Support to discuss your requirements.

How to run a simulation

Please see:

How to run a simulation

and for more information:

Advanced probing and simulation control

Introduction

EasyEDA is not just a way to draw circuit diagrams and design PCBs. It is also a circuit simulator.

A circuit simulator is basically a specialised mathematical program, optimised to construct and then solve the equations that define the behaviour of the circuit that has been described to it in the circuit diagram.

The circuit simulation program that EasyEDA uses is called ngspice. Ngspice is Free and Open Source Software (FOSS) that is in turn based on a simulator called SPICE that was originally written by Larry Nagel.

What this book is for

This book is an introduction to circuit simulation in EasyEDA using ngspice.
It starts with the basics of how to avoid some of the most common mistakes that cause simulations to fail and then goes on to illustrate how to set up a circuit so that it will simulate successfully and produce meaningful results. It also discusses some aspects of understanding how, what might at first appear to be unexpected or even nonsensical results, can arise.
The book then introduces and illustrates more advanced techniques such as:

  • probing signals such as voltages, currents, powers and resistances;

  • configuring signal sources;

  • setting up different types of analyses;

  • making measurements such as rise times, RMS values and bandwidths;

  • defining component values using parameters;

  • using expressions to calculate component values such as for a resistor to draw a given load current or capacitances for a specified filter cutoff frequency;

  • using manufacturer’s device models;

  • setting up complex simulations including arbitrary voltage and current sources.

What this book is not for

  • This is not a book about learning to use EasyEDA to draw schematics. For general information about using EasyEDA please refer to the >EasyEDA Tutorial.

  • This book does not teach electronics. Whilst there may be examples of circuits and explanatory text that are helpful in understanding electronics, it is assumed that the user already has sufficient knowledge of electronics to understand the content of this book.

  • Although ngspice is similar to other variants of spice and a lot of the information and techniques in this book may be applicable to some of those variants, this book is written specifically about circuit simulation in EasyEDA using ngspice.

  • Except where necessary to help explain some aspect of the behaviour of simulation, this book does not go into any detail of how circuit simulation in general and ngspice in particular actually works. For more information about those areas, please see the links below:

More information about Larry Nagel and SPICE is available from here:

http://www.omega-enterprises.net/The%20Origins%20of%20SPICE.html

Larry Nagel’s PhD Dissertation:

Laurence W. Nagel., “SPICE2: A Computer Program to Simulate Semiconductor Circuits,”
Memorandum No. ERL-M520, University of California, Berkeley, May 1975.

http://www.eecs.berkeley.edu/Pubs/TechRpts/1975/ERL-520.pdf

is actually very readable and instructive.

For more information about electronic circuit simulation and spice in particular, see:

http://en.wikipedia.org/wiki/Electronic_circuit_simulation

and:

http://en.wikipedia.org/wiki/SPICE

More information about ngpsice is available from here:

http://ngspice.sourceforge.net/presentation.html

Who this book is for

All simulation tools and how they interact with schematic capture tools are different so even for people with experience of using simulation tools, it is worth at least skimming through the sections of this book to get an idea of where to find information if things don’t seem to go quite as expected.

However, for people with limited or no previous experience of using simulation tools, this book is essential reading.

Why?

Because, as a newcomer to the world of circuit simulation, it is very tempting just to launch straight into trying to build and run lots of interesting and exciting simulations.

Sadly, however, this will almost certainly be a very frustrating and discouraging experience because many of those simulations will either not run, will not function correctly as circuits or will appear to give nonsensical results! This can happen for all sorts of often very simple reasons but to newcomers with no experience of simulation, those reasons can seem utterly incomprehensible.

So, to avoid a lot of discouragement and wasted time, it is worth taking a few minutes to understand some of the most common things that can cause a simulation to fail or to run but give unexpected answers.

How the book is structured

This book is not some dry tome with lots of words, diagrams and snippets of code. It is written as a live, interactive document. Rather than having to read lots of text and then having to go into EasyEDA to create circuits to try things out, live simulation examples are linked into the text to illustrate the points being discussed.

Just go to a topic or a section heading; read a couple of paragraphs and then open and run the embedded simulation to see exactly what the text is about.

Every embedded simulation must be saved before it can be run. Users who have joined EasyEDA can save the files to their own project folder. The examples can be copied and edited so that users can try out different things in whatever way helps their understanding of what the example is trying to explain, building up their own personal library of teaching examples as they progress through the book.

Newcomers are encouraged to work through the book in a linear manner because each section builds on the knowledge and insights gained from all the previous ones. Skipping sections leaves gaps that can catch out the novice and hinder the understanding of ideas presented in later sections.

  • The book begins by introducing some of the concepts and terms that are essential for a basic understanding of what a simulator is and how to use it effectively.

  • Then, using simple interactive simulation examples it describes and illustrates how to avoid the most common pitfalls in building, running and interpreting the results from simulations.

  • The book goes on to illustrate ways to create and show connectivity using wires and netlabels in schematics. It then discusses techniques for probing voltages and currents and how they relate to and can affect or be affected by the netnames that are assigned to nets either automatically by EasyEDA or manually by the user placing netlabels.

  • More advanced techniques for probing voltages and currents using the probe command are described, moving on to using this command to measure power dissipations, resistances and conductances.

This section describes the use of 0V sources to measure currents also introduces and E, F, G and H dependent sources and the very powerful arbitrary or B Dependent Sources.
In this section, the concept of the Spice Directive is also introduced, describing how to turn inactive comment text into active spice text that the simulator then recognises as an instruction to do something.

  • The probe concept is then extended by describing how several different ‘probe’ commands can be typed into a schematic and - simply by selecting which one is switched from being ‘comment’ text into ‘spice’ text - they can be used to swap between different selections of values and nodes to be probed.

  • The use of the let command to further extend and simplify the probing of signals is introduced with a simple example. This command will feature heavily in later sections about making measurements based on the results of simulations.

  • Early interactive simulation examples introduce the basic way of setting up and running a simulation using the Tools > Simulation > Simulate this Sheet option to open the Run your simulation dialogue and then select the type of analysis to run.

  • Later examples show how to use CTRL+R as a shortcut to the Run your simulation dialogue.

This idea is then extended with the concept of using spice directives to run simulations straight from CTRL+R so that, with a few simple key strokes, it is easy to switch between several different simulations from a single simulation schematic.

  • DC operating point, DC Transfer function, DC Sweep, AC (frequency domain) and Transient (time domain) Analyses are described in some detail.

Using the DC Sweep to sweep the value of a resistance in a circuit and to sweep the ambient temperature for circuit is covered in this section.

There are detailed sections on setting up each of the various time domain signal sources that are available, such as SINE, PULSE and more.

Configuring and using the frequency domain AC source that is built into to every independent signal source is covered.

  • The need for and different ways of defining initial conditions such as voltages on nets and across capacitors and currents in inductors are demonstrated.

Using PULSE, EXP, PWL and B Sources to ‘kick start’ circuits is also illustrated in this section.

  • The concept of using parameters (i.e. variables that are used in the simulation) to define things like multiple component values and signal source settings is described.

  • The use of parameters in expressions (i.e. formulas or equations) to calculate values such as the capacitance for a given RC time constant with a given resistance is covered and then extended into using them in B Sources.

  • The concept of predefined functions and their use in expressions is described in detail extending into the creation of user defined functions using the .func statement.

  • The concept and scope of device models in simulation is discussed in detail.

  • Ways to add 3rd party models and subcircuits into schematics and to use them with the predefined schematic symbols from the EasyEDA Libs is covered in detail.

  • The use of 3rd party models is extended into attaching them to custom schematic symbols.

  • The use of expressions and functions in the creation of custom behavioural models is covered with reference to some of the in-house EasyEDA (EE suffix) models.


goToTop