User Tools

Site Tools


kicad:using_arbitrary_spice_engines_in_kicad_5

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
Next revisionBoth sides next revision
kicad:using_arbitrary_spice_engines_in_kicad_5 [2018/09/09 14:23] mithatkicad:using_arbitrary_spice_engines_in_kicad_5 [2018/09/09 14:33] mithat
Line 5: Line 5:
 I have a lot of simulations I built under KiCad 4 that I still want to use. So I hacked together a bash script that makes it relatively easy to convert KiCad 4 simulations to something that works in KiCad 5. I'm dumping the source code here for now but will probably be moving it to Git[lab|hub] soon. I have a lot of simulations I built under KiCad 4 that I still want to use. So I hacked together a bash script that makes it relatively easy to convert KiCad 4 simulations to something that works in KiCad 5. I'm dumping the source code here for now but will probably be moving it to Git[lab|hub] soon.
  
-<code bash> +<file bash simulate.sh
-#! /bin/bash +#!/bin/bash 
 + 
 # (C) 2018 Mithat Konar https://mithatkonar.com # (C) 2018 Mithat Konar https://mithatkonar.com
 + 
 # A scheme to use arbitrary SPICE simulators in Kicad 5. # A scheme to use arbitrary SPICE simulators in Kicad 5.
 # #
Line 20: Line 20:
 #         hack the line where it's invoked to add command line #         hack the line where it's invoked to add command line
 #         parameters or if it's weird.) #         parameters or if it's weird.)
-# * In the KiCad Netlist dialog SPICE tab, set the simulator to this file using an absolute path. +# * In the KiCad Netlist dialog SPICE tab, set the simulator to this file using 
-# * In KiCad, Run Simulator +#   an absolute path. 
- +# * In KiCad, Run Simulator. 
-### --- config ------------------------------------------------------- #+  
 +----- config ---------------------------------------------------------
 # The name of the cir file to simulate with (w/o extension): # The name of the cir file to simulate with (w/o extension):
 CIRCUITNAME=opa-x5-spice CIRCUITNAME=opa-x5-spice
 + 
 # The command for the SPICE engine you want to use: # The command for the SPICE engine you want to use:
 SPICE_ENGINE=spiceopus SPICE_ENGINE=spiceopus
-# -------------------------------------------------------------------- # +# ---------------------------------------------------------------------- 
 + 
 ### constants ### constants
 CIRCUITFILE=${CIRCUITNAME}.cir CIRCUITFILE=${CIRCUITNAME}.cir
 CIRCUITFILE_CLEANED=${CIRCUITNAME}-cleaned.cir CIRCUITFILE_CLEANED=${CIRCUITNAME}-cleaned.cir
 GENERATED_CIR=${CIRCUITNAME}-complete.cir GENERATED_CIR=${CIRCUITNAME}-complete.cir
- +  
-### Go!+### go!
 # set the script's directory as the working directory # set the script's directory as the working directory
 cd $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) cd $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
 + 
 # remove all lines starting with .title from CIRCUITFILE # remove all lines starting with .title from CIRCUITFILE
 sed '/^.title/d' $CIRCUITFILE > $CIRCUITFILE_CLEANED sed '/^.title/d' $CIRCUITFILE > $CIRCUITFILE_CLEANED
 + 
 # concatenate the final file # concatenate the final file
 cat pre.cir > $GENERATED_CIR cat pre.cir > $GENERATED_CIR
 cat $CIRCUITFILE_CLEANED >> $GENERATED_CIR cat $CIRCUITFILE_CLEANED >> $GENERATED_CIR
 cat post.cir >> $GENERATED_CIR cat post.cir >> $GENERATED_CIR
 + 
 # run it # run it
 $SPICE_ENGINE $GENERATED_CIR $SPICE_ENGINE $GENERATED_CIR
 + 
 # cleanup # cleanup
 #~ rm $GENERATED_CIR #~ rm $GENERATED_CIR
 rm $CIRCUITFILE_CLEANED rm $CIRCUITFILE_CLEANED
-</code>+ 
 +</file>
  
kicad/using_arbitrary_spice_engines_in_kicad_5.txt · Last modified: 2019/01/04 21:41 by mithat

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki