diff --git a/src/browser/pages/User-Manual/eSim.html b/src/browser/pages/User-Manual/eSim.html index d14da2839..a2a970e4f 100644 --- a/src/browser/pages/User-Manual/eSim.html +++ b/src/browser/pages/User-Manual/eSim.html @@ -6,314 +6,167 @@ - - - + + + -

+

+

+

eSim

+An open source EDA tool for circuit design, +simulation, analysis and PCB design
+ +PIC +eSim User Manual
+version 1.0.0
+Prepared By:
+eSim Team
+FOSSEE at IIT,Bombay +

PIC
+Indian Institute of Technology Bombay
+○BY: ○$\ ○=
+August 2015

-

Contents

- List of Acronyms -
1 Introduction + 1 Introduction
2 Installing and Setting up eSim +href="#x1-30002" id="QQ2-1-3">Installing eSim
3 Architecture of eSim +href="#x1-40003" id="QQ2-1-4">Architecture of eSim
 3.1 Modules used in eSim +href="#x1-50003.1" id="QQ2-1-5">Modules used in eSim
  3.1.1 EEschema +href="#x1-60003.1.1" id="QQ2-1-6">Eeschema
  3.1.2 CvPcb +href="#x1-70003.1.2" id="QQ2-1-7">CvPcb
  3.1.3 Pcbnew +href="#x1-80003.1.3" id="QQ2-1-8">Pcbnew
  3.1.4 KiCad to Ngspice converter +href="#x1-90003.1.4" id="QQ2-1-9">KiCad to Ngspice converter
  3.1.5 Model Builder +href="#x1-100003.1.5" id="QQ2-1-10">Model Builder
  3.1.6 Subcircuit Builder +href="#x1-110003.1.6" id="QQ2-1-11">Subcircuit Builder
  3.1.7 KiCad to Ngspice netlist converter -
  3.1.8 Ngspice +href="#x1-120003.1.7" id="QQ2-1-12">Ngspice
 3.2 Work flow of eSim +href="#x1-130003.2" id="QQ2-1-13">Work flow of eSim
4 Getting Started +href="#x1-140004" id="QQ2-1-15">Getting Started
 4.1 eSim Main Window +href="#x1-150004.1" id="QQ2-1-16">eSim Main Window
  4.1.1 Workspace +href="#x1-160004.1.1" id="QQ2-1-17">How to launch eSim in Ubuntu?
  4.1.2 Main-GUI +href="#x1-170004.1.2" id="QQ2-1-19">Main-GUI
5 Schematic Creation +href="#x1-280005" id="QQ2-1-33">Schematic Creation
 5.1 Familiarizing the Schematic Editor interface +href="#x1-290005.1" id="QQ2-1-34">Familiarizing the Schematic Editor interface
  5.1.1 Top menu bar +href="#x1-300005.1.1" id="QQ2-1-36">Top menu bar
  5.1.2 Top toolbar +href="#x1-310005.1.2" id="QQ2-1-38">Top toolbar
  5.1.3 Toolbar on the right +href="#x1-320005.1.3" id="QQ2-1-40">Toolbar on the right
  5.1.4 Toolbar on the left +href="#x1-330005.1.4" id="QQ2-1-42">Toolbar on the left
  5.1.5 Hotkeys +href="#x1-340005.1.5" id="QQ2-1-44">Hotkeys
 5.2 Schematic creation for simulation +href="#x1-350005.2" id="QQ2-1-45">Schematic creation for simulation
  5.2.1 Selection and placement of components +href="#x1-360005.2.1" id="QQ2-1-47">Selection and placement of components
  5.2.2 Wiring the circuit +href="#x1-370005.2.2" id="QQ2-1-51">Wiring the circuit
  5.2.3 Assigning values to components +href="#x1-380005.2.3" id="QQ2-1-53">Assigning values to components
  5.2.4 Annotation and ERC +href="#x1-390005.2.4" id="QQ2-1-55">Annotation and ERC
  5.2.5 Netlist generation +href="#x1-400005.2.5" id="QQ2-1-59">Netlist generation
6 Simulation - +href="#x1-410006" id="QQ2-1-61">PCB Design
 6.1 Analysis Inserter +href="#x1-420006.1" id="QQ2-1-62">Schematic creation for PCB design
  6.1.1 Types of analysis +href="#x1-430006.1.1" id="QQ2-1-64">Netlist generation for PCB +
  6.1.2 DC analysis inserter +href="#x1-440006.1.2" id="QQ2-1-66">Mapping of components using Footprint Editor
  6.1.3 AC analysis inserter +href="#x1-450006.1.3" id="QQ2-1-67">Familiarising the Footprint Editor tool
  6.1.4 Transient analysis inserter +href="#x1-470006.1.4" id="QQ2-1-71">Viewing footprints in 2D and 3D +
  6.1.5 Mapping of components in the RC circuit
 6.2 Adding Source Details -
 6.3 Adding Ngspice Model -
 6.4 Adding Device Model Library -
 6.5 Adding Sub Circuit -
 6.6 Kicad to Ngspice Conversion -
 6.7 Simulation +href="#x1-490006.2" id="QQ2-1-77">Creation of PCB layout +
  6.2.1 Familiarizing the Layout Editor tool +
  6.2.2 Hotkeys +
  6.2.3 PCB design example using RC circuit
7 PCB Design +href="#x1-540007" id="QQ2-1-98">Model Editor
 7.1 Schematic creation for PCB design -
  7.1.1 Netlist generation for PCB -
  7.1.2 Mapping of components using Footprint Editor -
  7.1.3 Familiarising the Footprint Editor tool -
  7.1.4 Viewing footprints in 2D and 3D -
  7.1.5 Mapping of components in the RC circuit +href="#x1-550007.1" id="QQ2-1-100">Creating New Model Library
 7.2 Creation of PCB layout -
  7.2.1 Familiarizing the Layout Editor tool -
  7.2.2 Hotkeys -
  7.2.3 PCB design example using RC circuit +href="#x1-560007.2" id="QQ2-1-105">Editing Current Model Library +
 7.3 Uploading external .lib file to eSim repository
8 Model Editor +href="#x1-580008" id="QQ2-1-108">SubCircuit Builder
 8.1 Creating New Model Library +href="#x1-590008.1" id="QQ2-1-110">Creating a SubCircuit
 8.2 Editing Current Model Library -
 8.3 Converting Library file to XML file +href="#x1-600008.2" id="QQ2-1-118">Edit a Subcircuit
9 Sub-Circuit Builder +href="#x1-610009" id="QQ2-1-119">Solved Examples
 9.1 Creating a Sub-Circuit -
A Solved Examples -
 A.1 Solved Examples -
  A.1.1 Basic RC Circuit -
  A.1.2 Half Wave Rectifier -
  A.1.3 Inverting Amplifier -
  A.1.4 Precision Rectifier -
  A.1.5 Half Adder Example +href="#x1-620009.1" id="QQ2-1-120">Solved Examples +
  9.1.1 Basic RC Circuit +
  9.1.2 Half Wave Rectifier +
  9.1.3 Precision Rectifier +
  9.1.4 Inverting Amplifier +
  9.1.5 Half Adder Example
References +href="#Q1-1-166">References
-

List of Acronyms

- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ADC

Analog to Digital Converter

BJT

Bipolar Junction Transistor

BV

Breakdown Voltage

CCCS

Current Controlled Current Source

CCVS

Current Controlled Voltage Source

CPU

Central Processing Unit

DAC

Digital to Analog Converter

DRC

Design Rules Check

DXF

Drawing Interchange Format or Drawing Exchange Format

EDA

Electronic Design Automation

ERC

Electric Rules Check

FOSS

Free and Open Source Software

FPGA

Field Programmable Gate Array

gEDA

Electronic Design Automation released under GPL

GUI

Graphical User Interface

HDL

Hardware Descrition Language

HPGL

Hewlett-Packard Graphics Language

IC

Integrated Circuit

ICT

Information and Communication Technology

IGBT

Insulated Gate Bipolar Transistor

JFET

Junction Field Effect Transistor

KCE

Kirchoff’s Current Law

KVE

Kirchoff’s Voltage Law

LXDE

Lightweight X11 Desktop Environment

MNA

Modified Nodal Analysis

MOSFET

Metal Oxide Semiconductor Field Effect Transistor

NMEICT

National Mission on Education through ICT

Op-amp

Operational Amplifier

PCB

Printed Circuit Board

RS

Ohmic Resistance

SELF

Spoken Tutorial based Education and Learning through Free -FOSS study

SVF

Serial Vector Format

T10KT

Teach 10,000 Teachers

VCCS

Voltage Controlled Current Source

VCVS

Voltage Controlled Voltage source

- -

- - -

+

Chapter 1
Introduction

Electronic systems are an integral part of human life. They have + id="x1-20001">Introduction Electronic systems are an integral part of human life. They have simplified our lives to a great extent. Starting from small systems made of a few discrete components to the present day integrated circuits (ICs) with millions of logic gates, electronic systems have undergone a sea change. As a result, design of @@ -323,9 +176,9 @@

Chapter 1
Electronic Design Automation or EDA tools. + id="dx1-2001">tools.

Let us see the steps involved in EDA. In the first stage, the specifications of the system are + id="dx1-2002"> In the first stage, the specifications of the system are laid out. These specifications are then converted to a design. The design could be in the form of a circuit schematic, logical description using an HDL language, etc. The design is then simulated and re-designed, if needed, to achieve the desired @@ -337,14 +190,14 @@

Chapter 1

A person who builds an electronic system has to first design the circuit, produce a virtual representation of it through a schematic for easy comprehension, simulate it and finally convert it into a Printed Circuit Board (PCB). There are various tools available that help do -this. Some of the popular EDA tools are those of There are various tools available that will help +us do this. Some of the popular EDA tools are those of Cadence, Synopys, Mentor Graphics and -Xilinx. Although these are fairly comprehensive and high end, their licenses are expensive, -being proprietary. +class="cmtt-10x-x-109">Mentor Graphics +and Xilinx. Although these are fairly comprehensive and high end, their licenses are +expensive, being proprietary.

There are some free and open source EDA tools like gEDA, KiCad and Chapter 1

eSim is a free and open source EDA tool. It is an acronym for Open source computer -aided design. eSim is created using open source software packages, such as KiCad, Ngspice, -Scilab and Python. Using eSim, one can create circuit schematics, perform simulations and -design PCB layouts. It can create or edit new device models, and create or edit subcircuits for -simulation. This feature is unique to eSim. Because of these reasons, eSim is expected to -be useful to students, teachers and other professionals who would want to study -and/or design electronic systems. eSim is also useful for entrepreneurs and small scale -enterprises who do not have the capability to invest in heavily priced proprietary -tools. +class="cmbx-10x-x-109">Electronics Simulation. +eSim is created using open source software packages, such as KiCad, Ngspice and Python. +Using eSim, one can create circuit schematics, perform simulations and design PCB +layouts. It can create or edit new device models, and create or edit subcircuits for +simulation. +

Because of these reasons, eSim is expected to be useful for students, teachers and other +professionals who would want to study and/or design electronic systems. eSim is also useful +for entrepreneurs and small scale enterprises who do not have the capability to invest in +heavily priced proprietary tools.

This book introduces eSim to the reader and illustrates all the features of eSim with examples. Chapter 2 gives step by step instructions to install eSim on a typical computer +href="#x1-30002">2 gives step by step instructions to install eSim on a typical computer system and to validate the installation. The software architecture of eSim is presented in Chapter 3. Chapter 4 gets the user started with eSim. It takes them through a tour of eSim - -with the help of a simple RC circuit example. Chapter 5 explains how to create circuit -schematics using eSim, in detail using examples. Chapter 6 illustrates how to simulate -circuits using eSim. Chapter 7 explains PCB design using eSim, in detail. The advanced -features of eSim such as Model Builder covered in Chapter 8 and Sub circuiting -is covered in Chapter 9. Appendix A presents examples, that have been worked -out using eSim, from the book Microelectronic Circuits by Sedra and Smith - [1]. -

The following convention has been adopted throughout this book. All the menu names, -options under each menu item, tool names, certain points to be noted, etc., are given in -italics. Some keywords, names of certain windows/dialog boxes, names of some -files/projects/folders, messages displayed during an activity, names of websites, component -references, etc., are given in typewriter font. Some key presses, e.g. 3. Chapter 4 gets the user started with eSim. It takes them through a tour + +of eSim with the help of a simple RC circuit example. Chapter 5 illustrates how +to simulate circuits. Chapter 6 explains PCB design using eSim, in detail. The +advanced features of eSim such as Model Builder covered in Chapter 7 and Sub +circuiting is covered in Chapter 8. Chapter 9 illustrates how to use eSim for solving +problems. +

The following convention has been adopted throughout this manual.All the +menu names, options under each menu item, tool names, certain points to be noted, +etc., are given in italics. Some keywords, names of certain windows/dialog boxes, +names of some files/projects/folders, messages displayed during an activity, names +of websites, component references, etc., are given in typewriter font. Some key +presses, e.g. Enter key, F1 key, y for -yes, etc., are also mentioned in typewriter font. +class="cmtt-10x-x-109">y for yes, etc., are also mentioned in typewriter +font.

Chapter 2
Installing and Setting up eSim

+ id="x1-30002">Installing eSim
1.
Chapter 2
$ esim

or you can double click on eSim icon created on desktop after installation.
-

-

Chapter 3
Architecture of eSim

+ id="x1-40003">Architecture of eSim

eSim is a CAD tool that helps electronic system designers to design, test and analyse their + id="dx1-4001">tool that helps electronic system designers to design, test and analyse their circuits. But the important feature of this tool is that it is open source and hence the user can modify the source as per his/her need. The software provides a generic, modular and extensible platform for experiment with electronic circuits. This software runs on all -Ubuntu Linux distributions. It uses Python, KiCad, Ngspice and Scilab (5.4.0 or -above). -

The objective behind the development of eSim is to provide an open source EDA solution +class="cmtt-10x-x-109">KiCad and +Ngspice. +

The objective behind the development of eSim is to provide an open source EDA solution for electronics and electrical engineers. The software should be capable of performing schematic creation, PCB design and circuit simulation (analog, digital and mixed signal). It -should provide facilities to create new models and components. In addition to this, it should -have the capability to explain the circuit by giving symbolic equations and numerical -values. The architecture of eSim has been designed by keeping these objectives in -mind. +should provide facilities to create new models and components. The architecture of eSim has +been designed by keeping these objectives in mind.

3.1 Modules used in eSim

-

Various open-source tools have been used for the underlying build-up of eSim. In this section + id="x1-50003.1">Modules used in eSim +

Various open-source tools have been used for the underlying build-up of eSim. In this section we will give a brief idea about all the modules used in eSim. -

+

3.1.1 EEschema

+ id="x1-60003.1.1">Eeschema + id="dx1-6001"> -

EEschema is an integrated software where all functions of circuit drawing, control, layout, -library management and access to the PCB design software are carried out within itself. It is -the schematic editor tool used in KiCad  [11]. EEschema is intended to work with PCB -layout software such as Pcbnew. It provides netlist that describes the electrical connections of -the PCB. EEschema also integrates a component editor which allows the creation, editing and + id="dx1-6002"> +

Eeschema is an integrated software where all functions of circuit drawing, control, layout, +library management and access to the PCB design software are carried out. It is the +schematic editor tool used in KiCad  [11]. Eeschema is intended to work with PCB layout +software such as Pcbnew. It provides netlist that describes the electrical connections of the +PCB. Eeschema also integrates a component editor which allows the creation, editing and visualization of components. It also allows the user to effectively handle the symbol -libraries i.e; import, export, addition and deletion of library components. EEschema +libraries i.e; import, export, addition and deletion of library components. Eeschema also integrates the following additional but essential functions needed for a modern schematic capture software: 1. Design rules check (1. Design rules check (DRC) for the automatic control of incorrect connections and inputs of components left unconnected. 2. Generation of + id="x1-6005r2">2. Generation of layout files in POSTSCRIPT or or HPGL format. 3. Generation of layout files printable via + id="dx1-6007">format. 3. Generation of layout files printable via printer. 4. Bill of material generation. 5. Netlist generation for PCB layout or for + id="x1-6009r4">4. Bill of material generation. 5. Netlist generation for PCB layout or for simulation. This module is indicated by the label 1 in Fig. 3.1. -

As Eeschema is originally intended for PCB Design, there are no fictitious +href="#x1-130011">3.1. +

As Eeschema is originally intended for PCB Design, there are no fictitious components1 +href="esim2.html#fn1x3">1 such as voltage or current sources. Thus, we have added a new library for different types of voltage and current sources such as sine, pulse and square wave. We have also built a library which gives printing and plotting solutions. This extension, developed by us for eSim, is indicated by the label 2 in Fig. 3.1. +href="#x1-130011">3.1.

3.1.2 CvPcb

+ id="x1-70003.1.2">CvPcb -

CvPcb is a tool that allows the user to associate components in the schematic to component + id="dx1-7001"> +

CvPcb is a tool that allows the user to associate components in the schematic to component footprints when designing the printed circuit board. CvPcb is the footprint editor tool in KiCad  [11]. Typically the netlist file generated by EEschema does not specify which printed +href="#Xeeschema">11]. Typically the netlist file generated by Eeschema does not specify which printed circuit board footprint is associated with each component in the schematic. However, this is not always the case as component footprints can be associated during schematic capture by setting the component’s footprint field. CvPcb provides a convenient method of associating @@ -522,30 +359,30 @@

3.1.2 3.1. -

+href="#x1-130011">3.1. +

3.1.3 Pcbnew

+ id="x1-80003.1.3">Pcbnew -

Pcbnew is a powerful printed circuit board software tool. It is the layout editor tool + id="dx1-8001"> +

Pcbnew is a powerful printed circuit board software tool. It is the layout editor tool used in KiCad  [11]. It is used in association with the schematic capture software -EEschema, which provides the netlist. Netlist describes the electrical connections of +Eeschema, which provides the netlist. Netlist describes the electrical connections of the circuit. CvPcb is used to assign each component, in the netlist produced by -EEschema, to a module that is used by Pcbnew. The features of Pcbnew are given +Eeschema, to a module that is used by Pcbnew. The features of Pcbnew are given below:

-

This module is indicated by the label 4 in Fig. 3.1. +

This module is indicated by the label 4 in Fig. 3.1.

3.1.4 KiCad to Ngspice converter

-

It converts KiCad generated netlists to Ngspice compatible format. Also it facilitates adding -model library of components and subcircuits. Following are the different functionality lies -under conversion. -

Analysis Inserter
-

This feature helps the user to perform different types of analysis such as Operating -point analysis, DC analysis, AC analysis, transient analysis, etc. It has the facility -to -

-

-

Source Details
-

eSim sources are added from eSim-sources package. Sources auch as SINE, AC, DC, PULSE -are in this library. Input to all the sources added in the circuit are given in source -details. -

Ngspice Model
-

eSim adds Ngspice model using this facility. -

Device Modeling
-

Devices like Diode, JFET, MOSFET, IGBT, MOS etc added in the circuit can be modeled -using device model libraries. eSim also provides editing and adding new model libraries. While -converting Kicad to Ngspice these library files added to the corresponding devices used in the -circuit. - -

Subcircuits
-

Subcircuits are the circuits within a circuits. Subcircuiting helps to reuse the part of the -circuits. The sub circuit in the main circuits are added using this facility. Also, eSim provides -us with editing the already existing subcircuits. Sub circuits are saved separately in different -folders. + id="x1-90003.1.4">KiCad to Ngspice converter +

We can provide analysis parameters, and the source details through this module. It also +allows us to add and edit the device models and subcircuits, included in the circuit +schematic. Finally, this module facilitates the conversion of KiCad netlist to Ngspice +compatible ones. It is developed by us for eSim and it is indicated by the label 7 in +Fig. 3.1. +

3.1.5 Model Builder

+ id="x1-100003.1.5">Model Builder -

This tool provides the facility to define a new model for devices such as, 1. Diode 2. Bipolar + id="dx1-10001"> +

This tool provides the facility to define a new model for devices such as, 1. Diode 2. Bipolar Junction Transistor (BJT) 3. Metal Oxide Semiconductor Field Effect Transistor + id="x1-10004r3">3. Metal Oxide Semiconductor Field Effect Transistor (MOSFET) 4. Junction Field Effect Transistor (JFET) 5. IGBT and 6. Magnetic + id="x1-10005r4">4. Junction Field Effect Transistor (JFET) 5. IGBT and 6. Magnetic core. This module also helps edit existing models. It is developed by us for eSim and it is indicated by the label 5 in Fig. 3.1. -

+href="#x1-130011">3.1. +

3.1.6 Subcircuit Builder

+ id="x1-110003.1.6">Subcircuit Builder -

This module allows the user to create a subcircuit for a component. Once the subcircuit for a + id="dx1-11001"> +

This module allows the user to create a subcircuit for a component. Once the subcircuit for a component is created, the user can use it in other circuits. It has the facility to define new components such as, Op-amps and IC-555. This component also helps edit existing subcircuits. This module is developed by us for eSim and it is indicated by the label 6 in Fig. 3.1. -

+href="#x1-130011">3.1. +

3.1.7 KiCad to Ngspice netlist converter

- + id="x1-120003.1.7">Ngspice - -

It converts KiCad generated netlists to Ngspice (see Sec. 3.1.8) compatible format. It has the -capability to 1. Insert parameters for fictitious components 2. Convert IC into discrete -blocks 3. Insert D-A and A-D converter at appropriate places 4. Insert plotting -and printing statements in netlist and 5. Find current through all components. -

This module is developed by us for eSim and it is indicated by the label 7 in -Fig. 3.1. - -

-

3.1.8 Ngspice

- -

Ngspice is a general purpose circuit simulation program for nonlinear dc, nonlinear transient, -and linear ac analyses  [ +

Ngspice is a general purpose circuit simulation program for nonlinear dc, nonlinear transient, +and linear ac analysis  [12]. Circuits may contain resistors, capacitors, inductors, mutual inductors, independent voltage and current sources, four types of dependent sources, lossless and lossy transmission lines (two separate implementations), switches, uniform + distributed RC lines, and the five most common semiconductor devices: diodes, BJTs, JFETs, MESFETs, and MOSFET. This module is indicated by the label 9 in + id="dx1-12002">BJTs, JFETs, MESFETs, and MOSFET. This module is indicated by the label 9 in Fig. 3.1. -

+href="#x1-130011">3.1. +

3.2 Work flow of eSim

-

Fig. 3.1 shows the work flow in eSim. The block diagram consists of mainly three + id="x1-130003.2">Work flow of eSim +

Fig. 3.1 shows the work flow in eSim. The block diagram consists of mainly three parts:

-



+ id="x1-130011"> -

PIC

Figure 3.1: Work flow in eSim. Boxes with dotted lines denote the modules developed -in this work.
+class="content">Work flow in eSim. (Boxes with dotted lines denote the modules developed +in this work).
-


-

Here we explain the role of each block in designing electronic systems. Circuit design is the +


+

Here we explain the role of each block in designing electronic systems. Circuit design is the first step in the design of an electronic circuit. Generally a circuit diagram is drawn on a -paper, and then entered into a computer using a schematic editor. EEschema is the schematic -editor for eSim. Thus all the functionalities of EEschema are naturally available in eSim. +paper, and then entered into a computer using a schematic editor. Eeschema is the schematic +editor for eSim. Thus all the functionalities of Eeschema are naturally available in eSim. -

Libraries for components, explicitly or implicitly supported by Ngspice, have been created -using the features of EEschema. As EEschema is originally intended for PCB design, there are + id="dx1-13002"> +

Libraries for components, explicitly or implicitly supported by Ngspice, have been created +using the features of Eeschema. As Eeschema is originally intended for PCB design, there are no fictitious components such as voltage or current sources. Thus, a new library for different types of voltage and current sources such as sine, pulse and square wave, has been added in eSim. A library which gives the functionality of printing and plotting has also been created. -

The schematic editor provides a netlist file, which describes the electrical connections of +

The schematic editor provides a netlist file, which describes the electrical connections of the design. In order to create a PCB layout, physical components are required to be mapped into their footprints. To perform component to footprint mapping, CvPcb is used. Footprints have been created for the components in the newly created libraries. Pcbnew is used to draw a PCB layout. -

After designing a circuit, it is essential to check the integrity of the circuit design. In the +

After designing a circuit, it is essential to check the integrity of the circuit design. In the case of large electronic circuits, breadboard testing is impractical. In such cases, electronic system designers rely heavily on simulation. The accuracy of the simulation results can be increased by accurate modeling of the circuit elements. Model Builder provides the facility to define a new model for devices and edit existing models. Complex circuit elements can be created by hierarchical modeling. Subcircuit Builder provides an easy way to create a subcircuit. -

The netlist generated by Schematic Editor cannot be directly used for simulation -due to compatibility issues. Netlist Converter converts it into Ngspice compatible -format. The type of simulation to be performed and the corresponding options are -provided through a graphical user interface (GUI). This is called Analysis Inserter in +

The netlist generated by Schematic Editor cannot be directly used for simulation due to +compatibility issues. Netlist Converter converts it into Ngspice compatible format. The +type of simulation to be performed and the corresponding options are provided +through a graphical user interface (GUI). This is called KiCad to Ngspice Converter in eSim. -

eSim uses Ngspice for analog, digital, mixed-level/mixed-signal circuit simulation. Ngspice +

eSim uses Ngspice for analog, digital, mixed-level/mixed-signal circuit simulation. Ngspice is based on three open source software packages [14]:

-

It is a part of gEDA project. Ngspice is capable of simulating devices with BSIM, EKV, HICUM, +

It is a part of gEDA project. Ngspice is capable of simulating devices with BSIM, EKV, HICUM, HiSim, PSP, and PTM models. It is widely used due to its accuracy even for the latest + id="dx1-13007">PSP, and PTM models. It is widely used due to its accuracy even for the latest technology devices.

Chapter 4
Getting Started

+ id="x1-140004">Getting Started

In this chapter we will get started with eSim. We will run through the various options available with an example circuit. Referring to this chapter will make one familiar with eSim and will help plan the project before actually designing a circuit. Lets get started.

4.1 eSim Main Window

+ id="x1-150004.1">eSim Main Window

4.1.1 Workspace

-

After installation is completed, when the eSim is run the first window that appears is -workspace dialog as shown in Fig. 4.1.


How to launch eSim in Ubuntu? +

After installation is completed, to launch eSim 1. Go to terminal.
2. Type esim and hit enter.
The first window that appears is workspace dialog as shown in Fig. 4.1.


+ id="x1-160011"> -

PIC

Figure 4.1: eSim-Workspace
- -


-

The default eSim-Workspace can be chosen if the ok or cancel button is clicked. Else to -create new workspace browse button is used. +class="content">eSim-Workspace

+ +


+

The default workspace is eSim-Workspace under home directory. To create new workspace +use browse option.

4.1.2 Main-GUI

-

The main GUI window of eSim is as shown in Fig. 4.2


Main-GUI +

The main GUI window of eSim is as shown in Fig. 4.2


+ id="x1-170012"> -

PIC

Figure 4.2: eSim Main GUI
+class="content">eSim Main GUI
-


-

The eSim main GUI window consists the following symbols. +


+

The eSim main window consists of the following symbols.

1.
Toolbar @@ -833,302 +617,226 @@

4.1.2
Console area

Toolbar
- - - - -

PIC

+

9.1.2 Half Wave Rectifier

+

+

Problem Statement:
+

Plot the Input and Output Waveform of Half Wave Rectifier circuit where the input voltage +(Vs) is 50Hz, 2V peak to peak. The value for Resistor (R) is 1k. +

+

Solution:
+

The new project is created by clicking the New icon on the menubar. The name of the project +is given in the window shown in Fig. 9.1. +

-

A.1.4 Precision Rectifier

-

+

+

9.1.3 Precision Rectifier

+

Problem Statement-
-

Plot the Input and Output Waveform of Precision Reectifier ckt where the input voltage (Vs) -is 50Hz, 3V peak to peak. -

+ id="x1-700009.1.3">Problem Statement: +

Plot the input and output waveform of the Precision Rectifier circuit where input voltage +(Vs) is 50Hz , 3V peak to peak. +

Solution -
-

Draw the schematic and label the nodes as shown in Fig. D.1a using the schematic editor. -Annotate the schematic using the Annotate tool from the top toolbar in Schematic editor. -Perform Electric Rules check using the Perform electric rules check tool from the top toolbar. -Ensure that there are no errors in the circuit schematic. Now generate Spice netlist for -simulation using the Generate Netlist tool from the top toolbar. This is shown in -Fig. A.22. -

Next step is to convert kicad netlist to ngspice netlist by click on icon Convert Kicad to -Ngspice. Then Fill the Analysis tab with Transisent option selected as given in -Fig. A.23. Enter start time = 0ms, step time = 1 ms, stop time = 100 ms. Now Click -on Sources Details Tab to Enter Sine Source Values as shown in Fig. A.24. Now -Click on Device Model Tab to ADD Diode model to the circuit shown in Fig. A.25. -(Note Details about Device Model is expained in earlier chapter Model Builder.) -Then Click on Subciruits Tab to ADD UA741 Subcircut to the circuit shown in -Fig. A.26. (Note Details about Subcircuit is expained in earlier chapter Subcircuit -Builder.) -

Then Press Convert Button which will generate Ngspice Netlist (Precision-Rectifier.cir.out) -

Now Click on Simulation icon to open Ngspice Plot and Python Plot shown in Fig. A.27 -and Fig. A.28. -


- - - - -

Solution: +

The new project is created by clicking the New icon on the menubar. The name of the project +is given as shown in the Fig. 9.1. +


+

The KiCad netlist is generated as shown in Fig. 9.18.
+


PIC
Figure A.22: Precision Rectifier circuit Netlist Generation
- -


-


- - - +>Figure 9.18: Precision Rectifier circuit Netlist Generation
+


-

+

  • Convert KiCad to Ngspice: After creating KiCad netlist, click on KiCad-Ngspice + converter button.
    +

    This will open converter window where you can enter details of Analysis, Source values, + Device library and Subcircuit. +


    PIC -
    Figure A.23: Precision Rectifier Circuit Analysis Insertor
    - -


    -


    - - - - -

    (a) + Precision + Rectifier + Analysis PIC -

    Figure A.24: Precision Rectifier Source Details
    - -


    -


    - - - - -

    (b) + Precision + Rectifier + Source + Details + +

    PIC -

    Figure A.25: Device Modelling of Precision Rectifier circuit
    - -


    -


    - - - - -

    (c) +Precision +Rectifier +Device +Modeling PIC + (d) + Precision + Rectifier + Subcircuit

    Figure A.26: Precision Rectifier Sub-circuit
    +>Figure 9.19: Analysis, Source, Device library and Subcircuit tab
    +


    +

    Under device library you can add the library for the diode used in the circuit. If you do + not add any library it will take default Ngspice model for diode.
    +

    Under subcircuit tab you have to add the subciruit used in your circuit. If you forget to + add subcircuit it will throw an error. -


    -


    +
  • Simulation: Once the KiCad-Ngspice converter runs successfully, you can run the + simulation by clicking the simulation button in the toolbar.
    PIC +(a) +Ngspice +Plot +of +Precision +Rectifier PIC + (b) + Python + Plot + of + Precision + Rectifier +
    Figure 9.20: Precision Rectifier Simulation Output
    +


    +
  • - - - -

    PIC

    +

    9.1.4 Inverting Amplifier

    +

    +

    Problem Statement:
    +

    Plot the Input and Output Waveform of Inverting Amplifier circuit where the input voltage +(Vs) is 50Hz, 2V peak to peak and gain is 2. +

    Solution:
    + -

    A.1.5 Half Adder Example

    -

    +

    +

    9.1.5 Half Adder Example

    +

    Problem Statement-
    -

    Plot the Input and Output Waveform of Half Adder ckt. -

    + id="x1-760009.1.5">Problem Statement: +

    Plot the Input and Output Waveform of Half Adder circuit. +

    Solution -
    -

    Draw the schematic and label the nodes as shown in Fig. A.29 using the schematic editor. -[Note : To create any Digital Circuits ADCs and DACs must be connected to input and -output of the circuit.] Annotate the schematic using the Annotate tool from the top toolbar in -Schematic editor. Perform Electric Rules check using the Perform electric rules check tool -from the top toolbar. Ensure that there are no errors in the circuit schematic. Now generate -Spice netlist for simulation using the Generate Netlist tool from the top toolbar. This is -shown in Fig. A.30. -

    Next step is to convert kicad netlist to ngspice netlist by click on icon Convert Kicad to -Ngspice. Then Fill the Analysis tab with Transisent option selected as given in Fig. A.31. -Enter start time = 0ms, step time = 1ms, stop time = 100ms. Now Click on Sources Details -Tab to Enter Sine Source Values as shown in Fig. A.32. Click on Ngspice Model Tab and -Enter the Details of Ngspice Models else keep it empty where it will select default values as -shown in Fig. A.33 Then Click on Subciruits Tab to ADD half-adder Subcircut to the circuit -shown in Fig. A.34. (Note Details about Subcircuit is expained in earlier chapter Subcircuit -Builder.) -

    Then Press Convert Button which will generate Ngspice Netlist (Half-Adder.cir.out) -

    Now Click on Simulation icon to open Ngspice Plot and Python Plot shown in Fig. A.35 -and Fig. A.36. -


    - - - - -

    Solution: +


    +

    The KiCad netlist is generated as shown in Fig. 9.26.


    PIC
    Figure A.30: Half Adder circuit Netlist Generation
    +>Figure 9.26: Half Adder circuit Netlist Generation
    +


    -


    -


    - - - - -

    +

  • Convert KiCad to Ngspice: After creating KiCad netlist click on KiCad-Ngspice + converter button.
    +

    This will open converter window where you can enter details of Analysis, Source values, + Ngspice model and Subcircuit. +


    PIC -
    Figure A.31: Half Adder Circuit Analysis Insertor
    - -


    -


    - - - - -

    (a) + Half + Adder + Analysis PIC -

    Figure A.32: Half Adder Source Details
    - -


    -


    - - - - -

    (b) + Half + Adder + Source + Details + +

    PIC -

    Figure A.33: Ngspice Plot of Half Adder circuit
    - -


    -


    - - - - -

    (c) +Half +Adder +Ngspice +Model PIC + (d) + Half + Adder + Subcircuit + Model

    Figure A.34: Ngspice Plot of Half Adder circuit
    - -


    -


    - - - - -

    PICFigure 9.27: Analysis, Source, Ngspice Model and Subcircuit tab

    +


  • +

    Subcircuit of Half Adder in Fig. 9.28


    PIC
    Figure A.35: Ngspice Plot of Half Adder circuit
    - -


    -


    - - - +>Figure 9.28: Half Adder Subcircuit
    +


    -

    +

  • Simulation: Once the KiCad-Ngspice converter runs successfully, you can run + simulation by clicking the simulation button in the toolbar.
    PIC +(a) +Half +Adder +Ngspice +Plot PIC -
    Figure A.36: Python Plot of Half Adder Circuit
    - -


    - -

    + (b) + Half + Adder + Python + Plot +

    Figure 9.29: Half Adder Simulation Output
    +


    +
  • References

    + id="x1-780009.1.5">References

    [1]   CSI Communications, vol. 35, no. 6, pp. 10–12, September 2011, available at http://spoken-_tutorial.org/CSI.pdf. +href="http://spoken-tutorial.org/CSI.pdf" class="url" >http://spoken-tutorial.org/CSI.pdf.

    [3]      (2013, May). [Online]. Available: http://scilab-_test.garudaindia.in/scilab_in/,_http://scilab-_test.garudaindia.in/cloud +href="http://scilab-test.garudaindia.in/scilab_in/, http://scilab-test.garudaindia.in/cloud" class="url" >http://scilab-test.garudaindia.in/scilab_in/,http://scilab-test.garudaindia.in/cloud

    [5]      (2013, May) Synaptic Package Manager Spoken Tutorial. [Online]. Available: http://www.spoken-_tutorial.org/list_videos?view=1&foss=Linux&language=English +href="http://www.spoken-tutorial.org/list_videos?view=1&foss=Linux&language=English" class="url" >http://www.spoken-tutorial.org/list_videos?view=1&foss=Linux&language=English

    [11]   (2013, May). [Online]. Available: http://www.kicad-_pcb.org/display/KICAD/KiCad+EDA+Software+Suite +href="http://www.kicad-pcb.org/display/KICAD/KiCad+EDA+Software+Suite" class="url" >http://www.kicad-pcb.org/display/KICAD/KiCad+EDA+Software+Suite

    [12]      J.-P. Charras and F. Tappero. (2013, May). [Online]. Available: http://www.kicad-_pcb.org/display/KICAD/KiCad+Documentation +href="http://www.kicad-pcb.org/display/KICAD/KiCad+Documentation" class="url" >http://www.kicad-pcb.org/display/KICAD/KiCad+Documentation

    @@ -4221,13 +3642,13 @@

    D. Jahshan and P. Hutchinson. (2013, May). [Online]. Available: http://bazaar.launchpad.net/kicad-_developers/kicad/doc/files/head:/doc/tutorials/ +class="cmsy-8">∼kicad-developers/kicad/doc/files/head:/doc/tutorials/

    [17]   P. Nenzi and H. Vogt. (2013) Ngspice users manual version 25plus. [Online]. Available: http://ngspice.sourceforge.net/docs/ngspice-_manual.pdf +href="http://ngspice.sourceforge.net/docs/ngspice-manual.pdf" class="url" >http://ngspice.sourceforge.net/docs/ngspice-manual.pdf

    [18]    [19]   (2013, May). [Online]. Available: http://www.spoken-_tutorial.org/ +href="http://www.spoken-tutorial.org/" class="url" >http://www.spoken-tutorial.org/

    [20]