File: 16_opamp_dc.html

package info (click to toggle)
sch-rnd 1.0.10-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,696 kB
  • sloc: ansic: 119,120; awk: 1,502; makefile: 1,421; sh: 1,404; yacc: 905; lex: 172; xml: 160
file content (84 lines) | stat: -rw-r--r-- 2,325 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<html>
<body>
<h1> 16_opamp_dc: dc sweep </h1>

<h2> Scope </h2>
<p>
In this simulation we are going to map a simple opamp circuit's gain
at different voltages (dc sweep).

<h2> The schematics </h2>
<p>
The single-sheet schematic contains the opamp, the voltage sources for
input and two more voltage sources for the power supply (positive and
negative) for the opamp and spice command symbol.
<p>
<center>
<a href="16_opamp_dc.rs"><img src="16_opamp_dc.svg" width=400px></a>
<br>Click the image to get the sch-rnd sheet</center>
<p>

<h2> Opamp model </h2>
<p>
This example uses the lm358 macromodel from sch-rnd's stock spice
library. This model is a subcircuit of the amplifier and simulates a
lot of limiters and parasitics.

<h2> Preparing for simulation </h2>

<h3> Q1 </h3>
<p>
The model uses the standard opamp pinout so the hardwired spice/pinnum
attributes on the terminals will simply work.


<h3> V1 </h3>
<p>
V1 is generating the input dc voltage. We can leave it 0 here, since
the dc sweep command for the analysis will provide the change over time

<h3> V2 and V3</h3>
<p>
Both are 5V DC rails for powering the opamp with the required positive
and negative supplies.

<h3> Raw spice commands </h3>
<p>
It contains the following script:
<pre>
dc V1 -50m 60m 2m
plot v(in) v(out)
</pre>
<p>
which runs a DC sweep analysis from -50mV to +60mV on the input, increasing
voltage by 2 mV steps. At the end the input and output voltages
are plotted.

<h2> Export and run ngspice </h2>
<p>
Running ngspice the usual way on the export yields the following graph:
<p>
<img src="16_opamp_dc.png">

<h2> Using other implementations </h2>
<h3> gnucap </h3>
<p>
<b>Gnucap throws an error: <b>open circuit: internal node 14</b>
<p>
Gnucap uses a different command syntax. Modify the spice command symbol's
spice/command attribute to:
<pre>
print dc v(in) v(out)
dc V1 -50m 60m 2m > plot.txt
</pre>
<p>
After the export, write the single word <b>spice</b> in the first line of the
file (e.g. using a text editor), otherwise gnucap won't know the file is in spice
syntax. Then run <i>gnucap 16_omapm_dc.cir</i> and it will dump a text
table to plot.txt that can be plotted using a suitable utility, e.g. gnuplot.
<p>
The <a href="gnucap/16_opamp_dc.rs">gnucap-modified schematic is also available.</a>

<h3> xyce </h3>
<p>
TODO