You are not logged in.

#1 2015-03-13 00:04:18

felipeduque
Member
Registered: 2015-03-02
Posts: 16

Netlist converter: Qucs to spice

Intended for electrical engineers students/professionals/enthusiasts:

I use both Qucs and ngspice a lot. Qucs' GUI is very easy to use and ngspice is extremely powerful. However, ngspice doesn't have a GUI by default, so I thought of a way to combine Qucs interface with ngspice functionality. I think gEDA schem exports spice netlist; however, I personally don't like its feel - I use it only for manufacturing pcb.

The script

qucs2ng input output

converts Qucs netlist (located in ~/.qucs) to a spice netlist by simply using a bunch of sed instances.

Example:

The following Qucs circuit generates the ~/.qucs/netlist.txt below:

2v7tnyg.jpg

# Qucs 0.0.18  /home/felipe/test/test.sch

R:R2 _net1 vo R="10k" Temp="26.85" Tc1="0.0" Tc2="0.0" Tnom="26.85"
R:R1 _net0 vo R="20k" Temp="26.85" Tc1="0.0" Tc2="0.0" Tnom="26.85"
Vac:V1 _net1 _net0 U="3" f="100k" Phase="0" Theta="0"

After running

qucs2ng ~/.qucs/netlist.txt test.cir

we have the following proper spice netlist:

# Qucs 0.0.18  /home/felipe/test/test.sch

.include /home/felipe/.spicemodels
R2 1 vo 10k
R1 99 vo 20k
V1 1 99 SIN(0 3 100k)

.end

How to use

  1. Design your circuit in Qucs.

  2. Make sure all your elements values are in accordance with spice syntax. For example: '10 Ohm' should be just '10'; '5 MHz' should be '5Meg'.

  3. Run a Qucs simulation by hitting F2.

  4. Run the script:

    qucs2ng ~/.qucs/netlist.txt myspice.cir

    .

  5. If you have written a .control script in myspice.cir and want to keep it after changing the schematics, run

    qucs2ng -a ~/.qucs/netlist.txt myspice.cir

    .

Notes:

  1. The current script can handle BJT (npn, pnp), op amp, DC/AC/pulse source, diode, capacitor, resistor and inductor.

  2. Change your spice models file in line 136.

Download here:

https://sites.google.com/site/duquebelf … para-spice

Last edited by felipeduque (2015-03-13 00:09:57)

Offline

#2 2015-03-13 06:59:31

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,334

Re: Netlist converter: Qucs to spice

Pretty good.  Are your sources capable of sweeps? Or are these AC and DC operating point only at this point?   Obviously one can edit the script, but.....


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#3 2015-03-14 13:21:15

felipeduque
Member
Registered: 2015-03-02
Posts: 16

Re: Netlist converter: Qucs to spice

Hi,

the script doesn't handle .control blocks (where sweeps would take place). It simply builds the circuit in a spice format. You can do whatever you want with the sources in a .control block smile

Offline

Board footer

Powered by FluxBB