User Tools

Site Tools


geda:csygas

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
geda:csygas [2014/04/28 08:41]
vzh Punctuation
geda:csygas [2014/07/28 08:05]
vzh Rewritten the section on nullor
Line 237: Line 237:
  
 ==== Nullor ==== ==== Nullor ====
-A [[wp>​nullor]] is a theoretical representation of an ideal op amp, having +A [[wp>​nullor]] is an ideal element composed of a //​nullator//​ and 
-infinite current, voltage, transconductance and transimpedance gain and +a //​norator//​. It has zero input resistance and infinite output 
-transmission parameters equal to zero. Actually under the hood +resistance, as well as infinite current, voltage, 
-**gnet-spice-sdb** uses the voltage controlled voltage source for it+transconductance and transimpedance gain and transmission 
-Therefore you have to set the voltage gain of the source.+parameters equal to zero. 
 +It is a universal active element, that is, ideally it can be 
 +used for implementation of any linear and nonlinear functions,​ 
 +if a suitable set of linear and nonlinear passive elements 
 +is available. ​ In particular ​the nullor, resistors and 
 +capacitors form a complete set for linear circuits. 
 + 
 +Depending on connections of the nullor terminals, the nullor 
 +can be used to analyze and synthesize real circuits, which 
 +is achieved by replacing of real opamps, current conveyors,​ 
 +amplifying triodes (vacuum tubes and transistors) with the nullor 
 +and a small set of passives reflecting their parameters. 
 +Nullor based ideal transistors have been successfully used 
 +in ac modeling for synthesis of various composite transistor 
 +configurations and composite transistors. 
 +Nullor based operational amplifier circuits have been used 
 +for filter implementations. 
 +There are also methods using the nullor for verification,​ 
 +automatic fault diagnosis, automatic biasing analog 
 +circuits and so on. 
 + 
 +=== Nullor in SPICE === 
 +In the general-purpose circuit simulators which have no nullor 
 +model, the nullor element can be modeled using a [[#​dependent 
 +sources|dependent source]] with a large gain, for example 
 +10<​sup>​9</​sup>​. ​ The controlled source can be of type VCVS, VCCS, 
 +CCVS, or CCCS; the choice depends on the sensitivity issue and 
 +what output you want to have.  An infinite-gain controlled source 
 +of any of the four types of dependent sources is exactly 
 +equivalent to a nullor. 
 + 
 +A three terminal nullor allows ac modeling of //ideal 
 +transistors//​ and other //​triodes//​. ​ An //ideal operational 
 +amplifier// is realized by a voltage controlled voltage source 
 +having an infinite (actually, large enough) gain. 
 +//Current conveyor// (CCII) is equivalent to the already mentioned 
 +three terminal nullor. 
 + 
 +Usually the nullor is used for simulation in AC small-signal 
 +analysis (in the frequency domain)When a negative feedback 
 +is used, the nullor can be used as an ideal opamp even in 
 +transient simulation (see the 
 +[[#example schematic - summing amplifier|example]] below). 
 + 
 +=== Nullor in gEDA === 
 +**ngspice** and **gnucap** ​have no special models for the nullor. 
 +Therefore ​to represent ​the nullor, ​the **spice-sdb** backend 
 +uses VCVS with a high gain.
  
 To incorporate a nullor into your SPICE netlist, do the following: To incorporate a nullor into your SPICE netlist, do the following:
Line 247: Line 294:
   - Double click on the block and add/edit the following attributes:   - Double click on the block and add/edit the following attributes:
     * **''​refdes''​**:​ N?     * **''​refdes''​**:​ N?
-    * **''​value''​**:​ the voltage gain of the nullor.+    * **''​value''​**:​ the voltage gain of the nullor, typically 1000Meg (not needed since geda-gaf 1.9.2) 
 + 
 +== Example: nullor == 
 +  * **''​refdes=N1''​** 
 +  * **''​value=1000Meg''​** 
 + 
 +SPICE lines generated:​ 
 +  E_N1 1 2 3 4 1000Meg 
 +  IMeasure_N1 3 4 dc 0 
 +  IOut_N1 1 2 dc 0 
 + 
 +This code contains: 
 +  * The controlled voltage source E_N1. 
 +  * The voltage measuring current source IMeasure_N1. 
 +  * The output current source IOut_N1. 
 + 
 +So the nullor in **gnet-spice-sdb** is just a voltage controlled 
 +voltage source with two zero current sources connected to its 
 +input and output in order to prevent fails of the simulator 
 +program when the nullor input or output has no connections to 
 +anything. 
 + 
 +Please note: after some experiments I (vzh) have found that the 
 +presence or absence of those current sources doesn'​t affect 
 +simulation and doesn'​t solve the mentioned issue in modern 
 +versions of **ngspice**. **ngspice** still outputs an error in the 
 +case where either the nullor input or its output is floating, that 
 +is, not somehow connected to the ground. To avoid such an error 
 +you can connect one of those nullor terminals to the ground using 
 +a high ohm resistor. 
 +**gnucap** always works well; however, in such a case the nodes 
 +not connected to the ground will have an arbitrary varying 
 +large voltage, so you have to measure not the potential on 
 +the separate nullor terminals but the voltage just across 
 +the input or the output. 
 + 
 +If you want to make your own nullor component (with 
 +another type of sensitivity),​ you can use the controlled 
 +source symbol you want (one of vcvs-1.sym, vccs-1.sym,​ 
 +cccs-1.sym, ccvs-1.sym) and just change its **''​value''​** 
 +attribute to a large value, say 1000Meg. 
 + 
 +=== Example schematic - summing amplifier === 
 +In this example, the nullor is used as a model of an ideal opamp. 
 + 
 +{{ :​geda:​summing.png }} 
 + 
 +Schematic file for **gschem**: {{ :​geda:​summing.sch }} 
 + 
 +Command file for simulation in **gnucap** and/or **ngspice**:​ 
 +<file spice summing.cmd>​ 
 +.print tran v(nodes) 
 +.tran .0001 1 0 >​summing.dat 
 +</​file>​ 
 + 
 +Note the ''>​summing.dat''​ thing in the command file. It is 
 +ignored by **ngspice** while **gnucap** uses it to output data to 
 +the specified file in the batch mode (using shell redirection would output 
 +**gnucap** prompt together with data, which is not what we want). 
 + 
 +Command line to make netlist (note the ''​sort_mode''​ flag, we need 
 +it to make **gnucap** work right): 
 +  gnetlist -g spice-sdb -O sort_mode -o summing.net summing.sch 
 + 
 +Command line to simulate using **ngspice**:​ 
 +  ngspice -b -r summing.dat summing.net 
 + 
 +Command line to simulate using **gnucap**:​ 
 +  gnucap -b summing.net 
 + 
 +Command line to see the output waveforms:​ 
 +  gwave summing.dat 
  
 ==== SPICE components ==== ==== SPICE components ====
Line 497: Line 616:
 |**SPICE-vcvs**| ​ **E?​** ​ |  **(5)** ​ |  -  |  -  |  -  |  -  |  Voltage controlled voltage source ​ | |**SPICE-vcvs**| ​ **E?​** ​ |  **(5)** ​ |  -  |  -  |  -  |  -  |  Voltage controlled voltage source ​ |
 |**SPICE-vccs**| ​ **G?​** ​ |  **(5)** ​ |  -  |  -  |  -  |  -  |  Voltage controlled current source ​ | |**SPICE-vccs**| ​ **G?​** ​ |  **(5)** ​ |  -  |  -  |  -  |  -  |  Voltage controlled current source ​ |
-|**SPICE-nullor**| ​ **E?**  |  **(5)**  |  -  |  -  |  -  |  -  |    |+|**SPICE-nullor**| ​ **N?**  |  **(15)**  |  -  |  -  |  -  |  -  |    |
 |**DIODE**| ​ **D?​** ​ |  Part number ​ |  One line SPICE model  |  Model file name  |  **Name of model** ​ |  -  |  (12)  | |**DIODE**| ​ **D?​** ​ |  Part number ​ |  One line SPICE model  |  Model file name  |  **Name of model** ​ |  -  |  (12)  |
 |**PMOS_TRANSISTOR**| ​ **M?​** ​ |  Part number ​ |  One line SPICE model  |  Model file name  |  **Name of model** ​ |  -  |  (12)  | |**PMOS_TRANSISTOR**| ​ **M?​** ​ |  Part number ​ |  One line SPICE model  |  Model file name  |  **Name of model** ​ |  -  |  (12)  |
Line 527: Line 646:
 (12) For modeling, one must include either model or file\\ (12) For modeling, one must include either model or file\\
 (13) Places .INCLUDE directive in SPICE netlist\\ (13) Places .INCLUDE directive in SPICE netlist\\
-(14) Places .OPTIONS directive in SPICE netlist+(14) Places .OPTIONS directive in SPICE netlist\\ 
 +(15) A large enough gain value, e.g. 1000Meg; it is not required in the recent geda-gaf versions (since 1.9.2)
  
 "​Native to the netlister"​ means that there is a corresponding blob of scheme code which knows exactly how to handle these components and is guaranteed (almost) to generate correct spice code. Symbols having "​device"​ attributes not on the above list are handled using the scheme function "​spice-sdb:​write-default-component",​ which looks at the refdes of the component to make a decision about how to treat the component. In general, this function will "do the right thing" when generating spice code, but it is not guaranteed. In particular, this function cannot distinguish between N and P type transistors,​ and will generate an <​unknown>​ type for the .MODEL string in the netlist. This will probably cause your SPICE simulator to barf. Therefore, it is best to make sure that all devices used have the proper "​device"​ attribute. "​Native to the netlister"​ means that there is a corresponding blob of scheme code which knows exactly how to handle these components and is guaranteed (almost) to generate correct spice code. Symbols having "​device"​ attributes not on the above list are handled using the scheme function "​spice-sdb:​write-default-component",​ which looks at the refdes of the component to make a decision about how to treat the component. In general, this function will "do the right thing" when generating spice code, but it is not guaranteed. In particular, this function cannot distinguish between N and P type transistors,​ and will generate an <​unknown>​ type for the .MODEL string in the netlist. This will probably cause your SPICE simulator to barf. Therefore, it is best to make sure that all devices used have the proper "​device"​ attribute.
Line 548: Line 668:
 |NFET_TRANSISTOR ​ |  NJF  | | |NFET_TRANSISTOR ​ |  NJF  | |
 |MESFET_TRANSISTOR ​ |  -  | | |MESFET_TRANSISTOR ​ |  -  | |
 +
geda/csygas.txt · Last modified: 2014/07/28 08:05 by vzh