1 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml" xml:
lang=
"en"
6 <meta http-equiv=
"Content-Type" content=
"text/html; charset=utf-8" />
7 <title>geda:circuit_simulation_improvements
</title>
8 <meta name=
"generator" content=
"DokuWiki Release rc2007-05-24" />
9 <meta name=
"robots" content=
"noindex,nofollow" />
10 <meta name=
"date" content=
"2007-05-24T22:27:27-0400" />
11 <meta name=
"keywords" content=
"geda,circuit_simulation_improvements" />
12 <link rel=
"search" type=
"application/opensearchdescription+xml" href=
"http://geda.seul.org/wiki/lib/exe/opensearch.php" title=
"geda Wiki" />
13 <link rel=
"start" href=
"http://geda.seul.org/wiki/" />
14 <link rel=
"contents" href=
"http://geda.seul.org/wiki/geda:circuit_simulation_improvements?do=index" title=
"Index" />
15 <link rel=
"alternate" type=
"application/rss+xml" title=
"Recent Changes" href=
"http://geda.seul.org/wiki/feed.php" />
16 <link rel=
"alternate" type=
"application/rss+xml" title=
"Current Namespace" href=
"http://geda.seul.org/wiki/feed.php?mode=list&ns=geda" />
17 <link rel=
"alternate" type=
"text/html" title=
"Plain HTML" href=
"http://geda.seul.org/wiki/_export/xhtml/geda:circuit_simulation_improvements" />
18 <link rel=
"alternate" type=
"text/plain" title=
"Wiki Markup" href=
"http://geda.seul.org/wiki/_export/raw/geda:circuit_simulation_improvements" />
19 <link rel=
"stylesheet" media=
"all" type=
"text/css" href=
"lib/exe/css" />
20 <link rel=
"stylesheet" media=
"screen" type=
"text/css" href=
"lib/exe/001css" />
21 <link rel=
"stylesheet" media=
"print" type=
"text/css" href=
"lib/exe/002css" />
24 <div class=
"dokuwiki export">
26 <div class=
"tocheader toctoggle" id=
"toc__header">Table of Contents
</div>
27 <div id=
"toc__inside">
30 <li class=
"level1"><div class=
"li"><span class=
"li"><a href=
"#circuit_simulation_improvements_in_gschem" class=
"toc">Circuit simulation improvements in gschem
</a></span></div>
32 <li class=
"level2"><div class=
"li"><span class=
"li"><a href=
"#rationale" class=
"toc">Rationale
</a></span></div></li>
33 <li class=
"level2"><div class=
"li"><span class=
"li"><a href=
"#draft" class=
"toc">Draft
</a></span></div>
35 <li class=
"level3"><div class=
"li"><span class=
"li"><a href=
"#the_probes" class=
"toc">The probes
</a></span></div></li>
36 <li class=
"level3"><div class=
"li"><span class=
"li"><a href=
"#voltage_and_current_sources" class=
"toc">Voltage and current sources
</a></span></div></li>
37 <li class=
"level3"><div class=
"li"><span class=
"li"><a href=
"#the_simulations" class=
"toc">The simulations
</a></span></div></li>
38 <li class=
"level3"><div class=
"li"><span class=
"li"><a href=
"#creating_a_simulation_dialog_inside_gschem" class=
"toc">Creating a simulation dialog inside gschem
</a></span></div></li>
39 <li class=
"level3"><div class=
"li"><span class=
"li"><a href=
"#the_option_dialog" class=
"toc">The option dialog
</a></span></div></li>
40 <li class=
"level3"><div class=
"li"><span class=
"li"><a href=
"#invoking_the_simulation" class=
"toc">Invoking the simulation
</a></span></div></li>
43 <li class=
"level2"><div class=
"li"><span class=
"li"><a href=
"#appendix" class=
"toc">Appendix
</a></span></div>
45 <li class=
"level3"><div class=
"li"><span class=
"li"><a href=
"#a_current_probe_symbol_draft" class=
"toc">A current probe symbol (draft)
</a></span></div></li>
46 <li class=
"level3"><div class=
"li"><span class=
"li"><a href=
"#a_voltage_probe_symbol_draft" class=
"toc">A voltage probe symbol (draft)
</a></span></div></li>
47 <li class=
"level3"><div class=
"li"><span class=
"li"><a href=
"#another_current_probe_symbol_used_by_kurt_peters" class=
"toc">Another current probe symbol used by Kurt Peters
</a></span></div></li></ul>
55 <h1><a name=
"circuit_simulation_improvements_in_gschem" id=
"circuit_simulation_improvements_in_gschem">Circuit simulation improvements in gschem
</a></h1>
59 <!-- SECTION "Circuit simulation improvements in gschem" [1-58] -->
60 <h2><a name=
"rationale" id=
"rationale">Rationale
</a></h2>
64 Using gschem as a circuit simulation (ngspice or gnucap) frontend is not easy for novice users. A new user would like to do the following things inside gschem:
67 <li class=
"level1"><div class=
"li"> specify what kinds of simulations should be run
</div>
69 <li class=
"level1"><div class=
"li"> specify which voltages and currents should be plotted
</div>
71 <li class=
"level1"><div class=
"li"> start the simulation
</div>
76 The simulation runs and the postprocessing may be in an external programm that is triggered by IPC.
80 There are some graphical frontends around but they can’t solve all of the above problems
83 <li class=
"level1"><div class=
"li"> <a href=
"http://www.geda.seul.org/tools/gspiceui/index.html" class=
"urlextern" title=
"http://www.geda.seul.org/tools/gspiceui/index.html" rel=
"nofollow">gspiceui
</a></div>
85 <li class=
"level1"><div class=
"li"> <a href=
"http://www.comefly.us/" class=
"urlextern" title=
"http://www.comefly.us/" rel=
"nofollow">kjwaves
</a></div>
87 <li class=
"level1"><div class=
"li"> <a href=
"http://easy-spice.sourceforge.net/" class=
"urlextern" title=
"http://easy-spice.sourceforge.net/" rel=
"nofollow">easyspice
</a></div>
92 All frontends have the problem that you can not point to the net you’d like to see. You need to know the netname of the node.
96 <!-- SECTION "Rationale" [59-862] -->
97 <h2><a name=
"draft" id=
"draft">Draft
</a></h2>
101 Let’s assume we only want to make tiny changes to gschem and libgeda so that we can at least set some probes and ran a simulation.
105 <!-- SECTION "Draft" [863-1012] -->
106 <h3><a name=
"the_probes" id=
"the_probes">The probes
</a></h3>
110 <strong>Current probes
</strong> can be ordinary dc voltage sources with
0V. The easy way to insert that probe would be a symbol with two pins like an normal ampere meter. If we’d like to set a current probe to an end of a pin we need a netlister that detects that current probe and replaces it with our “ampere meter”. If we use a voltage source as an ampere meter the netlister does not need to know the netnames inside the schematic. All
0V voltage sources with a special device name are current probes.
114 <strong>Voltage probes
</strong> may be current sources with
0A. The second pin of the current source is tied to GND with a net attribute. Thus again the netlister does not need to know the netnames as it can use that net that is connected with that special current sources. Like above a voltage source could be a special (graphical) symbol that is detected by a netlister.
118 <!-- SECTION "The probes" [1013-1888] -->
119 <h3><a name=
"voltage_and_current_sources" id=
"voltage_and_current_sources">Voltage and current sources
</a></h3>
123 Specifying the parameters of sources is not that easy. Currently they are stored inside the “value” attribute of the symbol. eg. “value=pulse
0 1 10n
10n
100n
1u 2u”. These settings needs to match the spice attributes “pulse(V1 V2 TD TR TF PW PER)
".
127 A dialog would be nice that prompts the user for the named attributes and not only for the value string.
131 A modified edit attribute (ee) command could take care of voltage and current source devices and trigger a different property dialog for that sources. Currently the multiattrib edit dialog is triggered.
135 <!-- SECTION "Voltage and current sources" [1889-2487] -->
136 <h3><a name=
"the_simulations" id=
"the_simulations">The simulations
</a></h3>
140 How can we store a simulation inside gschem.
144 To store one simulation we can use a symbol with the devicename “SIMULATION”. All options that define one simulation are stored as attributes attached to that object.
147 <li class=
"level1"><div class=
"li"> kind of simulation (dc, ac, tran,
…)
</div>
149 <li class=
"level1"><div class=
"li"> simulator options
</div>
151 <li class=
"level1"><div class=
"li"> the simulator? (can we run the same circuit with too simulators in one step?)
</div>
153 <li class=
"level1"><div class=
"li"> simulation parameters (global parameters, temperature,
…)
</div>
158 C
41500 49200 1 0 0 spice-directive-
1.sym
160 device=spice_simulation_block
162 simulation_name=random name
164 simulation_type=DC
0V
1V
0.1V
165 parametric_simulation1=V1 lin
0 5 0.1
166 parametric_simulation2=R1.value lin
10k
100k
10k
175 There may be many simulation objects inside a single schematic.
179 To store additional libraries we can either use an include card or using a “LIBRARY” symbol that contains all libraries either as:
182 <li class=
"level1"><div class=
"li"> a multiline attribute
</div>
184 <li class=
"level1"><div class=
"li"> multiple attached library attributes to the LIBRARY symbol
</div>
189 There should be a distinction between global, user and local libs. global and user libs may be specified by a gafrc or a new spicerc configuration file.
193 <!-- SECTION "The simulations" [2488-3735] -->
194 <h3><a name=
"creating_a_simulation_dialog_inside_gschem" id=
"creating_a_simulation_dialog_inside_gschem">Creating a simulation dialog inside gschem
</a></h3>
198 Lets assume anything we need to add simulation support to gschem is a single dialog.
201 <li class=
"level1"><div class=
"li"> It would have a list of simulations (listview with enable/disable buttons and simulation names)
</div>
203 <li class=
"level1"><div class=
"li"> It would have some icons to add the probes.
</div>
205 <li class=
"level1"><div class=
"li"> It may have buttons for the most common symbols: resistor, capacitor, inductor, diode,
… [R,C,L,D,M,E,F,G,H..]
</div>
207 <li class=
"level1"><div class=
"li"> It would have some dialog elements to do the spice settings
</div>
209 <li class=
"level1"><div class=
"li"> It would have a simulate and a close button
</div>
211 <li class=
"level1"><div class=
"li"> Some additional buttons like: Copy simulation, Remove simulation, general options
…</div>
216 When creating that dialog all simulation objects are collected into the simulation list (listview with enable/disable checkbutton)
220 When changing the settings the attributes of the assosiated simulation object are changed.
224 <!-- SECTION "Creating a simulation dialog inside gschem" [3736-4567] -->
225 <h3><a name=
"the_option_dialog" id=
"the_option_dialog">The option dialog
</a></h3>
229 What kind of options do we need for that dialog? And Why?
233 The probes that we have placed can be used to tell the simulator the variables that we like to save or tell the plotting application which plots we’d like to see. This is something completely different, we need an option for that:
236 <li class=
"level1"><div class=
"li"> plot all marks and only save the corresponding node voltages
</div>
238 <li class=
"level1"><div class=
"li"> plot all marks but save all node voltages and currents (through voltage sources)
</div>
240 <li class=
"level1"><div class=
"li"> only save voltage nodes of the current schematic level or store subcircuit node voltages, too.
</div>
245 <!-- SECTION "The option dialog" [4568-5135] -->
246 <h3><a name=
"invoking_the_simulation" id=
"invoking_the_simulation">Invoking the simulation
</a></h3>
250 The simulation button of the dialog should lead to the following actions:
253 <li class=
"level1"><div class=
"li"> save the schematic (ask the user or use a temporary file?)
</div>
255 <li class=
"level1"><div class=
"li"> create a netlist using gnetlist
</div>
257 <li class=
"level1"><div class=
"li"> create simulation files and include the netlist (can this be done with gnetlist too?)
</div>
259 <li class=
"level1"><div class=
"li"> execute the simulation startup script (guile, sh,
…)
</div>
264 That startup script may even call a scheduler that can take lots of large simulations.
268 <!-- SECTION "Invoking the simulation" [5136-5581] -->
269 <h2><a name=
"appendix" id=
"appendix">Appendix
</a></h2>
273 <!-- SECTION "Appendix" [5582-5602] -->
274 <h3><a name=
"a_current_probe_symbol_draft" id=
"a_current_probe_symbol_draft">A current probe symbol (draft)
</a></h3>
280 T
100 0 5 10 0 1 0 0 1
282 T
0 100 5 10 0 1 0 0 1
284 T
0 100 5 10 0 1 0 0 1
286 T
0 100 5 10 0 1 0 0 1
289 V
300 300 150 3 10 0 0 -
1 -
1 0 -
1 -
1 -
1 -
1 -
1
290 L
300 200 240 360 3 10 0 0 -
1 -
1
291 L
300 200 360 360 3 10 0 0 -
1 -
1
292 T
0 500 9 10 0 0 0 0 1
294 T
200 50 9 6 1 1 0 0 1
296 T
0 700 9 10 0 0 0 0 1
298 T
0 900 9 10 0 0 0 0 1
303 <!-- SECTION "A current probe symbol (draft)" [5603-6092] -->
304 <h3><a name=
"a_voltage_probe_symbol_draft" id=
"a_voltage_probe_symbol_draft">A voltage probe symbol (draft)
</a></h3>
308 P
0 200 150 200 1 0 0
310 T -
150 50 5 10 0 1 0 0 1
312 T
50 250 5 10 0 1 0 0 1
314 T
50 250 5 10 0 1 0 0 1
316 T
50 250 5 10 0 1 0 0 1
319 V
300 200 150 3 10 0 0 -
1 -
1 0 -
1 -
1 -
1 -
1 -
1
320 L
300 300 380 140 3 10 0 0 -
1 -
1
321 L
300 300 220 140 3 10 0 0 -
1 -
1
322 T
0 500 9 10 0 0 0 0 1
324 T
200 370 9 6 1 1 0 0 1
326 P
600 200 450 200 1 0 0
328 T
500 50 5 10 0 1 0 0 1
330 T
500 250 5 10 0 1 0 0 1
332 T
500 250 5 10 0 1 0 0 1
334 T
500 250 5 10 0 1 0 0 1
337 L
240 180 360 180 3 10 0 0 -
1 -
1
338 T
0 700 9 10 0 0 0 0 1
343 <!-- SECTION "A voltage probe symbol (draft)" [6093-6761] -->
344 <h3><a name=
"another_current_probe_symbol_used_by_kurt_peters" id=
"another_current_probe_symbol_used_by_kurt_peters">Another current probe symbol used by Kurt Peters
</a></h3>
348 T
700 650 8 10 1 1 0 0 1
350 T
700 850 5 10 1 1 0 0 1
352 T
700 1050 5 10 0 0 0 0 1
354 T
700 1250 5 10 0 0 0 0 1
356 T
700 1450 5 10 0 0 0 0 1
357 description=ammeter for spice
358 P
300 1200 300 900 1 0 0
360 T
350 1000 5 8 1 1 0 0 1
362 T
350 1000 5 8 0 1 0 2 1
364 T
400 850 9 8 1 1 0 5 1
366 T
300 700 5 8 0 1 0 5 1
369 P
300 0 300 300 1 0 0
371 T
350 100 5 8 1 1 0 0 1
373 T
350 100 5 8 0 1 0 2 1
375 T
300 500 5 8 0 1 0 3 1
377 T
300 300 5 10 1 1 0 0 1
380 L
300 400 400 500 3 0 0 0 -
1 -
1
381 L
200 500 300 400 3 0 0 0 -
1 -
1
382 T
700 450 5 10 0 1 0 0 1
384 L
300 400 300 800 3 0 0 0 -
1 -
1
385 L
100 800 500 400 3 0 0 0 -
1 -
1
386 B
0 300 600 600 3 0 0 0 -
1 -
1 0 -
1 -
1 -
1 -
1 -
1
387 L
200 800 100 800 3 0 0 0 -
1 -
1
388 L
100 700 100 800 3 0 0 0 -
1 -
1
392 <!-- SECTION "Another current probe symbol used by Kurt Peters" [6762-] --></div>