User Tools

Site Tools


kicad:kicad_spice_quick_guide

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
kicad:kicad_spice_quick_guide [2012/09/23 21:27] – [What you'll need] mithatkicad:kicad_spice_quick_guide [2018/10/17 14:56] (current) – [Quick Guide to Using KiCad for SPICE Simulation] mithat
Line 1: Line 1:
-====== Quick Guide to using KiCad for SPICE simulation ======+====== Quick Guide to Using KiCad for SPICE Simulation ====== 
 + 
 +<WRAP center important 60%> 
 +The following was written for KiCad 4. Simulation support in KiCad 5 has been reworked to such an extent that a lot of the following doesn't work. 
 + 
 +If you have KiCad 4 SPICE stuff you'd like to use in KiCad 5, have a look [[kicad:using_arbitrary_spice_engines_in_kicad_5|here]]. 
 +</WRAP> 
 {{:kicad:kicad-spice.png?direct&400|}} {{:kicad:kicad-spice.png?direct&400|}}
  
Line 5: Line 12:
  
 ===== What you'll need ===== ===== What you'll need =====
 +You'll need the following to get a working SPICE setup:
  
   * [[http://iut-tice.ujf-grenoble.fr/kicad/|KiCad]]   * [[http://iut-tice.ujf-grenoble.fr/kicad/|KiCad]]
-  * A [[http://bwrc.eecs.berkeley.edu/classes/icbook/spice/|SPICE]] engine+  * A [[http://bwrc.eecs.berkeley.edu/classes/icbook/spice/|SPICE]] engine:
     * [[http://ngspice.sourceforge.net/|ngspice]]: Arguably the most FOSSy commonly available SPICE engine.     * [[http://ngspice.sourceforge.net/|ngspice]]: Arguably the most FOSSy commonly available SPICE engine.
     * [[https://www.gnu.org/software/gnucap/|gnucap]]: Not actually SPICE but tries to be syntax-compatible.     * [[https://www.gnu.org/software/gnucap/|gnucap]]: Not actually SPICE but tries to be syntax-compatible.
     * [[http://www.spiceopus.si/|SpiceOpus]]: Proprietary but nice, especially the output plotting.     * [[http://www.spiceopus.si/|SpiceOpus]]: Proprietary but nice, especially the output plotting.
-    * [[http://www.linear.com/designtools/software/|LTSpice]]: Linear Technology's popular, proprietary Windows solution. Works in [[http://www.winehq.org/|Wine]]. Need to verify if it is scriptable. Has a GUI anyway, so ... +    * [[http://www.linear.com/designtools/software/|LTSpice]]: Linear Technology's popular, proprietary Windows solution. Works in [[http://www.winehq.org/|Wine]]. It'scriptable but I have yet to understand how to embed control statements. Has a GUI anyway, so ... ? 
-    * [[http://www.cadence.com/products/orcad/pspice_simulation/Pages/default.aspx|PSpice]]: Windows-only, expensive, defacto standard professional solution in the USA. They also have a tradition of making available a //gratis// crippleware student version. Also has a a GUI, so ...  +    * [[http://www.cadence.com/products/orcad/pspice_simulation/Pages/default.aspx|PSpice]]: Windows-only, expensive, defacto standard professional solution in the USA. They also have a tradition of making available a //gratis// crippleware student version. And introducing non-standard model features, leading to an annoying situation where vendor-supplied models only work in PSPICE. Also has a a GUI, so ... 
-  * Component librar(ies) with SPICE symbols +    * Any others? 
-    * There is a library of basic SPICE components that ships with KiCad. It's good enough for initial experimentation. +  * Component libraries with SPICE symbols: 
-      * In Debian-based Linux (and likely others), it's at ''/usr/share/kicad/library/pspice.lib''. (PSpice is a popular proprietary version of SPICE.) +    * There is a library of basic SPICE components that ships with KiCad. It's good enough for initial experimentation. The library isn't included in Eeschema projects by default. You'll have to add it manually if you want to use it. In Debian-based Linux, it's at ''/usr/share/kicad/library/pspice.lib''
-      * EESchema does not include this library in projects by default+    * I am developing (very slowly) [[https://bitbucket.org/mithat/kicad-spice-library|my own library]] of components based on the above with some changes and additions.
-    * I am maintaining (slowly) [[https://bitbucket.org/mithat/kicad-spice-library|my own library]] of components based on the above with some changes and additions.+
  
 ===== Configuring a project ===== ===== Configuring a project =====
  
   - Create a new project in the conventional way.   - Create a new project in the conventional way.
-  - Open EESchema and remove all the library references included by default.+  - Open Eeschema and remove all the library references included by default.
   - Manually add one or more libraries with SPICE components to the project.   - Manually add one or more libraries with SPICE components to the project.
-    * The SPICE library that comes packaged with KiCad is //not// included by default in new KiCad projects. +    * Note that the SPICE library that comes packaged with KiCad is //not// included by default in new KiCad projects. 
-  - Specify the SPICE engine you want to use.+  - Specify the SPICE engine you want to use:
     * Click the "Generate netlist" button (or the equivalent menu item).     * Click the "Generate netlist" button (or the equivalent menu item).
     * Select the "Spice" tab     * Select the "Spice" tab
Line 33: Line 40:
   - Do your schematic capture, subject to a couple best practices:   - Do your schematic capture, subject to a couple best practices:
     * For named nets, use global labels instead of local labels.     * For named nets, use global labels instead of local labels.
-      * In the netlists, global identifiers will be used as-is. However, local labels will get text prepended to the name, and this will make it hard for you to remember/guess what the full identifier is.+      * The reason for this is that in the netlists, global identifiers will be used as-is but local labels get text prepended to the name---which makes it hard for you to remember/guess what the full identifier is.
     * Use the "''0''" component from a SPICE component library rather than the ''GND'' symbol.     * Use the "''0''" component from a SPICE component library rather than the ''GND'' symbol.
-      * "''0''" is the official name of ground node in SPICE. Some engines may translate ''GND'' into ''0'', some are not. +      * "''0''" is the official name of ground node in SPICE. Some engines may translate ''GND'' into ''0'', some may not. 
-  - Specify the simulations you want to run and the output you want to display by adding a text block (i.e., "comment") with the needed SPICE and Nutmeg syntax plus a little added mojo. To do an AC analysis and plot the response at node ''vout'', you would add the following block:<code> +  - To specify the simulations you want to run and the output you want to display, add a text block (i.e., "comment") with the needed SPICE and Nutmeg syntax plus a little added mojo. The following does an AC analysis and plots the response at node ''vout'':<code> 
-+pspice ++PSPICE 
 .control .control
 ac dec 66 1kHz 120kHz  ac dec 66 1kHz 120kHz 
Line 44: Line 51:
 plot vp(vout) plot vp(vout)
 .endc</code> .endc</code>
-    * The line ''+pspice'' is KiCad-speak for, "Stick the following text at the end of a SPICE netlist." +    * The line ''+PSPICE'' is KiCad-speak for, "Stick the following text at the end of a SPICE netlist." 
-      * :!: There appears to be a bug in the parser that requires you to add a space after ''+pspice'' and the line break. +      * :!: There appears to be a bug in the parser that requires you to add a space after ''+PSPICE'' and before the line break. 
-    * There is a corresponding ''-pspice'' that is KiCad-speak for, "Stick the following text at the //start// of a SPICE netlist." +    * There is a corresponding ''-PSPICE'' that is KiCad-speak for, "Stick the following text at the //start// of a SPICE netlist." 
-    * If you don't like seeing ''pspice'' in your designs, you can use ''gnucap'' instead. I believe they are exact synonyms in this context, but I am not certain.+    * If you don't like seeing references to PSpice in your designs, you can use ''+GNUCAP'' and ''-GNUCAP'' instead. I believe they are exact synonyms in this context, but I am not certain.
     * Yes, this means you need to learn some [[http://newton.ex.ac.uk/teaching/cdhw/Electronics2/userguide/sec5.html|SPICE and Nutmeg]] syntax. It's not hard.     * Yes, this means you need to learn some [[http://newton.ex.ac.uk/teaching/cdhw/Electronics2/userguide/sec5.html|SPICE and Nutmeg]] syntax. It's not hard.
   - Run the simulation:   - Run the simulation:
kicad/kicad_spice_quick_guide.1348435649.txt.gz · Last modified: 2012/09/23 21:27 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki