diff options
author | Sunil Shetye | 2019-06-13 13:11:14 +0530 |
---|---|---|
committer | GitHub | 2019-06-13 13:11:14 +0530 |
commit | cfc34bb19977e738582620802415ccde27a03039 (patch) | |
tree | daaace10133835956619b401aca9c252e3e789bc /src | |
parent | 25c6eddcea3c8a62d9750a78435454544d8c7b14 (diff) | |
parent | 20b23a7934f7cf01cd5b4353ddd2e008b40e5ffd (diff) | |
download | eSim-cfc34bb19977e738582620802415ccde27a03039.tar.gz eSim-cfc34bb19977e738582620802415ccde27a03039.tar.bz2 eSim-cfc34bb19977e738582620802415ccde27a03039.zip |
Merge pull request #86 from nilshah98/documentation
Documentation added and minor fixes
Diffstat (limited to 'src')
33 files changed, 2761 insertions, 2339 deletions
diff --git a/src/browser/Welcome.py.bak b/src/browser/Welcome.py.bak deleted file mode 100644 index 5c0195e2..00000000 --- a/src/browser/Welcome.py.bak +++ /dev/null @@ -1,20 +0,0 @@ -from PyQt4 import QtGui, QtCore - - -class Welcome(QtGui.QWidget): - """ - This class creates Welcome page of eSim. - """ - - def __init__(self): - QtGui.QWidget.__init__(self) - self.vlayout = QtGui.QVBoxLayout() - - self.browser = QtGui.QTextBrowser() - self.browser.setSource(QtCore.QUrl("../browser/pages/welcome.html")) - self.browser.setOpenExternalLinks(True) - self.browser.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) - - self.vlayout.addWidget(self.browser) - self.setLayout(self.vlayout) - self.show() diff --git a/src/browser/pages/User-Manual/eSim.html b/src/browser/pages/User-Manual/eSim.html index a2a970e4..79afa31e 100644 --- a/src/browser/pages/User-Manual/eSim.html +++ b/src/browser/pages/User-Manual/eSim.html @@ -1,183 +1,183 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html > -<head><title></title> -<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> -<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> -<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> -<!-- html --> -<meta name="src" content="esim.tex"> -<meta name="date" content="2015-09-15 14:59:00"> -<link rel="stylesheet" type="text/css" href="esim.css"> -</head><body -> - -<div class="center" +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> +<html > +<head><title>eSim Manual</title> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> +<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)"> +<!-- html --> +<meta name="src" content="esim.tex"> +<meta name="date" content="2015-09-15 14:59:00"> +<link rel="stylesheet" type="text/css" href="esim.css"> +</head><body +> + +<div class="center" > <!--l. 1--><p class="noindent" > -<!--l. 2--><p class="noindent" ><span +<!--l. 2--><p class="noindent" ><span class="cmbx-12x-x-207">eSim</span><br /><br /> -<span +<span class="cmbx-12x-x-144">An open source EDA tool for circuit design,</span> -<span +<span class="cmbx-12x-x-144">simulation, analysis and PCB design</span><br /> -<img -src="figures/logo-trimmed.png" alt="PIC" +<img +src="figures/logo-trimmed.png" alt="PIC" > -<span +<span class="cmbx-12x-x-144">eSim User Manual</span><br /> -<span +<span class="cmr-10">version 1.0.0</span><br /> -<span +<span class="cmbx-10">Prepared By:</span><br /> -<span +<span class="cmr-10">eSim Team</span><br /> -<span +<span class="cmr-10">FOSSEE at IIT,Bombay</span> -<!--l. 17--><p class="noindent" ><img -src="figures/iitblogo.png" alt="PIC" +<!--l. 17--><p class="noindent" ><img +src="figures/iitblogo.png" alt="PIC" ><br /> -<span +<span class="cmr-10">Indian Institute of Technology Bombay</span><br /> -<img -src="esim0x.png" alt="○BY:" class="oalign" > <img -src="esim1x.png" alt="○$\" class="oalign" > <img +<img +src="esim0x.png" alt="○BY:" class="oalign" > <img +src="esim1x.png" alt="○$\" class="oalign" > <img src="esim2x.png" alt="○=" class="oalign" > <br /> -<span +<span class="cmr-10">August 2015</span></div> - <h2 class="likechapterHead"><a + <h2 class="likechapterHead"><a id="x1-1000"></a>Contents</h2> <div class="tableofcontents"> - <span class="chapterToc" >1 <a + <span class="chapterToc" >1 <a href="#x1-20001" id="QQ2-1-2">Introduction</a></span> -<br /> <span class="chapterToc" >2 <a +<br /> <span class="chapterToc" >2 <a href="#x1-30002" id="QQ2-1-3">Installing eSim</a></span> -<br /> <span class="chapterToc" >3 <a +<br /> <span class="chapterToc" >3 <a href="#x1-40003" id="QQ2-1-4">Architecture of eSim</a></span> -<br />  <span class="sectionToc" >3.1 <a +<br />  <span class="sectionToc" >3.1 <a href="#x1-50003.1" id="QQ2-1-5">Modules used in eSim</a></span> -<br />   <span class="subsectionToc" >3.1.1 <a +<br />   <span class="subsectionToc" >3.1.1 <a href="#x1-60003.1.1" id="QQ2-1-6">Eeschema</a></span> -<br />   <span class="subsectionToc" >3.1.2 <a +<br />   <span class="subsectionToc" >3.1.2 <a href="#x1-70003.1.2" id="QQ2-1-7">CvPcb</a></span> -<br />   <span class="subsectionToc" >3.1.3 <a +<br />   <span class="subsectionToc" >3.1.3 <a href="#x1-80003.1.3" id="QQ2-1-8">Pcbnew</a></span> -<br />   <span class="subsectionToc" >3.1.4 <a +<br />   <span class="subsectionToc" >3.1.4 <a href="#x1-90003.1.4" id="QQ2-1-9">KiCad to Ngspice converter</a></span> -<br />   <span class="subsectionToc" >3.1.5 <a +<br />   <span class="subsectionToc" >3.1.5 <a href="#x1-100003.1.5" id="QQ2-1-10">Model Builder</a></span> -<br />   <span class="subsectionToc" >3.1.6 <a +<br />   <span class="subsectionToc" >3.1.6 <a href="#x1-110003.1.6" id="QQ2-1-11">Subcircuit Builder</a></span> -<br />   <span class="subsectionToc" >3.1.7 <a +<br />   <span class="subsectionToc" >3.1.7 <a href="#x1-120003.1.7" id="QQ2-1-12">Ngspice</a></span> -<br />  <span class="sectionToc" >3.2 <a +<br />  <span class="sectionToc" >3.2 <a href="#x1-130003.2" id="QQ2-1-13">Work flow of eSim</a></span> -<br /> <span class="chapterToc" >4 <a +<br /> <span class="chapterToc" >4 <a href="#x1-140004" id="QQ2-1-15">Getting Started</a></span> -<br />  <span class="sectionToc" >4.1 <a +<br />  <span class="sectionToc" >4.1 <a href="#x1-150004.1" id="QQ2-1-16">eSim Main Window</a></span> -<br />   <span class="subsectionToc" >4.1.1 <a +<br />   <span class="subsectionToc" >4.1.1 <a href="#x1-160004.1.1" id="QQ2-1-17">How to launch eSim in Ubuntu?</a></span> -<br />   <span class="subsectionToc" >4.1.2 <a +<br />   <span class="subsectionToc" >4.1.2 <a href="#x1-170004.1.2" id="QQ2-1-19">Main-GUI</a></span> -<br /> <span class="chapterToc" >5 <a +<br /> <span class="chapterToc" >5 <a href="#x1-280005" id="QQ2-1-33">Schematic Creation</a></span> -<br />  <span class="sectionToc" >5.1 <a +<br />  <span class="sectionToc" >5.1 <a href="#x1-290005.1" id="QQ2-1-34">Familiarizing the Schematic Editor interface</a></span> -<br />   <span class="subsectionToc" >5.1.1 <a +<br />   <span class="subsectionToc" >5.1.1 <a href="#x1-300005.1.1" id="QQ2-1-36">Top menu bar</a></span> -<br />   <span class="subsectionToc" >5.1.2 <a +<br />   <span class="subsectionToc" >5.1.2 <a href="#x1-310005.1.2" id="QQ2-1-38">Top toolbar</a></span> -<br />   <span class="subsectionToc" >5.1.3 <a +<br />   <span class="subsectionToc" >5.1.3 <a href="#x1-320005.1.3" id="QQ2-1-40">Toolbar on the right</a></span> -<br />   <span class="subsectionToc" >5.1.4 <a +<br />   <span class="subsectionToc" >5.1.4 <a href="#x1-330005.1.4" id="QQ2-1-42">Toolbar on the left</a></span> -<br />   <span class="subsectionToc" >5.1.5 <a +<br />   <span class="subsectionToc" >5.1.5 <a href="#x1-340005.1.5" id="QQ2-1-44">Hotkeys</a></span> -<br />  <span class="sectionToc" >5.2 <a +<br />  <span class="sectionToc" >5.2 <a href="#x1-350005.2" id="QQ2-1-45">Schematic creation for simulation</a></span> -<br />   <span class="subsectionToc" >5.2.1 <a +<br />   <span class="subsectionToc" >5.2.1 <a href="#x1-360005.2.1" id="QQ2-1-47">Selection and placement of components</a></span> -<br />   <span class="subsectionToc" >5.2.2 <a +<br />   <span class="subsectionToc" >5.2.2 <a href="#x1-370005.2.2" id="QQ2-1-51">Wiring the circuit</a></span> -<br />   <span class="subsectionToc" >5.2.3 <a +<br />   <span class="subsectionToc" >5.2.3 <a href="#x1-380005.2.3" id="QQ2-1-53">Assigning values to components</a></span> -<br />   <span class="subsectionToc" >5.2.4 <a +<br />   <span class="subsectionToc" >5.2.4 <a href="#x1-390005.2.4" id="QQ2-1-55">Annotation and ERC</a></span> -<br />   <span class="subsectionToc" >5.2.5 <a +<br />   <span class="subsectionToc" >5.2.5 <a href="#x1-400005.2.5" id="QQ2-1-59">Netlist generation</a></span> -<br /> <span class="chapterToc" >6 <a +<br /> <span class="chapterToc" >6 <a href="#x1-410006" id="QQ2-1-61">PCB Design</a></span> -<br />  <span class="sectionToc" >6.1 <a +<br />  <span class="sectionToc" >6.1 <a href="#x1-420006.1" id="QQ2-1-62">Schematic creation for PCB design</a></span> -<br />   <span class="subsectionToc" >6.1.1 <a +<br />   <span class="subsectionToc" >6.1.1 <a href="#x1-430006.1.1" id="QQ2-1-64">Netlist generation for PCB</a></span> -<br />   <span class="subsectionToc" >6.1.2 <a +<br />   <span class="subsectionToc" >6.1.2 <a href="#x1-440006.1.2" id="QQ2-1-66">Mapping of components using Footprint Editor</a></span> -<br />   <span class="subsectionToc" >6.1.3 <a +<br />   <span class="subsectionToc" >6.1.3 <a href="#x1-450006.1.3" id="QQ2-1-67">Familiarising the Footprint Editor tool</a></span> -<br />   <span class="subsectionToc" >6.1.4 <a +<br />   <span class="subsectionToc" >6.1.4 <a href="#x1-470006.1.4" id="QQ2-1-71">Viewing footprints in 2D and 3D</a></span> -<br />   <span class="subsectionToc" >6.1.5 <a +<br />   <span class="subsectionToc" >6.1.5 <a href="#x1-480006.1.5" id="QQ2-1-75">Mapping of components in the RC circuit</a></span> -<br />  <span class="sectionToc" >6.2 <a +<br />  <span class="sectionToc" >6.2 <a href="#x1-490006.2" id="QQ2-1-77">Creation of PCB layout</a></span> -<br />   <span class="subsectionToc" >6.2.1 <a +<br />   <span class="subsectionToc" >6.2.1 <a href="#x1-500006.2.1" id="QQ2-1-78">Familiarizing the Layout Editor tool</a></span> -<br />   <span class="subsectionToc" >6.2.2 <a +<br />   <span class="subsectionToc" >6.2.2 <a href="#x1-520006.2.2" id="QQ2-1-82">Hotkeys</a></span> -<br />   <span class="subsectionToc" >6.2.3 <a +<br />   <span class="subsectionToc" >6.2.3 <a href="#x1-530006.2.3" id="QQ2-1-83">PCB design example using RC circuit</a></span> -<br /> <span class="chapterToc" >7 <a +<br /> <span class="chapterToc" >7 <a href="#x1-540007" id="QQ2-1-98">Model Editor</a></span> -<br />  <span class="sectionToc" >7.1 <a +<br />  <span class="sectionToc" >7.1 <a href="#x1-550007.1" id="QQ2-1-100">Creating New Model Library </a></span> -<br />  <span class="sectionToc" >7.2 <a +<br />  <span class="sectionToc" >7.2 <a href="#x1-560007.2" id="QQ2-1-105">Editing Current Model Library</a></span> -<br />  <span class="sectionToc" >7.3 <a +<br />  <span class="sectionToc" >7.3 <a href="#x1-570007.3" id="QQ2-1-107">Uploading external .lib file to eSim repository</a></span> -<br /> <span class="chapterToc" >8 <a +<br /> <span class="chapterToc" >8 <a href="#x1-580008" id="QQ2-1-108">SubCircuit Builder</a></span> -<br />  <span class="sectionToc" >8.1 <a +<br />  <span class="sectionToc" >8.1 <a href="#x1-590008.1" id="QQ2-1-110">Creating a SubCircuit</a></span> -<br />  <span class="sectionToc" >8.2 <a +<br />  <span class="sectionToc" >8.2 <a href="#x1-600008.2" id="QQ2-1-118">Edit a Subcircuit</a></span> -<br /> <span class="chapterToc" >9 <a +<br /> <span class="chapterToc" >9 <a href="#x1-610009" id="QQ2-1-119">Solved Examples</a></span> -<br />  <span class="sectionToc" >9.1 <a +<br />  <span class="sectionToc" >9.1 <a href="#x1-620009.1" id="QQ2-1-120">Solved Examples</a></span> -<br />   <span class="subsectionToc" >9.1.1 <a +<br />   <span class="subsectionToc" >9.1.1 <a href="#x1-630009.1.1" id="QQ2-1-121">Basic RC Circuit</a></span> -<br />   <span class="subsectionToc" >9.1.2 <a +<br />   <span class="subsectionToc" >9.1.2 <a href="#x1-660009.1.2" id="QQ2-1-136">Half Wave Rectifier</a></span> -<br />   <span class="subsectionToc" >9.1.3 <a +<br />   <span class="subsectionToc" >9.1.3 <a href="#x1-690009.1.3" id="QQ2-1-143">Precision Rectifier</a></span> -<br />   <span class="subsectionToc" >9.1.4 <a +<br />   <span class="subsectionToc" >9.1.4 <a href="#x1-720009.1.4" id="QQ2-1-150">Inverting Amplifier</a></span> -<br />   <span class="subsectionToc" >9.1.5 <a +<br />   <span class="subsectionToc" >9.1.5 <a href="#x1-750009.1.5" id="QQ2-1-157">Half Adder Example</a></span> -<br /> <span class="chapterToc" > <a +<br /> <span class="chapterToc" > <a href="#Q1-1-166">References </a></span> </div> - <h2 class="chapterHead"><span class="titlemark">Chapter 1</span><br /><a + <h2 class="chapterHead"><span class="titlemark">Chapter 1</span><br /><a id="x1-20001"></a>Introduction</h2> 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 electronic systems too have become extremely difficult and time consuming. Thanks to a host of computer aided design tools, we have been able to come up with quick -and efficient designs. These are called <span -class="cmtt-10x-x-109">Electronic Design Automation </span>or <span +and efficient designs. These are called <span +class="cmtt-10x-x-109">Electronic Design Automation </span>or <span class="cmtt-10x-x-109">EDA</span> -<a +<a id="dx1-2001"></a>tools. -<!--l. 20--><p class="noindent" >Let us see the steps involved in EDA.<a +<!--l. 20--><p class="noindent" >Let us see the steps involved in EDA.<a id="dx1-2002"></a> 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. @@ -185,37 +185,37 @@ The design is then simulated and re-designed, if needed, to achieve the desired results. Once simulation achieves the specifications, the design is either converted to a PCB, a chip layout, or ported to an FPGA. The final product is again tested for specifications. The whole cycle is repeated until desired results are obtained -<span class="cite"> [<a +<span class="cite"> [<a href="#Xeda">9</a>]</span>. <!--l. 31--><p class="indent" > 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). <a +convert it into a Printed Circuit Board (PCB). <a id="dx1-2003"></a>There are various tools available that will help -us do this. Some of the popular EDA tools are those of <span -class="cmtt-10x-x-109">Cadence</span>, <span -class="cmtt-10x-x-109">Synopys</span>, <span +us do this. Some of the popular EDA tools are those of <span +class="cmtt-10x-x-109">Cadence</span>, <span +class="cmtt-10x-x-109">Synopys</span>, <span class="cmtt-10x-x-109">Mentor Graphics</span> -and <span +and <span class="cmtt-10x-x-109">Xilinx</span>. Although these are fairly comprehensive and high end, their licenses are expensive, being proprietary. -<!--l. 40--><p class="indent" > There are some free and open source EDA tools like <span -class="cmtt-10x-x-109">gEDA</span>, <span -class="cmtt-10x-x-109">KiCad </span>and <span +<!--l. 40--><p class="indent" > There are some free and open source EDA tools like <span +class="cmtt-10x-x-109">gEDA</span>, <span +class="cmtt-10x-x-109">KiCad </span>and <span class="cmtt-10x-x-109">Ngspice</span>. The main drawback of these open source tools is that they are not comprehensive. Some of them are -capable of PCB design (e.g. <span +capable of PCB design (e.g. <span class="cmtt-10x-x-109">KiCad</span>) while some of them are capable of performing simulations -(e.g. <span +(e.g. <span class="cmtt-10x-x-109">gEDA</span>). To the best of our knowledge, there is no open source software that can perform circuit design, simulation and layout design together. eSim is capable of doing all of the above. -<!--l. 49--><p class="indent" > eSim is a free and open source EDA tool. It is an acronym for <span -class="cmbx-10x-x-109">E</span>lectronics <span +<!--l. 49--><p class="indent" > eSim is a free and open source EDA tool. It is an acronym for <span +class="cmbx-10x-x-109">E</span>lectronics <span class="cmbx-10x-x-109">Sim</span>ulation. -eSim is created using open source software packages, such as KiCad, Ngspice and Python. <a - id="dx1-2004"></a><a +eSim is created using open source software packages, such as KiCad, Ngspice and Python. <a + id="dx1-2004"></a><a id="dx1-2005"></a> -<a +<a id="dx1-2006"></a>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. @@ -224,127 +224,127 @@ professionals who would want to study and/or design electronic systems. eSim is for entrepreneurs and small scale enterprises who do not have the capability to invest in heavily priced proprietary tools. <!--l. 63--><p class="indent" > This book introduces eSim to the reader and illustrates all the features of eSim with -examples. Chapter <a +examples. Chapter <a href="#x1-30002">2<!--tex4ht:ref: chap2 --></a> 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 <a -href="#x1-40003">3<!--tex4ht:ref: chap3 --></a>. Chapter <a +Chapter <a +href="#x1-40003">3<!--tex4ht:ref: chap3 --></a>. Chapter <a href="#x1-140004">4<!--tex4ht:ref: chap4 --></a> 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 <a +circuiting is covered in Chapter 8. Chapter <a href="#x1-610009">9<!--tex4ht:ref: chap5 --></a> illustrates how to use eSim for solving problems. <!--l. 73--><p class="indent" > 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 <span +etc., are given in <span class="cmti-10x-x-109">italics</span>. 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 <span +of websites, component references, etc., are given in <span class="cmtt-10x-x-109">typewriter </span>font. Some key -presses, e.g. <span -class="cmtt-10x-x-109">Enter </span>key, <span -class="cmtt-10x-x-109">F1 </span>key, <span -class="cmtt-10x-x-109">y </span>for yes, etc., are also mentioned in <span +presses, e.g. <span +class="cmtt-10x-x-109">Enter </span>key, <span +class="cmtt-10x-x-109">F1 </span>key, <span +class="cmtt-10x-x-109">y </span>for yes, etc., are also mentioned in <span class="cmtt-10x-x-109">typewriter</span> font. - <h2 class="chapterHead"><span class="titlemark">Chapter 2</span><br /><a + <h2 class="chapterHead"><span class="titlemark">Chapter 2</span><br /><a id="x1-30002"></a>Installing eSim</h2> <dl class="enumerate"><dt class="enumerate"> - 1. </dt><dd -class="enumerate"><span -class="cmbx-10x-x-109">eSim installation in Ubuntu:</span><br + 1. </dt><dd +class="enumerate"><span +class="cmbx-10x-x-109">eSim installation in Ubuntu:</span><br class="newline" />After downloading the zip file from https://github.com/FOSSEE/eSim to a local - directory unpack it using:<br -class="newline" />      <span -class="cmbx-10x-x-109">$ unzip eSim.zip </span><br + directory unpack it using:<br +class="newline" />      <span +class="cmbx-10x-x-109">$ unzip eSim.zip </span><br class="newline" />Now change directories in to the top-level source directory (where this INSTALL file can be found). - <!--l. 13--><p class="noindent" >To install eSim and other dependecies run the following command. <br -class="newline" />      <span -class="cmbx-10x-x-109">$ ../install-linux.sh –install </span><br + <!--l. 13--><p class="noindent" >To install eSim and other dependecies run the following command. <br +class="newline" />      <span +class="cmbx-10x-x-109">$ ../install-linux.sh –install </span><br class="newline" />Above script will install eSim along with dependencies. <!--l. 19--><p class="noindent" >eSim will be installed to /opt/eSim - <!--l. 21--><p class="noindent" >To run eSim you can directly run it from terminal as <br -class="newline" />      <span -class="cmbx-10x-x-109">$ esim </span><br + <!--l. 21--><p class="noindent" >To run eSim you can directly run it from terminal as <br +class="newline" />      <span +class="cmbx-10x-x-109">$ esim </span><br class="newline" />or you can double click on eSim icon created on desktop after installation.</dd></dl> - <h2 class="chapterHead"><span class="titlemark">Chapter 3</span><br /><a + <h2 class="chapterHead"><span class="titlemark">Chapter 3</span><br /><a id="x1-40003"></a>Architecture of eSim</h2> -<!--l. 6--><p class="noindent" >eSim is a CAD <a +<!--l. 6--><p class="noindent" >eSim is a CAD <a id="dx1-4001"></a>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 and some flavours of Windows. It uses <span -class="cmtt-10x-x-109">Python</span>, <span +Ubuntu Linux distributions and some flavours of Windows. It uses <span +class="cmtt-10x-x-109">Python</span>, <span class="cmtt-10x-x-109">KiCad </span>and -<span +<span class="cmtt-10x-x-109">Ngspice</span>. <!--l. 13--><p class="indent" > 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. The architecture of eSim has been designed by keeping these objectives in mind. - <h3 class="sectionHead"><span class="titlemark">3.1 </span> <a + <h3 class="sectionHead"><span class="titlemark">3.1 </span> <a id="x1-50003.1"></a>Modules used in eSim</h3> <!--l. 21--><p class="noindent" >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. <!--l. 23--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">3.1.1 </span> <a + <h4 class="subsectionHead"><span class="titlemark">3.1.1 </span> <a id="x1-60003.1.1"></a>Eeschema</h4> -<a +<a id="dx1-6001"></a> -<a +<a id="dx1-6002"></a> <!--l. 24--><p class="noindent" >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 <span class="cite"> [<a +schematic editor tool used in KiCad <span class="cite"> [<a href="#Xeeschema">11</a>]</span>. 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 also integrates the following additional but essential functions needed for a modern -schematic capture software: <a - id="x1-6003r1"></a>1. Design rules check <a - id="dx1-6004"></a>(<span +schematic capture software: <a + id="x1-6003r1"></a>1. Design rules check <a + id="dx1-6004"></a>(<span class="cmtt-10x-x-109">DRC</span>) for the automatic control of -incorrect connections and inputs of components left unconnected. <a +incorrect connections and inputs of components left unconnected. <a id="x1-6005r2"></a>2. Generation of -layout files in <span -class="cmtt-10x-x-109">POSTSCRIPT</span> <a - id="dx1-6006"></a>or <span -class="cmtt-10x-x-109">HPGL</span> <a - id="dx1-6007"></a>format. <a +layout files in <span +class="cmtt-10x-x-109">POSTSCRIPT</span> <a + id="dx1-6006"></a>or <span +class="cmtt-10x-x-109">HPGL</span> <a + id="dx1-6007"></a>format. <a id="x1-6008r3"></a>3. Generation of layout files printable via -printer. <a - id="x1-6009r4"></a>4. Bill of material generation. <a +printer. <a + id="x1-6009r4"></a>4. Bill of material generation. <a id="x1-6010r5"></a>5. Netlist generation for PCB layout or for simulation. -This module is indicated by the label 1 in Fig. <a +This module is indicated by the label 1 in Fig. <a href="#x1-130011">3.1<!--tex4ht:ref: blockd --></a>. <!--l. 45--><p class="indent" > As Eeschema is originally intended for PCB Design, there are no fictitious -components<span class="footnote-mark"><a -href="esim2.html#fn1x3"><sup class="textsuperscript">1</sup></a></span><a +components<span class="footnote-mark"><a +href="esim2.html#fn1x3"><sup class="textsuperscript">1</sup></a></span><a id="x1-6011f1"></a> 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. <a +indicated by the label 2 in Fig. <a href="#x1-130011">3.1<!--tex4ht:ref: blockd --></a>. - <h4 class="subsectionHead"><span class="titlemark">3.1.2 </span> <a + <h4 class="subsectionHead"><span class="titlemark">3.1.2 </span> <a id="x1-70003.1.2"></a>CvPcb</h4> -<a +<a id="dx1-7001"></a> <!--l. 58--><p class="noindent" >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 <span class="cite"> [<a +KiCad <span class="cite"> [<a href="#Xeeschema">11</a>]</span>. 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 @@ -358,15 +358,15 @@ and less error prone than directly associating footprints in the schematic edito This is because CvPcb not only allows automatic association, but also allows to see the list of available footprints and displays them on the screen to ensure the correct footprint is being associated. This module is indicated by the label 3 in -Fig. <a +Fig. <a href="#x1-130011">3.1<!--tex4ht:ref: blockd --></a>. <!--l. 80--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">3.1.3 </span> <a + <h4 class="subsectionHead"><span class="titlemark">3.1.3 </span> <a id="x1-80003.1.3"></a>Pcbnew</h4> -<a +<a id="dx1-8001"></a> <!--l. 81--><p class="noindent" >Pcbnew is a powerful printed circuit board software tool. It is the layout editor tool -used in KiCad <span class="cite"> [<a +used in KiCad <span class="cite"> [<a href="#Xeeschema">11</a>]</span>. It is used in association with the schematic capture software 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 @@ -375,7 +375,7 @@ below: <ul class="itemize1"> <li class="itemize">It manages libraries of modules. Each module is a drawing of the physical - component including its footprint<a + component including its footprint<a id="dx1-8002"></a> - the layout of pads providing connections to the component. The required modules are automatically loaded during the reading of the netlist produced by CvPcb. @@ -389,7 +389,7 @@ below: connected on the schematic. These connections move dynamically as track and module movements are made. </li> - <li class="itemize">It has an active Design Rules Check (<span + <li class="itemize">It has an active Design Rules Check (<span class="cmtt-10x-x-109">DRC</span>) which automatically indicates any error of track layout in real time. </li> @@ -397,7 +397,7 @@ class="cmtt-10x-x-109">DRC</span>) which automatically indicates any error pads. </li> <li class="itemize">It has a simple but effective auto router to assist in the production of the - circuit. An export/import in <span + circuit. An export/import in <span class="cmtt-10x-x-109">SPECCTRA </span>dsn format allows to use more advanced auto-routers. </li> @@ -413,67 +413,67 @@ class="cmtt-10x-x-109">SPECCTRA </span>dsn format allows to use more advanced <li class="itemize">display the track/pad clearance.</li></ul> </li></ul> -<!--l. 121--><p class="noindent" >This module is indicated by the label 4 in Fig. <a +<!--l. 121--><p class="noindent" >This module is indicated by the label 4 in Fig. <a href="#x1-130011">3.1<!--tex4ht:ref: blockd --></a>. - <h4 class="subsectionHead"><span class="titlemark">3.1.4 </span> <a + <h4 class="subsectionHead"><span class="titlemark">3.1.4 </span> <a id="x1-90003.1.4"></a>KiCad to Ngspice converter</h4> <!--l. 124--><p class="noindent" >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. <a +Fig. <a href="#x1-130011">3.1<!--tex4ht:ref: blockd --></a>. <!--l. 149--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">3.1.5 </span> <a + <h4 class="subsectionHead"><span class="titlemark">3.1.5 </span> <a id="x1-100003.1.5"></a>Model Builder</h4> -<a +<a id="dx1-10001"></a> -<!--l. 150--><p class="noindent" >This tool provides the facility to define a new model for devices such as, <a - id="x1-10002r1"></a>1. Diode <a +<!--l. 150--><p class="noindent" >This tool provides the facility to define a new model for devices such as, <a + id="x1-10002r1"></a>1. Diode <a id="x1-10003r2"></a>2. Bipolar -Junction Transistor (BJT) <a +Junction Transistor (BJT) <a id="x1-10004r3"></a>3. Metal Oxide Semiconductor Field Effect Transistor -(MOSFET) <a - id="x1-10005r4"></a>4. Junction Field Effect Transistor (JFET) <a - id="x1-10006r5"></a>5. IGBT and <a +(MOSFET) <a + id="x1-10005r4"></a>4. Junction Field Effect Transistor (JFET) <a + id="x1-10006r5"></a>5. IGBT and <a id="x1-10007r6"></a>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. <a +by the label 5 in Fig. <a href="#x1-130011">3.1<!--tex4ht:ref: blockd --></a>. <!--l. 164--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">3.1.6 </span> <a + <h4 class="subsectionHead"><span class="titlemark">3.1.6 </span> <a id="x1-110003.1.6"></a>Subcircuit Builder</h4> -<a +<a id="dx1-11001"></a> <!--l. 164--><p class="noindent" >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. <a +Fig. <a href="#x1-130011">3.1<!--tex4ht:ref: blockd --></a>. <!--l. 172--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">3.1.7 </span> <a + <h4 class="subsectionHead"><span class="titlemark">3.1.7 </span> <a id="x1-120003.1.7"></a>Ngspice</h4> -<a +<a id="dx1-12001"></a> <!--l. 173--><p class="noindent" >Ngspice is a general purpose circuit simulation program for nonlinear dc, nonlinear transient, -and linear ac analysis <span class="cite"> [<a +and linear ac analysis <span class="cite"> [<a href="#Xngspice-web">12</a>]</span>. 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, -<a - id="dx1-12002"></a>BJTs, <a - id="dx1-12003"></a>JFETs, MESFETs, and MOSFET. <a +<a + id="dx1-12002"></a>BJTs, <a + id="dx1-12003"></a>JFETs, MESFETs, and MOSFET. <a id="dx1-12004"></a>This module is indicated by the label 9 in -Fig. <a +Fig. <a href="#x1-130011">3.1<!--tex4ht:ref: blockd --></a>. <!--l. 184--><p class="noindent" > - <h3 class="sectionHead"><span class="titlemark">3.2 </span> <a + <h3 class="sectionHead"><span class="titlemark">3.2 </span> <a id="x1-130003.2"></a>Work flow of eSim</h3> -<!--l. 185--><p class="noindent" >Fig. <a +<!--l. 185--><p class="noindent" >Fig. <a href="#x1-130011">3.1<!--tex4ht:ref: blockd --></a> shows the work flow in eSim. The block diagram consists of mainly three parts: <ul class="itemize1"> @@ -482,18 +482,18 @@ parts: <li class="itemize">PCB Layout Editor </li> <li class="itemize">Circuit Simulators</li></ul> -<!--l. 193--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 193--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-130011"></a> -<!--l. 196--><p class="noindent" ><img -src="figures/blockdiagram.png" alt="PIC" +<!--l. 196--><p class="noindent" ><img +src="figures/blockdiagram.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 3.1: </span><span +<br /> <div class="caption" +><span class="id">Figure 3.1: </span><span class="content">Work flow in eSim. (Boxes with dotted lines denote the modules developed in this work).</span></div><!--tex4ht:label?: x1-130011 --> @@ -502,7 +502,7 @@ in this work).</span></div><!--tex4ht:label?: x1-130011 --> 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. -<a +<a id="dx1-13002"></a> <!--l. 210--><p class="indent" > 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 @@ -528,7 +528,7 @@ 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. <!--l. 245--><p class="indent" > eSim uses Ngspice for analog, digital, mixed-level/mixed-signal circuit simulation. Ngspice -is based on three open source software packages<span class="cite"> [<a +is based on three open source software packages<span class="cite"> [<a href="#Xspice">14</a>]</span>: <ul class="itemize1"> <li class="itemize">Spice3f5 (analog circuit simulator) @@ -537,130 +537,130 @@ href="#Xspice">14</a>]</span>: </li> <li class="itemize">Xspice (code modeling support and simulation of digital components through an event driven algorithm)</li></ul> -<!--l. 253--><p class="noindent" >It is a part of gEDA <a - id="dx1-13003"></a>project. Ngspice is capable of simulating devices with BSIM, <a - id="dx1-13004"></a>EKV, HICUM, <a - id="dx1-13005"></a><a +<!--l. 253--><p class="noindent" >It is a part of gEDA <a + id="dx1-13003"></a>project. Ngspice is capable of simulating devices with BSIM, <a + id="dx1-13004"></a>EKV, HICUM, <a + id="dx1-13005"></a><a id="dx1-13006"></a> -HiSim, <a - id="dx1-13007"></a>PSP, <a - id="dx1-13008"></a>and PTM <a +HiSim, <a + id="dx1-13007"></a>PSP, <a + id="dx1-13008"></a>and PTM <a id="dx1-13009"></a>models. It is widely used due to its accuracy even for the latest technology devices. - <h2 class="chapterHead"><span class="titlemark">Chapter 4</span><br /><a + <h2 class="chapterHead"><span class="titlemark">Chapter 4</span><br /><a id="x1-140004"></a>Getting Started</h2> <!--l. 5--><p class="noindent" >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. - <h3 class="sectionHead"><span class="titlemark">4.1 </span> <a + <h3 class="sectionHead"><span class="titlemark">4.1 </span> <a id="x1-150004.1"></a>eSim Main Window</h3> <!--l. 12--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">4.1.1 </span> <a + <h4 class="subsectionHead"><span class="titlemark">4.1.1 </span> <a id="x1-160004.1.1"></a>How to launch eSim in Ubuntu?</h4> -<!--l. 13--><p class="noindent" >After installation is completed, to launch eSim 1. Go to terminal.<br -class="newline" />2. Type <span -class="cmbx-10x-x-109">esim </span>and hit enter.<br -class="newline" />The first window that appears is workspace dialog as shown in Fig. <a -href="#x1-160011">4.1<!--tex4ht:ref: workspace --></a>. <hr class="figure"><div class="figure" +<!--l. 13--><p class="noindent" >After installation is completed, to launch eSim 1. Go to terminal.<br +class="newline" />2. Type <span +class="cmbx-10x-x-109">esim </span>and hit enter.<br +class="newline" />The first window that appears is workspace dialog as shown in Fig. <a +href="#x1-160011">4.1<!--tex4ht:ref: workspace --></a>. <hr class="figure"><div class="figure" > -<a +<a id="x1-160011"></a> -<!--l. 19--><p class="noindent" ><img -src="figures/workspace.png" alt="PIC" +<!--l. 19--><p class="noindent" ><img +src="figures/workspace.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 4.1: </span><span +<br /> <div class="caption" +><span class="id">Figure 4.1: </span><span class="content">eSim-Workspace</span></div><!--tex4ht:label?: x1-160011 --> <!--l. 22--><p class="indent" > </div><hr class="endfigure"> <!--l. 24--><p class="indent" > The default workspace is eSim-Workspace under home directory. To create new workspace -use <span +use <span class="cmti-10x-x-109">browse </span>option. - <h4 class="subsectionHead"><span class="titlemark">4.1.2 </span> <a + <h4 class="subsectionHead"><span class="titlemark">4.1.2 </span> <a id="x1-170004.1.2"></a>Main-GUI</h4> -<!--l. 27--><p class="noindent" >The main GUI window of eSim is as shown in Fig. <a -href="#x1-170012">4.2<!--tex4ht:ref: maingui --></a> <hr class="figure"><div class="figure" +<!--l. 27--><p class="noindent" >The main GUI window of eSim is as shown in Fig. <a +href="#x1-170012">4.2<!--tex4ht:ref: maingui --></a> <hr class="figure"><div class="figure" > -<a +<a id="x1-170012"></a> -<!--l. 30--><p class="noindent" ><img -src="figures/maingui.png" alt="PIC" +<!--l. 30--><p class="noindent" ><img +src="figures/maingui.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 4.2: </span><span +<br /> <div class="caption" +><span class="id">Figure 4.2: </span><span class="content">eSim Main GUI</span></div><!--tex4ht:label?: x1-170012 --> <!--l. 33--><p class="indent" > </div><hr class="endfigure"> <!--l. 34--><p class="indent" > The eSim main window consists of the following symbols. <dl class="enumerate"><dt class="enumerate"> - 1. </dt><dd + 1. </dt><dd class="enumerate">Toolbar </dd><dt class="enumerate"> - 2. </dt><dd + 2. </dt><dd class="enumerate">Menubar </dd><dt class="enumerate"> - 3. </dt><dd + 3. </dt><dd class="enumerate">Project explorer </dd><dt class="enumerate"> - 4. </dt><dd + 4. </dt><dd class="enumerate">Dockarea </dd><dt class="enumerate"> - 5. </dt><dd + 5. </dt><dd class="enumerate">Console area</dd></dl> - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-180004.1.2"></a>Toolbar</h5> -<!--l. 44--><p class="noindent" ><hr class="figure"><div class="figure" +<!--l. 44--><p class="noindent" ><hr class="figure"><div class="figure" > -<a +<a id="x1-180013"></a> -<!--l. 46--><p class="noindent" ><img -src="figures/guitoolbar.png" alt="PIC" +<!--l. 46--><p class="noindent" ><img +src="figures/guitoolbar.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 4.3: </span><span +<br /> <div class="caption" +><span class="id">Figure 4.3: </span><span class="content">Toolbar</span></div><!--tex4ht:label?: x1-180013 --> <!--l. 49--><p class="noindent" ></div><hr class="endfigure"> <ul class="itemize1"> - <li class="itemize">Open Schematic: The first tool on the toolbar i.e. <span -class="cmti-10x-x-109">Schematic Editor</span><a + <li class="itemize">Open Schematic: The first tool on the toolbar i.e. <span +class="cmti-10x-x-109">Schematic Editor</span><a id="dx1-18002"></a>. Clicking on this button will open Eeschema, the KiCad schematic editor. </li> <li class="itemize">Convert KiCad to Ngspice: This converter converts KiCad spice netlist into Ngspice compatible netlist. The KiCad to Ngspice window consists of total five - tabs as namely <span + tabs as namely <span class="cmti-10x-x-109">Analysis, Device Model, Source Details, Model Library, Subcircuits</span>. - Once the values have been entered, press the <span + Once the values have been entered, press the <span class="cmtt-10x-x-109">Convert </span>key. It will generate - <span -class="cmtt-10x-x-109">.cir.out </span>file in the same project directory.<br -class="newline" />Note that <span + <span +class="cmtt-10x-x-109">.cir.out </span>file in the same project directory.<br +class="newline" />Note that <span class="cmti-10x-x-109">KiCad to Ngspice Converter </span>can only be used if current project has - created the KiCad spice netlist file <span -class="cmtt-10x-x-109">.cir</span>.<br + created the KiCad spice netlist file <span +class="cmtt-10x-x-109">.cir</span>.<br class="newline" /> - <!--l. 62--><p class="noindent" >The details of tabs under KiCad to Ngspice converter are as follows:<br + <!--l. 62--><p class="noindent" >The details of tabs under KiCad to Ngspice converter are as follows:<br class="newline" /> - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-190004.1.2"></a>Analysis</h5> <!--l. 65--><p class="noindent" >This feature helps the user to perform different types of analysis such as Operating - point analysis, <a - id="dx1-19001"></a>DC analysis, <a - id="dx1-19002"></a>AC analysis, <a - id="dx1-19003"></a>transient analysis. <a + point analysis, <a + id="dx1-19001"></a>DC analysis, <a + id="dx1-19002"></a>AC analysis, <a + id="dx1-19003"></a>transient analysis. <a id="dx1-19004"></a>It has the facility to <ul class="itemize2"> @@ -668,71 +668,71 @@ class="newline" /> </li> <li class="itemize">Insert values for analysis</li></ul> <!--l. 73--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-200004.1.2"></a>Source Details</h5> - <!--l. 74--><p class="noindent" >eSim sources are added from <span -class="cmtt-10x-x-109">eSim</span><span -class="cmtt-10x-x-109">_Sources </span>library. Source such as <span + <!--l. 74--><p class="noindent" >eSim sources are added from <span +class="cmtt-10x-x-109">eSim</span><span +class="cmtt-10x-x-109">_Sources </span>library. Source such as <span class="cmti-10x-x-109">SINE, AC, DC,</span> - <span + <span class="cmti-10x-x-109">PULSE </span>are in this library. The parameter values to all the sources added in the shcematic can be given through ’Source Details’. <!--l. 76--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-210004.1.2"></a>Ngspice Model</h5> - <!--l. 77--><p class="noindent" >Ngspice has in built model such as <span + <!--l. 77--><p class="noindent" >Ngspice has in built model such as <span class="cmti-10x-x-109">flipflop(D,SR,JK,T),gain,summer </span>etc. which can be utilised while building a circuit. eSim allows to add and modify Ngspice model parameter through Ngspice Model tab. <!--l. 80--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-220004.1.2"></a>Device Modeling</h5> - <!--l. 81--><p class="noindent" >Devices like <span + <!--l. 81--><p class="noindent" >Devices like <span class="cmti-10x-x-109">Diode, JFET, MOSFET, IGBT, MOS </span>etc used 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 are added to the corresponding devices used in the circuit. <!--l. 83--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-230004.1.2"></a>Subcircuits</h5> <!--l. 84--><p class="noindent" >Subcircuits are circuits within circuit. Subcircuiting helps to reuse the parts of the circuits. The subcircuits in the main circuits are added using this facility. Also, eSim provides us with the facility to edit already existing subcircuits. </li> - <li class="itemize">Simulation: The netlist generated using the <span + <li class="itemize">Simulation: The netlist generated using the <span class="cmti-10x-x-109">KiCad to Ngspice </span>converter is - simulated using simulation button. Clicking on the <span + simulated using simulation button. Clicking on the <span class="cmti-10x-x-109">Simulation </span>button will run the Ngspice simulation for current project. Python plotting window will open, as - shown in Fig. <a + shown in Fig. <a href="#x1-230014">4.4<!--tex4ht:ref: simulation-op --></a>. It shows the output waveform of current project. In the - Ngspice tab we can view the output plotted by Ngspice. <hr class="figure"><div class="figure" -><a - id="x1-230014"></a> <img -src="figures/simulation-op.png" alt="PIC" + Ngspice tab we can view the output plotted by Ngspice. <hr class="figure"><div class="figure" +><a + id="x1-230014"></a> <img +src="figures/simulation-op.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 4.4: </span><span +<br /> <div class="caption" +><span class="id">Figure 4.4: </span><span class="content">Simulation Output in Python Plotting Window</span></div><!--tex4ht:label?: x1-230014 --> <!--l. 94--><p class="noindent" ></div><hr class="endfigure"> </li> - <li class="itemize">Foot Print Editor: Clicking on the <span -class="cmti-10x-x-109">Footprint Editor </span>tool will open the <span + <li class="itemize">Foot Print Editor: Clicking on the <span +class="cmti-10x-x-109">Footprint Editor </span>tool will open the <span class="cmtt-10x-x-109">CvPcb</span> - <a + <a id="dx1-23002"></a>window. This window will ideally open the .net file for the current project. So, before using this tool, one should have the netlist for PCB design (a .net file). </li> - <li class="itemize">PCB Layout: Clicking on the <span -class="cmti-10x-x-109">Layout Editor </span>tool will open <span -class="cmtt-10x-x-109">Pcbnew</span><a + <li class="itemize">PCB Layout: Clicking on the <span +class="cmti-10x-x-109">Layout Editor </span>tool will open <span +class="cmtt-10x-x-109">Pcbnew</span><a id="dx1-23003"></a>, the layout editor used in eSim. In this window, one will create the PCB. It involves laying tracks and vias, performing optimum routing of tracks, creating one or more - copper layers for PCB, etc. It will be saved as a <span + copper layers for PCB, etc. It will be saved as a <span class="cmtt-10x-x-109">.brd </span>file in the current project directory. </li> @@ -744,15 +744,15 @@ class="cmtt-10x-x-109">.brd </span>file in the current project components having subcircuits and so on. This enables users to build commonly used circuits as subcircuits and then use it across circuits. For example, one can build a 12 Volt power supply as a subcircuit and then use it as just a single component across - circuits without having to recreate it. Clicking on <span + circuits without having to recreate it. Clicking on <span class="cmti-10x-x-109">Subcircuit Builder </span>tool will allow one to edit or create a subcircuit. <!--l. 126--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-240004.1.2"></a>Menubar</h5> <ul class="itemize2"> <li class="itemize">New Project: New projects are created in the eSim-workspace. When this - menu is selected, a new window opens up with <span + menu is selected, a new window opens up with <span class="cmtt-10x-x-109">Enter Project name </span>field. Type the name of the new project and click on OK. A project directory will be created in eSim-Workspace. The name of this folder will be the same as @@ -767,300 +767,300 @@ class="cmtt-10x-x-109">Enter Project name </span>field. <li class="itemize">Help: It opens user manual in the dockarea.</li></ul> <!--l. 141--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-250004.1.2"></a>Project Explorer</h5> <!--l. 142--><p class="noindent" >Project explorer has tree of all the project previously added in it. On right clicking the project we can simply remove or refresh the project in the explorer. Also on double/right clicking, the project file can be opened in the text editor which can then be edited. <!--l. 145--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-260004.1.2"></a>Dockarea</h5> <!--l. 146--><p class="noindent" >This area is used to open the following windows. <dl class="enumerate"><dt class="enumerate"> - 1. </dt><dd + 1. </dt><dd class="enumerate">KiCad to Ngspice converter </dd><dt class="enumerate"> - 2. </dt><dd + 2. </dt><dd class="enumerate">Ngspice plotting </dd><dt class="enumerate"> - 3. </dt><dd + 3. </dt><dd class="enumerate">Python plotting </dd><dt class="enumerate"> - 4. </dt><dd + 4. </dt><dd class="enumerate">Model builder </dd><dt class="enumerate"> - 5. </dt><dd + 5. </dt><dd class="enumerate">Subcircuit builder</dd></dl> <!--l. 155--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-270004.1.2"></a>Console Area</h5> <!--l. 156--><p class="noindent" >Console area provides information about the activity done in current project. </li></ul> - <h2 class="chapterHead"><span class="titlemark">Chapter 5</span><br /><a + <h2 class="chapterHead"><span class="titlemark">Chapter 5</span><br /><a id="x1-280005"></a>Schematic Creation</h2> The first step in the design of an electronic system is the -design of its circuit. This circuit is usually created using a <span -class="cmtt-10x-x-109">Schematic Editor</span><a +design of its circuit. This circuit is usually created using a <span +class="cmtt-10x-x-109">Schematic Editor</span><a id="dx1-28001"></a> and is called a -<span -class="cmtt-10x-x-109">Schematic</span>. <a - id="dx1-28002"></a>eSim uses <span -class="cmtt-10x-x-109">Eeschema</span> <a +<span +class="cmtt-10x-x-109">Schematic</span>. <a + id="dx1-28002"></a>eSim uses <span +class="cmtt-10x-x-109">Eeschema</span> <a id="dx1-28003"></a>as its schematic editor. Eeschema is the schematic editor of -KiCad. <a +KiCad. <a id="dx1-28004"></a>It is a powerful schematic editor software. It allows the creation and modification of components and symbol libraries and supports multiple hierarchical layers of printed circuit design. - <h3 class="sectionHead"><span class="titlemark">5.1 </span> <a + <h3 class="sectionHead"><span class="titlemark">5.1 </span> <a id="x1-290005.1"></a>Familiarizing the Schematic Editor interface</h3> -<!--l. 22--><p class="noindent" >Fig. <a +<!--l. 22--><p class="noindent" >Fig. <a href="#x1-290011">5.1<!--tex4ht:ref: eesch1 --></a> shows the schematic editor and the various menu and toolbars. We will explain them -briefly in this section. <hr class="figure"><div class="figure" +briefly in this section. <hr class="figure"><div class="figure" > -<a +<a id="x1-290011"></a> -<div class="center" +<div class="center" > <!--l. 25--><p class="noindent" > -<!--l. 26--><p class="noindent" ><img -src="figures/schematic1.png" alt="PIC" +<!--l. 26--><p class="noindent" ><img +src="figures/schematic1.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 5.1: </span><span +<br /> <div class="caption" +><span class="id">Figure 5.1: </span><span class="content">Schematic editor with the menu bar and toolbars marked</span></div><!--tex4ht:label?: x1-290011 --> </div> <!--l. 30--><p class="indent" > </div><hr class="endfigure"> - <h4 class="subsectionHead"><span class="titlemark">5.1.1 </span> <a + <h4 class="subsectionHead"><span class="titlemark">5.1.1 </span> <a id="x1-300005.1.1"></a>Top menu bar</h4> <!--l. 35--><p class="noindent" >The top menu bar will be available at the top left corner. Some of the important menu options in the top menu bar are: <dl class="compactenum"><dt class="compactenum"> - 1. </dt><dd + 1. </dt><dd class="compactenum">File - The file menu items are given below: <dl class="compactenum"><dt class="compactenum"> - (a) </dt><dd + (a) </dt><dd class="compactenum">New - Clear current schematic and start a new one </dd><dt class="compactenum"> - (b) </dt><dd + (b) </dt><dd class="compactenum">Open - Open a schematic </dd><dt class="compactenum"> - (c) </dt><dd + (c) </dt><dd class="compactenum">Open Recent - A list of recently opened files for loading </dd><dt class="compactenum"> - (d) </dt><dd + (d) </dt><dd class="compactenum">Save Whole Schematic project - Save current sheet and all its hierarchy. </dd><dt class="compactenum"> - (e) </dt><dd + (e) </dt><dd class="compactenum">Save Current Sheet Only - Save current sheet, but not others in a hierarchy. </dd><dt class="compactenum"> - (f) </dt><dd + (f) </dt><dd class="compactenum">Save Current sheet as - Save current sheet with a new name. </dd><dt class="compactenum"> - (g) </dt><dd -class="compactenum">Print - Access to print menu (See Fig. <a + (g) </dt><dd +class="compactenum">Print - Access to print menu (See Fig. <a href="#x1-300112">5.2<!--tex4ht:ref: print --></a>). </dd><dt class="compactenum"> - (h) </dt><dd + (h) </dt><dd class="compactenum">Plot - Plot the schematic in Postscript, HPGL, SVF or DXF format </dd><dt class="compactenum"> - (i) </dt><dd + (i) </dt><dd class="compactenum">Quit - Quit the schematic editor.</dd></dl> - <!--l. 53--><p class="noindent" ><hr class="figure"><div class="figure" -><a + <!--l. 53--><p class="noindent" ><hr class="figure"><div class="figure" +><a id="x1-300112"></a> -<div class="center" +<div class="center" > <!--l. 54--><p class="noindent" > -<!--l. 55--><p class="noindent" ><img -src="figures/print.png" alt="PIC" +<!--l. 55--><p class="noindent" ><img +src="figures/print.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 5.2: </span><span +<br /> <div class="caption" +><span class="id">Figure 5.2: </span><span class="content">Print options</span></div><!--tex4ht:label?: x1-300112 --> </div> <!--l. 59--><p class="noindent" ></div><hr class="endfigure"> </dd><dt class="compactenum"> - 2. </dt><dd + 2. </dt><dd class="compactenum">Place - The place menu has shortcuts for placing various items like components, wire - and junction, on to the schematic editor window. See Sec. <a + and junction, on to the schematic editor window. See Sec. <a href="#x1-340005.1.5">5.1.5<!--tex4ht:ref: short --></a> to know more about various shortcut keys (hotkeys). </dd><dt class="compactenum"> - 3. </dt><dd + 3. </dt><dd class="compactenum">Preferences - The preferences menu has the following options: <dl class="compactenum"><dt class="compactenum"> - (a) </dt><dd + (a) </dt><dd class="compactenum">Library - Select libraries and library paths </dd><dt class="compactenum"> - (b) </dt><dd + (b) </dt><dd class="compactenum">Colors - Select colors for various items. </dd><dt class="compactenum"> - (c) </dt><dd + (c) </dt><dd class="compactenum">Options - Display schematic editor options (Units, Grid size). </dd><dt class="compactenum"> - (d) </dt><dd + (d) </dt><dd class="compactenum">Language - Shows the current list of translations. Use default. </dd><dt class="compactenum"> - (e) </dt><dd -class="compactenum">Hotkeys - Access to the hot keys menu. See Sec. <a + (e) </dt><dd +class="compactenum">Hotkeys - Access to the hot keys menu. See Sec. <a href="#x1-340005.1.5">5.1.5<!--tex4ht:ref: short --></a> about hotkeys. </dd><dt class="compactenum"> - (f) </dt><dd + (f) </dt><dd class="compactenum">Read preferences - Read configuration file. </dd><dt class="compactenum"> - (g) </dt><dd + (g) </dt><dd class="compactenum">Save preferences - Save configuration file.</dd></dl> </dd></dl> <!--l. 79--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">5.1.2 </span> <a + <h4 class="subsectionHead"><span class="titlemark">5.1.2 </span> <a id="x1-310005.1.2"></a>Top toolbar</h4> -<a +<a id="dx1-31001"></a> -<a +<a id="dx1-31002"></a> <!--l. 80--><p class="noindent" >Some of the important tools in the top toolbar are discussed below. They are marked in -Fig. <a -href="#x1-310033">5.3<!--tex4ht:ref: eeschem2 --></a>. <hr class="figure"><div class="figure" +Fig. <a +href="#x1-310033">5.3<!--tex4ht:ref: eeschem2 --></a>. <hr class="figure"><div class="figure" > -<a +<a id="x1-310033"></a> -<!--l. 84--><p class="noindent" ><img -src="figures/toptoolbar.png" alt="PIC" +<!--l. 84--><p class="noindent" ><img +src="figures/toptoolbar.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 5.3: </span><span +<br /> <div class="caption" +><span class="id">Figure 5.3: </span><span class="content">Toolbar on top with important tools marked</span></div><!--tex4ht:label?: x1-310033 --> <!--l. 87--><p class="indent" > </div><hr class="endfigure"> <dl class="compactenum"><dt class="compactenum"> - 1. </dt><dd + 1. </dt><dd class="compactenum">Save - Save the current schematic </dd><dt class="compactenum"> - 2. </dt><dd + 2. </dt><dd class="compactenum">Library Editor - Create or edit components. </dd><dt class="compactenum"> - 3. </dt><dd + 3. </dt><dd class="compactenum">Library Browser - Browse through the various component libraries available </dd><dt class="compactenum"> - 4. </dt><dd + 4. </dt><dd class="compactenum">Navigate schematic hierarchy - Navigate among the root and sub-sheets in the hierarchy </dd><dt class="compactenum"> - 5. </dt><dd + 5. </dt><dd class="compactenum">Print - Print the schematic </dd><dt class="compactenum"> - 6. </dt><dd + 6. </dt><dd class="compactenum">Generate netlist - Generate a netlist for PCB design or for simulation. </dd><dt class="compactenum"> - 7. </dt><dd + 7. </dt><dd class="compactenum">Annotate - Annotate the schematic </dd><dt class="compactenum"> - 8. </dt><dd + 8. </dt><dd class="compactenum">Check ERC - Do Electric Rules Check for the schematic </dd><dt class="compactenum"> - 9. </dt><dd + 9. </dt><dd class="compactenum">Create BOM - Create a Bill of Materials of the schematic</dd></dl> - <h4 class="subsectionHead"><span class="titlemark">5.1.3 </span> <a + <h4 class="subsectionHead"><span class="titlemark">5.1.3 </span> <a id="x1-320005.1.3"></a>Toolbar on the right</h4> -<a +<a id="dx1-32001"></a> -<a +<a id="dx1-32002"></a> <!--l. 104--><p class="noindent" >The toolbar on the right side of the schematic editor window has many important tools. Some -of them are marked in Fig. <a -href="#x1-320034">5.4<!--tex4ht:ref: eeschem3 --></a>. <hr class="figure"><div class="figure" +of them are marked in Fig. <a +href="#x1-320034">5.4<!--tex4ht:ref: eeschem3 --></a>. <hr class="figure"><div class="figure" > -<a +<a id="x1-320034"></a> -<!--l. 108--><p class="noindent" ><img -src="figures/rightoolbar.png" alt="PIC" +<!--l. 108--><p class="noindent" ><img +src="figures/rightoolbar.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 5.4: </span><span +<br /> <div class="caption" +><span class="id">Figure 5.4: </span><span class="content">Toolbar on right with important tools marked</span></div><!--tex4ht:label?: x1-320034 --> <!--l. 111--><p class="indent" > </div><hr class="endfigure"> <!--l. 112--><p class="indent" > Let us now look at each of these tools and their uses. <dl class="compactenum"><dt class="compactenum"> - 1. </dt><dd -class="compactenum">Place a component - Load a component to the schematic. See Sec. <a + 1. </dt><dd +class="compactenum">Place a component - Load a component to the schematic. See Sec. <a href="#x1-360005.2.1">5.2.1<!--tex4ht:ref: selplace --></a> for more details. </dd><dt class="compactenum"> - 2. </dt><dd + 2. </dt><dd class="compactenum">Place a power port - Load a power port (Vcc, ground) to the schematic </dd><dt class="compactenum"> - 3. </dt><dd + 3. </dt><dd class="compactenum">Place wire - Draw wires to connect components in schematic </dd><dt class="compactenum"> - 4. </dt><dd + 4. </dt><dd class="compactenum">Place bus - Place a bus on the schematic </dd><dt class="compactenum"> - 5. </dt><dd + 5. </dt><dd class="compactenum">Place a no connect - Place a no connect flag, particularly useful in ICs </dd><dt class="compactenum"> - 6. </dt><dd + 6. </dt><dd class="compactenum">Place a local label - Place a label or node name which is local to the schematic </dd><dt class="compactenum"> - 7. </dt><dd + 7. </dt><dd class="compactenum">Place a global label - Place a global label (these are connected across all schematic diagrams in the hierarchy) </dd><dt class="compactenum"> - 8. </dt><dd + 8. </dt><dd class="compactenum">Place a text or comment - Place a text or comment in the schematic</dd></dl> - <h4 class="subsectionHead"><span class="titlemark">5.1.4 </span> <a + <h4 class="subsectionHead"><span class="titlemark">5.1.4 </span> <a id="x1-330005.1.4"></a>Toolbar on the left</h4> -<a +<a id="dx1-33001"></a> -<a +<a id="dx1-33002"></a> <!--l. 126--><p class="noindent" >Some of the important tools in the toolbar on the left are discussed below. They are marked -in Fig. <a -href="#x1-330035">5.5<!--tex4ht:ref: eeschem4 --></a>. <hr class="figure"><div class="figure" +in Fig. <a +href="#x1-330035">5.5<!--tex4ht:ref: eeschem4 --></a>. <hr class="figure"><div class="figure" > -<a +<a id="x1-330035"></a> -<!--l. 130--><p class="noindent" ><img -src="figures/lefttoolbar.png" alt="PIC" +<!--l. 130--><p class="noindent" ><img +src="figures/lefttoolbar.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 5.5: </span><span +<br /> <div class="caption" +><span class="id">Figure 5.5: </span><span class="content">Toolbar on left with important tools marked</span></div><!--tex4ht:label?: x1-330035 --> <!--l. 133--><p class="indent" > </div><hr class="endfigure"> <dl class="compactenum"><dt class="compactenum"> - 1. </dt><dd + 1. </dt><dd class="compactenum">Show/Hide grid - Show or Hide the grid in the schematic editor. Pressing the tool again hides (shows) the grid if it was shown (hidden) earlier. </dd><dt class="compactenum"> - 2. </dt><dd + 2. </dt><dd class="compactenum">Show hidden pins - Show hidden pins of certain components, for example, power pins of certain ICs.</dd></dl> - <h4 class="subsectionHead"><span class="titlemark">5.1.5 </span> <a + <h4 class="subsectionHead"><span class="titlemark">5.1.5 </span> <a id="x1-340005.1.5"></a>Hotkeys</h4> <!--l. 142--><p class="noindent" >A set of keyboard keys are associated with various operations in the schematic editor. These keys save time and make it easy to switch from one operation to another. The list of hotkeys -can be viewed by going to Preferences in the top menu bar. Choose <span +can be viewed by going to Preferences in the top menu bar. Choose <span class="cmti-10x-x-109">Hotkeys </span>and -select <span +select <span class="cmti-10x-x-109">List current keys</span>. The hotkeys can also be edited by selecting the option -<span +<span class="cmti-10x-x-109">Edit Hotkeys</span>. Some frequently used hotkeys, along with their functions, are given below: <ul> @@ -1094,12 +1094,12 @@ below: <li class="compactitem">T - Add text </li> <li class="compactitem">S - Add sheet</li></ul> -<!--l. 166--><p class="noindent" ><span +<!--l. 166--><p class="noindent" ><span class="cmti-10x-x-109">Note: Both lower and upper-case keys will work as hotkeys</span>. <!--l. 168--><p class="noindent" > - <h3 class="sectionHead"><span class="titlemark">5.2 </span> <a + <h3 class="sectionHead"><span class="titlemark">5.2 </span> <a id="x1-350005.2"></a>Schematic creation for simulation</h3> -<a +<a id="dx1-35001"></a> <!--l. 170--><p class="noindent" >There are certain differences between the schematic created for simulation and that created for PCB design. We need certain components like plots and current sources. For simulation @@ -1108,1436 +1108,1436 @@ whereas these are not needed for PCB design. For PCB design, we would require co these have no meaning in simulation. This section covers schematic creation for simulation. <!--l. 177--><p class="indent" > The first step in the creation of circuit schematic is the selection and placement of -required components. The components are grouped under eSim-libraries as shown in Fig. <a +required components. The components are grouped under eSim-libraries as shown in Fig. <a href="#x1-350026">5.6<!--tex4ht:ref: libraries --></a>. -<hr class="figure"><div class="figure" +<hr class="figure"><div class="figure" > -<a +<a id="x1-350026"></a> -<!--l. 181--><p class="noindent" ><img -src="figures/libraries.png" alt="PIC" +<!--l. 181--><p class="noindent" ><img +src="figures/libraries.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 5.6: </span><span +<br /> <div class="caption" +><span class="id">Figure 5.6: </span><span class="content">eSim-Components Libraries</span></div><!--tex4ht:label?: x1-350026 --> <!--l. 184--><p class="indent" > </div><hr class="endfigure"> - <h4 class="subsectionHead"><span class="titlemark">5.2.1 </span> <a + <h4 class="subsectionHead"><span class="titlemark">5.2.1 </span> <a id="x1-360005.2.1"></a>Selection and placement of components</h4> -<a +<a id="dx1-36001"></a> <!--l. 189--><p class="noindent" >We would need a resistor, a capacitor, a voltage source, ground terminal. To place a resistor -on the schematic editor window, select the <span +on the schematic editor window, select the <span class="cmti-10x-x-109">Place a component </span>tool from the toolbar on the right side and click anywhere on the schematic editor. This opens up the -component selection window. Resistor component can be found under <span -class="cmti-10x-x-109">eSim</span><span +component selection window. Resistor component can be found under <span +class="cmti-10x-x-109">eSim</span><span class="cmti-10x-x-109">_Devices</span> -library. Fig. <a +library. Fig. <a href="#x1-360027">5.7<!--tex4ht:ref: resistor --></a> shows the selection of resistor component. Click on OK. A resistor will be tied to the cursor. Place the resistor on the schematic editor by a single click. -<!--l. 196--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 196--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-360027"></a> -<!--l. 198--><p class="noindent" ><img -src="figures/resistor.png" alt="PIC" +<!--l. 198--><p class="noindent" ><img +src="figures/resistor.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 5.7: </span><span +<br /> <div class="caption" +><span class="id">Figure 5.7: </span><span class="content">Placing a resistor using the Place a Component tool</span></div><!--tex4ht:label?: x1-360027 --> <!--l. 201--><p class="indent" > </div><hr class="endfigure"> <!--l. 202--><p class="indent" > To place the next component, i.e., capacitor, click again on the schematic editor.Similarly, -Capacitor component is found under <span -class="cmti-10x-x-109">eSim</span><span +Capacitor component is found under <span +class="cmti-10x-x-109">eSim</span><span class="cmti-10x-x-109">_Devices </span>library. Click on OK. Place the capacitor on the schematic editor by a single click. Let us now place a sinusoidal voltage source. This is required for performing transient analysis. To place it, click again on the schematic editor. On -the component selection window, choose the library <span -class="cmti-10x-x-109">eSim</span><span +the component selection window, choose the library <span +class="cmti-10x-x-109">eSim</span><span class="cmti-10x-x-109">_source </span>by double clicking on it. -Select the component <span +Select the component <span class="cmtt-10x-x-109">SINE </span>and click on OK. Place the sine source on the schematic editor by a single click. -<!--l. 211--><p class="indent" > Place the component by clicking on the schematic editor. Similarly place <span +<!--l. 211--><p class="indent" > Place the component by clicking on the schematic editor. Similarly place <span class="cmtt-10x-x-109">gnd</span>, a ground -terminal and <span -class="cmtt-10x-x-109">power</span><span -class="cmtt-10x-x-109">_flag </span>under <span +terminal and <span +class="cmtt-10x-x-109">power</span><span +class="cmtt-10x-x-109">_flag </span>under <span class="cmtt-10x-x-109">power </span>library. Once all the components are placed, the -schematic editor would look like the Fig. <a -href="#x1-360038">5.8<!--tex4ht:ref: afterplace --></a>. <hr class="figure"><div class="figure" +schematic editor would look like the Fig. <a +href="#x1-360038">5.8<!--tex4ht:ref: afterplace --></a>. <hr class="figure"><div class="figure" > -<a +<a id="x1-360038"></a> -<!--l. 216--><p class="noindent" ><img -src="figures/afterplace.png" alt="PIC" +<!--l. 216--><p class="noindent" ><img +src="figures/afterplace.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 5.8: </span><span +<br /> <div class="caption" +><span class="id">Figure 5.8: </span><span class="content">All RC circuit components placed</span></div><!--tex4ht:label?: x1-360038 --> <!--l. 219--><p class="indent" > </div><hr class="endfigure"> <!--l. 220--><p class="indent" > Let us rotate the resistor to complete the circuit. To rotate the resistor, place the cursor -on the resistor and press the key <span -class="cmtt-10x-x-109">R</span>. Note that if the cursor is placed above the letter <span +on the resistor and press the key <span +class="cmtt-10x-x-109">R</span>. Note that if the cursor is placed above the letter <span class="cmtt-10x-x-109">R </span>(not -<span -class="cmtt-10x-x-109">R?</span>) on the resistor, it asks to clarify selection. Choose the option <span +<span +class="cmtt-10x-x-109">R?</span>) on the resistor, it asks to clarify selection. Choose the option <span class="cmti-10x-x-109">Component R</span>. This can be -avoided by placing the cursor slightly away from the letter R as shown in Fig. <a +avoided by placing the cursor slightly away from the letter R as shown in Fig. <a href="#x1-360059">5.9<!--tex4ht:ref: rotate --></a>. This -applies to all components.<a - id="dx1-36004"></a> <hr class="figure"><div class="figure" +applies to all components.<a + id="dx1-36004"></a> <hr class="figure"><div class="figure" > -<a +<a id="x1-360059"></a> -<!--l. 228--><p class="noindent" ><img -src="figures/rotate.png" alt="PIC" +<!--l. 228--><p class="noindent" ><img +src="figures/rotate.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 5.9: </span><span +<br /> <div class="caption" +><span class="id">Figure 5.9: </span><span class="content">Placing the cursor (cross mark) slightly away from the letter R</span></div><!--tex4ht:label?: x1-360059 --> <!--l. 231--><p class="indent" > </div><hr class="endfigure"> <!--l. 232--><p class="indent" > If one wants to move a component, place the cursor on top of the component and press the -key <span +key <span class="cmtt-10x-x-109">M</span>. The component will be tied to the cursor and can be moved in any direction. -<a +<a id="dx1-36006"></a> - <h4 class="subsectionHead"><span class="titlemark">5.2.2 </span> <a + <h4 class="subsectionHead"><span class="titlemark">5.2.2 </span> <a id="x1-370005.2.2"></a>Wiring the circuit</h4> -<a +<a id="dx1-37001"></a> <!--l. 238--><p class="noindent" >The next step is to wire the connections. Let us connect the resistor to the capacitor. To do so, point the cursor to the terminal of resistor to be connected and press -the key <span +the key <span class="cmtt-10x-x-109">W</span>. It has now changed to the wiring mode. Move the cursor towards the -terminal of the capacitor and click on it. A wire is formed as shown in Fig. <a +terminal of the capacitor and click on it. A wire is formed as shown in Fig. <a href="#x1-37002r1">5.10a<!--tex4ht:ref: wire1 --></a>. -<hr class="figure"><div class="figure" +<hr class="figure"><div class="figure" > -<a +<a id="x1-3700510"></a> -<a +<a id="x1-37002r1"></a> -<!--l. 248--><p class="noindent" > <img -src="figures/wire1.png" alt="PIC" +<!--l. 248--><p class="noindent" > <img +src="figures/wire1.png" alt="PIC" > -<span +<span class="cmr-9">(a)</span> -<span +<span class="cmr-9">Initial</span> -<span -class="cmr-9">stages</span> <a - id="x1-37003r2"></a> <img -src="figures/wirefin.png" alt="PIC" +<span +class="cmr-9">stages</span> <a + id="x1-37003r2"></a> <img +src="figures/wirefin.png" alt="PIC" > - <span + <span class="cmr-9">(b)</span> - <span + <span class="cmr-9">Wiring</span> - <span -class="cmr-9">done</span> <a - id="x1-37004r3"></a> <img -src="figures/schemfin.png" alt="PIC" + <span +class="cmr-9">done</span> <a + id="x1-37004r3"></a> <img +src="figures/schemfin.png" alt="PIC" > - <span + <span class="cmr-9">(c)</span> - <span + <span class="cmr-9">Final</span> - <span + <span class="cmr-9">schematic</span> - <span + <span class="cmr-9">with</span> - <span -class="cmr-9">PWR</span><span + <span +class="cmr-9">PWR</span><span class="cmr-9">_FLAG</span> -<br /> <div class="caption" -><span class="id">Figure 5.10: </span><span +<br /> <div class="caption" +><span class="id">Figure 5.10: </span><span class="content">Various stages of wiring</span></div><!--tex4ht:label?: x1-3700510 --> <!--l. 256--><p class="indent" > </div><hr class="endfigure"> <!--l. 257--><p class="indent" > Similarly connect the wires between all terminals and the final schematic would look like -Fig. <a +Fig. <a href="#x1-37003r2">5.10b<!--tex4ht:ref: wirefin --></a>. - <h4 class="subsectionHead"><span class="titlemark">5.2.3 </span> <a + <h4 class="subsectionHead"><span class="titlemark">5.2.3 </span> <a id="x1-380005.2.3"></a>Assigning values to components</h4> -<a +<a id="dx1-38001"></a> <!--l. 261--><p class="noindent" >We need to assign values to the components in our circuit i.e., resistor and capacitor. Note that the sine voltage source has been placed for simulation. The specifications of sine source will be given during simulation. To assign value to the resistor, place the cursor above the -letter <span -class="cmtt-10x-x-109">R </span>(not <span -class="cmtt-10x-x-109">R?</span>) and press the key <span -class="cmtt-10x-x-109">E</span>. Choose <span -class="cmti-10x-x-109">Field value</span>. Type <span -class="cmtt-10x-x-109">1k </span>in the <span +letter <span +class="cmtt-10x-x-109">R </span>(not <span +class="cmtt-10x-x-109">R?</span>) and press the key <span +class="cmtt-10x-x-109">E</span>. Choose <span +class="cmti-10x-x-109">Field value</span>. Type <span +class="cmtt-10x-x-109">1k </span>in the <span class="cmti-10x-x-109">Edit value field </span>box -as shown in Fig. <a -href="#x1-3800211">5.11<!--tex4ht:ref: field --></a>. 1k means 1<span -class="cmmi-10x-x-109">k</span>Ω. Similarly give the value <span +as shown in Fig. <a +href="#x1-3800211">5.11<!--tex4ht:ref: field --></a>. 1k means 1<span +class="cmmi-10x-x-109">k</span>Ω. Similarly give the value <span class="cmtt-10x-x-109">1u </span>for the capacitor. 1u means -1<span +1<span class="cmmi-10x-x-109">μF</span>. -<!--l. 271--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 271--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-3800211"></a> -<!--l. 273--><p class="noindent" ><img -src="figures/field.png" alt="PIC" +<!--l. 273--><p class="noindent" ><img +src="figures/field.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 5.11: </span><span +<br /> <div class="caption" +><span class="id">Figure 5.11: </span><span class="content">Editing value of resistor</span></div><!--tex4ht:label?: x1-3800211 --> <!--l. 276--><p class="indent" > </div><hr class="endfigure"> - <h4 class="subsectionHead"><span class="titlemark">5.2.4 </span> <a + <h4 class="subsectionHead"><span class="titlemark">5.2.4 </span> <a id="x1-390005.2.4"></a>Annotation and ERC</h4> -<a +<a id="dx1-39001"></a> -<a +<a id="dx1-39002"></a> -<a +<a id="dx1-39003"></a> -<a +<a id="dx1-39004"></a> <!--l. 280--><p class="noindent" >The next step is to annotate the schematic. Annotation gives unique references to the -components. To annotate the schematic, click on <span +components. To annotate the schematic, click on <span class="cmti-10x-x-109">Annotate schematic </span>tool from the -top toolbar. Click on <span -class="cmtt-10x-x-109">annotation</span>, then click on <span +top toolbar. Click on <span +class="cmtt-10x-x-109">annotation</span>, then click on <span class="cmtt-10x-x-109">OK </span>and finally click on close as -shown in Fig. <a +shown in Fig. <a href="#x1-3900813">5.13<!--tex4ht:ref: anno --></a>. The schematic is now annotated. The question marks next to component references have been replaced by unique numbers. If there are more than one instance of a component (say resistor), the annotation will be done as R1, R2, etc. -<!--l. 289--><p class="indent" > Let us now do <span -class="cmtt-10x-x-109">ERC </span>or <span -class="cmtt-10x-x-109">Electric Rules Check</span>. To do so, click on <span +<!--l. 289--><p class="indent" > Let us now do <span +class="cmtt-10x-x-109">ERC </span>or <span +class="cmtt-10x-x-109">Electric Rules Check</span>. To do so, click on <span class="cmti-10x-x-109">Perform electric rules</span> -<span -class="cmti-10x-x-109">check </span>tool from the top toolbar. Click on <span -class="cmti-10x-x-109">Test Erc </span>button. The error as shown in Fig. <a +<span +class="cmti-10x-x-109">check </span>tool from the top toolbar. Click on <span +class="cmti-10x-x-109">Test Erc </span>button. The error as shown in Fig. <a href="#x1-3900712">5.12<!--tex4ht:ref: erc --></a> -may be displayed. Click on close in the test erc<a - id="dx1-39005"></a> window. <a - id="dx1-39006"></a><hr class="figure"><div class="figure" +may be displayed. Click on close in the test erc<a + id="dx1-39005"></a> window. <a + id="dx1-39006"></a><hr class="figure"><div class="figure" > -<a +<a id="x1-3900712"></a> -<!--l. 296--><p class="noindent" ><img -src="figures/erc2.png" alt="PIC" +<!--l. 296--><p class="noindent" ><img +src="figures/erc2.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 5.12: </span><span +<br /> <div class="caption" +><span class="id">Figure 5.12: </span><span class="content">ERC error</span></div><!--tex4ht:label?: x1-3900712 --> <!--l. 299--><p class="indent" > </div><hr class="endfigure"> -<!--l. 300--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 300--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-3900813"></a> -<!--l. 302--><p class="noindent" ><img -src="figures/anno.png" alt="PIC" +<!--l. 302--><p class="noindent" ><img +src="figures/anno.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 5.13: </span><span +<br /> <div class="caption" +><span class="id">Figure 5.13: </span><span class="content">Steps in annotating a schematic: 1. First click on Annotation then 2. Click on Ok then 3. Click on close</span></div><!--tex4ht:label?: x1-3900813 --> <!--l. 305--><p class="indent" > </div><hr class="endfigure"> <!--l. 306--><p class="indent" > There will be a green arrow pointing to the source of error in the schematic. Here it points -to the ground terminal. This is shown in Fig. <a -href="#x1-3900914">5.14<!--tex4ht:ref: ercgnd --></a>. <hr class="figure"><div class="figure" +to the ground terminal. This is shown in Fig. <a +href="#x1-3900914">5.14<!--tex4ht:ref: ercgnd --></a>. <hr class="figure"><div class="figure" > -<a +<a id="x1-3900914"></a> -<!--l. 311--><p class="noindent" ><img -src="figures/ercgnd.png" alt="PIC" +<!--l. 311--><p class="noindent" ><img +src="figures/ercgnd.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 5.14: </span><span +<br /> <div class="caption" +><span class="id">Figure 5.14: </span><span class="content">Green arrow pointing to Ground terminal indicating an ERC error</span></div><!--tex4ht:label?: x1-3900914 --> <!--l. 314--><p class="indent" > </div><hr class="endfigure"> -<!--l. 315--><p class="indent" > To correct this error, place a <span -class="cmtt-10x-x-109">PWR</span><span -class="cmtt-10x-x-109">_FLAG </span>from the Eeschema library <span -class="cmti-10x-x-109">power</span>. <a +<!--l. 315--><p class="indent" > To correct this error, place a <span +class="cmtt-10x-x-109">PWR</span><span +class="cmtt-10x-x-109">_FLAG </span>from the Eeschema library <span +class="cmti-10x-x-109">power</span>. <a id="dx1-39010"></a>Connect the -power flag to the ground terminal as shown in Fig. <a -href="#x1-37004r3">5.10c<!--tex4ht:ref: schemfin --></a>. One needs to place <span -class="cmtt-10x-x-109">PWR</span><span +power flag to the ground terminal as shown in Fig. <a +href="#x1-37004r3">5.10c<!--tex4ht:ref: schemfin --></a>. One needs to place <span +class="cmtt-10x-x-109">PWR</span><span class="cmtt-10x-x-109">_FLAG</span> -wherever the error shown in Fig. <a +wherever the error shown in Fig. <a href="#x1-3900712">5.12<!--tex4ht:ref: erc --></a> is obtained. Repeat the ERC. Now there are no errors. With this we have created the schematic for simulation. - <h4 class="subsectionHead"><span class="titlemark">5.2.5 </span> <a + <h4 class="subsectionHead"><span class="titlemark">5.2.5 </span> <a id="x1-400005.2.5"></a>Netlist generation</h4> -<a +<a id="dx1-40001"></a> <!--l. 326--><p class="noindent" >To simulate the circuit that has been created in the previous section, we need to generate its -netlist. <span +netlist. <span class="cmtt-10x-x-109">Netlist </span>is a list of components in the schematic along with their connection -information. <a - id="dx1-40002"></a>To do so, click on the <span +information. <a + id="dx1-40002"></a>To do so, click on the <span class="cmti-10x-x-109">Generate netlist </span>tool from the top toolbar. Click on spice -from the window that opens up. Check the option <span -class="cmtt-10x-x-109">Default Format</span>. Then click on <span +from the window that opens up. Check the option <span +class="cmtt-10x-x-109">Default Format</span>. Then click on <span class="cmti-10x-x-109">Generate</span>. -This is shown in Fig. <a -href="#x1-4000315">5.15<!--tex4ht:ref: chap5net --></a>. Save the netlist. This will be a <span +This is shown in Fig. <a +href="#x1-4000315">5.15<!--tex4ht:ref: chap5net --></a>. Save the netlist. This will be a <span class="cmtt-10x-x-109">.cir </span>file. Do not change the -directory while saving. <hr class="figure"><div class="figure" +directory while saving. <hr class="figure"><div class="figure" > -<a +<a id="x1-4000315"></a> -<!--l. 337--><p class="noindent" ><img -src="figures/netlist.png" alt="PIC" +<!--l. 337--><p class="noindent" ><img +src="figures/netlist.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 5.15: </span><span +<br /> <div class="caption" +><span class="id">Figure 5.15: </span><span class="content">Steps in generating a Netlist for simulation: 1. Click on Spice then 2. -Check the option <span +Check the option <span class="cmtt-10x-x-109">Default Format </span>then 3. Click on Generate </span></div><!--tex4ht:label?: x1-4000315 --> <!--l. 340--><p class="indent" > </div><hr class="endfigure"> -<!--l. 341--><p class="indent" > Now the netlist is ready to be simulated. Refer to <span class="cite"> [<a -href="#Xkicad">15</a>]</span> or <span class="cite"> [<a +<!--l. 341--><p class="indent" > Now the netlist is ready to be simulated. Refer to <span class="cite"> [<a +href="#Xkicad">15</a>]</span> or <span class="cite"> [<a href="#Xkicad2">16</a>]</span> to know more about Eeschema. - <h2 class="chapterHead"><span class="titlemark">Chapter 6</span><br /><a - id="x1-410006"></a>PCB Design</h2> Printed Circuit Board (PCB) <a + <h2 class="chapterHead"><span class="titlemark">Chapter 6</span><br /><a + id="x1-410006"></a>PCB Design</h2> Printed Circuit Board (PCB) <a id="dx1-41001"></a>design is an important step in electronic system design. Every component of the circuit needs to be placed and connections routed to minimise delay and area. Each component has an associated footprint. Footprint -refers to the physical layout of a component that is required to mount it on the PCB.<a - id="dx1-41002"></a> <a +refers to the physical layout of a component that is required to mount it on the PCB.<a + id="dx1-41002"></a> <a id="dx1-41003"></a>PCB design involves associating footprints to all components, placing them appropriately to minimise wire length and area, connecting the footprints using tracks/vias and finally extracting the required files needed for printing the PCB. Let us see the steps to design PCB using eSim. - <h3 class="sectionHead"><span class="titlemark">6.1 </span> <a + <h3 class="sectionHead"><span class="titlemark">6.1 </span> <a id="x1-420006.1"></a>Schematic creation for PCB design</h3> -<!--l. 16--><p class="noindent" >In Chapter <a +<!--l. 16--><p class="noindent" >In Chapter <a href="#x1-610009">9<!--tex4ht:ref: chap5 --></a>, we will see the differences between schematic for simulation and schematic for PCB design. Let us design the PCB for a RC circuit. A resistor, capacitor, ground, power flag and a connector are required. Connectors are used to take signals in and out of the PCB. -<!--l. 22--><p class="indent" > Create the circuit schematic as shown in Fig. <a -href="#x1-420011">6.1<!--tex4ht:ref: pcbschfin --></a>. The two pin connector (<span -class="cmti-10x-x-109">CONN</span><span +<!--l. 22--><p class="indent" > Create the circuit schematic as shown in Fig. <a +href="#x1-420011">6.1<!--tex4ht:ref: pcbschfin --></a>. The two pin connector (<span +class="cmti-10x-x-109">CONN</span><span class="cmti-10x-x-109">_2</span>) can -be placed from the Eeschema library <span +be placed from the Eeschema library <span class="cmti-10x-x-109">conn</span>. Do the annotation and test for ERC. Refer to -Chapter <a +Chapter <a href="#x1-610009">9<!--tex4ht:ref: chap5 --></a> to know more about basic steps in schematic creation. -<!--l. 28--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 28--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-420011"></a> -<!--l. 30--><p class="noindent" ><img -src="figures/pcbschfin.png" alt="PIC" +<!--l. 30--><p class="noindent" ><img +src="figures/pcbschfin.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.1: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.1: </span><span class="content">Final circuit schematic for RC low pass circuit</span></div><!--tex4ht:label?: x1-420011 --> <!--l. 33--><p class="indent" > </div><hr class="endfigure"> - <h4 class="subsectionHead"><span class="titlemark">6.1.1 </span> <a + <h4 class="subsectionHead"><span class="titlemark">6.1.1 </span> <a id="x1-430006.1.1"></a>Netlist generation for PCB</h4> -<a +<a id="dx1-43001"></a> -<a +<a id="dx1-43002"></a> <!--l. 38--><p class="noindent" >The netlist for PCB is different from that for simulation. To generate netlist for PCB, click on -the <span +the <span class="cmti-10x-x-109">Generate netlist </span>tool from the top toolbar in Schematic editor. In the Netlist window, -under the tab <span -class="cmti-10x-x-109">Pcbnew</span>, <a - id="dx1-43003"></a>click on the button <span -class="cmti-10x-x-109">Netlist</span>. This is shown in Fig. <a +under the tab <span +class="cmti-10x-x-109">Pcbnew</span>, <a + id="dx1-43003"></a>click on the button <span +class="cmti-10x-x-109">Netlist</span>. This is shown in Fig. <a href="#x1-430042">6.2<!--tex4ht:ref: netlistpcb --></a>. Click on -<span +<span class="cmti-10x-x-109">Save </span>in the Save netlist file dialog box that opens up. Do not change the directory or the name of the netlist file. Save the schematic and close the schematic editor. -<hr class="figure"><div class="figure" +<hr class="figure"><div class="figure" > -<a +<a id="x1-430042"></a> -<!--l. 48--><p class="noindent" ><img -src="figures/netlistpcb.png" alt="PIC" +<!--l. 48--><p class="noindent" ><img +src="figures/netlistpcb.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.2: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.2: </span><span class="content">Netlist generation for PCB</span></div><!--tex4ht:label?: x1-430042 --> <!--l. 51--><p class="indent" > </div><hr class="endfigure"> -<!--l. 52--><p class="indent" > <span -class="cmti-10x-x-109">Note that the netlist for PCB has an extension </span><span -class="cmtt-10x-x-109">.net</span><span +<!--l. 52--><p class="indent" > <span +class="cmti-10x-x-109">Note that the netlist for PCB has an extension </span><span +class="cmtt-10x-x-109">.net</span><span class="cmti-10x-x-109">. The netlist created for simulation</span> -<span -class="cmti-10x-x-109">has an extension </span><span +<span +class="cmti-10x-x-109">has an extension </span><span class="cmtt-10x-x-109">.cir</span>. - <h4 class="subsectionHead"><span class="titlemark">6.1.2 </span> <a + <h4 class="subsectionHead"><span class="titlemark">6.1.2 </span> <a id="x1-440006.1.2"></a>Mapping of components using Footprint Editor</h4> -<a +<a id="dx1-44001"></a> -<a +<a id="dx1-44002"></a> -<a +<a id="dx1-44003"></a> <!--l. 59--><p class="noindent" >Once the netlist for PCB is created, one needs to map each component in the netlist to a -footprint. The tool <span -class="cmti-10x-x-109">Footprint Editor </span>is used for this. eSim uses <span +footprint. The tool <span +class="cmti-10x-x-109">Footprint Editor </span>is used for this. eSim uses <span class="cmtt-10x-x-109">CvPcb </span>as its footprint editor. -<span -class="cmtt-10x-x-109">CvPcb </span>is the footprint editor tool in KiCad. <a +<span +class="cmtt-10x-x-109">CvPcb </span>is the footprint editor tool in KiCad. <a id="dx1-44004"></a> <!--l. 64--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">6.1.3 </span> <a + <h4 class="subsectionHead"><span class="titlemark">6.1.3 </span> <a id="x1-450006.1.3"></a>Familiarising the Footprint Editor tool</h4> -<a +<a id="dx1-45001"></a> -<!--l. 67--><p class="noindent" >If one opens the <span -class="cmti-10x-x-109">Footprint Editor </span>after creating the <span +<!--l. 67--><p class="noindent" >If one opens the <span +class="cmti-10x-x-109">Footprint Editor </span>after creating the <span class="cmtt-10x-x-109">.net </span>netlist file, the Footprint editor as -shown in Fig. <a +shown in Fig. <a href="#x1-450023">6.3<!--tex4ht:ref: fe --></a> will be obtained. The menu bar and toolbars and the panes are marked in this figure. The menu bar will be available in the top left corner. The left pane has a list of components in the netlist file and the right pane has a list of available footprints for each -component. <hr class="figure"><div class="figure" +component. <hr class="figure"><div class="figure" > -<a +<a id="x1-450023"></a> -<!--l. 75--><p class="noindent" ><img -src="figures/fe.png" alt="PIC" +<!--l. 75--><p class="noindent" ><img +src="figures/fe.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.3: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.3: </span><span class="content">Footprint editor with the menu bar, toolbar, left pane and right pane marked</span></div><!--tex4ht:label?: x1-450023 --> <!--l. 78--><p class="indent" > </div><hr class="endfigure"> -<!--l. 79--><p class="indent" > <span +<!--l. 79--><p class="indent" > <span class="cmti-10x-x-109">Note that if the Footprint Editor is opened before creating a ‘.net’ file, then the left and</span> -<span +<span class="cmti-10x-x-109">right panes will be empty</span>. - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-460006.1.3"></a>Toolbar</h5> -<!--l. 82--><p class="noindent" >Some of the important tools in the toolbar are shown in Fig. <a +<!--l. 82--><p class="noindent" >Some of the important tools in the toolbar are shown in Fig. <a href="#x1-460014">6.4<!--tex4ht:ref: tb_fe --></a>. They are explained below: -<hr class="figure"><div class="figure" +<hr class="figure"><div class="figure" > -<a +<a id="x1-460014"></a> -<!--l. 86--><p class="noindent" ><img -src="figures/tb_fe.png" alt="PIC" +<!--l. 86--><p class="noindent" ><img +src="figures/tb_fe.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.4: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.4: </span><span class="content">Some important tools in the toolbar</span></div><!--tex4ht:label?: x1-460014 --> <!--l. 89--><p class="indent" > </div><hr class="endfigure"> <dl class="compactenum"><dt class="compactenum"> - 1. </dt><dd + 1. </dt><dd class="compactenum">Save netlist and footprint files - Save the netlist and the footprints that are associated with it. </dd><dt class="compactenum"> - 2. </dt><dd -class="compactenum">View selected footprint - View the selected footprint in 2D. See Sec. <a + 2. </dt><dd +class="compactenum">View selected footprint - View the selected footprint in 2D. See Sec. <a href="#x1-470006.1.4">6.1.4<!--tex4ht:ref: viewfp --></a> for more details. </dd><dt class="compactenum"> - 3. </dt><dd + 3. </dt><dd class="compactenum">Automatic footprint association - Perform footprint association for each component automatically. Footprints will be selected from the list of footprints available. </dd><dt class="compactenum"> - 4. </dt><dd + 4. </dt><dd class="compactenum">Delete all associations - Delete all the footprint associations made </dd><dt class="compactenum"> - 5. </dt><dd + 5. </dt><dd class="compactenum">Display filtered footprint list - Display a filtered list of footprints suitable to the selected component </dd><dt class="compactenum"> - 6. </dt><dd + 6. </dt><dd class="compactenum">Display full footprint list - Display the list of all footprints available (without filtering)</dd></dl> - <h4 class="subsectionHead"><span class="titlemark">6.1.4 </span> <a + <h4 class="subsectionHead"><span class="titlemark">6.1.4 </span> <a id="x1-470006.1.4"></a>Viewing footprints in 2D and 3D</h4> -<a +<a id="dx1-47001"></a> -<a +<a id="dx1-47002"></a> -<!--l. 110--><p class="noindent" >To view a footprint in 2D, select it from the right pane and click on <span +<!--l. 110--><p class="noindent" >To view a footprint in 2D, select it from the right pane and click on <span class="cmti-10x-x-109">View selected footprint</span> -from the menu bar. Let us view the footprint for <span +from the menu bar. Let us view the footprint for <span class="cmtt-10x-x-109">SM1210</span>. Choose SM1210 from -the right pane as shown in Fig. <a -href="#x1-470035">6.5<!--tex4ht:ref: sm --></a>. On clicking the <span +the right pane as shown in Fig. <a +href="#x1-470035">6.5<!--tex4ht:ref: sm --></a>. On clicking the <span class="cmti-10x-x-109">View selected footprint </span>tool, -the <span -class="cmtt-10x-x-109">Footprint </span>window with the view in 2D will be displayed. Click on the <span +the <span +class="cmtt-10x-x-109">Footprint </span>window with the view in 2D will be displayed. Click on the <span class="cmti-10x-x-109">3D</span> -tool in the <span -class="cmtt-10x-x-109">Footprint </span>window, as shown in Fig. <a +tool in the <span +class="cmtt-10x-x-109">Footprint </span>window, as shown in Fig. <a href="#x1-470046">6.6<!--tex4ht:ref: 3d --></a>. A top view of the selected footprint in 3D is obtained. Click on the footprint and rotate it using mouse to get 3D views from various angles. One such side view of the footprint in 3D is shown in -Fig. <a +Fig. <a href="#x1-470057">6.7<!--tex4ht:ref: 3dv --></a>. -<!--l. 121--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 121--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-470035"></a> -<!--l. 123--><p class="noindent" ><img -src="figures/sm.png" alt="PIC" +<!--l. 123--><p class="noindent" ><img +src="figures/sm.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.5: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.5: </span><span class="content">Viewing footprint for SM1210: 1. Choose the footprint SM1210 from the -right pane, 2. Click on <span +right pane, 2. Click on <span class="cmti-10x-x-109">View selected footprint</span></span></div><!--tex4ht:label?: x1-470035 --> <!--l. 127--><p class="indent" > </div><hr class="endfigure"> -<!--l. 128--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 128--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-470046"></a> -<!--l. 130--><p class="noindent" ><img -src="figures/3d.png" alt="PIC" +<!--l. 130--><p class="noindent" ><img +src="figures/3d.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.6: </span><span -class="content">Footprint view in 2D. Click on <span +<br /> <div class="caption" +><span class="id">Figure 6.6: </span><span +class="content">Footprint view in 2D. Click on <span class="cmti-10x-x-109">3D </span>to get 3D view</span></div><!--tex4ht:label?: x1-470046 --> <!--l. 133--><p class="indent" > </div><hr class="endfigure"> -<!--l. 134--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 134--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-470057"></a> -<!--l. 136--><p class="noindent" ><img -src="figures/3dv.png" alt="PIC" +<!--l. 136--><p class="noindent" ><img +src="figures/3dv.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.7: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.7: </span><span class="content">Side view of the footprint in 3D</span></div><!--tex4ht:label?: x1-470057 --> <!--l. 139--><p class="indent" > </div><hr class="endfigure"> - <h4 class="subsectionHead"><span class="titlemark">6.1.5 </span> <a + <h4 class="subsectionHead"><span class="titlemark">6.1.5 </span> <a id="x1-480006.1.5"></a>Mapping of components in the RC circuit</h4> -<!--l. 142--><p class="noindent" >Click on <span -class="cmtt-10x-x-109">C1 </span>from the left pane. Choose the footprint <span +<!--l. 142--><p class="noindent" >Click on <span +class="cmtt-10x-x-109">C1 </span>from the left pane. Choose the footprint <span class="cmti-10x-x-109">C1 </span>from the right pane by double -clicking on it. Click on connector <span -class="cmtt-10x-x-109">P1 </span>from the left pane. Choose the footprint <span +clicking on it. Click on connector <span +class="cmtt-10x-x-109">P1 </span>from the left pane. Choose the footprint <span class="cmti-10x-x-109">SIL-2 </span>from the -right pane by double clicking on it. Similarly choose the footprint <span -class="cmti-10x-x-109">R3 </span>for the resistor <span +right pane by double clicking on it. Similarly choose the footprint <span +class="cmti-10x-x-109">R3 </span>for the resistor <span class="cmtt-10x-x-109">R1</span>. The -footprint mapping is shown in Fig. <a -href="#x1-480018">6.8<!--tex4ht:ref: map --></a>. Save the footprint association by clicking on the <span +footprint mapping is shown in Fig. <a +href="#x1-480018">6.8<!--tex4ht:ref: map --></a>. Save the footprint association by clicking on the <span class="cmti-10x-x-109">Save</span> -<span -class="cmti-10x-x-109">netlist and footprint files </span>tool from the <span -class="cmtt-10x-x-109">CvPcb </span>toolbar. The <span +<span +class="cmti-10x-x-109">netlist and footprint files </span>tool from the <span +class="cmtt-10x-x-109">CvPcb </span>toolbar. The <span class="cmtt-10x-x-109">Save Net and component List</span> window appears. Browse to the directory where the schematic file for this project is saved and -click on <span -class="cmti-10x-x-109">Save</span>. The netlist gets saved and the <span +click on <span +class="cmti-10x-x-109">Save</span>. The netlist gets saved and the <span class="cmti-10x-x-109">Footprint Editor </span>window closes automatically. -<hr class="figure"><div class="figure" +<hr class="figure"><div class="figure" > -<a +<a id="x1-480018"></a> -<!--l. 155--><p class="noindent" ><img -src="figures/map.png" alt="PIC" +<!--l. 155--><p class="noindent" ><img +src="figures/map.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.8: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.8: </span><span class="content">Footprint mapping done</span></div><!--tex4ht:label?: x1-480018 --> <!--l. 158--><p class="indent" > </div><hr class="endfigure"> -<!--l. 159--><p class="indent" > <span +<!--l. 159--><p class="indent" > <span class="cmti-10x-x-109">Note that one needs to browse to the directory where the schematic file is saved and save</span> -<span +<span class="cmti-10x-x-109">the ‘.net’ file in the same directory</span>. - <h3 class="sectionHead"><span class="titlemark">6.2 </span> <a + <h3 class="sectionHead"><span class="titlemark">6.2 </span> <a id="x1-490006.2"></a>Creation of PCB layout</h3> -<a +<a id="dx1-49001"></a> -<a +<a id="dx1-49002"></a> <!--l. 164--><p class="noindent" >The next step is to place the footprints and lay tracks between them to get the layout. This is -done using the <span -class="cmti-10x-x-109">Layout Editor </span>tool. eSim uses <span +done using the <span +class="cmti-10x-x-109">Layout Editor </span>tool. eSim uses <span class="cmtt-10x-x-109">Pcbnew</span>, the layout creation tool in KiCad, as its layout editor. <!--l. 169--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">6.2.1 </span> <a + <h4 class="subsectionHead"><span class="titlemark">6.2.1 </span> <a id="x1-500006.2.1"></a>Familiarizing the Layout Editor tool</h4> -<a +<a id="dx1-50001"></a> -<!--l. 172--><p class="noindent" >The layout editor with the various menu bar and toolbars is shown in Fig. <a +<!--l. 172--><p class="noindent" >The layout editor with the various menu bar and toolbars is shown in Fig. <a href="#x1-500029">6.9<!--tex4ht:ref: pcbnew --></a>. -<hr class="figure"><div class="figure" +<hr class="figure"><div class="figure" > -<a +<a id="x1-500029"></a> -<!--l. 176--><p class="noindent" ><img -src="figures/pcbnew.png" alt="PIC" +<!--l. 176--><p class="noindent" ><img +src="figures/pcbnew.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.9: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.9: </span><span class="content">Layout editor with menu bar, toolbars and layer options marked</span></div><!--tex4ht:label?: x1-500029 --> <!--l. 179--><p class="indent" > </div><hr class="endfigure"> -<!--l. 180--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 180--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-5000310"></a> -<!--l. 182--><p class="noindent" ><img -src="figures/toptble.png" alt="PIC" +<!--l. 182--><p class="noindent" ><img +src="figures/toptble.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.10: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.10: </span><span class="content">Top toolbar with important tools marked</span></div><!--tex4ht:label?: x1-5000310 --> <!--l. 185--><p class="indent" > </div><hr class="endfigure"> - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-510006.2.1"></a>Top toolbar</h5> -<!--l. 188--><p class="noindent" >Some of the important menu options in the top menu bar are shown in Fig. <a +<!--l. 188--><p class="noindent" >Some of the important menu options in the top menu bar are shown in Fig. <a href="#x1-5000310">6.10<!--tex4ht:ref: toptble --></a>. They are explained below: <dl class="compactenum"><dt class="compactenum"> - 1. </dt><dd + 1. </dt><dd class="compactenum">Save board - Save the printed circuit board </dd><dt class="compactenum"> - 2. </dt><dd + 2. </dt><dd class="compactenum">Module editor - Open module editor to edit footprint modules or libraries </dd><dt class="compactenum"> - 3. </dt><dd + 3. </dt><dd class="compactenum">Read netlist - Import the netlist whose layout needs to be created. </dd><dt class="compactenum"> - 4. </dt><dd + 4. </dt><dd class="compactenum">Perform design rules check - Check for design rules, unconnected nets, etc., in the layout. </dd><dt class="compactenum"> - 5. </dt><dd + 5. </dt><dd class="compactenum">Select working layer - Selection of working layer </dd><dt class="compactenum"> - 6. </dt><dd + 6. </dt><dd class="compactenum">Show active layer selections and select layer pair for route and place - Select layer in top and bottom layers. It also shows the currently active layer selections. </dd><dt class="compactenum"> - 7. </dt><dd + 7. </dt><dd class="compactenum">Mode footprint: Manual/automatic move and place - Move and place modules</dd></dl> <!--l. 206--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">6.2.2 </span> <a + <h4 class="subsectionHead"><span class="titlemark">6.2.2 </span> <a id="x1-520006.2.2"></a>Hotkeys</h4> -<a +<a id="dx1-52001"></a> <!--l. 208--><p class="noindent" >A list of hotkeys are given below: <dl class="compactenum"><dt class="compactenum"> - 1. </dt><dd + 1. </dt><dd class="compactenum">F1 - Zoom in </dd><dt class="compactenum"> - 2. </dt><dd + 2. </dt><dd class="compactenum">F2 - Zoom out </dd><dt class="compactenum"> - 3. </dt><dd + 3. </dt><dd class="compactenum">Delete - Delete Track or Footprint </dd><dt class="compactenum"> - 4. </dt><dd + 4. </dt><dd class="compactenum">X - Add new track </dd><dt class="compactenum"> - 5. </dt><dd + 5. </dt><dd class="compactenum">V - Add Via </dd><dt class="compactenum"> - 6. </dt><dd + 6. </dt><dd class="compactenum">M - Move Item </dd><dt class="compactenum"> - 7. </dt><dd + 7. </dt><dd class="compactenum">F - Flip Footprint </dd><dt class="compactenum"> - 8. </dt><dd + 8. </dt><dd class="compactenum">R - Rotate Item </dd><dt class="compactenum"> - 9. </dt><dd + 9. </dt><dd class="compactenum">G - Drag Footprint </dd><dt class="compactenum"> - 10. </dt><dd + 10. </dt><dd class="compactenum">Ctrl+Z - Undo </dd><dt class="compactenum"> - 11. </dt><dd + 11. </dt><dd class="compactenum">E - Edit Item</dd></dl> -<!--l. 222--><p class="noindent" >The list can be viewed by selecting <span -class="cmti-10x-x-109">Preferences </span>from the top menu bar and choosing <span +<!--l. 222--><p class="noindent" >The list can be viewed by selecting <span +class="cmti-10x-x-109">Preferences </span>from the top menu bar and choosing <span class="cmti-10x-x-109">List Current</span> -<span -class="cmti-10x-x-109">Keys </span>from the option <span +<span +class="cmti-10x-x-109">Keys </span>from the option <span class="cmti-10x-x-109">Hotkeys</span>. <!--l. 226--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">6.2.3 </span> <a + <h4 class="subsectionHead"><span class="titlemark">6.2.3 </span> <a id="x1-530006.2.3"></a>PCB design example using RC circuit</h4> -<a +<a id="dx1-53001"></a> -<!--l. 227--><p class="noindent" >Click on <span -class="cmti-10x-x-109">Layout Editor </span>from the eSim toolbar. Click on <span +<!--l. 227--><p class="noindent" >Click on <span +class="cmti-10x-x-109">Layout Editor </span>from the eSim toolbar. Click on <span class="cmti-10x-x-109">Read Netlist </span>tool from the top -toolbar. Click on <span -class="cmti-10x-x-109">Browse Netlist files </span>on the Netlist window that opens up. Select the <span +toolbar. Click on <span +class="cmti-10x-x-109">Browse Netlist files </span>on the Netlist window that opens up. Select the <span class="cmtt-10x-x-109">.net </span>file -that was modified after assigning footprints. Click on <span -class="cmti-10x-x-109">Open</span>. Now Click on <span +that was modified after assigning footprints. Click on <span +class="cmti-10x-x-109">Open</span>. Now Click on <span class="cmti-10x-x-109">Read Current</span> -<span +<span class="cmti-10x-x-109">Netlist </span>on the Netlist window. The message area in the Netlist window says that -the RC_pcb.net has been read. The sequence of operations is shown in Fig. <a +the RC_pcb.net has been read. The sequence of operations is shown in Fig. <a href="#x1-5300411">6.11<!--tex4ht:ref: brnet --></a>. -<a - id="dx1-53002"></a><a - id="dx1-53003"></a><hr class="figure"><div class="figure" +<a + id="dx1-53002"></a><a + id="dx1-53003"></a><hr class="figure"><div class="figure" > -<a +<a id="x1-5300411"></a> -<!--l. 238--><p class="noindent" ><img -src="figures/rcpcb.png" alt="PIC" +<!--l. 238--><p class="noindent" ><img +src="figures/rcpcb.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.11: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.11: </span><span class="content">Importing netlist file to layout editor: 1. Browse netlist Files, 2. Choose the RC_pcb.net file, 3. Read Netlist file, 4. Close</span></div><!--tex4ht:label?: x1-5300411 --> <!--l. 242--><p class="indent" > </div><hr class="endfigure"> <!--l. 243--><p class="indent" > The footprint modules will now be imported to the top left hand corner of the layout -editor window. This is shown in Fig. <a -href="#x1-5300512">6.12<!--tex4ht:ref: netlisttop --></a>. <hr class="figure"><div class="figure" +editor window. This is shown in Fig. <a +href="#x1-5300512">6.12<!--tex4ht:ref: netlisttop --></a>. <hr class="figure"><div class="figure" > -<a +<a id="x1-5300512"></a> -<!--l. 247--><p class="noindent" ><img -src="figures/netlisttop.png" alt="PIC" +<!--l. 247--><p class="noindent" ><img +src="figures/netlisttop.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.12: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.12: </span><span class="content">Footprint modules imported to top left corner of layout editor window</span></div><!--tex4ht:label?: x1-5300512 --> <!--l. 250--><p class="indent" > </div><hr class="endfigure"> -<!--l. 251--><p class="indent" > Zoom in to the top left corner by pressing the key <span +<!--l. 251--><p class="indent" > Zoom in to the top left corner by pressing the key <span class="cmtt-10x-x-109">F1 </span>or using the scroll button of the -mouse. The zoomed in version of the imported netlist is shown in Fig. <a +mouse. The zoomed in version of the imported netlist is shown in Fig. <a href="#x1-5300613">6.13<!--tex4ht:ref: zoom --></a>. -<!--l. 255--><p class="indent" > Let us now place this in the center of the layout editor window. <hr class="figure"><div class="figure" +<!--l. 255--><p class="indent" > Let us now place this in the center of the layout editor window. <hr class="figure"><div class="figure" > -<a +<a id="x1-5300613"></a> -<!--l. 259--><p class="noindent" ><img -src="figures/zoom.png" alt="PIC" +<!--l. 259--><p class="noindent" ><img +src="figures/zoom.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.13: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.13: </span><span class="content">Zoomed in version of the imported netlist</span></div><!--tex4ht:label?: x1-5300613 --> <!--l. 262--><p class="indent" > </div><hr class="endfigure"> -<!--l. 263--><p class="indent" > Click on <span +<!--l. 263--><p class="indent" > Click on <span class="cmti-10x-x-109">Mode footprint: Manual/automatic move and place </span>tool from the top toolbar. -Place the cursor near the center of the layout editor window. Right click and choose <span +Place the cursor near the center of the layout editor window. Right click and choose <span class="cmti-10x-x-109">Glob</span> -<span -class="cmti-10x-x-109">move and place</span>. Choose <span -class="cmti-10x-x-109">move all modules</span>. The sequence of operations is shown in Fig. <a +<span +class="cmti-10x-x-109">move and place</span>. Choose <span +class="cmti-10x-x-109">move all modules</span>. The sequence of operations is shown in Fig. <a href="#x1-5300714">6.14<!--tex4ht:ref: movep --></a>. -Click on <span +Click on <span class="cmti-10x-x-109">Yes </span>on the confirmation window to move the modules. Zoom in using the F1 key. -The current placement of components after zooming in is shown in Fig. <a +The current placement of components after zooming in is shown in Fig. <a href="#x1-53008r1">6.15a<!--tex4ht:ref: curplace --></a>. -<hr class="figure"><div class="figure" +<hr class="figure"><div class="figure" > -<a +<a id="x1-5300714"></a> -<!--l. 272--><p class="noindent" ><img -src="figures/movep.png" alt="PIC" +<!--l. 272--><p class="noindent" ><img +src="figures/movep.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.14: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.14: </span><span class="content">Moving and placing modules to the center of layout editor. 1. Click on -<span +<span class="cmti-10x-x-109">Mode footprint: Manual/automatic move and place</span>, 2. Place cursor at center of layout -editor and right click on it 3. Choose <span -class="cmti-10x-x-109">Glob Move and Place </span>and then choose <span +editor and right click on it 3. Choose <span +class="cmti-10x-x-109">Glob Move and Place </span>and then choose <span class="cmti-10x-x-109">Move All</span> -<span +<span class="cmti-10x-x-109">Modules.</span></span></div><!--tex4ht:label?: x1-5300714 --> <!--l. 279--><p class="indent" > </div><hr class="endfigure"> -<!--l. 286--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 286--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-5301015"></a> -<a +<a id="x1-53008r1"></a> -<!--l. 290--><p class="noindent" > <img -src="figures/curplace.png" alt="PIC" +<!--l. 290--><p class="noindent" > <img +src="figures/curplace.png" alt="PIC" > -<span +<span class="cmr-9">(a)</span> -<span +<span class="cmr-9">Zoomed</span> -<span +<span class="cmr-9">in</span> -<span +<span class="cmr-9">version</span> -<span +<span class="cmr-9">of the</span> -<span +<span class="cmr-9">current</span> -<span +<span class="cmr-9">placement</span> -<span +<span class="cmr-9">after</span> -<span +<span class="cmr-9">moving</span> -<span +<span class="cmr-9">modules</span> -<span +<span class="cmr-9">to the</span> -<span +<span class="cmr-9">center</span> -<span +<span class="cmr-9">of the</span> -<span +<span class="cmr-9">layout</span> -<span -class="cmr-9">editor</span> <a - id="x1-53009r2"></a> <img -src="figures/fplace.png" alt="PIC" +<span +class="cmr-9">editor</span> <a + id="x1-53009r2"></a> <img +src="figures/fplace.png" alt="PIC" > - <span + <span class="cmr-9">(b)</span> - <span + <span class="cmr-9">Final</span> - <span + <span class="cmr-9">placement</span> - <span + <span class="cmr-9">of</span> - <span + <span class="cmr-9">footprints</span> - <span + <span class="cmr-9">after</span> - <span + <span class="cmr-9">rotating</span> - <span + <span class="cmr-9">and</span> - <span + <span class="cmr-9">moving</span> - <span + <span class="cmr-9">P1</span> -<br /> <div class="caption" -><span class="id">Figure 6.15: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.15: </span><span class="content">Different stages of placement of modules on PCB</span></div><!--tex4ht:label?: x1-5301015 --> <!--l. 295--><p class="indent" > </div><hr class="endfigure"> <!--l. 296--><p class="indent" > We need to arrange the modules properly to lay tracks. Rotate the connector P1 by placing the cursor on top of P1 and pressing R. Move it by placing the cursor on top of it and -pressing M. The final placement is shown in Fig. <a -href="#x1-53009r2">6.15b<!--tex4ht:ref: fplace --></a>. <a +pressing M. The final placement is shown in Fig. <a +href="#x1-53009r2">6.15b<!--tex4ht:ref: fplace --></a>. <a id="dx1-53011"></a> -<!--l. 302--><p class="indent" > Let us now lay the tracks. Let us first change the track width. Click on <span +<!--l. 302--><p class="indent" > Let us now lay the tracks. Let us first change the track width. Click on <span class="cmti-10x-x-109">Design rules </span>from -the top menu bar. Click on <span -class="cmti-10x-x-109">Design rules</span>. This is shown in Fig. <a -href="#x1-5301416">6.16<!--tex4ht:ref: drules --></a>. The <span +the top menu bar. Click on <span +class="cmti-10x-x-109">Design rules</span>. This is shown in Fig. <a +href="#x1-5301416">6.16<!--tex4ht:ref: drules --></a>. The <span class="cmti-10x-x-109">Design Rules Editor</span> window opens up. Here one can edit the various design rules. Double click on the track width -field to edit it. Type 0.8 and press <span -class="cmtt-10x-x-109">Enter</span>. Click on OK. Fig. <a +field to edit it. Type 0.8 and press <span +class="cmtt-10x-x-109">Enter</span>. Click on OK. Fig. <a href="#x1-5301517">6.17<!--tex4ht:ref: druleedit --></a> shows the sequence of -operations. <a - id="dx1-53012"></a><a - id="dx1-53013"></a> <hr class="figure"><div class="figure" +operations. <a + id="dx1-53012"></a><a + id="dx1-53013"></a> <hr class="figure"><div class="figure" > -<a +<a id="x1-5301416"></a> -<!--l. 312--><p class="noindent" ><img -src="figures/drules.png" alt="PIC" +<!--l. 312--><p class="noindent" ><img +src="figures/drules.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.16: </span><span -class="content">Choose <span -class="cmti-10x-x-109">Design Rules </span>from the top menu bar and <span +<br /> <div class="caption" +><span class="id">Figure 6.16: </span><span +class="content">Choose <span +class="cmti-10x-x-109">Design Rules </span>from the top menu bar and <span class="cmti-10x-x-109">Design Rules </span>again</span></div><!--tex4ht:label?: x1-5301416 --> <!--l. 316--><p class="indent" > </div><hr class="endfigure"> -<!--l. 317--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 317--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-5301517"></a> -<!--l. 319--><p class="noindent" ><img -src="figures/druleedit.png" alt="PIC" +<!--l. 319--><p class="noindent" ><img +src="figures/druleedit.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.17: </span><span -class="content">Changing the track width: 1. Double click on <span +<br /> <div class="caption" +><span class="id">Figure 6.17: </span><span +class="content">Changing the track width: 1. Double click on <span class="cmti-10x-x-109">Track Width </span>field and type -0.8, 2. Click on <span +0.8, 2. Click on <span class="cmti-10x-x-109">OK</span></span></div><!--tex4ht:label?: x1-5301517 --> <!--l. 323--><p class="indent" > </div><hr class="endfigure"> -<!--l. 325--><p class="indent" > Click on <span -class="cmti-10x-x-109">Back </span>from the <span -class="cmti-10x-x-109">Layer </span>options as shown in Fig. <a -href="#x1-5301718">6.18<!--tex4ht:ref: layer --></a>. <a - id="dx1-53016"></a><hr class="figure"><div class="figure" +<!--l. 325--><p class="indent" > Click on <span +class="cmti-10x-x-109">Back </span>from the <span +class="cmti-10x-x-109">Layer </span>options as shown in Fig. <a +href="#x1-5301718">6.18<!--tex4ht:ref: layer --></a>. <a + id="dx1-53016"></a><hr class="figure"><div class="figure" > -<a +<a id="x1-5301718"></a> -<!--l. 329--><p class="noindent" ><img -src="figures/layer.png" alt="PIC" +<!--l. 329--><p class="noindent" ><img +src="figures/layer.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.18: </span><span -class="content">Choosing the copper layer <span +<br /> <div class="caption" +><span class="id">Figure 6.18: </span><span +class="content">Choosing the copper layer <span class="cmti-10x-x-109">Back</span></span></div><!--tex4ht:label?: x1-5301718 --> <!--l. 332--><p class="indent" > </div><hr class="endfigure"> <!--l. 333--><p class="indent" > Let us now start laying the tracks. Place the cursor above the left terminal of R1 -in the layout editor window. Press the key <span +in the layout editor window. Press the key <span class="cmtt-10x-x-109">x</span>. Move the cursor down and double -click on the left terminal of C1. A track is formed. This is shown in Fig. <a +click on the left terminal of C1. A track is formed. This is shown in Fig. <a href="#x1-53018r1">6.19a<!--tex4ht:ref: track1 --></a>. -<hr class="figure"><div class="figure" +<hr class="figure"><div class="figure" > -<a +<a id="x1-5302119"></a> -<a +<a id="x1-53018r1"></a> -<!--l. 341--><p class="noindent" > <img -src="figures/track1.png" alt="PIC" +<!--l. 341--><p class="noindent" > <img +src="figures/track1.png" alt="PIC" > -<span +<span class="cmr-9">(a) A</span> -<span +<span class="cmr-9">track</span> -<span +<span class="cmr-9">formed</span> -<span +<span class="cmr-9">between</span> -<span +<span class="cmr-9">resistor</span> -<span +<span class="cmr-9">and</span> -<span -class="cmr-9">capacitor</span> <a - id="x1-53019r2"></a> <img -src="figures/track2.png" alt="PIC" +<span +class="cmr-9">capacitor</span> <a + id="x1-53019r2"></a> <img +src="figures/track2.png" alt="PIC" > - <span + <span class="cmr-9">(b) A</span> - <span + <span class="cmr-9">track</span> - <span + <span class="cmr-9">formed</span> - <span + <span class="cmr-9">between</span> - <span + <span class="cmr-9">capacitor</span> - <span + <span class="cmr-9">and</span> - <span -class="cmr-9">connector</span> <a - id="x1-53020r3"></a> <img -src="figures/track3.png" alt="PIC" + <span +class="cmr-9">connector</span> <a + id="x1-53020r3"></a> <img +src="figures/track3.png" alt="PIC" > - <span + <span class="cmr-9">(c) A</span> - <span + <span class="cmr-9">track</span> - <span + <span class="cmr-9">formed</span> - <span + <span class="cmr-9">between</span> - <span + <span class="cmr-9">connector</span> - <span + <span class="cmr-9">and</span> - <span + <span class="cmr-9">resistor</span> -<br /> <div class="caption" -><span class="id">Figure 6.19: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.19: </span><span class="content">Different stages of laying tracks during PCB design</span></div><!--tex4ht:label?: x1-5302119 --> <!--l. 349--><p class="indent" > </div><hr class="endfigure"> <!--l. 350--><p class="indent" > Similarly lay the track between capacitor C1 and connector P1 as shown in -Fig. <a +Fig. <a href="#x1-53019r2">6.19b<!--tex4ht:ref: track2 --></a>. The last track needs to be laid at an angle. To do so, place the cursor above the second terminal of R1. Press the key x and move the cursor diagonally down. Double click on the other terminal of the connector. The track will be laid -as shown in Fig. <a +as shown in Fig. <a href="#x1-53020r3">6.19c<!--tex4ht:ref: track3 --></a>. All tracks are now laid. The next step is to create PCB edges. -<!--l. 358--><p class="indent" > Choose <span -class="cmti-10x-x-109">PCB</span><span -class="cmti-10x-x-109">_edges </span>from the <span -class="cmti-10x-x-109">Layer </span>options to add edges. Click on <span +<!--l. 358--><p class="indent" > Choose <span +class="cmti-10x-x-109">PCB</span><span +class="cmti-10x-x-109">_edges </span>from the <span +class="cmti-10x-x-109">Layer </span>options to add edges. Click on <span class="cmti-10x-x-109">Add graphic line or</span> -<span -class="cmti-10x-x-109">polygon </span>from the toolbar on the left. Fig. <a +<span +class="cmti-10x-x-109">polygon </span>from the toolbar on the left. Fig. <a href="#x1-5302320">6.20<!--tex4ht:ref: pcbedges --></a> shows the sequence of operations. Let us now -start drawing edges for PCB. <a - id="dx1-53022"></a><hr class="figure"><div class="figure" +start drawing edges for PCB. <a + id="dx1-53022"></a><hr class="figure"><div class="figure" > -<a +<a id="x1-5302320"></a> -<!--l. 365--><p class="noindent" ><img -src="figures/pcbedges.png" alt="PIC" +<!--l. 365--><p class="noindent" ><img +src="figures/pcbedges.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.20: </span><span -class="content">Creating PCB edges: 1. Choose <span -class="cmti-10x-x-109">PCB</span><span -class="cmti-10x-x-109">_Edges </span>from <span +<br /> <div class="caption" +><span class="id">Figure 6.20: </span><span +class="content">Creating PCB edges: 1. Choose <span +class="cmti-10x-x-109">PCB</span><span +class="cmti-10x-x-109">_Edges </span>from <span class="cmti-10x-x-109">Layer </span>options 2. Choose -<span +<span class="cmti-10x-x-109">Add graphic line or polygon </span>from left toolbar</span></div><!--tex4ht:label?: x1-5302320 --> <!--l. 370--><p class="indent" > </div><hr class="endfigure"> <!--l. 371--><p class="indent" > Click to the left of the layout. Move cursor horizontally to the right. Click once to change -orientation. Move cursor vertically down. Draw the edges as shown in Fig. <a +orientation. Move cursor vertically down. Draw the edges as shown in Fig. <a href="#x1-5302421">6.21<!--tex4ht:ref: pcbed --></a>. Double click -to finish drawing the edges. <hr class="figure"><div class="figure" +to finish drawing the edges. <hr class="figure"><div class="figure" > -<a +<a id="x1-5302421"></a> -<!--l. 377--><p class="noindent" ><img -src="figures/pcbed.png" alt="PIC" +<!--l. 377--><p class="noindent" ><img +src="figures/pcbed.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.21: </span><span +<br /> <div class="caption" +><span class="id">Figure 6.21: </span><span class="content">PCB edges drawn</span></div><!--tex4ht:label?: x1-5302421 --> <!--l. 380--><p class="indent" > </div><hr class="endfigure"> -<!--l. 382--><p class="indent" > Click on <span +<!--l. 382--><p class="indent" > Click on <span class="cmti-10x-x-109">Perform design rules check </span>from the top toolbar to check for design rules. The -<span -class="cmti-10x-x-109">DRC Control </span>window opens up. Click on <span -class="cmti-10x-x-109">Start DRC</span>. There are no errors under the <span +<span +class="cmti-10x-x-109">DRC Control </span>window opens up. Click on <span +class="cmti-10x-x-109">Start DRC</span>. There are no errors under the <span class="cmtt-10x-x-109">Error</span> -<span -class="cmtt-10x-x-109">messages </span>tab. Click on <span -class="cmti-10x-x-109">OK </span>to close DRC control window. Fig. <a +<span +class="cmtt-10x-x-109">messages </span>tab. Click on <span +class="cmti-10x-x-109">OK </span>to close DRC control window. Fig. <a href="#x1-5302622">6.22<!--tex4ht:ref: drc --></a> shows the sequence of -operations. <a - id="dx1-53025"></a><hr class="figure"><div class="figure" +operations. <a + id="dx1-53025"></a><hr class="figure"><div class="figure" > -<a +<a id="x1-5302622"></a> -<!--l. 390--><p class="noindent" ><img -src="figures/drc.png" alt="PIC" +<!--l. 390--><p class="noindent" ><img +src="figures/drc.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.22: </span><span -class="content">Performing design rules check: 1. Click on <span -class="cmti-10x-x-109">Start DRC</span>, 2. Click on <span +<br /> <div class="caption" +><span class="id">Figure 6.22: </span><span +class="content">Performing design rules check: 1. Click on <span +class="cmti-10x-x-109">Start DRC</span>, 2. Click on <span class="cmti-10x-x-109">Ok</span></span></div><!--tex4ht:label?: x1-5302622 --> <!--l. 394--><p class="indent" > </div><hr class="endfigure"> -<!--l. 395--><p class="indent" > Click on <span +<!--l. 395--><p class="indent" > Click on <span class="cmti-10x-x-109">Save board </span>on the top toolbar. -<!--l. 397--><p class="indent" > To generate Gerber files, click on <span -class="cmti-10x-x-109">File </span>from the top menu bar. Click on <span +<!--l. 397--><p class="indent" > To generate Gerber files, click on <span +class="cmti-10x-x-109">File </span>from the top menu bar. Click on <span class="cmti-10x-x-109">Plot</span>. This is shown -in Fig. <a +in Fig. <a href="#x1-5302823">6.23<!--tex4ht:ref: plot --></a>. The plot window opens up. One can choose which layers to plot by -selecting/deselecting them from the <span +selecting/deselecting them from the <span class="cmtt-10x-x-109">Layers </span>pane on the left side. One can also choose the -format used to plot them. Choose <span +format used to plot them. Choose <span class="cmti-10x-x-109">Gerber</span>. The output directory of the plots created can also be chosen. By default, it is the project directory. Some more options can -be chosen in this window. Click on <span +be chosen in this window. Click on <span class="cmti-10x-x-109">Plot</span>. The message window shows the location -in which the Gerber files are created. Click on <span -class="cmti-10x-x-109">Close</span>. This is shown in Fig. <a +in which the Gerber files are created. Click on <span +class="cmti-10x-x-109">Close</span>. This is shown in Fig. <a href="#x1-5302924">6.24<!--tex4ht:ref: plot2 --></a>. -<a - id="dx1-53027"></a><hr class="figure"><div class="figure" +<a + id="dx1-53027"></a><hr class="figure"><div class="figure" > -<a +<a id="x1-5302823"></a> -<!--l. 410--><p class="noindent" ><img -src="figures/plot.png" alt="PIC" +<!--l. 410--><p class="noindent" ><img +src="figures/plot.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.23: </span><span -class="content">Choosing <span -class="cmti-10x-x-109">Plot </span>from the <span +<br /> <div class="caption" +><span class="id">Figure 6.23: </span><span +class="content">Choosing <span +class="cmti-10x-x-109">Plot </span>from the <span class="cmti-10x-x-109">File </span>menu</span></div><!--tex4ht:label?: x1-5302823 --> <!--l. 413--><p class="indent" > </div><hr class="endfigure"> -<!--l. 414--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 414--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-5302924"></a> -<!--l. 416--><p class="noindent" ><img -src="figures/plot2.png" alt="PIC" +<!--l. 416--><p class="noindent" ><img +src="figures/plot2.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 6.24: </span><span -class="content">Creating Gerber files: 1. Choose <span +<br /> <div class="caption" +><span class="id">Figure 6.24: </span><span +class="content">Creating Gerber files: 1. Choose <span class="cmti-10x-x-109">Gerber </span>as the plot format, 2. Click on -<span -class="cmti-10x-x-109">Plot</span>. Message window shows location in which Gerber files are created, 3. Click on <span +<span +class="cmti-10x-x-109">Plot</span>. Message window shows location in which Gerber files are created, 3. Click on <span class="cmti-10x-x-109">Close</span></span></div><!--tex4ht:label?: x1-5302924 --> <!--l. 421--><p class="indent" > </div><hr class="endfigure"> <!--l. 422--><p class="indent" > The PCB design of RC circuit is now complete. To know more about Pcbnew, refer to -<span class="cite"> [<a -href="#Xkicad">15</a>]</span> or <span class="cite"> [<a +<span class="cite"> [<a +href="#Xkicad">15</a>]</span> or <span class="cite"> [<a href="#Xkicad2">16</a>]</span>. - <h2 class="chapterHead"><span class="titlemark">Chapter 7</span><br /><a + <h2 class="chapterHead"><span class="titlemark">Chapter 7</span><br /><a id="x1-540007"></a>Model Editor</h2> <!--l. 4--><p class="noindent" >Spice based simulators include a feature which allows accurate modeling of semiconductor devices such as diodes, transistors etc. eSim Model Editor provides a facility to define a new -model for devices such as <span +model for devices such as <span class="cmti-10x-x-109">diodes, MOSFET, BJT, JFET, IGBT, Magnetic core </span>etc. Model Editor in eSim lets the user enter the values of parameters depending on the type of device for which a model is required. The parameter values can be obtained from the data-sheet of the device. A newly created model can be exported to the model library and one can import it for different projects, whenever required. Model Editor also provides a facility to edit existing models. The GUI of the model editor is as shown in -Fig. <a +Fig. <a href="#x1-540011">7.1<!--tex4ht:ref: modeleditor --></a> -<!--l. 15--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 15--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-540011"></a> -<!--l. 17--><p class="noindent" ><img -src="figures/modeleditor_new.png" alt="PIC" +<!--l. 17--><p class="noindent" ><img +src="figures/modeleditor_new.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 7.1: </span><span +<br /> <div class="caption" +><span class="id">Figure 7.1: </span><span class="content">Model Editor</span></div><!--tex4ht:label?: x1-540011 --> <!--l. 20--><p class="indent" > </div><hr class="endfigure"> - <h3 class="sectionHead"><span class="titlemark">7.1 </span> <a + <h3 class="sectionHead"><span class="titlemark">7.1 </span> <a id="x1-550007.1"></a>Creating New Model Library </h3> <!--l. 24--><p class="noindent" >eSim lets us create new model libraries based on the template model libraries. On selecting -<span -class="cmtt-10x-x-109">New </span>button the window is popped as shown in Fig. <a +<span +class="cmtt-10x-x-109">New </span>button the window is popped as shown in Fig. <a href="#x1-550012">7.2<!--tex4ht:ref: modeleditor_new --></a>. The name has to be unique otherwise the error message appears on the window. -<!--l. 27--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 27--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-550012"></a> -<!--l. 29--><p class="noindent" ><img -src="figures/modeleditor.png" alt="PIC" +<!--l. 29--><p class="noindent" ><img +src="figures/modeleditor.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 7.2: </span><span +<br /> <div class="caption" +><span class="id">Figure 7.2: </span><span class="content">Creating New Model Library</span></div><!--tex4ht:label?: x1-550012 --> <!--l. 32--><p class="indent" > </div><hr class="endfigure"> <!--l. 33--><p class="indent" > After the OK button is pressed the type of model library to be created is chosen by -selecting one of the types on the left hand side i.e. <span +selecting one of the types on the left hand side i.e. <span class="cmtt-10x-x-109">Diode, BJT, MOS, JFET, IGBT,</span> -<span -class="cmtt-10x-x-109">Magnetic Core</span>. The template model library opens up in a tabular form as shown in Fig. <a +<span +class="cmtt-10x-x-109">Magnetic Core</span>. The template model library opens up in a tabular form as shown in Fig. <a href="#x1-550023">7.3<!--tex4ht:ref: modelnew --></a> -<hr class="figure"><div class="figure" +<hr class="figure"><div class="figure" > -<a +<a id="x1-550023"></a> -<!--l. 36--><p class="noindent" ><img -src="figures/modelnew.png" alt="PIC" +<!--l. 36--><p class="noindent" ><img +src="figures/modelnew.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 7.3: </span><span +<br /> <div class="caption" +><span class="id">Figure 7.3: </span><span class="content">Choosing the Template Model Library </span></div><!--tex4ht:label?: x1-550023 --> <!--l. 39--><p class="indent" > </div><hr class="endfigure"> -<!--l. 43--><p class="indent" > New parameters can be added or current parameters can be removed using <span +<!--l. 43--><p class="indent" > New parameters can be added or current parameters can be removed using <span class="cmtt-10x-x-109">ADD</span> -and <span +and <span class="cmtt-10x-x-109">REMOVE </span>buttons. Also the values of parameters can be changed in the table. -Adding and removing the parameters in library files is shown in the Fig. <a +Adding and removing the parameters in library files is shown in the Fig. <a href="#x1-550034">7.4<!--tex4ht:ref: modeladd --></a> and -Fig. <a +Fig. <a href="#x1-550045">7.5<!--tex4ht:ref: modelremove --></a> -<!--l. 45--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 45--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-550034"></a> -<!--l. 47--><p class="noindent" ><img -src="figures/modeladd.png" alt="PIC" +<!--l. 47--><p class="noindent" ><img +src="figures/modeladd.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 7.4: </span><span +<br /> <div class="caption" +><span class="id">Figure 7.4: </span><span class="content">Adding the Parameter in a Library</span></div><!--tex4ht:label?: x1-550034 --> <!--l. 50--><p class="indent" > </div><hr class="endfigure"> -<!--l. 52--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 52--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-550045"></a> -<!--l. 54--><p class="noindent" ><img -src="figures/modelremove.png" alt="PIC" +<!--l. 54--><p class="noindent" ><img +src="figures/modelremove.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 7.5: </span><span +<br /> <div class="caption" +><span class="id">Figure 7.5: </span><span class="content">Removing a Parameter from a Library </span></div><!--tex4ht:label?: x1-550045 --> <!--l. 57--><p class="indent" > </div><hr class="endfigure"> -<!--l. 59--><p class="indent" > After the editing of the model library is done, the file can be saved by selecting the <span +<!--l. 59--><p class="indent" > After the editing of the model library is done, the file can be saved by selecting the <span class="cmtt-10x-x-109">SAVE</span> -button. These libraries are saved in the <span -class="cmti-10x-x-109">User Libraries </span>folder under <span +button. These libraries are saved in the <span +class="cmti-10x-x-109">User Libraries </span>folder under <span class="cmti-10x-x-109">deviceModelLibrary</span> repository. - <h3 class="sectionHead"><span class="titlemark">7.2 </span> <a + <h3 class="sectionHead"><span class="titlemark">7.2 </span> <a id="x1-560007.2"></a>Editing Current Model Library</h3> -<!--l. 62--><p class="noindent" >The existing model library can be modified using <span -class="cmtt-10x-x-109">EDIT </span>option. On clicking the <span +<!--l. 62--><p class="noindent" >The existing model library can be modified using <span +class="cmtt-10x-x-109">EDIT </span>option. On clicking the <span class="cmtt-10x-x-109">EDIT </span>button -the file dialog opens where all the library files are saved as shown in Fig. <a +the file dialog opens where all the library files are saved as shown in Fig. <a href="#x1-560016">7.6<!--tex4ht:ref: modeledit --></a>. You can select -the library you want to edit. Once you are done with the editing, click on <span +the library you want to edit. Once you are done with the editing, click on <span class="cmtt-10x-x-109">SAVE</span> button. -<!--l. 65--><p class="indent" > <hr class="figure"><div class="figure" +<!--l. 65--><p class="indent" > <hr class="figure"><div class="figure" > -<a +<a id="x1-560016"></a> -<!--l. 67--><p class="noindent" ><img -src="figures/modeledit.png" alt="PIC" +<!--l. 67--><p class="noindent" ><img +src="figures/modeledit.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 7.6: </span><span +<br /> <div class="caption" +><span class="id">Figure 7.6: </span><span class="content">Editing Existing Model Library</span></div><!--tex4ht:label?: x1-560016 --> <!--l. 70--><p class="indent" > </div><hr class="endfigure"> - <h3 class="sectionHead"><span class="titlemark">7.3 </span> <a + <h3 class="sectionHead"><span class="titlemark">7.3 </span> <a id="x1-570007.3"></a>Uploading external .lib file to eSim repository</h3> <!--l. 73--><p class="noindent" >eSim directly cannot use the external .lib file. It has to be uploaded to eSim repository before using it in a circuit. eSim provides the facility to upload library files. They are then converted -into xml format, which can be easily modified from the eSim interface. On clicking <span +into xml format, which can be easily modified from the eSim interface. On clicking <span class="cmtt-10x-x-109">UPLOAD</span> button the library can be uploaded from any location. The model library will be -saved with the name you have provided, in the <span +saved with the name you have provided, in the <span class="cmti-10x-x-109">User Libraries </span>folder of repository -<span +<span class="cmti-10x-x-109">deviceModelLibrary</span>. - <h2 class="chapterHead"><span class="titlemark">Chapter 8</span><br /><a + <h2 class="chapterHead"><span class="titlemark">Chapter 8</span><br /><a id="x1-580008"></a>SubCircuit Builder</h2> Subcircuit is a way to implement hierarchical modeling. Once a subcircuit for a compo- nent is created, it can be used in other circuits. -eSim provides an easy way to create a subcircuit. The following Fig. <a +eSim provides an easy way to create a subcircuit. The following Fig. <a href="#x1-580011">8.1<!--tex4ht:ref: subcircuit_mainwin --></a> shows the window that is opened when the SubCircuit tool is chosen from the toolbar. -<hr class="figure"><div class="figure" +<hr class="figure"><div class="figure" > -<a +<a id="x1-580011"></a> -<!--l. 8--><p class="noindent" ><img -src="figures/subcirciut_window.png" alt="PIC" +<!--l. 8--><p class="noindent" ><img +src="figures/subcirciut_window.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 8.1: </span><span +<br /> <div class="caption" +><span class="id">Figure 8.1: </span><span class="content">Subcircuit Window</span></div><!--tex4ht:label?: x1-580011 --> <!--l. 11--><p class="noindent" ></div><hr class="endfigure"> - <h3 class="sectionHead"><span class="titlemark">8.1 </span> <a + <h3 class="sectionHead"><span class="titlemark">8.1 </span> <a id="x1-590008.1"></a>Creating a SubCircuit</h3> <!--l. 32--><p class="noindent" >The steps to create subcircuit are as follows. <ul class="itemize1"> - <li class="itemize">After opening the Subcircuit tool, click on <span + <li class="itemize">After opening the Subcircuit tool, click on <span class="cmtt-10x-x-109">New Subcircuit Schematic </span>button. It will ask the name of the subcircuit. Enter the name of subcircuit (without any - spaces) and click <span -class="cmtt-10x-x-109">OK </span>as shown in Fig. <a + spaces) and click <span +class="cmtt-10x-x-109">OK </span>as shown in Fig. <a href="#x1-590012">8.2<!--tex4ht:ref: newsubcktschematic --></a>. - <!--l. 39--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-590012"></a> <img -src="figures/newsubcktschematic.png" alt="PIC" + <!--l. 39--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-590012"></a> <img +src="figures/newsubcktschematic.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 8.2: </span><span +<br /> <div class="caption" +><span class="id">Figure 8.2: </span><span class="content">New Sub circuit Window</span></div><!--tex4ht:label?: x1-590012 --> <!--l. 44--><p class="noindent" ></div><hr class="endfigure"> </li> - <li class="itemize">After clicking <span + <li class="itemize">After clicking <span class="cmtt-10x-x-109">OK </span>button it will open KiCad schematic. Draw your circuit - which will be later used as a subcircuit. e.g the Fig. <a + which will be later used as a subcircuit. e.g the Fig. <a href="#x1-590023">8.3<!--tex4ht:ref: createsubcktsch --></a> shows the half adder circuit. - <!--l. 49--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-590023"></a> <img -src="figures/createsubcktsch.png" alt="PIC" + <!--l. 49--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-590023"></a> <img +src="figures/createsubcktsch.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 8.3: </span><span +<br /> <div class="caption" +><span class="id">Figure 8.3: </span><span class="content">New Sub circuit Window</span></div><!--tex4ht:label?: x1-590023 --> <!--l. 54--><p class="noindent" ></div><hr class="endfigure"> </li> <li class="itemize">Once you complete the circuit, assign port to the node of your circuit which will be - used to connect with the main circuit. The circuit will look like Fig. <a + used to connect with the main circuit. The circuit will look like Fig. <a href="#x1-590034">8.4<!--tex4ht:ref: halfadder --></a> after adding PORT to it. The PORT symbol can be found in Eeschema as shown in - Fig. <a + Fig. <a href="#x1-590045">8.5<!--tex4ht:ref: port --></a>. - <!--l. 61--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-590034"></a> <img -src="figures/ha_sub.png" alt="PIC" + <!--l. 61--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-590034"></a> <img +src="figures/ha_sub.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 8.4: </span><span +<br /> <div class="caption" +><span class="id">Figure 8.4: </span><span class="content">Half-Adder Subcircuit </span></div><!--tex4ht:label?: x1-590034 --> <!--l. 66--><p class="noindent" ></div><hr class="endfigure"> - <!--l. 69--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-590045"></a> <img -src="figures/port_lib.png" alt="PIC" + <!--l. 69--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-590045"></a> <img +src="figures/port_lib.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 8.5: </span><span +<br /> <div class="caption" +><span class="id">Figure 8.5: </span><span class="content">Selection of PORT component</span></div><!--tex4ht:label?: x1-590045 --> <!--l. 74--><p class="noindent" ></div><hr class="endfigure"> @@ -2548,45 +2548,45 @@ class="content">Selection of PORT component</span></div><!--tex4ht:label?: x1-59 <li class="itemize">To use this as a subcircuit, create a block in KiCad Eeschema by following steps given below: <dl class="enumerate"><dt class="enumerate"> - 1. </dt><dd + 1. </dt><dd class="enumerate">Go to library browser of Eeschema. </dd><dt class="enumerate"> - 2. </dt><dd -class="enumerate">Select the working library as eSim_Subckt as shown in Fig. <a -href="#x1-590076">8.6<!--tex4ht:ref: esimsubckt --></a> <hr class="figure"><div class="figure" -><a - id="x1-590076"></a> <img -src="figures/esim-subckt.png" alt="PIC" -> -<br /> <div class="caption" -><span class="id">Figure 8.6: </span><span + 2. </dt><dd +class="enumerate">Select the working library as eSim_Subckt as shown in Fig. <a +href="#x1-590076">8.6<!--tex4ht:ref: esimsubckt --></a> <hr class="figure"><div class="figure" +><a + id="x1-590076"></a> <img +src="figures/esim-subckt.png" alt="PIC" +> +<br /> <div class="caption" +><span class="id">Figure 8.6: </span><span class="content">Selecting Working Library</span></div><!--tex4ht:label?: x1-590076 --> <!--l. 90--><p class="noindent" ></div><hr class="endfigure"> </dd><dt class="enumerate"> - 3. </dt><dd -class="enumerate">Click on create a new component with reference X as shown in Fig. <a -href="#x1-590097">8.7<!--tex4ht:ref: subcktnewcomp --></a> <hr class="figure"><div class="figure" -><a + 3. </dt><dd +class="enumerate">Click on create a new component with reference X as shown in Fig. <a +href="#x1-590097">8.7<!--tex4ht:ref: subcktnewcomp --></a> <hr class="figure"><div class="figure" +><a id="x1-590097"></a> - <img -src="figures/subcktnewcomp.png" alt="PIC" + <img +src="figures/subcktnewcomp.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 8.7: </span><span +<br /> <div class="caption" +><span class="id">Figure 8.7: </span><span class="content">Creating New Component</span></div><!--tex4ht:label?: x1-590097 --> <!--l. 99--><p class="noindent" ></div><hr class="endfigure"> </dd><dt class="enumerate"> - 4. </dt><dd -class="enumerate">Start drawing the subcircuit block. Update and save it as shown in Fig. <a + 4. </dt><dd +class="enumerate">Start drawing the subcircuit block. Update and save it as shown in Fig. <a href="#x1-590118">8.8<!--tex4ht:ref: block --></a>. - <!--l. 104--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-590118"></a> <img -src="figures/halfadderblock.png" alt="PIC" + <!--l. 104--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-590118"></a> <img +src="figures/halfadderblock.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 8.8: </span><span +<br /> <div class="caption" +><span class="id">Figure 8.8: </span><span class="content">Half-Adder Subcircuit Block</span></div><!--tex4ht:label?: x1-590118 --> <!--l. 109--><p class="noindent" ></div><hr class="endfigure"> </dd></dl> @@ -2598,11 +2598,11 @@ class="content">Half-Adder Subcircuit Block</span></div><!--tex4ht:label?: x1-59 circuit. </li></ul> <!--l. 120--><p class="noindent" > - <h3 class="sectionHead"><span class="titlemark">8.2 </span> <a + <h3 class="sectionHead"><span class="titlemark">8.2 </span> <a id="x1-600008.2"></a>Edit a Subcircuit</h3> <!--l. 121--><p class="noindent" >The steps to edit a subcircuit are as follows. <ul class="itemize1"> - <li class="itemize">After opening the Subcircuit tool, click on <span + <li class="itemize">After opening the Subcircuit tool, click on <span class="cmtt-10x-x-109">Edit Subcircuit Schematic </span>button. It will open a dialog box where you can select any subcircuit for editing. </li> @@ -2614,222 +2614,222 @@ class="cmtt-10x-x-109">Edit Subcircuit Schematic </span>button. <li class="itemize">If you have edited the number of ports then you have to change the block in KiCad Eeschema accordingly. </li> - <li class="itemize">Close the Eeschema window and click on <span + <li class="itemize">Close the Eeschema window and click on <span class="cmtt-10x-x-109">Convert KiCad to Ngspice </span>button in subcircuit builder tool to convert the edited subcircuit KiCad netlist into Ngspice netlist. </li></ul> - <h2 class="chapterHead"><span class="titlemark">Chapter 9</span><br /><a + <h2 class="chapterHead"><span class="titlemark">Chapter 9</span><br /><a id="x1-610009"></a>Solved Examples</h2> - <h3 class="sectionHead"><span class="titlemark">9.1 </span> <a + <h3 class="sectionHead"><span class="titlemark">9.1 </span> <a id="x1-620009.1"></a>Solved Examples</h3> <!--l. 8--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">9.1.1 </span> <a + <h4 class="subsectionHead"><span class="titlemark">9.1.1 </span> <a id="x1-630009.1.1"></a>Basic RC Circuit</h4> <!--l. 9--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-640009.1.1"></a>Problem Statement:</h5> <!--l. 9--><p class="noindent" >Plot the Input and Output Waveform of an RC circuit whose input voltage (Vs) is 50Hz, -3V peak to peak. The values of Resistor (R) and Capacitor(C) are 1<span -class="cmmi-10x-x-109">k </span>and 1<span +3V peak to peak. The values of Resistor (R) and Capacitor(C) are 1<span +class="cmmi-10x-x-109">k </span>and 1<span class="cmmi-10x-x-109">uf</span> respectively. - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-650009.1.1"></a>Solution:</h5> <ul class="itemize1"> - <li class="itemize">Creating a Project: The new project is created by clicking the <span + <li class="itemize">Creating a Project: The new project is created by clicking the <span class="cmtt-10x-x-109">New </span>icon on the menubar. The name of the project is given in the pop up window as shown in - Fig. <a -href="#x1-650011">9.1<!--tex4ht:ref: rc1 --></a>. <hr class="figure"><div class="figure" -><a - id="x1-650011"></a> <img -src="figures/rc1.png" alt="PIC" -> -<br /> <div class="caption" -><span class="id">Figure 9.1: </span><span + Fig. <a +href="#x1-650011">9.1<!--tex4ht:ref: rc1 --></a>. <hr class="figure"><div class="figure" +><a + id="x1-650011"></a> <img +src="figures/rc1.png" alt="PIC" +> +<br /> <div class="caption" +><span class="id">Figure 9.1: </span><span class="content">Creating New Project</span></div><!--tex4ht:label?: x1-650011 --> <!--l. 20--><p class="noindent" ></div><hr class="endfigure"> </li> <li class="itemize">Creating the Schematic: To create the schematic, click the very first icon of the left - toolbar as shown in the Fig. <a + toolbar as shown in the Fig. <a href="#x1-650022">9.2<!--tex4ht:ref: rc2 --></a>. This will open KiCad Eeschema. - <!--l. 25--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-650022"></a> <img -src="figures/rc2.png" alt="PIC" + <!--l. 25--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-650022"></a> <img +src="figures/rc2.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 9.2: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.2: </span><span class="content">Open Schematic Editor</span></div><!--tex4ht:label?: x1-650022 --> <!--l. 31--><p class="noindent" ></div><hr class="endfigure"> - <!--l. 33--><p class="noindent" >To create a schematic in KiCad, we need to place the required components. Fig. <a + <!--l. 33--><p class="noindent" >To create a schematic in KiCad, we need to place the required components. Fig. <a href="#x1-650033">9.3<!--tex4ht:ref: rc_component --></a> shows the icon on the right toolbar which opens the component library. - <!--l. 35--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-650033"></a> <img -src="figures/rc_component.png" alt="PIC" + <!--l. 35--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-650033"></a> <img +src="figures/rc_component.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 9.3: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.3: </span><span class="content">Place Component Icon</span></div><!--tex4ht:label?: x1-650033 --> <!--l. 41--><p class="noindent" ></div><hr class="endfigure"> <!--l. 45--><p class="noindent" >After all the required components of the simple RC circuit are placed, wiring is done - using the <span -class="cmtt-10x-x-109">Place Wire </span>option as shown in the Fig. <a + using the <span +class="cmtt-10x-x-109">Place Wire </span>option as shown in the Fig. <a href="#x1-650044">9.4<!--tex4ht:ref: rc_wire --></a> - <!--l. 47--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-650044"></a> <img -src="figures/rc_wire.png" alt="PIC" + <!--l. 47--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-650044"></a> <img +src="figures/rc_wire.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 9.4: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.4: </span><span class="content">Place Wire Icon</span></div><!--tex4ht:label?: x1-650044 --> <!--l. 53--><p class="noindent" ></div><hr class="endfigure"> - <!--l. 55--><p class="noindent" >Next step is <span -class="cmtt-10x-x-109">ERC (Electric Rules Check)</span>. Fig. <a -href="#x1-650055">9.5<!--tex4ht:ref: erc1 --></a> shows the icon for <span + <!--l. 55--><p class="noindent" >Next step is <span +class="cmtt-10x-x-109">ERC (Electric Rules Check)</span>. Fig. <a +href="#x1-650055">9.5<!--tex4ht:ref: erc1 --></a> shows the icon for <span class="cmtt-10x-x-109">ERC</span>. - <!--l. 57--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-650055"></a> <img -src="figures/erc1.png" alt="PIC" + <!--l. 57--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-650055"></a> <img +src="figures/erc1.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 9.5: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.5: </span><span class="content">Electric Rules Check Icon</span></div><!--tex4ht:label?: x1-650055 --> <!--l. 63--><p class="noindent" ></div><hr class="endfigure"> - <!--l. 65--><p class="noindent" >Fig. <a + <!--l. 65--><p class="noindent" >Fig. <a href="#x1-650066">9.6<!--tex4ht:ref: rc_complete1 --></a> shows the RC circuit after connecting the components by wire. - <!--l. 67--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-650066"></a> <img -src="figures/rc_complete1.png" alt="PIC" + <!--l. 67--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-650066"></a> <img +src="figures/rc_complete1.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 9.6: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.6: </span><span class="content">RC circuit</span></div><!--tex4ht:label?: x1-650066 --> <!--l. 72--><p class="noindent" ></div><hr class="endfigure"> - <!--l. 76--><p class="noindent" >After clicking the <span -class="cmtt-10x-x-109">ERC </span>icon a window opens up. Click the <span + <!--l. 76--><p class="noindent" >After clicking the <span +class="cmtt-10x-x-109">ERC </span>icon a window opens up. Click the <span class="cmtt-10x-x-109">Run </span>button to run rules check. - The errors are listed in as shown in Fig. <a -href="#x1-65007r1">9.7a<!--tex4ht:ref: erc2 --></a>. This error is handled by adding <span + The errors are listed in as shown in Fig. <a +href="#x1-65007r1">9.7a<!--tex4ht:ref: erc2 --></a>. This error is handled by adding <span class="cmtt-10x-x-109">Power</span> - <span -class="cmtt-10x-x-109">Flag </span>as shown in Fig. <a + <span +class="cmtt-10x-x-109">Flag </span>as shown in Fig. <a href="#x1-65008r2">9.7b<!--tex4ht:ref: rc_pwr --></a>. - <!--l. 78--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-650097"></a> <a - id="x1-65007r1"></a> <img -src="figures/erc2.png" alt="PIC" + <!--l. 78--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-650097"></a> <a + id="x1-65007r1"></a> <img +src="figures/erc2.png" alt="PIC" > - <span + <span class="cmr-9">(a)</span> - <span + <span class="cmr-9">ERC</span> - <span -class="cmr-9">Run</span> <a - id="x1-65008r2"></a> <img -src="figures/rc_pwr.png" alt="PIC" + <span +class="cmr-9">Run</span> <a + id="x1-65008r2"></a> <img +src="figures/rc_pwr.png" alt="PIC" > - <span + <span class="cmr-9">(b)</span> - <span + <span class="cmr-9">Power</span> - <span + <span class="cmr-9">Flag</span> -<br /> <div class="caption" -><span class="id">Figure 9.7: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.7: </span><span class="content">ERC check and POWER FLAG</span></div><!--tex4ht:label?: x1-650097 --> <!--l. 87--><p class="noindent" ></div><hr class="endfigure"> - <!--l. 89--><p class="noindent" >After adding the <span -class="cmtt-10x-x-109">Power Flag </span>the completed RC circuit is shown in Fig. <a + <!--l. 89--><p class="noindent" >After adding the <span +class="cmtt-10x-x-109">Power Flag </span>the completed RC circuit is shown in Fig. <a href="#x1-65010r1">9.8a<!--tex4ht:ref: rc_schematic --></a> and the - netlist is generated as shown in Fig. <a + netlist is generated as shown in Fig. <a href="#x1-65011r2">9.8b<!--tex4ht:ref: rc_netlist --></a>. - <!--l. 92--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-650128"></a> <a - id="x1-65010r1"></a> <img -src="figures/rc_schematic.png" alt="PIC" + <!--l. 92--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-650128"></a> <a + id="x1-65010r1"></a> <img +src="figures/rc_schematic.png" alt="PIC" > - <span + <span class="cmr-9">(a)</span> - <span + <span class="cmr-9">Schematic</span> - <span + <span class="cmr-9">of RC</span> - <span -class="cmr-9">circuit</span> <a - id="x1-65011r2"></a> <img -src="figures/rc_netlistgeneration.png" alt="PIC" + <span +class="cmr-9">circuit</span> <a + id="x1-65011r2"></a> <img +src="figures/rc_netlistgeneration.png" alt="PIC" > - <span + <span class="cmr-9">(b)</span> - <span + <span class="cmr-9">Generating</span> - <span + <span class="cmr-9">KiCad</span> - <span + <span class="cmr-9">Netlist</span> - <span + <span class="cmr-9">of RC</span> - <span + <span class="cmr-9">circuit</span> -<br /> <div class="caption" -><span class="id">Figure 9.8: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.8: </span><span class="content">RC Schematic and Netlist Generation</span></div><!--tex4ht:label?: x1-650128 --> <!--l. 101--><p class="noindent" ></div><hr class="endfigure"> </li> <li class="itemize">Convert KiCad to Ngspice: To convert KiCad netlist of RC circuit to NgSpice - compatible netlist click on KiCad to Ngspice icon as shown in Fig. <a + compatible netlist click on KiCad to Ngspice icon as shown in Fig. <a href="#x1-650139">9.9<!--tex4ht:ref: rcki2ng --></a>. - <!--l. 107--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-650139"></a> <img -src="figures/rc_ki2ng.png" alt="PIC" + <!--l. 107--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-650139"></a> <img +src="figures/rc_ki2ng.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 9.9: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.9: </span><span class="content">Convert KiCad to Ngspice Icon</span></div><!--tex4ht:label?: x1-650139 --> <!--l. 112--><p class="noindent" ></div><hr class="endfigure"> - <!--l. 114--><p class="noindent" >Now you can enter the type of analysis and source details as shown in Fig. <a + <!--l. 114--><p class="noindent" >Now you can enter the type of analysis and source details as shown in Fig. <a href="#x1-65014r1">9.10a<!--tex4ht:ref: rc_analysistab --></a> and - Fig. <a + Fig. <a href="#x1-65015r2">9.10b<!--tex4ht:ref: rc_sourcedetailstab --></a> respectively. - <!--l. 116--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-6501610"></a> <a - id="x1-65014r1"></a> <img -src="figures/rc_analysistab.png" alt="PIC" + <!--l. 116--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-6501610"></a> <a + id="x1-65014r1"></a> <img +src="figures/rc_analysistab.png" alt="PIC" > - <span + <span class="cmr-9">(a)</span> - <span + <span class="cmr-9">RC</span> - <span -class="cmr-9">Analysis</span> <a - id="x1-65015r2"></a> <img -src="figures/rc_sourcedetailstab.png" alt="PIC" + <span +class="cmr-9">Analysis</span> <a + id="x1-65015r2"></a> <img +src="figures/rc_sourcedetailstab.png" alt="PIC" > - <span + <span class="cmr-9">(b)</span> - <span + <span class="cmr-9">RC</span> - <span + <span class="cmr-9">Source</span> - <span + <span class="cmr-9">Details</span> -<br /> <div class="caption" -><span class="id">Figure 9.10: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.10: </span><span class="content">RC Analysis and Source Detail</span></div><!--tex4ht:label?: x1-6501610 --> <!--l. 125--><p class="noindent" ></div><hr class="endfigure"> <!--l. 126--><p class="noindent" >The other tab will be empty as RC circuit do not use any Ngspice model, device library @@ -2839,47 +2839,47 @@ class="content">RC Analysis and Source Detail</span></div><!--tex4ht:label?: x1- </li> <li class="itemize">Simulation: To run Ngspice simulation click the simulation icon in the tool bar - as shown in the Fig. <a -href="#x1-6501711">9.11<!--tex4ht:ref: rcplot --></a>. <hr class="figure"><div class="figure" -><a - id="x1-6501711"></a> <img -src="figures/rc_plot.png" alt="PIC" -> -<br /> <div class="caption" -><span class="id">Figure 9.11: </span><span + as shown in the Fig. <a +href="#x1-6501711">9.11<!--tex4ht:ref: rcplot --></a>. <hr class="figure"><div class="figure" +><a + id="x1-6501711"></a> <img +src="figures/rc_plot.png" alt="PIC" +> +<br /> <div class="caption" +><span class="id">Figure 9.11: </span><span class="content">Simulation Icon</span></div><!--tex4ht:label?: x1-6501711 --> <!--l. 139--><p class="noindent" ></div><hr class="endfigure"> <!--l. 141--><p class="noindent" >In eSim, there are two types of plot. First is normal Ngspice plot and second is - interactive python plot as shown in Fig. <a -href="#x1-65018r1">9.12a<!--tex4ht:ref: rc_ngspiceplot --></a> and Fig. <a + interactive python plot as shown in Fig. <a +href="#x1-65018r1">9.12a<!--tex4ht:ref: rc_ngspiceplot --></a> and Fig. <a href="#x1-65019r2">9.12b<!--tex4ht:ref: rc_pythonplot --></a> respectively. - <!--l. 143--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-6502012"></a> <a - id="x1-65018r1"></a> <img -src="figures/rc_ngspiceplot.png" alt="PIC" + <!--l. 143--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-6502012"></a> <a + id="x1-65018r1"></a> <img +src="figures/rc_ngspiceplot.png" alt="PIC" > - <span + <span class="cmr-9">(a)</span> - <span + <span class="cmr-9">Ngspice</span> - <span + <span class="cmr-9">Plot</span> - <span -class="cmr-9">of RC</span> <a - id="x1-65019r2"></a> <img -src="figures/rc_pythonplot.png" alt="PIC" + <span +class="cmr-9">of RC</span> <a + id="x1-65019r2"></a> <img +src="figures/rc_pythonplot.png" alt="PIC" > - <span + <span class="cmr-9">(b)</span> - <span + <span class="cmr-9">Python</span> - <span + <span class="cmr-9">Plot</span> - <span + <span class="cmr-9">of RC</span> -<br /> <div class="caption" -><span class="id">Figure 9.12: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.12: </span><span class="content">Ngspice and Interactive Python Plotting</span></div><!--tex4ht:label?: x1-6502012 --> <!--l. 152--><p class="noindent" ></div><hr class="endfigure"> <!--l. 154--><p class="noindent" >In the interactive python plot you can select any node or branch to plot voltage or @@ -2888,788 +2888,785 @@ class="content">Ngspice and Interactive Python Plotting</span></div><!--tex4ht:l </li></ul> <!--l. 160--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">9.1.2 </span> <a + <h4 class="subsectionHead"><span class="titlemark">9.1.2 </span> <a id="x1-660009.1.2"></a>Half Wave Rectifier</h4> <!--l. 162--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-670009.1.2"></a>Problem Statement:</h5> <!--l. 162--><p class="noindent" >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. <!--l. 164--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-680009.1.2"></a>Solution:</h5> -<!--l. 165--><p class="noindent" >The new project is created by clicking the <span +<!--l. 165--><p class="noindent" >The new project is created by clicking the <span class="cmtt-10x-x-109">New </span>icon on the menubar. The name of the project -is given in the window shown in Fig. <a +is given in the window shown in Fig. <a href="#x1-650011">9.1<!--tex4ht:ref: rc1 --></a>. <ul class="itemize1"> <li class="itemize">Creating Schematic: To create the schematic, click the very first icon of the left - toolbar as shown in the Fig. <a -href="#x1-650022">9.2<!--tex4ht:ref: rc2 --></a>. This will open KiCad Eeschema.<br + toolbar as shown in the Fig. <a +href="#x1-650022">9.2<!--tex4ht:ref: rc2 --></a>. This will open KiCad Eeschema.<br class="newline" /> <!--l. 171--><p class="noindent" >After the KiCad window is opened, to create a schematic we need to place the - required components. Fig. <a + required components. Fig. <a href="#x1-650033">9.3<!--tex4ht:ref: rc_component --></a> shows the icon on the right toolbar which opens - the component library.<br + the component library.<br class="newline" /> <!--l. 174--><p class="noindent" >After all the required components of the simple Half Wave rectifier circuits are - placed, wiring is done using the <span -class="cmtt-10x-x-109">Place Wire </span>option as shown in the Fig. <a -href="#x1-650044">9.4<!--tex4ht:ref: rc_wire --></a><br + placed, wiring is done using the <span +class="cmtt-10x-x-109">Place Wire </span>option as shown in the Fig. <a +href="#x1-650044">9.4<!--tex4ht:ref: rc_wire --></a><br class="newline" /> - <!--l. 176--><p class="noindent" >Next step is <span -class="cmtt-10x-x-109">ERC (Electric Rules Check)</span>. Fig. <a -href="#x1-650055">9.5<!--tex4ht:ref: erc1 --></a> shows the icon for <span + <!--l. 176--><p class="noindent" >Next step is <span +class="cmtt-10x-x-109">ERC (Electric Rules Check)</span>. Fig. <a +href="#x1-650055">9.5<!--tex4ht:ref: erc1 --></a> shows the icon for <span class="cmtt-10x-x-109">ERC</span>. After completing all the above steps the final Half Wave Rectifier schematic will look - like Fig. <a -href="#x1-6800113">9.13<!--tex4ht:ref: hwr_schematic --></a>.<br + like Fig. <a +href="#x1-6800113">9.13<!--tex4ht:ref: hwr_schematic --></a>.<br class="newline" /> - <!--l. 178--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-6800113"></a> <img -src="figures/hwr_schematic.png" alt="PIC" + <!--l. 178--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-6800113"></a> <img +src="figures/hwr_schematic.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 9.13: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.13: </span><span class="content">Schematic of Half Wave Rectifier circuit</span></div><!--tex4ht:label?: x1-6800113 --> <!--l. 183--><p class="noindent" ></div><hr class="endfigure"> - <!--l. 187--><p class="noindent" >KiCad netlist is generated as shown in the Fig. <a -href="#x1-6800214">9.14<!--tex4ht:ref: hwr_netlistgeneration --></a> <br + <!--l. 187--><p class="noindent" >KiCad netlist is generated as shown in the Fig. <a +href="#x1-6800214">9.14<!--tex4ht:ref: hwr_netlistgeneration --></a> <br class="newline" /> - <!--l. 189--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-6800214"></a> <img -src="figures/hwr_netlistgeneration.png" alt="PIC" + <!--l. 189--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-6800214"></a> <img +src="figures/hwr_netlistgeneration.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 9.14: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.14: </span><span class="content">Half Wave Rectifier circuit Netlist Generation</span></div><!--tex4ht:label?: x1-6800214 --> <!--l. 194--><p class="noindent" ></div><hr class="endfigure"> </li> - <li class="itemize">Convert KiCad to Ngspice: After creating KiCad netlist, click on the <span + <li class="itemize">Convert KiCad to Ngspice: After creating KiCad netlist, click on the <span class="cmtt-10x-x-109">KiCad-Ngspice</span> - <span + <span class="cmtt-10x-x-109">converter </span>button. This will open converter window where you can enter details of Analysis, Source values and Device library. - <!--l. 198--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-6800615"></a> <a - id="x1-68003r1"></a> <img -src="figures/hwr_analysistab.png" alt="PIC" + <!--l. 198--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-6800615"></a> <a + id="x1-68003r1"></a> <img +src="figures/hwr_analysistab.png" alt="PIC" > - <span + <span class="cmr-9">(a)</span> - <span + <span class="cmr-9">Half</span> - <span + <span class="cmr-9">Wave</span> - <span + <span class="cmr-9">Rectifier</span> - <span -class="cmr-9">Analysis</span> <a - id="x1-68004r2"></a> <img -src="figures/hwr_sourcedetailstab.png" alt="PIC" + <span +class="cmr-9">Analysis</span> <a + id="x1-68004r2"></a> <img +src="figures/hwr_sourcedetailstab.png" alt="PIC" > - <span + <span class="cmr-9">(b)</span> - <span + <span class="cmr-9">Half</span> - <span + <span class="cmr-9">Wave</span> - <span + <span class="cmr-9">Rectifier</span> - <span + <span class="cmr-9">Source</span> - <span -class="cmr-9">Details</span> <a - id="x1-68005r3"></a> <img -src="figures/hwr_devicemodelingtab.png" alt="PIC" + <span +class="cmr-9">Details</span> <a + id="x1-68005r3"></a> <img +src="figures/hwr_devicemodelingtab.png" alt="PIC" > - <span + <span class="cmr-9">(c)</span> - <span + <span class="cmr-9">Half</span> - <span + <span class="cmr-9">Wave</span> - <span + <span class="cmr-9">Rectifier</span> - <span + <span class="cmr-9">Device</span> - <span + <span class="cmr-9">Modeling</span> -<br /> <div class="caption" -><span class="id">Figure 9.15: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.15: </span><span class="content">Analysis, Source and Device Tab</span></div><!--tex4ht:label?: x1-6800615 --> <!--l. 210--><p class="noindent" ></div><hr class="endfigure"> <!--l. 212--><p class="noindent" >Under device library you can add the library for diode used in the circuit. If you do not add any library it will take default Ngspice model. </li> <li class="itemize">Simulation: Once the KiCad-Ngspice converter runs successfully, you can run - simulation by clicking the simulation button in the toolbar. <hr class="figure"><div class="figure" -><a - id="x1-6800916"></a> <a - id="x1-68007r1"></a> <img -src="figures/hwr_ngspiceplot.png" alt="PIC" -> -<span -class="cmr-9">(a)</span> -<span -class="cmr-9">Ngspice</span> -<span -class="cmr-9">Plot</span> -<span -class="cmr-9">of</span> -<span -class="cmr-9">Half</span> -<span -class="cmr-9">Wave</span> -<span -class="cmr-9">Rectifier</span> <a - id="x1-68008r2"></a> <img -src="figures/hwr_pythonplot.png" alt="PIC" -> - <span + simulation by clicking the simulation button in the toolbar. <hr class="figure"><div class="figure" +><a + id="x1-6800916"></a> <a + id="x1-68007r1"></a> <img +src="figures/hwr_ngspiceplot.png" alt="PIC" +> +<span +class="cmr-9">(a)</span> +<span +class="cmr-9">Ngspice</span> +<span +class="cmr-9">Plot</span> +<span +class="cmr-9">of</span> +<span +class="cmr-9">Half</span> +<span +class="cmr-9">Wave</span> +<span +class="cmr-9">Rectifier</span> <a + id="x1-68008r2"></a> <img +src="figures/hwr_pythonplot.png" alt="PIC" +> + <span class="cmr-9">(b)</span> - <span + <span class="cmr-9">Python</span> - <span + <span class="cmr-9">Plot</span> - <span + <span class="cmr-9">of</span> - <span + <span class="cmr-9">Half</span> - <span + <span class="cmr-9">Wave</span> - <span + <span class="cmr-9">Rectifier</span> -<br /> <div class="caption" -><span class="id">Figure 9.16: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.16: </span><span class="content">Half Wave Rectifier Simulation Output</span></div><!--tex4ht:label?: x1-6800916 --> <!--l. 225--><p class="noindent" ></div><hr class="endfigure"> </li></ul> <!--l. 232--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">9.1.3 </span> <a + <h4 class="subsectionHead"><span class="titlemark">9.1.3 </span> <a id="x1-690009.1.3"></a>Precision Rectifier</h4> <!--l. 233--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-700009.1.3"></a>Problem Statement:</h5> <!--l. 233--><p class="noindent" >Plot the input and output waveform of the Precision Rectifier circuit where input voltage -(Vs) is 50<span -class="cmmi-10x-x-109">Hz </span>, 3<span +(Vs) is 50<span +class="cmmi-10x-x-109">Hz </span>, 3<span class="cmmi-10x-x-109">V </span>peak to peak. <!--l. 235--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-710009.1.3"></a>Solution:</h5> -<!--l. 236--><p class="noindent" >The new project is created by clicking the <span +<!--l. 236--><p class="noindent" >The new project is created by clicking the <span class="cmtt-10x-x-109">New </span>icon on the menubar. The name of the project -is given as shown in the Fig. <a +is given as shown in the Fig. <a href="#x1-650011">9.1<!--tex4ht:ref: rc1 --></a>. <ul class="itemize1"> <li class="itemize">Creating Schematic: To create the schematic, click the very first icon of the left - toolbar as shown in the Fig. <a -href="#x1-650022">9.2<!--tex4ht:ref: rc2 --></a>. This will open KiCad Eeschema.<br + toolbar as shown in the Fig. <a +href="#x1-650022">9.2<!--tex4ht:ref: rc2 --></a>. This will open KiCad Eeschema.<br class="newline" />After the KiCad window is opened, to create a schematic we need to place the - required components. Fig. <a + required components. Fig. <a href="#x1-650033">9.3<!--tex4ht:ref: rc_component --></a> shows the icon on the right toolbar which opens - the component library.<br + the component library.<br class="newline" />After all the required components of the precision rectifier circuit are placed, - wiring is done using the <span -class="cmtt-10x-x-109">Place Wire </span>option as shown in the Fig. <a -href="#x1-650044">9.4<!--tex4ht:ref: rc_wire --></a>.<br -class="newline" />Next step is <span -class="cmtt-10x-x-109">ERC (Electric Rules Check)</span>. Fig. <a -href="#x1-650055">9.5<!--tex4ht:ref: erc1 --></a> shows the icon for <span + wiring is done using the <span +class="cmtt-10x-x-109">Place Wire </span>option as shown in the Fig. <a +href="#x1-650044">9.4<!--tex4ht:ref: rc_wire --></a>.<br +class="newline" />Next step is <span +class="cmtt-10x-x-109">ERC (Electric Rules Check)</span>. Fig. <a +href="#x1-650055">9.5<!--tex4ht:ref: erc1 --></a> shows the icon for <span class="cmtt-10x-x-109">ERC</span>. The - Fig. <a + Fig. <a href="#x1-7100117">9.17<!--tex4ht:ref: pr_schematic --></a> shows the complete Precision Rectifier schematic after removing the errors. - <!--l. 246--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-7100117"></a> <img -src="figures/pr_schematic.png" alt="PIC" + <!--l. 246--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-7100117"></a> <img +src="figures/pr_schematic.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 9.17: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.17: </span><span class="content">Schematic of Precision Rectifier circuit</span></div><!--tex4ht:label?: x1-7100117 --> <!--l. 251--><p class="noindent" ></div><hr class="endfigure"> - <!--l. 253--><p class="noindent" >The KiCad netlist is generated as shown in Fig. <a -href="#x1-7100218">9.18<!--tex4ht:ref: pr_netlistgeneration --></a>.<br + <!--l. 253--><p class="noindent" >The KiCad netlist is generated as shown in Fig. <a +href="#x1-7100218">9.18<!--tex4ht:ref: pr_netlistgeneration --></a>.<br class="newline" /> - <!--l. 255--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-7100218"></a> <img -src="figures/pr_netlistgeneration.png" alt="PIC" + <!--l. 255--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-7100218"></a> <img +src="figures/pr_netlistgeneration.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 9.18: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.18: </span><span class="content">Precision Rectifier circuit Netlist Generation</span></div><!--tex4ht:label?: x1-7100218 --> <!--l. 260--><p class="noindent" ></div><hr class="endfigure"> </li> <li class="itemize">Convert KiCad to Ngspice: After creating KiCad netlist, click on KiCad-Ngspice - converter button.<br + converter button.<br class="newline" /> <!--l. 266--><p class="noindent" >This will open converter window where you can enter details of Analysis, Source values, Device library and Subcircuit. - <!--l. 268--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-7100719"></a> <a - id="x1-71003r1"></a> <img -src="figures/pr_analysistab.png" alt="PIC" + <!--l. 268--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-7100719"></a> <a + id="x1-71003r1"></a> <img +src="figures/pr_analysistab.png" alt="PIC" > - <span + <span class="cmr-9">(a)</span> - <span + <span class="cmr-9">Precision</span> - <span + <span class="cmr-9">Rectifier</span> - <span -class="cmr-9">Analysis</span> <a - id="x1-71004r2"></a> <img -src="figures/pr_sourcedetailstab.png" alt="PIC" + <span +class="cmr-9">Analysis</span> <a + id="x1-71004r2"></a> <img +src="figures/pr_sourcedetailstab.png" alt="PIC" > - <span + <span class="cmr-9">(b)</span> - <span + <span class="cmr-9">Precision</span> - <span + <span class="cmr-9">Rectifier</span> - <span + <span class="cmr-9">Source</span> - <span + <span class="cmr-9">Details</span> -<a +<a id="x1-71005r3"></a> -<!--l. 278--><p class="noindent" > <img -src="figures/pr_devicemodelingtab.png" alt="PIC" +<!--l. 278--><p class="noindent" > <img +src="figures/pr_devicemodelingtab.png" alt="PIC" > -<span +<span class="cmr-9">(c)</span> -<span +<span class="cmr-9">Precision</span> -<span +<span class="cmr-9">Rectifier</span> -<span +<span class="cmr-9">Device</span> -<span -class="cmr-9">Modeling</span> <a - id="x1-71006r4"></a> <img -src="figures/pr_subcircuitstab.png" alt="PIC" +<span +class="cmr-9">Modeling</span> <a + id="x1-71006r4"></a> <img +src="figures/pr_subcircuitstab.png" alt="PIC" > - <span + <span class="cmr-9">(d)</span> - <span + <span class="cmr-9">Precision</span> - <span + <span class="cmr-9">Rectifier</span> - <span + <span class="cmr-9">Subcircuit</span> -<br /> <div class="caption" -><span class="id">Figure 9.19: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.19: </span><span class="content">Analysis, Source, Device library and Subcircuit tab</span></div><!--tex4ht:label?: x1-7100719 --> <!--l. 283--><p class="noindent" ></div><hr class="endfigure"> <!--l. 285--><p class="noindent" >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.<br + not add any library it will take default Ngspice model for diode.<br class="newline" /> <!--l. 288--><p class="noindent" >Under subcircuit tab you have to add the subciruit used in your circuit. If you forget to add subcircuit it will throw an error. </li> <li class="itemize">Simulation: Once the KiCad-Ngspice converter runs successfully, you can run the - simulation by clicking the simulation button in the toolbar. <hr class="figure"><div class="figure" -><a - id="x1-7101020"></a> <a - id="x1-71008r1"></a> <img -src="figures/pr_ngspiceplot.png" alt="PIC" -> -<span -class="cmr-9">(a)</span> -<span -class="cmr-9">Ngspice</span> -<span -class="cmr-9">Plot</span> -<span -class="cmr-9">of</span> -<span -class="cmr-9">Precision</span> -<span -class="cmr-9">Rectifier</span> <a - id="x1-71009r2"></a> <img -src="figures/pr_pythonplot.png" alt="PIC" -> - <span + simulation by clicking the simulation button in the toolbar. <hr class="figure"><div class="figure" +><a + id="x1-7101020"></a> <a + id="x1-71008r1"></a> <img +src="figures/pr_ngspiceplot.png" alt="PIC" +> +<span +class="cmr-9">(a)</span> +<span +class="cmr-9">Ngspice</span> +<span +class="cmr-9">Plot</span> +<span +class="cmr-9">of</span> +<span +class="cmr-9">Precision</span> +<span +class="cmr-9">Rectifier</span> <a + id="x1-71009r2"></a> <img +src="figures/pr_pythonplot.png" alt="PIC" +> + <span class="cmr-9">(b)</span> - <span + <span class="cmr-9">Python</span> - <span + <span class="cmr-9">Plot</span> - <span + <span class="cmr-9">of</span> - <span + <span class="cmr-9">Precision</span> - <span + <span class="cmr-9">Rectifier</span> -<br /> <div class="caption" -><span class="id">Figure 9.20: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.20: </span><span class="content">Precision Rectifier Simulation Output</span></div><!--tex4ht:label?: x1-7101020 --> <!--l. 302--><p class="noindent" ></div><hr class="endfigure"> </li></ul> <!--l. 309--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">9.1.4 </span> <a + <h4 class="subsectionHead"><span class="titlemark">9.1.4 </span> <a id="x1-720009.1.4"></a>Inverting Amplifier</h4> <!--l. 310--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-730009.1.4"></a>Problem Statement:</h5> <!--l. 311--><p class="noindent" >Plot the Input and Output Waveform of Inverting Amplifier circuit where the input voltage -(Vs) is 50<span -class="cmmi-10x-x-109">Hz</span>, 2<span +(Vs) is 50<span +class="cmmi-10x-x-109">Hz</span>, 2<span class="cmmi-10x-x-109">V </span>peak to peak and gain is 2. - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-740009.1.4"></a>Solution:</h5> <ul class="itemize1"> <li class="itemize">Creating Schematic: To create the schematic, click the very first icon of the left - toolbar as shown in the Fig. <a -href="#x1-650022">9.2<!--tex4ht:ref: rc2 --></a>. This will open KiCad Eeschema.<br + toolbar as shown in the Fig. <a +href="#x1-650022">9.2<!--tex4ht:ref: rc2 --></a>. This will open KiCad Eeschema.<br class="newline" />After the KiCad window is opened, to create a schematic we need to place the - required components. Fig. <a + required components. Fig. <a href="#x1-650033">9.3<!--tex4ht:ref: rc_component --></a> shows the icon on the right toolbar which opens - the component library.<br + the component library.<br class="newline" />After all the required components of the inverting amplifier circuit are placed, - wiring is done using the <span -class="cmtt-10x-x-109">Place Wire </span>option as shown in the Fig. <a -href="#x1-650044">9.4<!--tex4ht:ref: rc_wire --></a>.<br -class="newline" />Next step is <span -class="cmtt-10x-x-109">ERC (Electric Rules Check)</span>. Fig. <a -href="#x1-650055">9.5<!--tex4ht:ref: erc1 --></a> shows the icon for <span + wiring is done using the <span +class="cmtt-10x-x-109">Place Wire </span>option as shown in the Fig. <a +href="#x1-650044">9.4<!--tex4ht:ref: rc_wire --></a>.<br +class="newline" />Next step is <span +class="cmtt-10x-x-109">ERC (Electric Rules Check)</span>. Fig. <a +href="#x1-650055">9.5<!--tex4ht:ref: erc1 --></a> shows the icon for <span class="cmtt-10x-x-109">ERC</span>. - <!--l. 321--><p class="noindent" >The Fig. <a + <!--l. 321--><p class="noindent" >The Fig. <a href="#x1-7400121">9.21<!--tex4ht:ref: ia_schematic --></a> shows the complete Precision Rectifier schematic after removing the errors. - <!--l. 323--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-7400121"></a> <img -src="figures/ia_schematic.png" alt="PIC" + <!--l. 323--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-7400121"></a> <img +src="figures/ia_schematic.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 9.21: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.21: </span><span class="content">Schematic of Inverting Amplifier circuit</span></div><!--tex4ht:label?: x1-7400121 --> <!--l. 328--><p class="noindent" ></div><hr class="endfigure"> - <!--l. 330--><p class="noindent" >The KiCad netlist is generated as shown in Fig. <a -href="#x1-7400222">9.22<!--tex4ht:ref: ia_netlistgeneration --></a>.<br -class="newline" /><hr class="figure"><div class="figure" -><a - id="x1-7400222"></a> <img -src="figures/ia_netlistgeneration.png" alt="PIC" -> -<br /> <div class="caption" -><span class="id">Figure 9.22: </span><span + <!--l. 330--><p class="noindent" >The KiCad netlist is generated as shown in Fig. <a +href="#x1-7400222">9.22<!--tex4ht:ref: ia_netlistgeneration --></a>.<br +class="newline" /><hr class="figure"><div class="figure" +><a + id="x1-7400222"></a> <img +src="figures/ia_netlistgeneration.png" alt="PIC" +> +<br /> <div class="caption" +><span class="id">Figure 9.22: </span><span class="content">Inverting Amplifier circuit Netlist Generation</span></div><!--tex4ht:label?: x1-7400222 --> <!--l. 336--><p class="noindent" ></div><hr class="endfigure"> </li> <li class="itemize">Convert KiCad to Ngspice: After creating KiCad netlist, click on KiCad-Ngspice - converter button.<br + converter button.<br class="newline" /> <!--l. 342--><p class="noindent" >This will open converter window where you can enter details of Analysis, Source values, Device library and Subcircuit. - <!--l. 344--><p class="noindent" >Subcircuit of Op-Amp is shown in Fig. <a -href="#x1-74006r4">9.23d<!--tex4ht:ref: ia_sub --></a> <hr class="figure"><div class="figure" -><a - id="x1-7400723"></a> <a - id="x1-74003r1"></a> <img -src="figures/ia_analysistab.png" alt="PIC" -> -<span -class="cmr-9">(a)</span> -<span -class="cmr-9">Inverting</span> -<span -class="cmr-9">Amplifier</span> -<span -class="cmr-9">Analysis</span> <a - id="x1-74004r2"></a> <img -src="figures/ia_sourcedetailstab.png" alt="PIC" -> - <span + <!--l. 344--><p class="noindent" >Subcircuit of Op-Amp is shown in Fig. <a +href="#x1-74006r4">9.23d<!--tex4ht:ref: ia_sub --></a> <hr class="figure"><div class="figure" +><a + id="x1-7400723"></a> <a + id="x1-74003r1"></a> <img +src="figures/ia_analysistab.png" alt="PIC" +> +<span +class="cmr-9">(a)</span> +<span +class="cmr-9">Inverting</span> +<span +class="cmr-9">Amplifier</span> +<span +class="cmr-9">Analysis</span> <a + id="x1-74004r2"></a> <img +src="figures/ia_sourcedetailstab.png" alt="PIC" +> + <span class="cmr-9">(b)</span> - <span + <span class="cmr-9">Inverting</span> - <span + <span class="cmr-9">Amplifier</span> - <span + <span class="cmr-9">Source</span> - <span + <span class="cmr-9">Details</span> -<a +<a id="x1-74005r3"></a> -<!--l. 355--><p class="noindent" > <img -src="figures/ia_subcircuitstab.png" alt="PIC" +<!--l. 355--><p class="noindent" > <img +src="figures/ia_subcircuitstab.png" alt="PIC" > -<span +<span class="cmr-9">(c)</span> -<span +<span class="cmr-9">Inverting</span> -<span +<span class="cmr-9">Amplifier</span> -<span -class="cmr-9">Subcircuit</span> <a - id="x1-74006r4"></a> <img -src="figures/ia_sub.png" alt="PIC" +<span +class="cmr-9">Subcircuit</span> <a + id="x1-74006r4"></a> <img +src="figures/ia_sub.png" alt="PIC" > - <span + <span class="cmr-9">(d)</span> - <span + <span class="cmr-9">Sub-Circuit</span> - <span + <span class="cmr-9">of</span> - <span + <span class="cmr-9">Op-Amp</span> -<br /> <div class="caption" -><span class="id">Figure 9.23: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.23: </span><span class="content">Analysis, Source, and Subcircuit tab</span></div><!--tex4ht:label?: x1-7400723 --> <!--l. 360--><p class="noindent" ></div><hr class="endfigure"> <!--l. 363--><p class="noindent" >Under subcircuit tab you have to add the subciruit used in your circuit. If you forget to - add subcircuit, it will throw an error.<br + add subcircuit, it will throw an error.<br class="newline" /> </li> <li class="itemize">Simulation: Once the KiCad-Ngspice converter runs successfully, you can run - simulation by clicking the simulation button in the toolbar. <hr class="figure"><div class="figure" -><a - id="x1-7401024"></a> <a - id="x1-74008r1"></a> <img -src="figures/ia_ngspiceplot.png" alt="PIC" -> -<span -class="cmr-9">(a)</span> -<span -class="cmr-9">Inverting</span> -<span -class="cmr-9">Amplifier</span> -<span -class="cmr-9">Ngspice</span> -<span + simulation by clicking the simulation button in the toolbar. <hr class="figure"><div class="figure" +><a + id="x1-7401024"></a> <a + id="x1-74008r1"></a> <img +src="figures/ia_ngspiceplot.png" alt="PIC" +> +<span +class="cmr-9">(a)</span> +<span +class="cmr-9">Inverting</span> +<span +class="cmr-9">Amplifier</span> +<span +class="cmr-9">Ngspice</span> +<span class="cmr-9">Plot</span> -<a +<a id="x1-74009r2"></a> -<!--l. 374--><p class="noindent" > <img -src="figures/ia_pythonplot.png" alt="PIC" +<!--l. 374--><p class="noindent" > <img +src="figures/ia_pythonplot.png" alt="PIC" > -<span +<span class="cmr-9">(b)</span> -<span +<span class="cmr-9">Inverting</span> -<span +<span class="cmr-9">Amplifier</span> -<span +<span class="cmr-9">Python</span> -<span +<span class="cmr-9">Plot</span> -<br /> <div class="caption" -><span class="id">Figure 9.24: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.24: </span><span class="content">Inverting Amplifier Simulation Output</span></div><!--tex4ht:label?: x1-7401024 --> <!--l. 376--><p class="noindent" ></div><hr class="endfigure"> </li></ul> <!--l. 386--><p class="noindent" > - <h4 class="subsectionHead"><span class="titlemark">9.1.5 </span> <a + <h4 class="subsectionHead"><span class="titlemark">9.1.5 </span> <a id="x1-750009.1.5"></a>Half Adder Example</h4> <!--l. 388--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-760009.1.5"></a>Problem Statement:</h5> <!--l. 388--><p class="noindent" >Plot the Input and Output Waveform of Half Adder circuit. <!--l. 390--><p class="noindent" > - <h5 class="subsubsectionHead"><a + <h5 class="subsubsectionHead"><a id="x1-770009.1.5"></a>Solution:</h5> <ul class="itemize1"> <li class="itemize">Creating Schematic: To create the schematic, click the very first icon of the left - toolbar as shown in the Fig. <a -href="#x1-650022">9.2<!--tex4ht:ref: rc2 --></a>. This will open KiCad Eeschema.<br + toolbar as shown in the Fig. <a +href="#x1-650022">9.2<!--tex4ht:ref: rc2 --></a>. This will open KiCad Eeschema.<br class="newline" />After the KiCad window is opened, to create a schematic we need to place the - required components. Fig. <a + required components. Fig. <a href="#x1-650033">9.3<!--tex4ht:ref: rc_component --></a> shows the icon on the right toolbar which opens - the component library.<br + the component library.<br class="newline" />After all the required components of the Half Adder circuit are placed, wiring is - done using the <span -class="cmtt-10x-x-109">Place Wire </span>option as shown in the Fig. <a -href="#x1-650044">9.4<!--tex4ht:ref: rc_wire --></a>.<br -class="newline" />Next step is <span -class="cmtt-10x-x-109">ERC (Electric Rules Check)</span>. Fig. <a -href="#x1-650055">9.5<!--tex4ht:ref: erc1 --></a> shows the icon for <span + done using the <span +class="cmtt-10x-x-109">Place Wire </span>option as shown in the Fig. <a +href="#x1-650044">9.4<!--tex4ht:ref: rc_wire --></a>.<br +class="newline" />Next step is <span +class="cmtt-10x-x-109">ERC (Electric Rules Check)</span>. Fig. <a +href="#x1-650055">9.5<!--tex4ht:ref: erc1 --></a> shows the icon for <span class="cmtt-10x-x-109">ERC</span>. - <!--l. 399--><p class="noindent" >The Fig. <a + <!--l. 399--><p class="noindent" >The Fig. <a href="#x1-7700125">9.25<!--tex4ht:ref: ha_schematic --></a> shows the complete Half Adder schematic after removing the - errors. <hr class="figure"><div class="figure" -><a - id="x1-7700125"></a> <img -src="figures/ha_schematic.png" alt="PIC" + errors. <hr class="figure"><div class="figure" +><a + id="x1-7700125"></a> <img +src="figures/ha_schematic.png" alt="PIC" > -<br /> <div class="caption" -><span class="id">Figure 9.25: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.25: </span><span class="content">Schematic of Half Adder circuit</span></div><!--tex4ht:label?: x1-7700125 --> <!--l. 405--><p class="noindent" ></div><hr class="endfigure"> - <!--l. 407--><p class="noindent" >The KiCad netlist is generated as shown in Fig. <a -href="#x1-7700226">9.26<!--tex4ht:ref: ha_netlistgeneration --></a>.<br -class="newline" /><hr class="figure"><div class="figure" -><a - id="x1-7700226"></a> <img -src="figures/ha_netlistgeneration.png" alt="PIC" -> -<br /> <div class="caption" -><span class="id">Figure 9.26: </span><span + <!--l. 407--><p class="noindent" >The KiCad netlist is generated as shown in Fig. <a +href="#x1-7700226">9.26<!--tex4ht:ref: ha_netlistgeneration --></a>.<br +class="newline" /><hr class="figure"><div class="figure" +><a + id="x1-7700226"></a> <img +src="figures/ha_netlistgeneration.png" alt="PIC" +> +<br /> <div class="caption" +><span class="id">Figure 9.26: </span><span class="content">Half Adder circuit Netlist Generation</span></div><!--tex4ht:label?: x1-7700226 --> <!--l. 413--><p class="noindent" ></div><hr class="endfigure"> </li> <li class="itemize">Convert KiCad to Ngspice: After creating KiCad netlist click on KiCad-Ngspice - converter button.<br + converter button.<br class="newline" /> <!--l. 420--><p class="noindent" >This will open converter window where you can enter details of Analysis, Source values, Ngspice model and Subcircuit. - <!--l. 422--><p class="noindent" ><hr class="figure"><div class="figure" -><a - id="x1-7700727"></a> <a - id="x1-77003r1"></a> <img -src="figures/ha_analysistab.png" alt="PIC" + <!--l. 422--><p class="noindent" ><hr class="figure"><div class="figure" +><a + id="x1-7700727"></a> <a + id="x1-77003r1"></a> <img +src="figures/ha_analysistab.png" alt="PIC" > - <span + <span class="cmr-9">(a)</span> - <span + <span class="cmr-9">Half</span> - <span + <span class="cmr-9">Adder</span> - <span -class="cmr-9">Analysis</span> <a - id="x1-77004r2"></a> <img -src="figures/ha_sourcedetailstab.png" alt="PIC" + <span +class="cmr-9">Analysis</span> <a + id="x1-77004r2"></a> <img +src="figures/ha_sourcedetailstab.png" alt="PIC" > - <span + <span class="cmr-9">(b)</span> - <span + <span class="cmr-9">Half</span> - <span + <span class="cmr-9">Adder</span> - <span + <span class="cmr-9">Source</span> - <span + <span class="cmr-9">Details</span> -<a +<a id="x1-77005r3"></a> -<!--l. 432--><p class="noindent" > <img -src="figures/ha_ngspicemodeltab.png" alt="PIC" +<!--l. 432--><p class="noindent" > <img +src="figures/ha_ngspicemodeltab.png" alt="PIC" > -<span +<span class="cmr-9">(c)</span> -<span +<span class="cmr-9">Half</span> -<span +<span class="cmr-9">Adder</span> -<span +<span class="cmr-9">Ngspice</span> -<span -class="cmr-9">Model</span> <a - id="x1-77006r4"></a> <img -src="figures/ha_subcircuitstab.png" alt="PIC" +<span +class="cmr-9">Model</span> <a + id="x1-77006r4"></a> <img +src="figures/ha_subcircuitstab.png" alt="PIC" > - <span + <span class="cmr-9">(d)</span> - <span + <span class="cmr-9">Half</span> - <span + <span class="cmr-9">Adder</span> - <span + <span class="cmr-9">Subcircuit</span> - <span + <span class="cmr-9">Model</span> -<br /> <div class="caption" -><span class="id">Figure 9.27: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.27: </span><span class="content">Analysis, Source, Ngspice Model and Subcircuit tab</span></div><!--tex4ht:label?: x1-7700727 --> <!--l. 437--><p class="noindent" ></div><hr class="endfigure"> - <!--l. 439--><p class="noindent" >Subcircuit of Half Adder in Fig. <a -href="#x1-7700828">9.28<!--tex4ht:ref: ha_sub --></a> <hr class="figure"><div class="figure" -><a - id="x1-7700828"></a> <img -src="figures/ha_sub.png" alt="PIC" -> -<br /> <div class="caption" -><span class="id">Figure 9.28: </span><span + <!--l. 439--><p class="noindent" >Subcircuit of Half Adder in Fig. <a +href="#x1-7700828">9.28<!--tex4ht:ref: ha_sub --></a> <hr class="figure"><div class="figure" +><a + id="x1-7700828"></a> <img +src="figures/ha_sub.png" alt="PIC" +> +<br /> <div class="caption" +><span class="id">Figure 9.28: </span><span class="content">Half Adder Subcircuit</span></div><!--tex4ht:label?: x1-7700828 --> <!--l. 445--><p class="noindent" ></div><hr class="endfigure"> </li> <li class="itemize">Simulation: Once the KiCad-Ngspice converter runs successfully, you can run - simulation by clicking the simulation button in the toolbar. <hr class="figure"><div class="figure" -><a - id="x1-7701129"></a> <a - id="x1-77009r1"></a> <img -src="figures/ha_ngspiceplot.png" alt="PIC" -> -<span -class="cmr-9">(a)</span> -<span -class="cmr-9">Half</span> -<span -class="cmr-9">Adder</span> -<span -class="cmr-9">Ngspice</span> -<span -class="cmr-9">Plot</span> <a - id="x1-77010r2"></a> <img -src="figures/ha_pythonplot.png" alt="PIC" -> - <span + simulation by clicking the simulation button in the toolbar. <hr class="figure"><div class="figure" +><a + id="x1-7701129"></a> <a + id="x1-77009r1"></a> <img +src="figures/ha_ngspiceplot.png" alt="PIC" +> +<span +class="cmr-9">(a)</span> +<span +class="cmr-9">Half</span> +<span +class="cmr-9">Adder</span> +<span +class="cmr-9">Ngspice</span> +<span +class="cmr-9">Plot</span> <a + id="x1-77010r2"></a> <img +src="figures/ha_pythonplot.png" alt="PIC" +> + <span class="cmr-9">(b)</span> - <span + <span class="cmr-9">Half</span> - <span + <span class="cmr-9">Adder</span> - <span + <span class="cmr-9">Python</span> - <span + <span class="cmr-9">Plot</span> -<br /> <div class="caption" -><span class="id">Figure 9.29: </span><span +<br /> <div class="caption" +><span class="id">Figure 9.29: </span><span class="content">Half Adder Simulation Output</span></div><!--tex4ht:label?: x1-7701129 --> <!--l. 459--><p class="noindent" ></div><hr class="endfigure"> </li></ul> - <h2 class="likechapterHead"><a - id="x1-780009.1.5"></a>References</h2><a + <h2 class="likechapterHead"><a + id="x1-780009.1.5"></a>References</h2><a id="Q1-1-166"></a> <div class="thebibliography"> <p class="bibitem" ><span class="biblabel"> - [1]<span class="bibsp">   </span></span><a - id="Xsedra"></a>A. S. Sedra and K. C. Smith, <span + [1]<span class="bibsp">   </span></span><a + id="Xsedra"></a>A. S. Sedra and K. C. Smith, <span class="cmti-10x-x-109">Microelectronic Circuits - Theory and</span> - <span + <span class="cmti-10x-x-109">Applications</span>. Oxford University Press, 2009. </p> <p class="bibitem" ><span class="biblabel"> - [2]<span class="bibsp">   </span></span><a + [2]<span class="bibsp">   </span></span><a id="Xkmm11-csi"></a>K. M. Moudgalya, “Spoken Tutorial: A Collaborative and Scalable Education - Technology,” <span + Technology,” <span class="cmti-10x-x-109">CSI Communications</span>, vol. 35, no. 6, pp. 10–12, September 2011, - available at <a + available at <a href="http://spoken-tutorial.org/CSI.pdf" class="url" >http://spoken-tutorial.org/CSI.pdf</a>. </p> <p class="bibitem" ><span class="biblabel"> - [3]<span class="bibsp">   </span></span><a - id="Xscilab"></a>(2013, May). [Online]. Available: <a + [3]<span class="bibsp">   </span></span><a + id="Xscilab"></a>(2013, May). [Online]. Available: <a href="http://www.scilab.org/" class="url" >http://www.scilab.org/</a> </p> <p class="bibitem" ><span class="biblabel"> - [4]<span class="bibsp">   </span></span><a + [4]<span class="bibsp">   </span></span><a id="XGARUDA"></a>(2013, May). [Online]. Available: - <a + <a 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</a> </p> <p class="bibitem" ><span class="biblabel"> - [5]<span class="bibsp">   </span></span><a + [5]<span class="bibsp">   </span></span><a id="XT10KT"></a>D. B. Phatak. (2013, May) Teach 10,000 teacher programme. [Online]. - Available: <a + Available: <a href="http://www.it.iitb.ac.in/nmeict/MegaWorkshop.do" class="url" >http://www.it.iitb.ac.in/nmeict/MegaWorkshop.do</a> </p> <p class="bibitem" ><span class="biblabel"> - [6]<span class="bibsp">   </span></span><a + [6]<span class="bibsp">   </span></span><a id="XT10KT-kal"></a>K. Kannan and K. Narayanan, “Ict-enabled scalable workshops for engineering - college teachers in india,” in <span + college teachers in india,” in <span class="cmti-10x-x-109">Post-Secondary Education and Technology: A Global</span> - <span + <span class="cmti-10x-x-109">Perspective on Opportunities and Obstacles to Development (International and</span> - <span + <span class="cmti-10x-x-109">Development Education)</span>, R. Clohey, S. Austin-Li, and J. C. Weldman, Eds. Palgrave Macmillan, 2012. </p> <p class="bibitem" ><span class="biblabel"> - [7]<span class="bibsp">   </span></span><a + [7]<span class="bibsp">   </span></span><a id="XT10KT-kgp"></a>(2013, May) Teach 10,000 teacher programme on analog electronics. [Online]. - Available: <a + Available: <a href="http://www.nmeict.iitkgp.ernet.in/Analogmain.htm" class="url" >http://www.nmeict.iitkgp.ernet.in/Analogmain.htm</a> </p> <p class="bibitem" ><span class="biblabel"> - [8]<span class="bibsp">   </span></span><a - id="Xaakash"></a>(2013, May). [Online]. Available: <a + [8]<span class="bibsp">   </span></span><a + id="Xaakash"></a>(2013, May). [Online]. Available: <a href="http://www.aakashlabs.org/" class="url" >http://www.aakashlabs.org/</a> </p> <p class="bibitem" ><span class="biblabel"> - [9]<span class="bibsp">   </span></span><a + [9]<span class="bibsp">   </span></span><a id="Xeda"></a>(2013, May). [Online]. Available: - <a + <a href="http://en.wikipedia.org/wiki/Electronic_design_automation" class="url" >http://en.wikipedia.org/wiki/Electronic_design_automation</a> </p> <p class="bibitem" ><span class="biblabel"> - [10]<span class="bibsp">   </span></span><a + [10]<span class="bibsp">   </span></span><a id="Xsynaptic"></a>(2013, May) Synaptic Package Manager Spoken Tutorial. [Online]. Available: - <a + <a 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</a> </p> <p class="bibitem" ><span class="biblabel"> - [11]<span class="bibsp">   </span></span><a + [11]<span class="bibsp">   </span></span><a id="Xeeschema"></a>(2013, May). [Online]. Available: - <a + <a 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</a> </p> <p class="bibitem" ><span class="biblabel"> - [12]<span class="bibsp">   </span></span><a - id="Xngspice-web"></a>(2013, May). [Online]. Available: <a + [12]<span class="bibsp">   </span></span><a + id="Xngspice-web"></a>(2013, May). [Online]. Available: <a href="http://ngspice.sourceforge.net/" class="url" >http://ngspice.sourceforge.net/</a> </p> <p class="bibitem" ><span class="biblabel"> - [13]<span class="bibsp">   </span></span><a - id="Xscilab-in"></a>(2013, May). [Online]. Available: <a + [13]<span class="bibsp">   </span></span><a + id="Xscilab-in"></a>(2013, May). [Online]. Available: <a href="http://scilab.in/" class="url" >http://scilab.in/</a> </p> <p class="bibitem" ><span class="biblabel"> - [14]<span class="bibsp">   </span></span><a - id="Xspice"></a>S. M. Sandler and C. Hymowitz, <span + [14]<span class="bibsp">   </span></span><a + id="Xspice"></a>S. M. Sandler and C. Hymowitz, <span class="cmti-10x-x-109">SPICE Circuit Handbook</span>. New York: McGraw-Hill Professional, 2006. </p> <p class="bibitem" ><span class="biblabel"> - [15]<span class="bibsp">   </span></span><a + [15]<span class="bibsp">   </span></span><a id="Xkicad"></a>J.-P. Charras and F. Tappero. (2013, May). [Online]. Available: - <a + <a href="http://www.kicad-pcb.org/display/KICAD/KiCad+Documentation" class="url" >http://www.kicad-pcb.org/display/KICAD/KiCad+Documentation</a> </p> <p class="bibitem" ><span class="biblabel"> - [16]<span class="bibsp">   </span></span><a + [16]<span class="bibsp">   </span></span><a id="Xkicad2"></a>D. Jahshan and P. Hutchinson. (2013, May). [Online]. Available: - <a -href="http://bazaar.launchpad.net/~kicad-developers/kicad/doc/files/head:/doc/tutorials/" class="url" >http://bazaar.launchpad.net/<span + <a +href="http://bazaar.launchpad.net/~kicad-developers/kicad/doc/files/head:/doc/tutorials/" class="url" >http://bazaar.launchpad.net/<span class="cmsy-8">∼</span>kicad-developers/kicad/doc/files/head:/doc/tutorials/</a> </p> <p class="bibitem" ><span class="biblabel"> - [17]<span class="bibsp">   </span></span><a + [17]<span class="bibsp">   </span></span><a id="Xngspice"></a>P. Nenzi and H. Vogt. (2013) Ngspice users manual version 25plus. [Online]. - Available: <a + Available: <a href="http://ngspice.sourceforge.net/docs/ngspice-manual.pdf" class="url" >http://ngspice.sourceforge.net/docs/ngspice-manual.pdf</a> </p> <p class="bibitem" ><span class="biblabel"> - [18]<span class="bibsp">   </span></span><a - id="Xkmm11-TUGboat"></a>K. M. Moudgalya, “<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span -class="E">E</span>X</span></span> Training through Spoken Tutorials,” <span + [18]<span class="bibsp">   </span></span><a + id="Xkmm11-TUGboat"></a>K. M. Moudgalya, “<span class="LATEX">L<span class="A">A</span><span class="TEX">T<span +class="E">E</span>X</span></span> Training through Spoken Tutorials,” <span class="cmti-10x-x-109">TUGboat</span>, vol. 32, no. 3, pp. 251–257, 2011. </p> <p class="bibitem" ><span class="biblabel"> - [19]<span class="bibsp">   </span></span><a - id="Xst"></a>(2013, May). [Online]. Available: <a + [19]<span class="bibsp">   </span></span><a + id="Xst"></a>(2013, May). [Online]. Available: <a href="http://www.spoken-tutorial.org/" class="url" >http://www.spoken-tutorial.org/</a> </p> <p class="bibitem" ><span class="biblabel"> - [20]<span class="bibsp">   </span></span><a - id="Xoscad"></a>(2013, May). [Online]. Available: <a + [20]<span class="bibsp">   </span></span><a + id="Xoscad"></a>(2013, May). [Online]. Available: <a href="http://oscad.in/" class="url" >http://oscad.in/</a> </p> </div> - -</body></html> - - +</body></html> diff --git a/src/configuration/Appconfig.py b/src/configuration/Appconfig.py index 40bb8ef6..8c34abb8 100644 --- a/src/configuration/Appconfig.py +++ b/src/configuration/Appconfig.py @@ -54,8 +54,13 @@ class Appconfig(QtGui.QWidget): os.path.join( '.esim', 'config.ini'))) - # Need to comment below line to execute on Windows 10 - # modelica_map_json = parser_esim.get('eSim', 'MODELICA_MAP_JSON') + + # Try catch added, since eSim cannot be accessed under parser for Win10 + try: + modelica_map_json = parser_esim.get('eSim', 'MODELICA_MAP_JSON') + except: + print("Cannot access eSim in parser") + try: project_explorer = json.load(open(dictPath)) except BaseException: diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py index 19fe17ef..c2790a80 100755 --- a/src/frontEnd/Application.py +++ b/src/frontEnd/Application.py @@ -32,16 +32,14 @@ import sys import os +# Its our main window of application. class Application(QtGui.QMainWindow): + """This class initializes all objects used in this file(Application.py).""" global project_name - """ - Its our main window of application - """ def __init__(self, *args): - """ - Initialize main Application window - """ + """Initialize main Application window.""" + # Calling __init__ of super class QtGui.QMainWindow.__init__(self, *args) @@ -67,9 +65,16 @@ class Application(QtGui.QMainWindow): self.systemTrayIcon.setIcon(QtGui.QIcon('../../images/logo.png')) self.systemTrayIcon.setVisible(True) + # This function initializes Tool Bars def initToolBar(self): """ - This function initialize Tool Bar + In this function we are setting icons, short-cuts,and + defining functonality for:. + a)Top-tool-bar (New project, Open project, Close + project, Help option ) + b)Left-tool-bar (Open Schematic, Convert KiCad to + NgSpice, Simuation, Model Editor, Subcircuit, NGHDL, + Modelica Converter, OM Optimisation ) """ # Top Tool bar self.newproj = QtGui.QAction( @@ -106,6 +111,8 @@ class Application(QtGui.QMainWindow): self.topToolbar.addAction(self.closeproj) self.topToolbar.addAction(self.helpfile) + # This part is setting fossee logo to the right + # corner in the application window. self.spacer = QtGui.QWidget() self.spacer.setSizePolicy( QtGui.QSizePolicy.Expanding, @@ -186,7 +193,23 @@ class Application(QtGui.QMainWindow): self.lefttoolbar.setOrientation(QtCore.Qt.Vertical) self.lefttoolbar.setIconSize(QSize(40, 40)) + # This function closes the ongoing program(process). def closeEvent(self, event): + ''' + When exit button is pressed a Message box pops out with + exit message and buttons 'Yes', 'No'. + + 1. If 'Yes' is pressed:. + a)it checks that program(process) in procThread_list + (list made in Appconfig.py): + a.1) if available it terminates that program + a.2) if the program(process) is not available, + it checks for it in process_obj (list made in + Appconfig.py) if found it closes the program. + + 2. If 'No' is pressed: + a)the program just continues as it was doing earlier. + ''' exit_msg = "Are you sure you want to exit the program\ ? All unsaved data will be lost." reply = QtGui.QMessageBox.question( @@ -219,7 +242,16 @@ class Application(QtGui.QMainWindow): elif reply == QtGui.QMessageBox.No: event.ignore() + # This function closes the saved project. def close_project(self): + """ + This function first checks whether project(file) is present in list. + a)If present: + :-it first kills that process-id. + :-closes that file. + :-Shows message "Current project <path of file> is closed" + b)If not present:- pass + """ print("Function : Close Project") current_project = self.obj_appconfig.current_project['ProjectName'] if current_project is None: @@ -239,10 +271,8 @@ class Application(QtGui.QMainWindow): os.path.basename(current_project) + ' is Closed.') + # This function call New Project Info class. def new_project(self): - """ - This function call New Project Info class. - """ text, ok = QtGui.QInputDialog.getText( self, 'New Project Info', 'Enter Project Name:') if ok: @@ -263,10 +293,8 @@ class Application(QtGui.QMainWindow): except BaseException: pass + # This project call Open Project Info class def open_project(self): - """ - This project call Open Project Info class - """ print("Function : Open Project") self.project = OpenProjectInfo() @@ -277,17 +305,21 @@ class Application(QtGui.QMainWindow): except BaseException: pass + # This page opens usermanual in dockarea. def help_project(self): + """ + 1)It prints the message ""Function : Help"" + 2)Uses print_info() method of class Appconfig + form Configuration/Appconfig.py file. + 3)Call method usermanual() from ./DockArea.py. + """ print("Function : Help") self.obj_appconfig.print_info('Help is called') print("Current Project is : ", self.obj_appconfig.current_project) self.obj_Mainview.obj_dockarea.usermanual() + # This Function execute ngspice on current project. def open_ngspice(self): - """ - This Function execute ngspice on current project - """ - self.projDir = self.obj_appconfig.current_project["ProjectName"] if self.projDir is not None: @@ -311,12 +343,29 @@ class Application(QtGui.QMainWindow): create new project or open existing project') self.msg.setWindowTitle("Error Message") + # This function opens 'subcircuit' option in left-tool-bar. def open_subcircuit(self): + """ + When 'subcircuit' icon is clicked wich is present in + left-tool-bar of main page: + a) Meassge shown on screen "Subcircuit editor is called". + b) 'subcircuiteditor()'' function is called using object + 'obj_dockarea' of class 'Mainview'. + """ print("Function : Subcircuit editor") self.obj_appconfig.print_info('Subcircuit editor is called') self.obj_Mainview.obj_dockarea.subcircuiteditor() + # This function calls NGHDl option in left-tool-bar. def open_nghdl(self): + """ + This function uses validateTool() method from + Validation.py: + a) If 'nghdl' is present in executables list then + it adds passes command 'nghdl -e' to WorkerThread class of + Worker.py. + b) If 'nghdl' not present then it shows error message. + """ print("Function : Nghdl") self.obj_appconfig.print_info('Nghdl is called') @@ -333,16 +382,22 @@ class Application(QtGui.QMainWindow): Please make sure nghdl is installed') self.msg.setWindowTitle('nghdl Error Message') + # This function opens model editor option in left-tool-bar. def open_modelEditor(self): + """ + When model editor icon is clicked wich is present in + left-tool-bar of main page: + a) Meassge shown on screen "Model editor is called". + b) 'modeleditor()'' function is called using object + 'obj_dockarea' of class 'Mainview'. + """ print("Function : Model editor") self.obj_appconfig.print_info('Model editor is called') self.obj_Mainview.obj_dockarea.modelEditor() + # This function call ngspice to OM edit converter + # and then launch OM edit. def open_OMedit(self): - """ - This function call ngspice to OM edit converter - and then launch OM edit. - """ self.obj_appconfig.print_info('OM edit is called') self.projDir = self.obj_appconfig.current_project["ProjectName"] @@ -358,7 +413,7 @@ class Application(QtGui.QMainWindow): try: # Creating a command for Ngspice to Modelica converter self.cmd1 = " - python ../ngspicetoModelica/NgspicetoModelica.py "\ + python3 ../ngspicetoModelica/NgspicetoModelica.py "\ +self.ngspiceNetlist self.obj_workThread1 = Worker.WorkerThread(self.cmd1) self.obj_workThread1.start() @@ -415,7 +470,17 @@ class Application(QtGui.QMainWindow): or open existing project') self.msg.setWindowTitle("Error Message") + # sdf def open_OMoptim(self): + """ + This function uses validateTool() method from + Validation.py: + a) If 'OMOptim' is present in executables list then + it adds passes command 'OMOptim' to WorkerThread class of + Worker.py. + b) If 'OMOptim' not present then it shows error message with + link to download it on Linux and Windows. + """ print("Function : OM Optim") self.obj_appconfig.print_info('OM Optim is called') # Check if OMOptim is installed @@ -441,9 +506,17 @@ class Application(QtGui.QMainWindow): self.msg.exec_() +# This class initialize the Main View of Application class MainView(QtGui.QWidget): """ - This class initialize the Main View of Application + This class defines whole view and style of main page: + a)Position of tool bars: + :-Top tool bar. + :-Left tool bar. + b) Project explorer Area. + c) Dock area. + d)Console area. + """ def __init__(self, *args): @@ -497,9 +570,11 @@ class MainView(QtGui.QWidget): self.setLayout(self.mainLayout) +# It is main function of the module.It starts the application def main(args): """ - It is main function of the module.It starts the application + The splash screen opened at the starting of screen is performed + by this function. """ print("Starting eSim......") app = QtGui.QApplication(args) diff --git a/src/frontEnd/DockArea.py b/src/frontEnd/DockArea.py index b44a87e6..2c605272 100644 --- a/src/frontEnd/DockArea.py +++ b/src/frontEnd/DockArea.py @@ -14,9 +14,9 @@ dockList = ['Welcome'] count = 1 dock = {} - +# class DockArea(QtGui.QMainWindow): - + """ """ def __init__(self): QtGui.QMainWindow.__init__(self) self.obj_appconfig = Appconfig() @@ -39,32 +39,10 @@ class DockArea(QtGui.QMainWindow): # self.tabifyDockWidget(dock['Notes'],dock['Blank']) self.show() - - ''' - def __init__(self): - QtGui.QMainWindow.__init__(self) - self.obj_appconfig = Appconfig() - - for dockName in dockList: - dock[dockName] = QtGui.QDockWidget(dockName) - self.welcome = QtGui.QTextEdit() - self.welcome.setReadOnly(True) - dock[dockName].setWidget(self.welcome) - #CSS - dock[dockName].setStyleSheet(" \ - QWidget { border-radius: 15px; border: 1px solid gray;\ - padding: 5px; width: 200px; height: 150px; } \ - ") - self.addDockWidget(QtCore.Qt.TopDockWidgetArea, dock[dockName]) - #self.tabifyDockWidget(dock['Notes'],dock['Blank']) - self.show() - ''' - + # This function create widget for Library Editor def createTestEditor(self): - """ - This function create widget for Library Editor - """ + """ """ global count self.testWidget = QtGui.QWidget() @@ -81,32 +59,19 @@ class DockArea(QtGui.QMainWindow): self.tabifyDockWidget( dock['Welcome'], dock['Tips-' + str(count)]) - """ - #CSS - dock['Tips-'+str(count)].setStyleSheet(" \ - .QWidget { border-radius: 15px; border: 1px solid gray; padding: 5px;\ - width: 200px; height: 150px; } \ - ") - """ - dock['Tips-' + str(count)].setVisible(True) dock['Tips-' + str(count)].setFocus() - """ - dock['Tips-'+str(count)].setStyleSheet(" \ - :hover { background-color: yellow; } \ - ") - """ + dock['Tips-' + str(count)].raise_() temp = self.obj_appconfig.current_project['ProjectName'] self.obj_appconfig.dock_dict[temp].append( dock['Tips-' + str(count)]) count = count + 1 - + + # This function create widget for interactive PythonPlotting def plottingEditor(self): - """ - This function create widget for interactive PythonPlotting - """ + """ """ self.projDir = self.obj_appconfig.current_project["ProjectName"] self.projName = os.path.basename(self.projDir) # self.project = os.path.join(self.projDir,self.projName) @@ -126,13 +91,6 @@ class DockArea(QtGui.QMainWindow): dock['Plotting-' + str(count)]) self.tabifyDockWidget(dock['Welcome'], dock['Plotting-' + str(count)]) - """ - #CSS - dock['Plotting-'+str(count)].setStyleSheet(" \ - .QWidget { border-radius: 15px; border: 1px solid gray; padding: 5px;\ - width: 200px; height: 150px; } \ - ") - """ dock['Plotting-' + str(count)].setVisible(True) dock['Plotting-' + str(count)].setFocus() dock['Plotting-' + str(count)].raise_() @@ -143,9 +101,7 @@ class DockArea(QtGui.QMainWindow): count = count + 1 def ngspiceEditor(self, projDir): - """ - This function creates widget for NgSpice window - """ + """This function creates widget for NgSpice window.""" self.projDir = projDir self.projName = os.path.basename(self.projDir) @@ -314,9 +270,7 @@ class DockArea(QtGui.QMainWindow): count = count + 1 def modelicaEditor(self, projDir): - """ - This function sets up the UI for ngspice to modelica conversion - """ + """This function sets up the UI for ngspice to modelica conversion.""" global count self.modelicaWidget = QtGui.QWidget() diff --git a/src/frontEnd/ProjectExplorer.py b/src/frontEnd/ProjectExplorer.py index 77b3f124..d84f41e0 100644 --- a/src/frontEnd/ProjectExplorer.py +++ b/src/frontEnd/ProjectExplorer.py @@ -4,8 +4,16 @@ import json from configuration.Appconfig import Appconfig +# This is main class for Project Explorer Area. class ProjectExplorer(QtGui.QWidget): + """ """ + def __init__(self): + """ + This method is doing following tasks: + a)initializing objects used in full program. + b)view of project explorer area. + """ QtGui.QWidget.__init__(self) self.obj_appconfig = Appconfig() self.treewidget = QtGui.QTreeWidget() @@ -37,8 +45,8 @@ class ProjectExplorer(QtGui.QWidget): os.path.join(parents) if os.path.exists(parents): pathlist = parents.split(os.sep) - parentnode = QtGui.QTreeWidgetItem( - self.treewidget, [pathlist[-1], parents]) + parentnode = QtGui.QTreeWidgetItem(self.treewidget, + [pathlist[-1], parents]) for files in children: QtGui.QTreeWidgetItem( parentnode, [files, os.path.join(parents, files)]) @@ -73,7 +81,6 @@ class ProjectExplorer(QtGui.QWidget): indexes = self.treewidget.selectedIndexes() if len(indexes) > 0: - level = 0 index = indexes[0] while index.parent().isValid(): @@ -132,25 +139,35 @@ class ProjectExplorer(QtGui.QWidget): else: self.obj_appconfig.current_project["ProjectName"] = str( self.filePath) - self.obj_appconfig.proc_dict - [self.obj_appconfig.current_project['ProjectName']] = [ - ] - if self.obj_appconfig.current_project['ProjectName'] \ - not in self.obj_appconfig.dock_dict: + ( + self.obj_appconfig. + proc_dict[self.obj_appconfig.current_project['ProjectName']] + ) = [] + if ( + self.obj_appconfig.current_project['ProjectName'] not in self.obj_appconfig.dock_dict - [self.obj_appconfig.current_project['ProjectName']] = [ - ] - + ): + ( + self.obj_appconfig. + dock_dict[ + self.obj_appconfig.current_project['ProjectName']] + ) = [] + + # This function is enabling save button option. def enable_save(self): self.save.setEnabled(True) + # This function is saving data before it closes the given file. def save_data(self): self.fopen = open(self.filePath, 'w') self.fopen.write(self.text.toPlainText()) self.fopen.close() self.textwindow.close() + # This function removes the project in explorer area by right + # clicking on project and selecting remove option. def removeProject(self): + """ """ self.indexItem = self.treewidget.currentIndex() self.filePath = str( self.indexItem.sibling( @@ -166,7 +183,10 @@ class ProjectExplorer(QtGui.QWidget): json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath, 'w')) + # This function refresh the project in explorer area by right + # clicking on project and selecting refresh option. def refreshProject(self): + """ """ self.indexItem = self.treewidget.currentIndex() self.filePath = str( self.indexItem.sibling( diff --git a/src/frontEnd/ProjectExplorer.py.bak b/src/frontEnd/ProjectExplorer.py.bak deleted file mode 100644 index 8c75398e..00000000 --- a/src/frontEnd/ProjectExplorer.py.bak +++ /dev/null @@ -1,147 +0,0 @@ -from PyQt4 import QtGui,QtCore -import os -import json -from configuration.Appconfig import Appconfig - - -class ProjectExplorer(QtGui.QWidget): - def __init__(self): - QtGui.QWidget.__init__(self) - self.obj_appconfig = Appconfig() - self.treewidget = QtGui.QTreeWidget() - self.window= QtGui.QVBoxLayout() - header = QtGui.QTreeWidgetItem(["Projects","path"]) - self.treewidget.setHeaderItem(header) - self.treewidget.setColumnHidden(1,True) - - #CSS - self.treewidget.setStyleSheet(" \ - QTreeView { border-radius: 15px; border: 1px solid gray; padding: 5px; width: 200px; height: 150px; } \ - QTreeView::branch:has-siblings:!adjoins-item { border-image: url(../../images/vline.png) 0; } \ - QTreeView::branch:has-siblings:adjoins-item { border-image: url(../../images/branch-more.png) 0; } \ - QTreeView::branch:!has-children:!has-siblings:adjoins-item { border-image: url(../../images/branch-end.png) 0; } \ - QTreeView::branch:has-children:!has-siblings:closed, \ - QTreeView::branch:closed:has-children:has-siblings { border-image: none; image: url(../../images/branch-closed.png); } \ - QTreeView::branch:open:has-children:!has-siblings, \ - QTreeView::branch:open:has-children:has-siblings { border-image: none; image: url(../../images/branch-open.png); } \ - ") - - for parents, children in list(self.obj_appconfig.project_explorer.items()): - os.path.join(parents) - if os.path.exists(parents): - pathlist= parents.split(os.sep) - parentnode = QtGui.QTreeWidgetItem(self.treewidget, [pathlist[-1],parents]) - for files in children: - childnode = QtGui.QTreeWidgetItem(parentnode, [files, os.path.join(parents,files)]) - self.window.addWidget(self.treewidget) - - self.treewidget.doubleClicked.connect(self.openProject) - self.treewidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) - self.treewidget.customContextMenuRequested.connect(self.openMenu) - self.setLayout(self.window) - self.show() - - def addTreeNode(self, parents, children): - os.path.join(parents) - pathlist= parents.split(os.sep) - parentnode = QtGui.QTreeWidgetItem(self.treewidget, [pathlist[-1], parents]) - for files in children: - childnode = QtGui.QTreeWidgetItem(parentnode, [files, os.path.join(parents,files)]) - self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']] = [] - self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']] = [] - - def openMenu(self, position): - - indexes = self.treewidget.selectedIndexes() - if len(indexes) > 0: - - level = 0 - index = indexes[0] - while index.parent().isValid(): - index = index.parent() - level += 1 - - menu = QtGui.QMenu() - if level == 0: - deleteproject = menu.addAction(self.tr("Remove Project")) - deleteproject.triggered.connect(self.removeProject) - refreshproject= menu.addAction(self.tr("Refresh")) - refreshproject.triggered.connect(self.refreshProject) - elif level == 1: - openfile = menu.addAction(self.tr("Open")) - openfile.triggered.connect(self.openProject) - - menu.exec_(self.treewidget.viewport().mapToGlobal(position)) - - def openProject(self): - self.indexItem =self.treewidget.currentIndex() - filename= self.indexItem.data().toString() - self.filePath= self.indexItem.sibling(self.indexItem.row(), 1).data().toString() - self.obj_appconfig.print_info('The current project is ' + self.filePath) - - self.textwindow = QtGui.QWidget() - self.textwindow.setMinimumSize(600, 500) - self.textwindow.setGeometry(QtCore.QRect(400,150,400,400)) - self.textwindow.setWindowTitle(filename) - - self.text = QtGui.QTextEdit() - self.save = QtGui.QPushButton('Save and Exit') - self.save.setDisabled(True) - self.windowgrid = QtGui.QGridLayout() - if (os.path.isfile(str(self.filePath)))== True: - self.fopen = open(str(self.filePath), 'r') - lines = self.fopen.read() - self.text.setText(lines) - - QtCore.QObject.connect(self.text,QtCore.SIGNAL("textChanged()"), self.enable_save) - - vbox_main = QtGui.QVBoxLayout(self.textwindow) - vbox_main.addWidget(self.text) - vbox_main.addWidget(self.save) - self.save.clicked.connect(self.save_data) - #self.connect(exit,QtCore.SIGNAL('close()'), self.onQuit) - - self.textwindow.show() - else: - self.obj_appconfig.current_project["ProjectName"]= str(self.filePath) - self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']] = [] - if self.obj_appconfig.current_project['ProjectName'] not in self.obj_appconfig.dock_dict: - self.obj_appconfig.dock_dict[self.obj_appconfig.current_project['ProjectName']] = [] - - def enable_save(self): - self.save.setEnabled(True) - - def save_data(self): - self.fopen=open(self.filePath, 'w') - self.fopen.write(self.text.toPlainText()) - self.fopen.close() - self.textwindow.close() - - def removeProject(self): - self.indexItem =self.treewidget.currentIndex() - filename= self.indexItem.data().toString() - self.filePath= self.indexItem.sibling(self.indexItem.row(), 1).data().toString() - self.int = self.indexItem.row() - self.treewidget.takeTopLevelItem(self.int) - - if self.obj_appconfig.current_project["ProjectName"] == self.filePath: - self.obj_appconfig.current_project["ProjectName"] = None - - del self.obj_appconfig.project_explorer[str(self.filePath)] - json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w')) - - def refreshProject(self): - self.indexItem =self.treewidget.currentIndex() - filename= self.indexItem.data().toString() - self.filePath= str(self.indexItem.sibling(self.indexItem.row(), 1).data().toString()) - filelistnew= os.listdir(os.path.join(self.filePath)) - parentnode = self.treewidget.currentItem() - count = parentnode.childCount() - for i in range(count): - for items in self.treewidget.selectedItems(): - items.removeChild(items.child(0)) - for files in filelistnew: - childnode= QtGui.QTreeWidgetItem(parentnode, [files, os.path.join(self.filePath,files)]) - - self.obj_appconfig.project_explorer[self.filePath]= filelistnew - json.dump(self.obj_appconfig.project_explorer, open(self.obj_appconfig.dictPath,'w')) diff --git a/src/frontEnd/Workspace.py b/src/frontEnd/Workspace.py index 7bc74deb..62833064 100644 --- a/src/frontEnd/Workspace.py +++ b/src/frontEnd/Workspace.py @@ -20,10 +20,10 @@ from configuration.Appconfig import Appconfig import time import os - +# This class creates Workspace GUI. class Workspace(QtGui.QWidget): """ - This class creates Workspace GUI. + """ def __init__(self, parent=None): diff --git a/src/kicadtoNgspice/Analysis.py b/src/kicadtoNgspice/Analysis.py index cde39f8f..c5981f4d 100644 --- a/src/kicadtoNgspice/Analysis.py +++ b/src/kicadtoNgspice/Analysis.py @@ -8,7 +8,17 @@ import json class Analysis(QtGui.QWidget): """ - This class create Analysis Tab in KicadtoNgspice Window. + - This class create Analysis Tab in KicadtoNgspice Window. + - Set various track widget options here + - AC_entry_var + - AC_Parameter + - DC_entry_var + - DC_Parameter + - TRAN_entry_var + - TRAN_Parameter + - set_Checkbox + - AC_type + - op_check """ def __init__(self, clarg1): @@ -26,6 +36,14 @@ class Analysis(QtGui.QWidget): self.createAnalysisWidget() def createAnalysisWidget(self): + """ + - Create the main anaylsis widget overwiew + - - Checkbox for analysis type + - - Respective analysis type group, AC, DC, TRAN... + - Check for `analysis` file, if any in projDir, extract data from it + - Else set the default checkbox to `TRAN` + - Accordingly set state for track widget options + """ self.grid = QtGui.QGridLayout() self.grid.addWidget(self.createCheckBox(), 0, 0) self.grid.addWidget(self.createACgroup(), 1, 0) @@ -40,7 +58,9 @@ class Analysis(QtGui.QWidget): analysisfile = open(os.path.join(projpath, 'analysis')) content = analysisfile.readline() + print("=========================================================") print("Content of Analysis file :", content) + print("=========================================================") contentlist = content.split() if contentlist[0] == '.ac': @@ -89,6 +109,11 @@ class Analysis(QtGui.QWidget): self.show() def createCheckBox(self): + """ + - Create the checkboxes for analysis type, under analysis tab + - checkbox > checkgrid > checkgroupbtn > checkAC | checkDC | checkTRAN + - Trigger enableBox on clicking + """ self.checkbox = QtGui.QGroupBox() self.checkbox.setTitle("Select Analysis Type") self.checkgrid = QtGui.QGridLayout() @@ -112,6 +137,10 @@ class Analysis(QtGui.QWidget): return self.checkbox def enableBox(self): + """ + - Activate deactive analysis areas according to type + - Add analysis data to track_obj from TrackWidget + """ if self.checkAC.isChecked(): self.acbox.setDisabled(False) self.dcbox.setDisabled(True) @@ -131,6 +160,13 @@ class Analysis(QtGui.QWidget): self.track_obj.set_CheckBox["ITEMS"] = "TRAN" def createACgroup(self): + """ + - Designing of AC group in analysis tab + - 3 radio buttons - Lin | Dec | Oct + - 3 input boxes, with top 2 combos\ + - If previous values exist then fill default values from + previous value json file + """ kicadFile = self.clarg1 (projpath, filename) = os.path.split(kicadFile) project_name = os.path.basename(projpath) @@ -202,12 +238,14 @@ class Analysis(QtGui.QWidget): self.acgrid.addWidget(self.start_fre_combo, 2, 2) self.ac_parameter[0] = "Hz" + # Try setting to default value from anaylsis file try: self.ac_parameter[self.parameter_cnt] = str( json_data["analysis"]["ac"]["Start Fre Combo"]) except BaseException: self.ac_parameter[self.parameter_cnt] = "Hz" + # Event listener for combo action self.start_fre_combo.activated[str].connect(self.start_combovalue) self.parameter_cnt = self.parameter_cnt + 1 @@ -274,13 +312,33 @@ class Analysis(QtGui.QWidget): return self.acbox + ''' + - Below 2 functions handle combo value event listeners for + - - start frequency for ac + - - stop frequency for ac + - And accordingly set the ac_parameters + ''' + def start_combovalue(self, text): + """ + - Handle start_fre_combo box event + - Check where it is Hz, MHz, etc. + - Accordingly set ac_parameter + """ self.ac_parameter[0] = str(text) def stop_combovalue(self, text): + """ + - Handle stop_fre_combo box event + - Check where it is Hz, MHz, etc. + - Accordingly set ac_parameter + """ self.ac_parameter[1] = str(text) def set_ac_type(self): + """S + - Set track object for AC, according to the type of radio box selected + """ self.parameter_cnt = 0 if self.Lin.isChecked(): @@ -293,6 +351,16 @@ class Analysis(QtGui.QWidget): pass def createDCgroup(self): + """ + - Create DC area under analysis tab + - Source 1 and 2, each having 4 input boxes as follows + - - Source + - - Start + - - Increment + - - Stop + - The last 3 have combo box pertaining to their unit as well + - Also in the end a checkbox, for operating system point analysis + """ kicadFile = self.clarg1 (projpath, filename) = os.path.split(kicadFile) project_name = os.path.basename(projpath) @@ -564,6 +632,7 @@ class Analysis(QtGui.QWidget): return self.dcbox + # Below 6 functions to handle combo boxes for the DC group def start_changecombo(self, text): self.dc_parameter[0] = str(text) @@ -583,12 +652,24 @@ class Analysis(QtGui.QWidget): self.dc_parameter[5] = str(text) def setflag(self): + """ + - Handles the Operating point analysis checkbox + """ if self.check.isChecked(): self.track_obj.op_check.append(1) else: self.track_obj.op_check.append(0) def createTRANgroup(self): + """ + - Creating transient group under analysis and creating it's components + - Contains 3 inout and combo boxes for - + - - Start time + - - Step time + - - Stop time + - Input boxes for values, combo boxes for unit + - Accordingly also event handleres for combo boxes, creates 3 functions + """ kicadFile = self.clarg1 (projpath, filename) = os.path.split(kicadFile) project_name = os.path .basename(projpath) @@ -717,6 +798,9 @@ class Analysis(QtGui.QWidget): print("Transient Analysis JSON Parse Error") return self.trbox + ''' + - Below 3 functions handle event for the combo box in transient group + ''' def start_combo_change(self, text): self.tran_parameter[0] = str(text) diff --git a/src/kicadtoNgspice/Convert.py b/src/kicadtoNgspice/Convert.py index 38234fed..76b6ba57 100644 --- a/src/kicadtoNgspice/Convert.py +++ b/src/kicadtoNgspice/Convert.py @@ -8,7 +8,7 @@ from xml.etree import ElementTree as ET class Convert: """ - This class has all the necessary function required to convert + - This class has all the necessary function required to convert kicad netlist to ngspice netlist. """ @@ -22,7 +22,7 @@ class Convert: def addSourceParameter(self): """ - This function add the source details to schematicInfo + - This function add the source details to schematicInfo """ self.start = 0 @@ -39,7 +39,7 @@ class Convert: str(self.entry_var[self.start].text())) > 0 else '0' va_val = str( self.entry_var[self.start + 1].text() - ) if len( + ) if len( str(self.entry_var[self.start + 1].text())) \ > 0 else '0' freq_val = str(self.entry_var[self.start + 2].text()) \ @@ -205,6 +205,8 @@ class Convert: self.direct = self.clarg1 (filepath, filemname) = os.path.split(self.direct) self.Fileopen = os.path.join(filepath, "analysis") + print("======================================================") + print("FILEOPEN CONVERT ANALYS", self.Fileopen) self.writefile = open(self.Fileopen, "w") if self.variable == 'AC': self.no = 0 @@ -440,7 +442,10 @@ class Convert: param = key default = 0 # Cheking if value is iterable.its for vector - if hasattr(value, '__iter__'): + if ( + type(value) is not str and + hasattr(value, '__iter__') + ): addmodelLine += param + "=[" for lineVar in value: if str( diff --git a/src/kicadtoNgspice/DeviceModel.py b/src/kicadtoNgspice/DeviceModel.py index 909756b5..57fd3f25 100644 --- a/src/kicadtoNgspice/DeviceModel.py +++ b/src/kicadtoNgspice/DeviceModel.py @@ -7,9 +7,18 @@ from . import TrackWidget class DeviceModel(QtGui.QWidget): """ - This class creates Device Library Tab in KicadtoNgspice Window - It dynamically creates the widget for device like diode,mosfet, - transistor and jfet. + - This class creates Device Library Tab in KicadtoNgspice Window + It dynamically creates the widget for device like diode,mosfet, + transistor and jfet. + - Same function as the subCircuit file, except for + this takes different parameters in the if block + - - q TRANSISTOR + - - d DIODE + - - j JFET + - - m MOSFET + - Other 2 functions same as the ones in subCircuit + - - trackLibrary + - - trackLibraryWithoutButton """ def __init__(self, schematicInfo, clarg1): @@ -81,8 +90,9 @@ class DeviceModel(QtGui.QWidget): json_data["deviceModel"][key][0]): self.entry_var[self.count].setText( json_data["deviceModel"][key][0]) - path_name = json_data - ["deviceModel"][key][0] + path_name = ( + json_data["deviceModel"][key][0] + ) else: self.entry_var[self.count].setText("") except BaseException: @@ -144,8 +154,9 @@ class DeviceModel(QtGui.QWidget): try: if os.path.exists( json_data["deviceModel"][key][0]): - path_name = json_data - ["deviceModel"][key][0] + path_name = ( + json_data["deviceModel"][key][0] + ) self.entry_var[self.count].setText( json_data["deviceModel"][key][0]) else: @@ -210,8 +221,9 @@ class DeviceModel(QtGui.QWidget): json_data["deviceModel"][key][0]): self.entry_var[self.count].setText( json_data["deviceModel"][key][0]) - path_name = json_data - ["deviceModel"][key][0] + path_name = ( + json_data["deviceModel"][key][0] + ) else: self.entry_var[self.count].setText("") except BaseException: @@ -323,8 +335,9 @@ class DeviceModel(QtGui.QWidget): if (i - beg) == 0: if os.path.exists( json_data["deviceModel"][key][0]): - path_name = json_data - ["deviceModel"][key][0] + path_name = ( + json_data["deviceModel"][key][0] + ) else: self.entry_var[i].setText("") i = i + 1 diff --git a/src/kicadtoNgspice/KicadtoNgspice.py b/src/kicadtoNgspice/KicadtoNgspice.py index 2f9b0400..9624fc82 100644 --- a/src/kicadtoNgspice/KicadtoNgspice.py +++ b/src/kicadtoNgspice/KicadtoNgspice.py @@ -33,13 +33,14 @@ import json class MainWindow(QtGui.QWidget): """ - This class create KicadtoNgspice window. - And Call Convert function if convert button is pressed. - The convert function takes all the value entered by user and create - a final netlist "*.cir.out". - This final netlist is compatible with NgSpice. + - This class create KicadtoNgspice window. + - And Call Convert function if convert button is pressed. + - The convert function takes all the value entered by user and create + a final netlist "*.cir.out". + - This final netlist is compatible with NgSpice. + - clarg1 is the path to the .cir file + - clarg2 is either None or "sub" depending on the analysis type """ - def __init__(self, clarg1, clarg2=None): QtGui.QWidget.__init__(self) print("==================================") @@ -52,6 +53,7 @@ class MainWindow(QtGui.QWidget): self.clarg2 = clarg2 # Create object of track widget + # Track the dynamically created widget of KicadtoNgSpice Window self.obj_track = TrackWidget.TrackWidget() # Clear Dictionary/List item of sub circuit and ngspice model @@ -65,9 +67,9 @@ class MainWindow(QtGui.QWidget): # Object of Processing obj_proc = PrcocessNetlist() - # Read the netlist + # Read the netlist, ie the .cir file kicadNetlist = obj_proc.readNetlist(self.kicadFile) - + print("=============================================================") print("Given Kicad Schematic Netlist Info :", kicadNetlist) # Construct parameter information @@ -75,13 +77,13 @@ class MainWindow(QtGui.QWidget): # Replace parameter with values netlist, infoline = obj_proc.preprocessNetlist(kicadNetlist, param) - + print("=============================================================") print("Schematic Info after processing Kicad Netlist: ", netlist) # print "INFOLINE",infoline # Separate option and schematic information optionInfo, schematicInfo = obj_proc.separateNetlistInfo(netlist) - + print("=============================================================") print("OPTIONINFO in the Netlist", optionInfo) # List for storing source and its value @@ -92,23 +94,30 @@ class MainWindow(QtGui.QWidget): schematicInfo, sourcelist) # List storing model detail - global modelList, outputOption, unknownModelList, \ - multipleModelList, plotText + global modelList, outputOption,\ + unknownModelList, multipleModelList, plotText modelList = [] outputOption = [] plotText = [] - schematicInfo, outputOption, modelList, unknownModelList, - multipleModelList, plotText = obj_proc.convertICintoBasicBlocks( - schematicInfo, outputOption, modelList, plotText) - + ( + schematicInfo, + outputOption, + modelList, + unknownModelList, + multipleModelList, + plotText + ) = obj_proc.convertICintoBasicBlocks( + schematicInfo, outputOption, modelList, plotText + ) + print("=======================================") print("Model available in the Schematic :", modelList) """ - Checking if any unknown model is used in schematic which is not - recognized by NgSpice. - Also if the two model of same name is present under - modelParamXML directory + - Checking if any unknown model is used in schematic which is not + recognized by NgSpice. + - Also if the two model of same name is present under + modelParamXML directory """ if unknownModelList: print("Unknown Model List is : ", unknownModelList) @@ -131,9 +140,11 @@ class MainWindow(QtGui.QWidget): def createMainWindow(self): """ - This function create main window of Kicad to Ngspice converter + - This function create main window of Kicad to Ngspice converter + - Two components + - - createcreateConvertWidget + - - Convert button => callConvert """ - self.vbox = QtGui.QVBoxLayout(self) self.hbox = QtGui.QHBoxLayout(self) self.hbox.addStretch(1) @@ -148,6 +159,26 @@ class MainWindow(QtGui.QWidget): self.show() def createcreateConvertWidget(self): + """ + - Contains the tabs for various convertor elements + - - Analysis => obj_analysis + => Analysis.Analysis(`path_to_projFile`) + + - - Source Details => obj_source + => Source.Source(`sourcelist`,`sourcelisttrack`,`path_to_projFile`) + + - - NgSpice Model => obj_model + => Model.Model(`schematicInfo`,`modelList`,`path_to_projFile`) + + - - Device Modelling => obj_devicemodel + => DeviceModel.DeviceModel(`schematicInfo`,`path_to_projFile`) + + - - Subcircuits => obj_subcircuitTab + => SubcircuitTab.SubcircuitTab(`schematicInfo`,`path_to_projFile`) + + - Finally pass each of these objects, to widgets + - convertWindow > mainLayout > tabWidgets > AnalysisTab, SourceTab .... + """ global obj_analysis self.convertWindow = QtGui.QWidget() self.analysisTab = QtGui.QScrollArea() @@ -196,7 +227,11 @@ class MainWindow(QtGui.QWidget): def callConvert(self): """ - Calling Convert Class Constructor + - This function called when convert button clicked + - Extracting data from the objs created above + - Pushing this data to json, and dumping it finally + - Written to a ..._Previous_Valuse.json file in the projDirectory + - Finally, call createNetListFile, with the converted schematic """ global schematicInfo global analysisoutput @@ -205,18 +240,18 @@ class MainWindow(QtGui.QWidget): (projpath, filename) = os.path.split(self.kicadFile) project_name = os.path.basename(projpath) + # Opening previous value file pertaining to the selected project fw = open( os.path.join( projpath, project_name + "_Previous_Values.json"), 'w') - json_data = {} - """ - Writing Analysis values - """ + # Creating a dictionary to map the json data + json_data = {} + # Writing analysis values json_data["analysis"] = {} json_data["analysis"]["ac"] = {} @@ -241,10 +276,12 @@ class MainWindow(QtGui.QWidget): obj_analysis.ac_entry_var[1].text()) json_data["analysis"]["ac"]["No. of points"] = str( obj_analysis.ac_entry_var[2].text()) - json_data - ["analysis"]["ac"]["Start Fre Combo"] = obj_analysis.ac_parameter[0] - json_data - ["analysis"]["ac"]["Stop Fre Combo"] = obj_analysis.ac_parameter[1] + json_data["analysis"]["ac"]["Start Fre Combo"] = ( + obj_analysis.ac_parameter[0] + ) + json_data["analysis"]["ac"]["Stop Fre Combo"] = ( + obj_analysis.ac_parameter[1] + ) json_data["analysis"]["dc"] = {} json_data["analysis"]["dc"]["Source 1"] = str( @@ -257,12 +294,15 @@ class MainWindow(QtGui.QWidget): obj_analysis.dc_entry_var[3].text()) json_data["analysis"]["dc"]["Operating Point"] = str( self.obj_track.op_check[-1]) - json_data - ["analysis"]["dc"]["Start Combo"] = obj_analysis.dc_parameter[0] - json_data - ["analysis"]["dc"]["Increment Combo"] = obj_analysis.dc_parameter[1] - json_data - ["analysis"]["dc"]["Stop Combo"] = obj_analysis.dc_parameter[2] + json_data["analysis"]["dc"]["Start Combo"] = ( + obj_analysis.dc_parameter[0] + ) + json_data["analysis"]["dc"]["Increment Combo"] = ( + obj_analysis.dc_parameter[1] + ) + json_data["analysis"]["dc"]["Stop Combo"] = ( + obj_analysis.dc_parameter[2] + ) json_data["analysis"]["dc"]["Source 2"] = str( obj_analysis.dc_entry_var[4].text()) json_data["analysis"]["dc"]["Start2"] = str( @@ -271,12 +311,15 @@ class MainWindow(QtGui.QWidget): obj_analysis.dc_entry_var[6].text()) json_data["analysis"]["dc"]["Stop2"] = str( obj_analysis.dc_entry_var[7].text()) - json_data - ["analysis"]["dc"]["Start Combo2"] = obj_analysis.dc_parameter[3] - json_data - ["analysis"]["dc"]["Increment Combo2"] = obj_analysis.dc_parameter[4] - json_data - ["analysis"]["dc"]["Stop Combo2"] = obj_analysis.dc_parameter[5] + json_data["analysis"]["dc"]["Start Combo2"] = ( + obj_analysis.dc_parameter[3] + ) + json_data["analysis"]["dc"]["Increment Combo2"] = ( + obj_analysis.dc_parameter[4] + ) + json_data["analysis"]["dc"]["Stop Combo2"] = ( + obj_analysis.dc_parameter[5] + ) json_data["analysis"]["tran"] = {} json_data["analysis"]["tran"]["Start Time"] = str( @@ -285,17 +328,17 @@ class MainWindow(QtGui.QWidget): obj_analysis.tran_entry_var[1].text()) json_data["analysis"]["tran"]["Stop Time"] = str( obj_analysis.tran_entry_var[2].text()) - json_data - ["analysis"]["tran"]["Start Combo"] = obj_analysis.tran_parameter[0] - json_data - ["analysis"]["tran"]["Step Combo"] = obj_analysis.tran_parameter[1] - json_data - ["analysis"]["tran"]["Stop Combo"] = obj_analysis.tran_parameter[2] - - """ - Writing Source values - """ - + json_data["analysis"]["tran"]["Start Combo"] = ( + obj_analysis.tran_parameter[0] + ) + json_data["analysis"]["tran"]["Step Combo"] = ( + obj_analysis.tran_parameter[1] + ) + json_data["analysis"]["tran"]["Stop Combo"] = ( + obj_analysis.tran_parameter[2] + ) + + # Writing source values json_data["source"] = {} count = 1 @@ -421,9 +464,7 @@ class MainWindow(QtGui.QWidget): else: pass - """ - Writing Model values - """ + # Writing Model values i = 0 json_data["model"] = {} @@ -440,7 +481,11 @@ class MainWindow(QtGui.QWidget): json_data["model"][line[3]]["values"] = [] for key, value in line[7].items(): - if hasattr(value, '__iter__') and i <= end: + if( + hasattr(value, '__iter__') and + i <= end and type(value) is not + str + ): for item in value: fields = { item: str( @@ -455,9 +500,7 @@ class MainWindow(QtGui.QWidget): json_data["model"][line[3]]["values"].append(fields) i = i + 1 - """ - Writing Device Model values - """ + # Writing Device Model values json_data["deviceModel"] = {} @@ -471,9 +514,7 @@ class MainWindow(QtGui.QWidget): str(obj_devicemodel.entry_var[it].text())) it = it + 1 - """ - Writing Subcircuit values - """ + # Writing Subcircuit values json_data["subcircuit"] = {} for subckt in obj_subcircuitTab.subcircuit_dict_beg: @@ -486,28 +527,42 @@ class MainWindow(QtGui.QWidget): str(obj_subcircuitTab.entry_var[it].text())) it = it + 1 + # json dumped and written to previous value file for the project write_data = json.dumps(json_data) fw.write(write_data) + # Create Convert object with the source details & the schematic details + print("=============================================================") + print("SOURCE LIST TRACK") + print(self.obj_track.sourcelisttrack["ITEMS"]) + print("SOURCE ENTRY VAR") + print(self.obj_track.source_entry_var["ITEMS"]) + print("SCHEMATIC INFO") + print(store_schematicInfo) + print("=============================================================") + self.obj_convert = Convert.Convert( self.obj_track.sourcelisttrack["ITEMS"], self.obj_track.source_entry_var["ITEMS"], store_schematicInfo, self.clarg1 - ) + ) try: # Adding Source Value to Schematic Info store_schematicInfo = self.obj_convert.addSourceParameter() + print("=========================================================") print("Netlist After Adding Source details :", store_schematicInfo) # Adding Model Value to store_schematicInfo store_schematicInfo = self.obj_convert.addModelParameter( store_schematicInfo) + print("=========================================================") print("Netlist After Adding Ngspice Model :", store_schematicInfo) # Adding Device Library to SchematicInfo store_schematicInfo = self.obj_convert.addDeviceLibrary( store_schematicInfo, self.kicadFile) + print("=========================================================") print( "Netlist After Adding Device Model Library :", store_schematicInfo) @@ -515,6 +570,7 @@ class MainWindow(QtGui.QWidget): # Adding Subcircuit Library to SchematicInfo store_schematicInfo = self.obj_convert.addSubcircuit( store_schematicInfo, self.kicadFile) + print("=========================================================") print("Netlist After Adding subcircuits :", store_schematicInfo) analysisoutput = self.obj_convert.analysisInsertor( @@ -528,10 +584,14 @@ class MainWindow(QtGui.QWidget): self.obj_track.AC_type["ITEMS"], self.obj_track.op_check ) - + print("=========================================================") print("Analysis OutPut ", analysisoutput) # Calling netlist file generation function + print("=========================================================") + print("STORE SCHEMATIC INFO") + print(store_schematicInfo) + print("=========================================================") self.createNetlistFile(store_schematicInfo, plotText) self.msg = "The Kicad to Ngspice Conversion completed\ @@ -547,10 +607,25 @@ class MainWindow(QtGui.QWidget): # Generate .sub file from .cir.out file if it is a subcircuit subPath = os.path.splitext(self.kicadFile)[0] + # If sub argument passed, create subCircuit file as well if self.clarg2 == "sub": self.createSubFile(subPath) def createNetlistFile(self, store_schematicInfo, plotText): + """ + - Creating .cir.out file + - If analysis file present uses that and extract + - - Simulator + - - Initial + - - Analysis + - Finally add the following components to .cir.out file + - - SimulatorOption + - - InitialCondOption + - - Store_SchematicInfo + - - AnalysisOption + - In the end add control statements and allv, alli, end statements + """ + print("=============================================================") print("Creating Final netlist") # print "INFOLINE",infoline # print "OPTIONINFO",optionInfo @@ -578,6 +653,7 @@ class MainWindow(QtGui.QWidget): Please check it") sys.exit() else: + print("========================================================") print(analysisFileLoc + " does not exist") sys.exit() @@ -655,6 +731,10 @@ class MainWindow(QtGui.QWidget): out.close() def createSubFile(self, subPath): + """ + - To create subcircuit file + - Extract data from .cir.out file + """ self.project = subPath self.projName = os.path.basename(self.project) if os.path.exists(self.project + ".cir.out"): @@ -663,6 +743,7 @@ class MainWindow(QtGui.QWidget): except BaseException: print("Error in opening .cir.out file.") else: + print("=========================================================") print( self.projName + ".cir.out does not exist. Please create a spice netlist.") @@ -722,4 +803,5 @@ class MainWindow(QtGui.QWidget): out.writelines('\n') out.writelines('.ends ' + self.projName) + print("=============================================================") print("The subcircuit has been written in " + self.projName + ".sub") diff --git a/src/kicadtoNgspice/Model.py b/src/kicadtoNgspice/Model.py index 7ae41791..eb1793f9 100644 --- a/src/kicadtoNgspice/Model.py +++ b/src/kicadtoNgspice/Model.py @@ -7,8 +7,8 @@ import os class Model(QtGui.QWidget): """ - This class creates Model Tab of KicadtoNgspice window. - The widgets are created dynamically in the Model Tab. + - This class creates Model Tab of KicadtoNgspice window. + The widgets are created dynamically in the Model Tab. """ def __init__(self, schematicInfo, modelList, clarg1): @@ -62,14 +62,14 @@ class Model(QtGui.QWidget): # print "Key : ",key # print "Value : ",value # Check if value is iterable - if hasattr(value, '__iter__'): + if type(value) is not str and hasattr(value, '__iter__'): # For tag having vector value temp_tag = [] for item in value: paramLabel = QtGui.QLabel(item) modelgrid.addWidget(paramLabel, self.nextrow, 0) - self.obj_trac.model_entry_var - [self.nextcount] = QtGui.QLineEdit( + self.obj_trac.model_entry_var[self.nextcount] = ( + QtGui.QLineEdit() ) modelgrid.addWidget( self.obj_trac.model_entry_var @@ -78,12 +78,15 @@ class Model(QtGui.QWidget): try: for mod in json_data["model"]: if json_data["model"][mod]["type"] ==\ - line[2] and mod == line[3]: - self.obj_trac.model_entry_var - [self.nextcount].setText( - str(list( - json_data["model"][mod]["values"] - [i].values())[0])) + line[2] and mod == line[3]: + ( + self.obj_trac.model_entry_var + [self.nextcount].setText( + str(list( + json_data + ["model"][mod]["values"] + [i].values())[0])) + ) i = i + 1 except BaseException: pass @@ -96,22 +99,25 @@ class Model(QtGui.QWidget): else: paramLabel = QtGui.QLabel(value) modelgrid.addWidget(paramLabel, self.nextrow, 0) - self.obj_trac.model_entry_var - [self.nextcount] = QtGui.QLineEdit( + self.obj_trac.model_entry_var[self.nextcount] = ( + QtGui.QLineEdit() ) modelgrid.addWidget( - self.obj_trac.model_entry_var - [self.nextcount], self.nextrow, 1) + self.obj_trac.model_entry_var[self.nextcount], + self.nextrow, 1 + ) try: for mod in json_data["model"]: if json_data["model"][mod]["type"] ==\ - line[2] and mod == line[3]: - self.obj_trac.model_entry_var - [self.nextcount].setText( - str(list(json_data - ["model"][mod]["values"] - [i].values())[0])) + line[2] and mod == line[3]: + ( + self.obj_trac.model_entry_var + [self.nextcount].setText( + str(list(json_data + ["model"][mod]["values"] + [i].values())[0])) + ) i = i + 1 except BaseException: pass diff --git a/src/kicadtoNgspice/Processing.py b/src/kicadtoNgspice/Processing.py index 63847761..ebbd3429 100644 --- a/src/kicadtoNgspice/Processing.py +++ b/src/kicadtoNgspice/Processing.py @@ -5,23 +5,35 @@ from xml.etree import ElementTree as ET class PrcocessNetlist: """ - This class include all the function required for pre-proccessing of netlist - before converting to Ngspice Netlist. + - This class include all the function required for pre-proccessing of + netlist before converting to Ngspice Netlist. """ modelxmlDIR = '../modelParamXML' def __init__(self): pass + """ + - Read the circuit file and return splitted lines + """ def readNetlist(self, filename): f = open(filename) data = f.read() f.close() + print("=============================================================") + print("readNetList called, from Processing") + print("=============================================================") + print("NETLIST", data.splitlines()) + print("=============================================================") return data.splitlines() + """ + - Read Parameter information and store it into dictionary + - kicadNetlis is the .cir file content + """ def readParamInfo(self, kicadNetlis): - """Read Parameter information and store it into dictionary""" param = {} + print("=========================KICADNETLIST========================") for eachline in kicadNetlis: print(eachline) eachline = eachline.strip() @@ -32,10 +44,18 @@ class PrcocessNetlist: for i in range(1, len(words), 1): paramList = words[i].split('=') param[paramList[0]] = paramList[1] + print("=============================================================") + print("readParamInfo called, from Processing") + print("=============================================================") + print("PARAM", param) + print("=============================================================") return param + """ + - Preprocess netlist (replace parameters) + - Separate infoline (first line) from the rest of netlist + """ def preprocessNetlist(self, kicadNetlis, param): - """Preprocess netlist (replace parameters)""" netlist = [] for eachline in kicadNetlis: # Remove leading and trailing blanks spaces from line @@ -66,9 +86,22 @@ class PrcocessNetlist: # Copy information line infoline = netlist[0] netlist.remove(netlist[0]) + print("=============================================================") + print("preprocessNetList called, from Processing") + print("=============================================================") + print("NETLIST", netlist) + print("INFOLINE", infoline) + print("=============================================================") return netlist, infoline def separateNetlistInfo(self, netlist): + """ + - Remove the options such as .end, .param, starting wtih "." + from the netlist file + - This is stored as option info, whereas rest is stored as + schematicInfo + - Rest from the `* Sheet Name:` line stored as schematicInfo + """ optionInfo = [] schematicInfo = [] for eachline in netlist: @@ -78,14 +111,25 @@ class PrcocessNetlist: optionInfo.append(eachline) else: schematicInfo.append(eachline) + print("=============================================================") + print("separateNetlistInfo called, from Processing") + print("=============================================================") + print("OPTIONINFO", optionInfo) + print("SCHEMATICINFO", schematicInfo) + print("=============================================================") return optionInfo, schematicInfo + """ + - Insert Special source parameter + - As per the parameters passed create source list, start with v or i + - Then check for type whether ac, dc, sine, etc... + - Handle starting with h and f as well + """ def insertSpecialSourceParam(self, schematicInfo, sourcelist): - # Inser Special source parameter schematicInfo1 = [] - + print("=============================================================") print("Reading schematic info for source details") - + print("=============================================================") for compline in schematicInfo: words = compline.split() compName = words[0] @@ -171,10 +215,27 @@ class PrcocessNetlist: schematicInfo = schematicInfo + schematicInfo1 print("Source List : ", sourcelist) # print schematicInfo + print("=============================================================") + print("insertSpecialSourceParam called, from Processing") + print("=============================================================") + print("SCHEMATICINFO", schematicInfo) + print("SOURCELIST", sourcelist) + print("=============================================================") return schematicInfo, sourcelist def convertICintoBasicBlocks( self, schematicInfo, outputOption, modelList, plotText): + """ + - Parses the schematicInfo and returns + - - SchematicInfo + - - Output Option + - - Model List + - - Unkown Model List + - - Multiple Model List + - - Plot text + - Parsing info is provided below + """ + print("=============================================================") print("Reading Schematic info for Model") # Insert details of Ngspice model unknownModelList = [] @@ -228,6 +289,8 @@ class PrcocessNetlist: unknownModelList.append(compType) elif count == 1: try: + print("==========================================\ + ===========================") print( "Start Parsing Previous Values XML\ for ngspice model :", modelPath) @@ -265,7 +328,7 @@ class PrcocessNetlist: if 'default' in item.attrib: paramDict[item.tag + ":" + item.attrib['default']] \ - = temp_list + = temp_list else: paramDict[item.tag] = item.text @@ -273,7 +336,7 @@ class PrcocessNetlist: if 'default' in item.attrib: paramDict[item.tag + ":" + item.attrib['default']]\ - = item.text + = item.text else: paramDict[item.tag] = item.text @@ -288,6 +351,8 @@ class PrcocessNetlist: modelLine += compName else: + print("=====================================\ + ================================") print("Split Details :", splitDetail) modelLine = "a" + str(k) + " " vectorDetail = splitDetail.split(':') @@ -302,7 +367,7 @@ class PrcocessNetlist: for i in range(0, int( item.split("-")[0])): modelLine += words[pos] +\ - " " + " " pos += 1 modelLine += ") " else: @@ -310,7 +375,7 @@ class PrcocessNetlist: for i in range(0, int( item.split("-")[0])): modelLine += words[pos] + \ - " " + " " pos += 1 modelLine += "] " elif item.split("-")[1] == 'NV': @@ -376,8 +441,8 @@ class PrcocessNetlist: words = compline.split() # Adding zero voltage source to netlist schematicInfo.append( - "v_" + words[0] + " " - + words[1] + " " + words[2] + " " + "0") + "v_" + words[0] + " " + + words[1] + " " + words[2] + " " + "0") plotText.append("plot i(v_" + words[0] + ")") elif compType == 'plot_log': words = compline.split() @@ -393,9 +458,11 @@ class PrcocessNetlist: schematicInfo.insert(index, "* " + compline) # For Primary Couple - modelLine = "a" + str(k) - + " (" + words[1] + " " + words[2] + ") (interNode_" + str( - interMediateNodeCount) + " " + words[3] + ") " + modelLine = ( + "a" + str(k) + " (" + words[1] + " " + + words[2] + ") (interNode_" + + str(interMediateNodeCount) + " " + words[3] + ") " + ) modelLine += compName + "_primary" schematicInfo.append(modelLine) k = k + 1 @@ -436,16 +503,27 @@ class PrcocessNetlist: else: schematicInfo.insert(index, "* " + compline) - + print("=====================================================") print( "UnknownModelList Used in the Schematic", unknownModelList) + print("=====================================================") print( "Multiple Model XML file with same name ", multipleModelList) + print("=====================================================") print("Model List Details : ", modelList) - + print("=============================================================") + print("convertICIntoBasicBlocks called, from Processing") + print("=============================================================") + print("SCHEMATICINFO", schematicInfo) + print("OUTPUTOPTION", outputOption) + print("MODELLIST", modelList) + print("UNKOWNMODELLIST", unknownModelList) + print("MULTIPLEMODELLIST", multipleModelList) + print("PLOTTEST", plotText) + print("=============================================================") return ( schematicInfo, outputOption, modelList, unknownModelList, multipleModelList, plotText - ) + ) diff --git a/src/kicadtoNgspice/Source.py b/src/kicadtoNgspice/Source.py index 8649ce93..c9d50a26 100644 --- a/src/kicadtoNgspice/Source.py +++ b/src/kicadtoNgspice/Source.py @@ -27,9 +27,23 @@ class Source(QtGui.QWidget): def createSourceWidget(self, sourcelist, sourcelisttrack): """ - This function dynamically create source widget in the + - This function dynamically create source widget in the Source tab of KicadtoNgSpice window + - Depending on the type of source, ac, dc, sine, pwl, etc... + source tab is created + - All the entry fields, are kept into the entry_var + tracked by self.count + - Finally after each of the sourcelist is mapped to its input component + we move to adding these to the track widget + - Also check if any default values present from previous analysis & add + them by default + - Each line in sourcelist corresponds to a source + - According to the source type modify the source and add it to the tab """ + print("============================================================") + print("SOURCE LIST TRACK", sourcelisttrack) + print("SOURCE LIST", sourcelist) + print("============================================================") kicadFile = self.clarg1 (projpath, filename) = os.path.split(kicadFile) project_name = os.path.basename(projpath) @@ -328,8 +342,8 @@ class Source(QtGui.QWidget): list( json_data["source"][key] ["values"][it - 4].values())[0] - ) - ) + ) + ) except BaseException: pass @@ -353,6 +367,7 @@ class Source(QtGui.QWidget): else: print("No source is present in your circuit") + print("============================================================") # This is used to keep the track of dynamically created widget self.obj_track.sourcelisttrack["ITEMS"] = sourcelisttrack self.obj_track.source_entry_var["ITEMS"] = self.entry_var diff --git a/src/kicadtoNgspice/SubcircuitTab.py b/src/kicadtoNgspice/SubcircuitTab.py index b9c6402b..52a7a824 100644 --- a/src/kicadtoNgspice/SubcircuitTab.py +++ b/src/kicadtoNgspice/SubcircuitTab.py @@ -8,8 +8,14 @@ import os class SubcircuitTab(QtGui.QWidget): """ - This class creates Subcircuit Tab in KicadtoNgspice Window - It dynamically creates the widget for subcircuits. + - This class creates Subcircuit Tab in KicadtoNgspice Window + - It dynamically creates the widget for subcircuits, + according to the .cir file + - Creates `lineEdit` and `Add` button, which triggers `fileSelector` + - Also, checks `Previous_value.json` for previous subcircuit value + to autofill, the `lineEdit` + - Add button is bind to `trackSubcircuit` + - Also `trackSubcircuit` without button is triggered if `lineEdit` filled """ def __init__(self, schematicInfo, clarg1): @@ -55,7 +61,7 @@ class SubcircuitTab(QtGui.QWidget): for eachline in schematicInfo: words = eachline.split() if eachline[0] == 'x': - print(("Subcircuit : Words", words[0])) + print("Subcircuit : Words", words[0]) self.obj_trac.subcircuitList[project_name + words[0]] = words self.subcircuit_dict_beg[words[0]] = self.count subbox = QtGui.QGroupBox() @@ -91,7 +97,7 @@ class SubcircuitTab(QtGui.QWidget): # eg. If the line is 'x1 4 0 3 ua741', there are 3 ports(4, 0 # and 3). self.numPorts.append(len(words) - 2) - print(("Number of ports of sub circuit : ", self.numPorts)) + print("Number of ports of sub circuit : ", self.numPorts) self.addbtn.clicked.connect(self.trackSubcircuit) subgrid.addWidget(self.addbtn, self.row, 2) subbox.setLayout(subgrid) @@ -124,7 +130,13 @@ class SubcircuitTab(QtGui.QWidget): def trackSubcircuit(self): """ - This function is use to keep track of all Subcircuit widget + - This function is use to keep track of all Subcircuit widget + - Here the number of ports is tracked using the numPorts + and `Add` button objectName property, which is refered using `sender` + - Once a file is selected using the `QFileDialog` validate it + - Pass the path of subciruit and the number of ports + - According to validation state take further steps + - If validated correctly, add to TrackWidget """ sending_btn = self.sender() # print "Object Called is ",sending_btn.objectName() @@ -160,6 +172,11 @@ class SubcircuitTab(QtGui.QWidget): self.msg.show() def trackSubcircuitWithoutButton(self, iter_value, path_value): + """ + - Same as trackSubcircuit, but here the count value is passed directly + without using any button as in `Add` + - This is triggered only once, initally + """ self.widgetObjCount = iter_value diff --git a/src/kicadtoNgspice/TrackWidget.py b/src/kicadtoNgspice/TrackWidget.py index dcf85dca..ec5c2c81 100644 --- a/src/kicadtoNgspice/TrackWidget.py +++ b/src/kicadtoNgspice/TrackWidget.py @@ -1,6 +1,12 @@ class TrackWidget: """ - This Class track the dynamically created widget of KicadtoNgSpice Window. + - This Class track the dynamically created widget of KicadtoNgSpice Window. + - Tracks using dictionary and lists ==> + - - Sources + - - Parameters + - - References + - - Model Details + - - ... etc """ # Track widget list for Source details sourcelisttrack = {"ITEMS": "None"} diff --git a/src/modelEditor/ModelEditor.py b/src/modelEditor/ModelEditor.py index 573e506c..0d5ff0cf 100644 --- a/src/modelEditor/ModelEditor.py +++ b/src/modelEditor/ModelEditor.py @@ -6,6 +6,28 @@ import os class ModelEditorclass(QtGui.QWidget): + ''' + - Initialise the layout for dockarea + - Use QVBoxLayout, QSplitter, QGridLayout to define the layout + - Initalise directory to save new models, + savepathtest = '../deviceModelLibrary' + - Initialise buttons and options ====> + - - Name Function Called + ======================================== + - - New opennew + - - Edit openedit + - - Save savemodelfile + - - Upload converttoxml + - - Add addparameters + - - Remove removeparameter + - - Diode diode_click + - - BJT bjt_click + - - MOS mos_click + - - JFET jfet_click + - - IGBT igbt_click + - - Magnetic Core magnetic_click + ''' + def __init__(self): QtGui.QWidget.__init__(self) self.savepathtest = '../deviceModelLibrary' @@ -15,7 +37,8 @@ class ModelEditorclass(QtGui.QWidget): self.splitter = QtGui.QSplitter() self.grid = QtGui.QGridLayout() self.splitter.setOrientation(QtCore.Qt.Vertical) - + + # Initialise the table view self.modeltable = QtGui.QTableWidget() self.newbtn = QtGui.QPushButton('New') @@ -72,6 +95,7 @@ class ModelEditorclass(QtGui.QWidget): self.radiobtnbox.addButton(self.magnetic) self.magnetic.clicked.connect(self.magnetic_click) + # Dropdown for various types supported by that element, ex bjt -> npn self.types = QtGui.QComboBox() self.types.setHidden(True) @@ -84,9 +108,12 @@ class ModelEditorclass(QtGui.QWidget): self.grid.addWidget(self.magnetic, 8, 1) self.setLayout(self.grid) self.show() - - '''To create New Model file ''' + ''' + - To create New Model file + - Change state of other buttons accordingly, ex. enable diode, bjt, ... + - Validate filename created, to check if one already exists + ''' def opennew(self): self.addbtn.setHidden(True) try: @@ -95,6 +122,7 @@ class ModelEditorclass(QtGui.QWidget): except BaseException: pass os.chdir(self.savepathtest) + # Opens new dialog box text, ok = QtGui.QInputDialog.getText( self, 'New Model', 'Enter Model Name:') if ok: @@ -108,22 +136,48 @@ class ModelEditorclass(QtGui.QWidget): self.modelname = (str(text)) else: pass - + + # Validate if the file created exists already or not + # Show error accordingly self.validation(text) - + + ''' + - Call function, openfiletype, which opens the table view for Diode specs + - Set states for other elements + - Diode has no types, so hide that + ''' def diode_click(self): self.openfiletype('Diode') self.types.setHidden(True) - + + ''' + - Set states for other elements + - Initialise types combo box elements + - - NPN + - - PNP + - Open the default type in the table + - Add an event listener for type-selection event + ''' def bjt_click(self): self.types.setHidden(False) self.types.clear() self.types.addItem('NPN') self.types.addItem('PNP') + # Open in table default filetype = str(self.types.currentText()) self.openfiletype(filetype) + # When element selected from combo box, call setfiletype self.types.activated[str].connect(self.setfiletype) + ''' + - Set states for other elements + - Initialise types combo box elements + - - NMOS(Level-1 5um) + - - NMOS(Level-3 0.5um) + - - ... + - Open the default type in the table + - Add an event listener for type-selection event + ''' def mos_click(self): self.types.setHidden(False) self.types.clear() @@ -136,7 +190,15 @@ class ModelEditorclass(QtGui.QWidget): filetype = str(self.types.currentText()) self.openfiletype(filetype) self.types.activated[str].connect(self.setfiletype) - + + ''' + - Set states for other elements + - Initialise types combo box elements + - - N-JFET + - - P-JFET + - Open the default type in the table + - Add an event listener for type-selection event + ''' def jfet_click(self): self.types.setHidden(False) self.types.clear() @@ -145,7 +207,15 @@ class ModelEditorclass(QtGui.QWidget): filetype = str(self.types.currentText()) self.openfiletype(filetype) self.types.activated[str].connect(self.setfiletype) - + + ''' + - Set states for other elements + - Initialise types combo box elements + - - N-IGBT + - - P-IGBT + - Open the default type in the table + - Add an event listener for type-selection event + ''' def igbt_click(self): self.types.setHidden(False) self.types.clear() @@ -154,20 +224,33 @@ class ModelEditorclass(QtGui.QWidget): filetype = str(self.types.currentText()) self.openfiletype(filetype) self.types.activated[str].connect(self.setfiletype) - + + ''' + - Set states for other elements + - Initialise types combo box elements + - Open the default type in the table + - Add an event listener for type-selection event + - No types here, only one view + ''' def magnetic_click(self): self.openfiletype('Magnetic Core') self.types.setHidden(True) + ''' + - Triggered when each type selected + - Get the type clicked, from text + - Open appropriate table using openfiletype(filetype) + ''' def setfiletype(self, text): self.filetype = str(text) self.openfiletype(self.filetype) + ''' + - Select path for the filetype passed + - Accordingly call `createtable(path)` to draw tables usingg QTable + - Check for the state of button before rendering + ''' def openfiletype(self, filetype): - ''' - Select the path of the file to be opened \ - depending upon selected file type - ''' self.path = '../deviceModelLibrary/Templates' if self.diode.isChecked(): if filetype == 'Diode': @@ -219,7 +302,15 @@ class ModelEditorclass(QtGui.QWidget): self.createtable(path) else: pass - + + ''' + - When `Edit` button clicked, this function called + - Set states for other buttons accordingly + - Open the file selector box with path as deviceModelLibrary + and filetype set as .lib, save it in `self.editfile` + - Create table for the selected .lib file using `self.createtable(path)` + - Handle exception of no file selected + ''' def openedit(self): os.chdir(self.savepathtest) self.newflag = 0 @@ -242,11 +333,19 @@ class ModelEditorclass(QtGui.QWidget): except BaseException: print("No File selected for edit") pass - + + ''' + - Set states for other components + - Initialise QTable widget + - Set options for QTable widget + - Place QTable widget, using `self.grid.addWidget` + - Select the `.xml` file from the modelfile passed as `.lib` + - Use ET (xml.etree.ElementTree) to parse the xml file + - Extract data from the XML and store it in `modeldict` + - Show the extracted data in QTableWidget + - Can edit QTable inplace, connect `edit_modeltable` function for editing + ''' def createtable(self, modelfile): - ''' - This function Creates the model table by parsing the .xml file - ''' self.savebtn.setDisabled(False) self.addbtn.setHidden(False) self.removebtn.setHidden(False) @@ -269,12 +368,14 @@ class ModelEditorclass(QtGui.QWidget): for elem in self.tree.iter(tag='model_name'): self.model_name = elem.text row = 0 + # get data from XML and store to dictionary (self.modeldict) for params in self.tree.findall('param'): for paramlist in params: self.modeldict[paramlist.tag] = paramlist.text row = row + 1 self.modeltable.setRowCount(row) count = 0 + # setItem in modeltable, for each item in modeldict for tags, values in list(self.modeldict.items()): self.modeltable.setItem(count, 0, QTableWidgetItem(tags)) try: @@ -287,7 +388,14 @@ class ModelEditorclass(QtGui.QWidget): QtCore.QString("Parameters;Values").split(";")) self.modeltable.show() self.modeltable.itemChanged.connect(self.edit_modeltable) - + + ''' + - Called when editing model inplace in QTableWidget + - Set states of other components + - Get data from the modeltable of the selected row + - Edit name and value as per needed + - Add the val name pair in the modeldict + ''' def edit_modeltable(self): self.savebtn.setDisabled(False) try: @@ -299,10 +407,15 @@ class ModelEditorclass(QtGui.QWidget): self.modeldict[val] = name except BaseException: pass + + ''' + - Called when `Add` button clicked beside QTableWidget + - Open up dialog box to enter parameter and value accordingly + - Validate if parameter already in list of parameters + - Accordingly add parameter and value in modeldict as well as table + - text1 => parameter, text2 => value + ''' def addparameters(self): - ''' - This function is used to add new parameter in the table - ''' text1, ok = QtGui.QInputDialog.getText( self, 'Parameter', 'Enter Parameter') if ok: @@ -326,16 +439,25 @@ class ModelEditorclass(QtGui.QWidget): pass else: pass + + ''' + - Called when save functon clicked + - If new file created, call `createXML` file + - Else call `savethefile` + ''' def savemodelfile(self): if self.newflag == 1: self.createXML(self.model_name) else: self.savethefile(self.editfile) + ''' + - Create .xml and .lib file if new model is being created + - Save it in the corresponding compoenent directory, example Diode, IGBT.. + - For each component, separate folder is there + - Check the contents of .lib and .xml file to understand their structure + ''' def createXML(self, model_name): - ''' - This function creates .xml and .lib files from the model table - ''' root = ET.Element("library") ET.SubElement(root, "model_name").text = model_name ET.SubElement(root, "ref_model").text = self.modelname @@ -474,10 +596,11 @@ class ModelEditorclass(QtGui.QWidget): txtfile.close() os.chdir(defaultcwd) + ''' + - This function checks if the file (xml type) with the name already exists + - Accordingly show error message + ''' def validation(self, text): - ''' - This function checks if the file with the name already exists - ''' newfilename = text + '.xml' all_dir = [x[0] for x in os.walk(self.savepathtest)] @@ -489,10 +612,12 @@ class ModelEditorclass(QtGui.QWidget): 'The file with name ' + text + ' already exists.') self.msg.setWindowTitle("Error Message") + ''' + - This function save the editing in the model table + - Create .lib and .xml file for the editfile path and replace them + - Also print Updated Library with libpath in the command window + ''' def savethefile(self, editfile): - ''' - This function save the editing in the model table - ''' xmlpath, file = os.path.split(editfile) filename = os.path.splitext(file)[0] libpath = os.path.join(xmlpath, filename + '.lib') @@ -520,13 +645,27 @@ class ModelEditorclass(QtGui.QWidget): self.obj_appconfig.print_info('Updated library ' + libpath) + ''' + - Get the index of the current selected item + - Remove the whole row from QTable Widget + - Remove the param,value pair from modeldict + ''' def removeparameter(self): self.savebtn.setDisabled(False) index = self.modeltable.currentIndex() remove_item = self.modeltable.item(index.row(), 0).text() self.modeltable.removeRow(index.row()) del self.modeldict[str(remove_item)] - + + ''' + - Called when upload button clicked + - Used to read file form a certain location for .lib extension + - Accordingly parse it and extract modelname and modelref + - Also extract param value pairs + - Take input the name of the library you want to save it as + - Save it in `User Libraries` with the given name, + and input from uploaded file + ''' def converttoxml(self): os.chdir(self.savepathtest) self.addbtn.setHidden(True) diff --git a/src/ngspiceSimulation/NgspiceWidget.py b/src/ngspiceSimulation/NgspiceWidget.py index 52427681..def1d4e9 100644 --- a/src/ngspiceSimulation/NgspiceWidget.py +++ b/src/ngspiceSimulation/NgspiceWidget.py @@ -4,9 +4,11 @@ import platform import os +# This Class creates NgSpice Window class NgspiceWidget(QtGui.QWidget): """ - This Class creates NgSpice Window + Includes functions that checks whether OS is linux or windows + and creates NgSpice window accordingly. """ def __init__(self, command, projPath): @@ -18,21 +20,21 @@ class NgspiceWidget(QtGui.QWidget): self.layout.addWidget(self.terminal) print("Argument to ngspice command : ", command) - + # For Linux OS if platform.system() == 'Linux': self.command = "cd " + projPath + ";ngspice " + command # Creating argument for process - # self.args = ['-into', str(self.terminal.winId()),\ - # '-hold','-e', self.command] self.args = ['-hold', '-e', self.command] self.process.start('xterm', self.args) self.obj_appconfig.process_obj.append(self.process) + print(self.obj_appconfig.proc_dict) ( self.obj_appconfig.proc_dict [self.obj_appconfig.current_project['ProjectName']].append( self.process.pid()) ) + # For Windows OS elif platform.system() == 'Windows': tempdir = os.getcwd() projPath = self.obj_appconfig.current_project["ProjectName"] diff --git a/src/ngspiceSimulation/NgspiceWidget.py.bak b/src/ngspiceSimulation/NgspiceWidget.py.bak deleted file mode 100644 index 27101eb3..00000000 --- a/src/ngspiceSimulation/NgspiceWidget.py.bak +++ /dev/null @@ -1,37 +0,0 @@ -from PyQt4 import QtGui,QtCore -from configuration.Appconfig import Appconfig -import platform -import os - -class NgspiceWidget(QtGui.QWidget): - """ - This Class creates NgSpice Window - """ - def __init__(self,command,projPath): - QtGui.QWidget.__init__(self) - self.obj_appconfig = Appconfig() - self.process = QtCore.QProcess(self) - self.terminal = QtGui.QWidget(self) - self.layout = QtGui.QVBoxLayout(self) - self.layout.addWidget(self.terminal) - - print("Argument to ngspice command : ",command) - - if platform.system() == 'Linux': - self.command = "cd "+projPath+";ngspice "+command - #Creating argument for process - #self.args = ['-into', str(self.terminal.winId()),'-hold','-e', self.command] - self.args = ['-hold','-e', self.command] - self.process.start('xterm', self.args) - self.obj_appconfig.process_obj.append(self.process) - self.obj_appconfig.proc_dict[self.obj_appconfig.current_project['ProjectName']].append(self.process.pid()) - - elif platform.system() == 'Windows': - tempdir= os.getcwd() - projPath = self.obj_appconfig.current_project["ProjectName"] - os.chdir(projPath) - self.command = "ngspice "+command - self.process.start(self.command) - os.chdir(tempdir) - - diff --git a/src/ngspiceSimulation/pythonPlotting.py b/src/ngspiceSimulation/pythonPlotting.py index 9e9db8f6..9f8f8e88 100644 --- a/src/ngspiceSimulation/pythonPlotting.py +++ b/src/ngspiceSimulation/pythonPlotting.py @@ -11,7 +11,13 @@ from configuration.Appconfig import Appconfig import numpy as np +# This class creates Python Plotting window class plotWindow(QtGui.QMainWindow): + ''' + This class defines python plotting window, its features, buttons, + colors, AC and DC analysis, plotting etc. + ''' + def __init__(self, fpath, projectName): QtGui.QMainWindow.__init__(self) self.fpath = fpath @@ -114,6 +120,7 @@ class plotWindow(QtGui.QMainWindow): '; font-weight = bold;') self.top_grid.addWidget(self.colorLab, i + 3, 1) + # Buttons for Plot, multimeter, plotting function. self.clear = QtGui.QPushButton("Clear") self.warnning = QtGui.QLabel() self.funcName = QtGui.QLabel() @@ -135,7 +142,7 @@ class plotWindow(QtGui.QMainWindow): self.palette2.setColor(QtGui.QPalette.Foreground, QtCore.Qt.red) self.funcName.setPalette(self.palette1) self.funcExample.setPalette(self.palette2) - + # Widgets for grid, plot button and multimeter button. self.right_vbox.addLayout(self.top_grid) self.right_vbox.addWidget(self.plotbtn) self.right_vbox.addWidget(self.multimeterbtn) @@ -158,10 +165,13 @@ class plotWindow(QtGui.QMainWindow): self.scrollArea = QtGui.QScrollArea() self.scrollArea.setWidgetResizable(True) self.scrollArea.setWidget(self.widget) - + ''' + Right side box containing checkbox for different inputs and + options of plot, multimeter and plot function. + ''' self.finalhbox = QtGui.QHBoxLayout() self.finalhbox.addWidget(self.scrollArea) - + # Right side window frame showing list of nodes and branches. self.mainFrame.setLayout(self.finalhbox) self.showMaximized() @@ -170,10 +180,10 @@ class plotWindow(QtGui.QMainWindow): "<font color='indigo'>List of Branches:</font>") self.funcLabel.setText("<font color='indigo'>Function:</font>") self.funcName.setText( - "<font color='indigo'>Standard functions</font>\ + "<font color='indigo'>Standard functions</font>\ <br><br>Addition:<br>Subtraction:<br>\ Multiplication:<br>Division:<br>Comparison:" - ) + ) self.funcExample.setText( "\n\nNode1 + Node2\nNode1 - Node2\nNode1 * Node2\nNode1 / Node2\ \nNode1 vs Node2") @@ -188,7 +198,7 @@ class plotWindow(QtGui.QMainWindow): self.multimeterbtn, QtCore.SIGNAL('clicked()'), self.multiMeter) - + # for AC analysis if self.plotType[0] == 0: self.analysisType.setText("<b>AC Analysis</b>") if self.plotType[1] == 1: @@ -201,7 +211,7 @@ class plotWindow(QtGui.QMainWindow): self.plotbtn, QtCore.SIGNAL('clicked()'), self.onPush_ac) - + # for transient analysis elif self.plotType[0] == 1: self.analysisType.setText("<b>Transient Analysis</b>") self.connect( @@ -210,14 +220,16 @@ class plotWindow(QtGui.QMainWindow): self.onPush_trans) else: + # For DC analysis self.analysisType.setText("<b>DC Analysis</b>") self.connect( self.plotbtn, QtCore.SIGNAL('clicked()'), self.onPush_dc) - self.setCentralWidget(self.mainFrame) - + self.setCentralWidget(self.mainFrame) + + # definition of functions pushedClear, pushedPlotFunc. def pushedClear(self): self.text.clear() self.axes.cla() @@ -372,6 +384,9 @@ class plotWindow(QtGui.QMainWindow): self.combo = [] self.combo1 = [] self.combo1_rev = [] + + # definition of functions onPush_decade, onPush_ac, onPush_trans,\ + # onPush_dc, color and multimeter and getRMSValue. def onPush_decade(self): # print "Calling on push Decade" boxCheck = 0 @@ -502,9 +517,10 @@ class plotWindow(QtGui.QMainWindow): loc_y += 50 # Adding object of multimeter to dictionary ( - self.obj_appconfig.dock_dict - [self.obj_appconfig.current_project['ProjectName']].append( - self.obj[j]) + self.obj_appconfig. + dock_dict[ + self.obj_appconfig.current_project['ProjectName']]. + append(self.obj[j]) ) if boxCheck == 0: @@ -554,7 +570,7 @@ class DataExtraction: self.x = [] # stores x-axis data def numberFinder(self, fpath): - # Opening ANalysis file + # Opening Analysis file with open(os.path.join(fpath, "analysis")) as f3: self.analysisInfo = f3.read() self.analysisInfo = self.analysisInfo.split(" ") diff --git a/src/ngspicetoModelica/ModelicaUI.py b/src/ngspicetoModelica/ModelicaUI.py index daef6e76..5d9a6ab9 100644 --- a/src/ngspicetoModelica/ModelicaUI.py +++ b/src/ngspicetoModelica/ModelicaUI.py @@ -52,7 +52,7 @@ class OpenModelicaEditor(QtGui.QWidget): def callConverter(self): try: - self.cmd1 = "python ../ngspicetoModelica/NgspicetoModelica.py " + \ + self.cmd1 = "python3 ../ngspicetoModelica/NgspicetoModelica.py " + \ self.ngspiceNetlist + ' ' + self.map_json # self.obj_workThread1 = Worker.WorkerThread(self.cmd1) # self.obj_workThread1.start() @@ -72,7 +72,7 @@ class OpenModelicaEditor(QtGui.QWidget): self.obj_appconfig.print_info( "Ngspice netlist successfully converted to OpenModelica" + "netlist" - ) + ) self.msg.exec_() else: diff --git a/src/ngspicetoModelica/NgspicetoModelica.py b/src/ngspicetoModelica/NgspicetoModelica.py index dfeafb53..1c5e754c 100644 --- a/src/ngspicetoModelica/NgspicetoModelica.py +++ b/src/ngspicetoModelica/NgspicetoModelica.py @@ -30,7 +30,7 @@ class NgMoConverter: f = open(filename) except Exception as e: print("Error in opening file") - print((str(e))) + print(str(e)) sys.exit() else: print(filename + " does not exist") @@ -421,11 +421,11 @@ class NgMoConverter: # If parameter is not mapped then it will just pass try: actualModelicaParam = ( - self.mappingData["Devices"] - [deviceName] - ["mapping"] - [key] - ) + self.mappingData["Devices"] + [deviceName] + ["mapping"] + [key] + ) tempstatList.append( actualModelicaParam + "=" + @@ -473,13 +473,13 @@ class NgMoConverter: if trans == 'npn': start = ( self.mappingData["Devices"][deviceName]["import"] - ) + ".NPN" + ) + ".NPN" elif trans == 'pnp': start = self.mappingData( - ["Devices"] - [deviceName] - ["import"] - ) + ".PNP" + ["Devices"] + [deviceName] + ["import"] + ) + ".PNP" else: print("Transistor " + str(trans) + " Not found") sys.exit(1) @@ -501,12 +501,12 @@ class NgMoConverter: userDeviceParamList.append(str("Vak")) else: actualModelicaParam = ( - self.mappingData - ["Devices"] - [deviceName] - ["mapping"] - [key] - ) + self.mappingData + ["Devices"] + [deviceName] + ["mapping"] + [key] + ) tempstatList.append( actualModelicaParam + "=" + @@ -519,21 +519,21 @@ class NgMoConverter: pass # Running loop over default parameter of OpenModelica for default in ( - self.mappingData - ["Devices"] - [deviceName] - ["default"] - ): + self.mappingData + ["Devices"] + [deviceName] + ["default"] + ): if default in userDeviceParamList: continue else: defaultValue = ( - self.mappingData - ["Devices"] - [deviceName] - ["default"] - [default] - ) + self.mappingData + ["Devices"] + [deviceName] + ["default"] + [default] + ) tempstatList.append( default + "=" + self.getUnitVal(defaultValue) + " ") @@ -563,18 +563,18 @@ class NgMoConverter: if trans == 'nmos': start = ( - self.mappingData - ["Devices"] - [deviceName] - ["import"] - ) + ".Mn" + self.mappingData + ["Devices"] + [deviceName] + ["import"] + ) + ".Mn" elif trans == 'pmos': start = ( - self.mappingData - ["Devices"] - [deviceName] - ["import"] - ) + ".Mp" + self.mappingData + ["Devices"] + [deviceName] + ["import"] + ) + ".Mp" else: print("MOSFET " + str(trans) + " not found") sys.exit(1) @@ -597,12 +597,12 @@ class NgMoConverter: userDeviceParamList.append(str("U0")) else: actualModelicaParam = ( - self.mappingData - ["Devices"] - [deviceName] - ["mapping"] - [key] - ) + self.mappingData + ["Devices"] + [deviceName] + ["mapping"] + [key] + ) tempstatList.append( actualModelicaParam + "=" + @@ -616,24 +616,24 @@ class NgMoConverter: # Running loop over default parameter of OpenModelica for default in ( - self.mappingData - ["Devices"] - [deviceName] - ["default"] - ): + self.mappingData + ["Devices"] + [deviceName] + ["default"] + ): if default in userDeviceParamList: continue else: defaultValue = ( - self.mappingData - ["Devices"] - [deviceName] - ["default"] - [default] - ) + self.mappingData + ["Devices"] + [deviceName] + ["default"] + [default] + ) tempstatList.append( default + "=" + self.getUnitVal(defaultValue) + " " - ) + ) # Adding LEVEL(This is constant not the device level) tempstatList.append("Level=1" + " ") @@ -697,11 +697,11 @@ class NgMoConverter: # If parameter is not mapped then it will just pass try: actualModelicaParam = self.mappingData( - ["Devices"] - [deviceName] - ["mapping"] - [key] - ) + ["Devices"] + [deviceName] + ["mapping"] + [key] + ) tempstatList.append( actualModelicaParam + "=" + @@ -713,24 +713,24 @@ class NgMoConverter: pass # Running loop over default parameter of OpenModelica for default in ( - self.mappingData - ["Devices"] - [deviceName] - ["default"] - ): + self.mappingData + ["Devices"] + [deviceName] + ["default"] + ): if default in userDeviceParamList: continue else: defaultValue = ( - self.mappingData - ["Devices"] - [deviceName] - ["default"] - [default] - ) + self.mappingData + ["Devices"] + [deviceName] + ["default"] + [default] + ) tempstatList.append( default + "=" + self.getUnitVal(defaultValue) + " " - ) + ) stat += ",".join(str(item) for item in tempstatList) + "));" modelicaCompInit.append(stat) @@ -779,12 +779,12 @@ class NgMoConverter: # If parameter is not mapped then it will just pass try: actualModelicaParam = ( - self.mappingData - ["Models"] - [actualModelName] - ["mapping"] - [key] - ) + self.mappingData + ["Models"] + [actualModelName] + ["mapping"] + [key] + ) tempstatList.append( actualModelicaParam + "=" + @@ -797,24 +797,24 @@ class NgMoConverter: # Running loop over default parameter of OpenModelica for default in ( - self.mappingData - ["Models"] - [actualModelName] - ["default"] - ): + self.mappingData + ["Models"] + [actualModelName] + ["default"] + ): if default in userModelParamList: continue else: defaultValue = ( - self.mappingData - ["Models"] - [actualModelName] - ["default"] - [default] - ) + self.mappingData + ["Models"] + [actualModelName] + ["default"] + [default] + ) tempstatList.append( default + "=" + self.getUnitVal(defaultValue) + " " - ) + ) stat += ",".join(str(item) for item in tempstatList) + ");" modelicaCompInit.append(stat) @@ -1180,7 +1180,7 @@ class NgMoConverter: dir_name, subtransInfo, subInbuiltModelDict - ) + ) # print "modelicaSubCompInit------------>",modelicaSubCompInit # print "numNodesSubsub---------------------->",numNodesSubsub modelicaSubParamNew = self.getSubParamLine( @@ -1195,7 +1195,7 @@ class NgMoConverter: nodeDicSub, numNodesSubsub, subcktName - ) + ) # print "connSubInfo----------------->",connSubInfo newname = basename.split('.') newfilename = newname[0] @@ -1242,21 +1242,21 @@ class NgMoConverter: out.close() return ( - data, - subOptionInfo, - subSchemInfo, - subModel, - subModelInfo, - subsubName, - subParamInfo, - modelicaSubCompInit, - modelicaSubParam, - nodeSubInterface, - nodeSub, - nodeDicSub, - pinInitSub, - connSubInfo - ) + data, + subOptionInfo, + subSchemInfo, + subModel, + subModelInfo, + subsubName, + subParamInfo, + modelicaSubCompInit, + modelicaSubParam, + nodeSubInterface, + nodeSub, + nodeDicSub, + pinInitSub, + connSubInfo + ) def main(args): @@ -1268,7 +1268,7 @@ def main(args): map_json = sys.argv[2] else: print("USAGE:") - print("python NgspicetoModelica.py <filename>") + print("python3 NgspicetoModelica.py <filename>") sys.exit() dir_name = os.path.dirname(os.path.realpath(filename)) @@ -1347,7 +1347,7 @@ def main(args): dir_name, transInfo, inbuiltModelDict - ) + ) # print "ModelicaComponents # : modelicaCompInit----------->",modelicaCompInit # print "SubcktNumNodes @@ -1365,7 +1365,7 @@ def main(args): nodeSubInterface, nodeSub, nodeDicSub, pinInitSub, connSubInfo = ( obj_NgMoConverter.procesSubckt( subcktName, numNodesSub, dir_name - ) + ) ) # Adding 'numNodesSub' by Fahim # Creating Final Output file diff --git a/src/projManagement/Kicad.py b/src/projManagement/Kicad.py index 2eaef643..9aaac46d 100644 --- a/src/projManagement/Kicad.py +++ b/src/projManagement/Kicad.py @@ -22,11 +22,22 @@ from configuration.Appconfig import Appconfig from . import Worker from PyQt4 import QtGui +""" +This class called the Kicad Schematic,KicadtoNgspice Converter,Layout +editor and Footprint Editor +""" + class Kicad: + """ - This class called the Kicad Schematic,KicadtoNgspice Converter,Layout - editor and Footprint Editor + Initialise validation, appconfig and dockarea + + @params + :dockarea => passed from DockArea in frontEnd folder, consists + of all functions for dockarea + + @return """ def __init__(self, dockarea): @@ -34,10 +45,16 @@ class Kicad: self.obj_appconfig = Appconfig() self.obj_dockarea = dockarea + """ + This function create command to open Kicad schematic after + appropriate validation checks + + @params + + @return + """ + def openSchematic(self): - """ - This function create command to open Kicad schematic - """ print("Function : Open Kicad Schematic") self.projDir = self.obj_appconfig.current_project["ProjectName"] try: @@ -134,6 +151,14 @@ class Kicad: self.msg.setWindowTitle("Error Message") ''' + """ + This function create command to validate and then call + KicadToNgSPice converter from DockArea file + + @params + + @return + """ def openKicadToNgspice(self): """ @@ -157,7 +182,7 @@ class Kicad: # Creating a command to run """ - self.cmd = ("python ../kicadtoNgspice/KicadtoNgspice.py " + self.cmd = ("python3 ../kicadtoNgspice/KicadtoNgspice.py " + "self.project+".cir ") self.obj_workThread = Worker.WorkerThread(self.cmd) self.obj_workThread.start() diff --git a/src/projManagement/Validation.py b/src/projManagement/Validation.py index 11cdcaf9..9fcac9a2 100644 --- a/src/projManagement/Validation.py +++ b/src/projManagement/Validation.py @@ -21,12 +21,26 @@ import os import re import distutils.spawn +""" +This is Validation class use for validating Project. +e.g if .proj is present in project directory +or if new project name is already exist in workspace etc +""" + class Validation: + """ - This is Validation class use for validating Project. - e.g if .proj is present in project directory - or if new project name is already exist in workspace etc + Takes as input the path of the project and checks if + projName.proj file exists + projName is same as the folder selected + + @params + :projDir => contains the path of the project folder selected to open + + @return + True => If the folder contains the projName.proj file + False => If the folder doesn't contain projName.proj file """ def __init__(self): @@ -45,6 +59,18 @@ class Validation: else: return False + """ + Validate new project created + + @params + :projDir => Contains path of the new projDir created + + @return + :"CHECKEXIST" => If smae project name folder exists + :"CHECKNAME" => If space is there in name + :"VALID" => If valid project name given + """ + def validateNewproj(self, projDir): """ This Project Validate New Project Information @@ -61,6 +87,19 @@ class Validation: else: return "VALID" + """ + Validate if projDir is set appropriately in the function calling file + and if Kicad components are present + + @params + :projDir => the path of the project directory, passed from + the calling function + + @return + True + False + """ + def validateKicad(self, projDir): """ This function validate if Kicad components are present @@ -71,6 +110,18 @@ class Validation: else: return True + """ + Validate if cir file present in the directory with the appropriate .cir + file name, same as the project directory base + + @params + :projDir => the path to the project diretory + + @return + True + False + """ + def validateCir(self, projDir): """ This function checks if ".cir" file is present. diff --git a/src/projManagement/Worker.py b/src/projManagement/Worker.py index 65c67dde..f40fd724 100644 --- a/src/projManagement/Worker.py +++ b/src/projManagement/Worker.py @@ -19,23 +19,70 @@ from PyQt4 import QtCore import subprocess from configuration.Appconfig import Appconfig +""" +WorkerThread uses QThread to support threading operations for +other PyQT windows +This is a helper functions, used to create threads for various commands +""" + class WorkerThread(QtCore.QThread): """ - This is Thread class use to run the command + Initialise a QThread with the passed arguments + + @params + :args => takes a space separated string of comamnds to be execute + in different child processes (see subproces.Popen()) + + @return + None """ def __init__(self, args): QtCore.QThread.__init__(self) self.args = args + """ + __del__ is a called whenever garbage collection is initialised + Here, it waits (self.wait()) for the thread to finish executing + before garbage collecting it + + @params + + @return + None + """ + def __del__(self): self.wait() + """ + run is the function that is called, when we start the thread as + thisThread.start() + Here, it makes system calls for all args passed (self.args) + + @params + + @return + None + """ + def run(self): print("Worker Thread Calling Command :", self.args) self.call_system(self.args) + """ + call_system is used to create childprocess for the passed arguments + (self.args) and also pass the process created and its id to config file + Apponfig() object contains procThread and proc_dist used to + track processes called + + @params + :command => (self.args) takes space separated string of comamnds to + be executed in different child processes + (see subproces.Popen()) + """ + def call_system(self, command): procThread = Appconfig() proc = subprocess.Popen(command.split()) diff --git a/src/projManagement/Worker.py.bak b/src/projManagement/Worker.py.bak deleted file mode 100644 index 575ea12c..00000000 --- a/src/projManagement/Worker.py.bak +++ /dev/null @@ -1,46 +0,0 @@ -#=============================================================================== -# -# FILE: WorkerThread.py -# -# USAGE: --- -# -# DESCRIPTION: This class open all third party application using QT Thread -# -# OPTIONS: --- -# REQUIREMENTS: --- -# BUGS: --- -# NOTES: --- -# AUTHOR: Fahim Khan, fahim.elex@gmail.com -# ORGANIZATION: eSim team at FOSSEE, IIT Bombay. -# CREATED: Tuesday 24 Feb 2015 -# REVISION: --- -#=============================================================================== -from PyQt4 import QtCore -import subprocess -from configuration.Appconfig import Appconfig - -class WorkerThread(QtCore.QThread): - """ - This is Thread class use to run the command - """ - def __init__(self,args): - QtCore.QThread.__init__(self) - self.args = args - - - def __del__(self): - self.wait() - - def run(self): - print("Worker Thread Calling Command :",self.args) - self.call_system(self.args) - - def call_system(self,command): - procThread = Appconfig() - proc = subprocess.Popen(command.split()) - procThread.procThread_list.append(proc) - procThread.proc_dict[procThread.current_project['ProjectName']].append(proc.pid) - - - - diff --git a/src/projManagement/newProject.py b/src/projManagement/newProject.py index 40d66003..c8cd4078 100644 --- a/src/projManagement/newProject.py +++ b/src/projManagement/newProject.py @@ -22,17 +22,30 @@ from configuration.Appconfig import Appconfig import os import json +""" +This class is called when User create new Project. +""" + class NewProjectInfo(QtGui.QWidget): - """ - This class is called when User create new Project. - """ def __init__(self): super(NewProjectInfo, self).__init__() self.obj_validation = Validation() self.obj_appconfig = Appconfig() + """ + This function create Project related directories and files + + @params + :projName => name of the project created passed from + frontEnd/Application new_project() + + @return + :dirs => The directories inside the project folder + :filelist => The files inside the project folder + """ + def createProject(self, projName): """ This function create Project related directories and files diff --git a/src/projManagement/openProject.py b/src/projManagement/openProject.py index 6cdcbb38..100cf12c 100644 --- a/src/projManagement/openProject.py +++ b/src/projManagement/openProject.py @@ -23,16 +23,27 @@ from configuration.Appconfig import Appconfig import os import json +""" +This class is called when User click on Open Project Button +""" -class OpenProjectInfo(QtGui.QWidget): - """ - This class is called when User click on Open Project Button - """ +class OpenProjectInfo(QtGui.QWidget): def __init__(self): super(OpenProjectInfo, self).__init__() self.obj_validation = Validation() + """ + Open a project directory using Qt GUI and validate + if .proj file present in it + + @params + + @return + :dirs => The directories inside the project folder + :filelist => The files inside the project folder + """ + def body(self): self.obj_Appconfig = Appconfig() self.openDir = self.obj_Appconfig.default_workspace["workspace"] diff --git a/src/subcircuit/Subcircuit.py b/src/subcircuit/Subcircuit.py index 259ae40a..39c0fe77 100644 --- a/src/subcircuit/Subcircuit.py +++ b/src/subcircuit/Subcircuit.py @@ -6,9 +6,11 @@ from subcircuit.openSub import openSub from subcircuit.convertSub import convertSub +# This class creates Subcircuit GUI. class Subcircuit(QtGui.QWidget): """ - This class creates Subcircuit GUI. + Creates buttons for New project, Edit existing project and + Kicad Netlist to Ngspice Netlist converter. """ def __init__(self, parent=None): diff --git a/src/subcircuit/convertSub.py b/src/subcircuit/convertSub.py index 31ae3022..cce27476 100644 --- a/src/subcircuit/convertSub.py +++ b/src/subcircuit/convertSub.py @@ -4,9 +4,12 @@ from configuration.Appconfig import Appconfig import os +# This class is called when User create new Project and contains \ +# functions to convert kicad to Ngspice. class convertSub(QtGui.QWidget): """ - This class is called when User create new Project. + Contains functions that checks project present for conversion and + also function to convert Kicad to Ngspice. """ def __init__(self, dockarea): diff --git a/src/subcircuit/newSub.py b/src/subcircuit/newSub.py index c39f7c7a..d94f4395 100644 --- a/src/subcircuit/newSub.py +++ b/src/subcircuit/newSub.py @@ -5,9 +5,13 @@ from projManagement import Worker import os +# This class is called when User create new Project. class NewSub(QtGui.QWidget): """ - This class is called when User create new Project. + Contains funstions to check : + - Name of project should not be blank. + - Name should not contain space between them. + - Name does not match with existing project. """ def __init__(self): diff --git a/src/subcircuit/openSub.py b/src/subcircuit/openSub.py index ba6d0617..4c1394eb 100644 --- a/src/subcircuit/openSub.py +++ b/src/subcircuit/openSub.py @@ -4,9 +4,11 @@ from projManagement.Worker import WorkerThread import os +# This class is called when User clicks on Edit Subcircuit Button. class openSub(QtGui.QWidget): """ - This class is called when User click on Open Project Button + It opens the existing subcircuit projects that are present in + Subcircuit Library. """ def __init__(self): |