Ryusai's Homepage
トップページ > LinuxでEDA > ngspice

ngspice

ngspice は mixed-level/mixed-signal 回路シミュレータです。Spice3f5、Cider1b1そしてXspice といったものがベースになっているようです。

ngspiceのインストール

インストールFedora Core 4 で行いました。
2005年11月6日現在で最新のrework-17バージョンをSourceForgeからダウンロードし、適当なディレクトリに展開します。
$ tar vxfz ng-spice-rework-17.tar.gz
解凍して生成された ng-spice-rework-17ディレクトリに移動してmakeします。
コンフィグレーションのオプションには --enable-xspice --with-readline を指定しています。 --enable-xspice は SPICE2 の POLYs が使えるようになり、さらに --wth-readline によって emacs-style のキーコマンドが使えるようになります。
$ cd ng-spice-rework-17
$ ./configure --enable-xspice --with-readline
$ make
$ su
Password:
# make install

2次ローパスフィルタのシミュレーション

gsshemで回路図作成したlpf.schからgnetlistコマンドでngspiceでシミュレーションする為のネットリストを生成し、AC解析を実行して周波数特性と位相特性をグラフ化してみます。
gnetlist で生成された SPICE ネットリストは lpf.cir です。SPICEの回路記述の構文やコマンドについてはSPICE3f5 マニュアルを参照してください。
$ ngspice lpf.cir
******
** ngspice-17 : Circuit level simulation program
** The U. C. Berkeley CAD Group
** Copyright 1985-1994, Regents of the University of California.
** Please submit bug-reports to: ngspice-bugs@lists.sourceforge.net
** Creation Date: Sun Nov 13 18:46:22 JST 2005
******
      
Circuit: * 2 Stage Low Pass Filter

Warning -- Level not specified on line "(is=16e-15 bf=1700)"
Using level 1.
Warning -- Level not specified on line "(is=16e-15 bf=1610.5)"
Using level 1.
ngspice 1 ->
ここでrunコマンドを実行。
gspice 1 -> run
Doing analysis at TEMP = 300.150000 and TNOM = 300.150000
Warning: vin: has no value, DC 0 assumed
Reference value :  5.01187e+04
Reference value :  9.77237e+05
Reference value :  7.07946e+06

No. of Data Rows : 501
ngspice 2 ->
グラフ化するためにplotコマンドを実行すると図 1 のグラフが表示されます。
ngspice 2 -> plot ylabel db ylimit -70 -10 db(v(vout))
図 2 周波数特性
2次ローパスフィルタの周波数特性
位相特性を表示させるには
ngspice 2 -> set units=degree
ngspice 3 -> plot ph(v(vout))
とすることによって図 3 のグラフが表示されます。
図 2 位相特性
2次ローパスフィルタの位相特性
また、アナログ波形ビューワである gwave で表示することが可能な raw ファイルは
$ ngspice -r lpf.raw -b lpf.cir
とすることで出力されます。




サイトマップこのサイトについてお問い合わせ |
Copyright (C) 2006-2008 Ryusai's Homepage All rights reserved