Ability of Qucs to decipher and simulate the Netlist code created in SPICE.

in utopian-io •  2 years ago  (edited)

What Will I Learn?

In this tutorial you will learn:

  • The programming code generated by SPICE, using an example of an electronic circuit.

  • Observe the differences of the netlist code of the Qucs and SPICE

  • Use Qucs to simulate a netlist from SPICE.

Requirements

  • Knowledge of amplifiers with BJT transistors.

  • Learn about the list of SPICE and Qucs networks

  • Use of the Qucs for transient analysis, CC and CA.

  • Installation of the Qucs program.

  • Knowledge of the SPICE netlist.

Difficulty

  • Advanced

Tutorial Contents

The following tutorial is a contribution of the @edagmi account for the Utopian community. The SPICE circuit list programming language represents a standard for describing, exchanging and publishing semiconductor device models and circuit data. Nowadays, most manufacturers of semiconductor devices provide their models in SPICE for their discrete components and integrated circuits. Qucs differs from SPICE in the programming format of the list of its circuits, that is, in its netlist. Qucs can not directly simulate the SPICE netlist, it requires that they be converted to the equivalent netlist of the Qucs before the simulation. The purpose of this material is to learn techniques that simulate the SPICE netlist in Qucs.

ps2.png

The SPICE netlist consists of a code that describes the circuit structure, component data and simulation tasks. The format of the code contains:

  1. The title of the circuit.
  2. Names of the circuit nodes: normally identified by integers, letters can be combined with numbers in each node.
  3. Values of the elements of the circuit: they are represented with real numbers in scientific notation, accompanied by suffixes, for example meg = 1e6 (mega), also abbreviations corresponding to the units of the elements, for example V = Volt, A=Amps .
  4. Description of voltage and current sources.
  5. Analysis command
  6. output data and some other instructions.

Note: All circuit nodes must have a DC path to ground. The ground node is always node 0 and is considered global.

The netlist code is represented in an input data file in SPICE, which has the following format:

  1. Title
  2. (*) To start comments
  3. Description of the circuit
  4. Simulation directives
  5. Data output directives
  6. End

To test the data conversion we will use an example of a multistage amplifier circuit with BJT and we will explain the functionality of the Qucs, in order to decipher a Nestlist created in SPICE.

ps3.png

Next, the code for the SPICE input data file for multistage amplifier circuit is described. Typical nodes are defined for a circuit of discrete components. In the netlist, all the nodes are numbered, following the naming convention of SPICE, as shown in the following figure. The power supply, the AC input signal generator and the output load are not included.

Below is the SPICE netlist code:

• Input node 2, output node 9
• Power supply Vcc connected to node 10
•   
Cin 2 3 10 uf
R1 3 10 200k
R2 3 0 30k
RC1 10 5k
q1 4 3 5 qmod
RE1 5 0 3  1.5 k
C2 4 6 10 uf
CE1 5 0 15 uf
R3 10 6 100k
R4 6 0 20k
RC2 10 7 6.5k
q2 7 6 8 qmod
RE2 8 0 2k
CE2 8 0 15 uf
C3 7 9 10 uf
•   
. model qmod npn ( is=2e-16 bf=50 br=1 rb=5 rc=1 re=0
+ cje =0.4 pf vje =0.8 me=0.4 cjc =0.5 pf vjc =0.8 ccs=1pf va=100)
•   
. end

Qucs can not directly simulate the SPICE netlist, but it contains a network list conversion program from SPICE to Qucs called QUCSCONV. This function takes as input a SPICE netlist and generates an equivalent netlist for the Qucs, which can be read and simulated by the Qucs electronic simulator. In the following image you can see in the program the location of the component that allows loading the SPICE netlist.

pspice2.png

The SPICE netlist files can be linked to a schematic symbol of the Qucs netlist, these in turn, can be connected in the circuit diagram, to any other component of the Qucs. The following figure shows the resulting scheme for the multistage circuit with BJT. In this diagram, the external voltage sources and the amplifier load have been added together with the usual Qucs icons for the transient, DC and AC simulation of the circuit.

ps1.png

During the simulation, Qucs treats the SPICE netlist component as a subcircuit and generates the appropriate netlist code of Qucs.

When executing the simulation, you can see the result of the transient analysis between the input voltages (vin) and output (vout) of the amplifier with BJT, you can also see the frequency response of the output signal (vout) in a logarithmic graph , as shown in the following figure.

ps4.png

The graphics show the correct operation of the circuit, this certifies that the conversion of the SPICE netlist was correctly processed by the Qucs.

Below is a part of the netlist created by Qucs after executing the conversion and simulation.

Netlist of the Qucs:

C:C3 _net7 _net9 C="10uF"
C:C5 _net8 _ref C="15uF"
R:RE2 _net8 _ref R="2k "
BJT:Q2 _net6 _net7 _net8 _ref Type="npn " Is="2e-16" Bf="50" Br="1"
Rb="5" Rc="1" Re="0" Cje="0.4pF"Vje="0.8" Mje="0.4" Cjc="0.5pF"
Vjc="0.8" Cjs="1pF" Vaf="100" Nf="1" Nr="1" I k f ="0" Ikr ="0" Var="0"
Ise ="0" Ne="1.5" Isc ="0" Nc="2" Rbm="0" Irb ="0" Mjc="0.33" Xcjc="1"
Vjs ="0.75" Mjs="0" Fc="0.5" Vtf="0" Tf="0" Xtf="0" Itf ="0" Tr="0"
R:RC2 _net10 _net7 R="6.5k "
R:R4 _net6 _ref R="20k "
R:R3 _net10 _net6 R="100k "
C:C4 _net5 _ref C="15uF"
C:C2 _net4 _net6 C="10uF"
R:RE1 _net5 _ref R="1.5k "
BJT:Q1 _net3 _net4 _net5 _ref Type="npn " Is="2e-16" Bf="50" Br="1"
Rb="5" Rc="1" Re="0" Cje="0.4pF"Vje="0.8" Mje="0.4" Cjc="0.5pF"
Vjc="0.8" Cjs="1pF" Vaf="100" Nf="1" Nr="1" I k f ="0" Ikr ="0" Var="0"
Ise ="0" Ne="1.5" Isc ="0" Nc="2" Rbm="0" Irb ="0" Mjc="0.33" Xcjc="1"
Vjs ="0.75" Mjs="0" Fc="0.5" Vtf="0" Tf="0" Xtf="0" Itf ="0" Tr="0"
R:RC1 _net10 _net4 R="12k "
R:R2 _net3 ref R="30k "
R:R1 _net3 _net10 R="200k "
C:C1 _net2 _net3 C="10uF"
. Def :End

With this contribution, another potential of the Qucs in relation to the family of electronic circuit simulators is highlighted.

Thank you for your attention ... I hope this tutorial is very useful for Qucs applications. I hope to see you in a next tutorial.

Curriculum



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Your contribution cannot be approved because it is not as informative as other contributions. See the Utopian Rules. Contributions need to be informative and descriptive in order to help readers and developers understand them.

  • i quite agree on @roj who rejected your last post .
  • one more , it seems there is so much grammar problem in the post ,which inevitably leads to comprehension difficulty when users read it ,

You can contact us on Discord.
[utopian-moderator]