Updated all pot/po files (via make update-po). Added new menus to rcstrings.c.
[geda-gaf/whiteaudio.git] / docs / wiki / geda_circuit_simulation_improvements.html
blobc8c84505b7b6afcb73cb195bbf9c7e766b81ae89
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"
4 lang="en" dir="ltr">
5 <head>
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" />
22 </head>
23 <body>
24 <div class="dokuwiki export">
25 <div class="toc">
26 <div class="tocheader toctoggle" id="toc__header">Table of Contents</div>
27 <div id="toc__inside">
29 <ul class="toc">
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>
31 <ul class="toc">
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>
34 <ul class="toc">
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>
41 </ul>
42 </li>
43 <li class="level2"><div class="li"><span class="li"><a href="#appendix" class="toc">Appendix</a></span></div>
44 <ul class="toc">
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>
48 </li></ul>
49 </li></ul>
50 </div>
51 </div>
55 <h1><a name="circuit_simulation_improvements_in_gschem" id="circuit_simulation_improvements_in_gschem">Circuit simulation improvements in gschem</a></h1>
56 <div class="level1">
58 </div>
59 <!-- SECTION "Circuit simulation improvements in gschem" [1-58] -->
60 <h2><a name="rationale" id="rationale">Rationale</a></h2>
61 <div class="level2">
63 <p>
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:
65 </p>
66 <ul>
67 <li class="level1"><div class="li"> specify what kinds of simulations should be run</div>
68 </li>
69 <li class="level1"><div class="li"> specify which voltages and currents should be plotted</div>
70 </li>
71 <li class="level1"><div class="li"> start the simulation</div>
72 </li>
73 </ul>
75 <p>
76 The simulation runs and the postprocessing may be in an external programm that is triggered by IPC.
77 </p>
79 <p>
80 There are some graphical frontends around but they can’t solve all of the above problems
81 </p>
82 <ul>
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>
84 </li>
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>
86 </li>
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>
88 </li>
89 </ul>
91 <p>
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.
93 </p>
95 </div>
96 <!-- SECTION "Rationale" [59-862] -->
97 <h2><a name="draft" id="draft">Draft</a></h2>
98 <div class="level2">
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.
102 </p>
104 </div>
105 <!-- SECTION "Draft" [863-1012] -->
106 <h3><a name="the_probes" id="the_probes">The probes</a></h3>
107 <div class="level3">
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.
111 </p>
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.
115 </p>
117 </div>
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>
120 <div class="level3">
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)&quot;.
124 </p>
127 A dialog would be nice that prompts the user for the named attributes and not only for the value string.
128 </p>
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.
132 </p>
134 </div>
135 <!-- SECTION "Voltage and current sources" [1889-2487] -->
136 <h3><a name="the_simulations" id="the_simulations">The simulations</a></h3>
137 <div class="level3">
140 How can we store a simulation inside gschem.
141 </p>
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.
145 </p>
146 <ul>
147 <li class="level1"><div class="li"> kind of simulation (dc, ac, tran, &hellip;)</div>
148 </li>
149 <li class="level1"><div class="li"> simulator options</div>
150 </li>
151 <li class="level1"><div class="li"> the simulator? (can we run the same circuit with too simulators in one step?)</div>
152 </li>
153 <li class="level1"><div class="li"> simulation parameters (global parameters, temperature, &hellip;)</div>
154 </li>
155 </ul>
156 <pre class="code">
157 v 20061020 1
158 C 41500 49200 1 0 0 spice-directive-1.sym
160 device=spice_simulation_block
161 refdes=A1
162 simulation_name=random name
163 simulation_active=1
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
167 option_TNOM=100 Deg
168 option_ABSTOL=1e-3
169 global_param1=???
170 global_param2=???
172 </pre>
175 There may be many simulation objects inside a single schematic.
176 </p>
179 To store additional libraries we can either use an include card or using a “LIBRARY” symbol that contains all libraries either as:
180 </p>
181 <ul>
182 <li class="level1"><div class="li"> a multiline attribute</div>
183 </li>
184 <li class="level1"><div class="li"> multiple attached library attributes to the LIBRARY symbol</div>
185 </li>
186 </ul>
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.
190 </p>
192 </div>
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>
195 <div class="level3">
198 Lets assume anything we need to add simulation support to gschem is a single dialog.
199 </p>
200 <ul>
201 <li class="level1"><div class="li"> It would have a list of simulations (listview with enable/disable buttons and simulation names)</div>
202 </li>
203 <li class="level1"><div class="li"> It would have some icons to add the probes. </div>
204 </li>
205 <li class="level1"><div class="li"> It may have buttons for the most common symbols: resistor, capacitor, inductor, diode, &hellip; [R,C,L,D,M,E,F,G,H..]</div>
206 </li>
207 <li class="level1"><div class="li"> It would have some dialog elements to do the spice settings</div>
208 </li>
209 <li class="level1"><div class="li"> It would have a simulate and a close button</div>
210 </li>
211 <li class="level1"><div class="li"> Some additional buttons like: Copy simulation, Remove simulation, general options&hellip;</div>
212 </li>
213 </ul>
216 When creating that dialog all simulation objects are collected into the simulation list (listview with enable/disable checkbutton)
217 </p>
220 When changing the settings the attributes of the assosiated simulation object are changed.
221 </p>
223 </div>
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>
226 <div class="level3">
229 What kind of options do we need for that dialog? And Why?
230 </p>
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:
234 </p>
235 <ul>
236 <li class="level1"><div class="li"> plot all marks and only save the corresponding node voltages</div>
237 </li>
238 <li class="level1"><div class="li"> plot all marks but save all node voltages and currents (through voltage sources)</div>
239 </li>
240 <li class="level1"><div class="li"> only save voltage nodes of the current schematic level or store subcircuit node voltages, too.</div>
241 </li>
242 </ul>
244 </div>
245 <!-- SECTION "The option dialog" [4568-5135] -->
246 <h3><a name="invoking_the_simulation" id="invoking_the_simulation">Invoking the simulation</a></h3>
247 <div class="level3">
250 The simulation button of the dialog should lead to the following actions:
251 </p>
252 <ul>
253 <li class="level1"><div class="li"> save the schematic (ask the user or use a temporary file?)</div>
254 </li>
255 <li class="level1"><div class="li"> create a netlist using gnetlist</div>
256 </li>
257 <li class="level1"><div class="li"> create simulation files and include the netlist (can this be done with gnetlist too?)</div>
258 </li>
259 <li class="level1"><div class="li"> execute the simulation startup script (guile, sh, &hellip;)</div>
260 </li>
261 </ul>
264 That startup script may even call a scheduler that can take lots of large simulations.
265 </p>
267 </div>
268 <!-- SECTION "Invoking the simulation" [5136-5581] -->
269 <h2><a name="appendix" id="appendix">Appendix</a></h2>
270 <div class="level2">
272 </div>
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>
275 <div class="level3">
276 <pre class="code">
277 v 20061020 1
278 P 0 0 200 200 1 0 0
280 T 100 0 5 10 0 1 0 0 1
281 pintype=pas
282 T 0 100 5 10 0 1 0 0 1
283 pinseq=1
284 T 0 100 5 10 0 1 0 0 1
285 pinnumber=1
286 T 0 100 5 10 0 1 0 0 1
287 pinlabel=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
293 device=VOLTAGE_PROBE
294 T 200 50 9 6 1 1 0 0 1
295 refdes=I_VP?
296 T 0 700 9 10 0 0 0 0 1
297 net=GND:2
298 T 0 900 9 10 0 0 0 0 1
299 value=DC 0A
300 </pre>
302 </div>
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>
305 <div class="level3">
306 <pre class="code">
307 v 20061020 1
308 P 0 200 150 200 1 0 0
310 T -150 50 5 10 0 1 0 0 1
311 pintype=pas
312 T 50 250 5 10 0 1 0 0 1
313 pinseq=1
314 T 50 250 5 10 0 1 0 0 1
315 pinnumber=1
316 T 50 250 5 10 0 1 0 0 1
317 pinlabel=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
323 device=CURRENT_PROBE
324 T 200 370 9 6 1 1 0 0 1
325 refdes=V_IP?
326 P 600 200 450 200 1 0 0
328 T 500 50 5 10 0 1 0 0 1
329 pintype=pas
330 T 500 250 5 10 0 1 0 0 1
331 pinseq=2
332 T 500 250 5 10 0 1 0 0 1
333 pinnumber=2
334 T 500 250 5 10 0 1 0 0 1
335 pinlabel=2
337 L 240 180 360 180 3 10 0 0 -1 -1
338 T 0 700 9 10 0 0 0 0 1
339 value=DC 0V
340 </pre>
342 </div>
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>
345 <div class="level3">
346 <pre class="code">
347 v 20061020 1
348 T 700 650 8 10 1 1 0 0 1
349 refdes=VAM?
350 T 700 850 5 10 1 1 0 0 1
351 device=Ammeter
352 T 700 1050 5 10 0 0 0 0 1
353 footprint=none
354 T 700 1250 5 10 0 0 0 0 1
355 numslots=0
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
361 pinnumber=1
362 T 350 1000 5 8 0 1 0 2 1
363 pinseq=1
364 T 400 850 9 8 1 1 0 5 1
365 pinlabel=+
366 T 300 700 5 8 0 1 0 5 1
367 pintype=pwr
369 P 300 0 300 300 1 0 0
371 T 350 100 5 8 1 1 0 0 1
372 pinnumber=2
373 T 350 100 5 8 0 1 0 2 1
374 pinseq=2
375 T 300 500 5 8 0 1 0 3 1
376 pintype=pwr
377 T 300 300 5 10 1 1 0 0 1
378 pinlabel=-
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
383 value=DC 0V
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
389 </pre>
391 </div>
392 <!-- SECTION "Another current probe symbol used by Kurt Peters" [6762-] --></div>
393 </body>
394 </html>