Index: trunk/doc/tutorial/simulation/raw/10_bjt_amp_tr.html =================================================================== --- trunk/doc/tutorial/simulation/raw/10_bjt_amp_tr.html (nonexistent) +++ trunk/doc/tutorial/simulation/raw/10_bjt_amp_tr.html (revision 7851) @@ -0,0 +1,124 @@ + + +

Model from the library

+ +

Scope

+

+In this simulation we are going to look at a single-transistor amplifier +in time domain to verify how it amplifies a sine wave. + +

The schematics

+

+The single-sheet schematics contains the amplifier, the voltage sources and +spice command symbol. +

+

+ +
Click the image to get the sch-rnd sheet
+

+ +

How to specify the model

+

+In the previous examples all componets used were ideal: simple +resistors, capacitors and sources, without any special characteristics +or side effects. More complex components, like transistors typically +have a large set of parameters that differ per device type. Spice addresses +thios by using models. +

+A model in spice is really two things: +

+

+The former, the code, is typically provided as part of the simulator software, +at least for the most common, basic component types. The latter, model +parameters, is specified by the user (normally acquired from the device +vendor or constructed from the datasheet or measurements). +

+In sch-rnd these models are kept in the spice library, which is very much like +the symbol or devmap library: a directory tree that holds spice models, +one model per file, models identified by file name. Spice export files +are self-contained and do not rely on external model files. This is achieved +by sch-rnd copying the content of these spice model files from the library +into the output file. +

+Furthermore there's a sheet-local library, just like with devmap (and +optionally with symbols), so any spice model used by the sheet is also saved +in the sheet so the sheet is self-contained (and portable) too. + +

Preparing for simulation

+ +

Q1

+

+This is the usual npn symbol from the stock symbol library shipped with +sch-rnd, with devmap set up to bc817_sot23 so the sheet can be used in +a PCB workflow as well. +

+The spice-specific aspects are the model and the spice pinout. The model +is specified using the spice/model attribute, with value bc817. +There is a file in the spice model library shipped with sch-rnd called +bc817.prm. The pinout is set by the spice/pinnum terminal attributes. +For the BJT model of spice the pinpout is always the same, so the stock +library symbol has this attribute hardwired in terminals with a low priority +(so that it can be overridden by other mechanisms). +

+The devmap file could contain the symbol's spice/model and portmap to set +spice/pinnum for each terminal. The former is a bad idea because there may be +different spice models for different complexity of simulation. Simple models, +like bc817.prm, concentrate only on the core of the functionality, while +more complex models implemented as "subcircuits" (subckt in spice slang) may +add parasitic effects, such as pin inductances and pin/package +related stray capacitances. Such complex models run slower, but may be +more accurate in some cases, while the simpler model would cover most of the +normal use cases. The user needs to decide which model to use for the given +circuit or even the given simulation, this should not be coming from the devmap. +

+Specifying the spice pinout from the devmap is unnecessary if both the model +and the symbol use the standard spice BJT pinout that matches the model code +in spice. However, for subcircuit models the pinout may differ, and sch-rnd +offers mechanisms + + +

V1

+

+V1 is generating the input sine wave on the in network. +The syntax for this is (see in V1's spice/params): +

+SINE(0 0.01 1k)
+
+

+The first parameter is the (dc) voltage offset, the second is the +AC amplitude voltage and the third is the frequency in Hz. + +

V2

+

+V2 is an 5V DC power supply for Vcc: +

+dc 5
+
+ + +

Raw spice commands

+

+It contains the following script: +

+tran 1u 10m
+plot v(out) v(in)
+
+

+which runs the simulation for 10 mS sampling it once a microsecond. At +the end we are plotting the input and output voltages. + +

Export and run ngspice

+

+Running ngspice the usual way on the export yields the following graph: +

+ + +

Using other implementations

+

gnucap

+ +

xyce

+

+TODO Index: trunk/doc/tutorial/simulation/raw/10_bjt_amp_tr.png =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Index: trunk/doc/tutorial/simulation/raw/10_bjt_amp_tr.png =================================================================== --- trunk/doc/tutorial/simulation/raw/10_bjt_amp_tr.png (nonexistent) +++ trunk/doc/tutorial/simulation/raw/10_bjt_amp_tr.png (revision 7851) Property changes on: trunk/doc/tutorial/simulation/raw/10_bjt_amp_tr.png ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: trunk/doc/tutorial/simulation/raw/10_bjt_amp_tr.svg =================================================================== --- trunk/doc/tutorial/simulation/raw/10_bjt_amp_tr.svg (nonexistent) +++ trunk/doc/tutorial/simulation/raw/10_bjt_amp_tr.svg (revision 7851) @@ -0,0 +1,1058 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +