← Back to team overview

kicad-developers team mailing list archive

Re: KiCad And Quces

 

Hello,

Qucs maintainer here.

On Tue, Jan 16, 2018 at 9:48 AM, Maciej Sumiński <maciej.suminski@xxxxxxx>
wrote:

> On 01/16/2018 09:38 AM, Christian Gagneraud wrote:
> > CC Qucs's maintainer, please feel free to extend.
> >
> > On 16 January 2018 at 21:14, Babar Malik <babarnamal@xxxxxxxxx> wrote:
> >> I am much more interested to integrate Kicad and Qucs,  and the first
> step
> >> towards this would be to study the source code of Kicad from scratch.
> Can
> >> you please help me regarding to this ? Please guide me from where I
> should
> >> take first step?
> >> your help will be highly appreciated.
> >
> > Hi Babar, (Please keep mailing list(s) posted)
> >
> > Integrating KiCAD and Qucs can be done at several levels.
> > Both projects are written in C++, but one uses WxWidgets, while the
> > other is using Qt (3, 4, but not 5).
> > So maybe a possible approach would be to try to integrate qucsator
> > (the core simulation engine) with KiCAD's GUI.
> > That is: do not try to merge/join them at C++ level, but at process
> level.
> > Please also note that Qucs has some friendly forks that attempts to
> > consolidate alternative simulation engines (ngspice, xyce, gnucap,
> > spice opus, ...)
>
> I think you are right about the approach. It would be even more
> convenient if one could interface qucs(ator) via a shared library, as we
> currently do with ngspice. Obviously, calling qucs from command line is
> likely to work as well, but probably would require some text processing
> to make simulation results available to KiCad.
>
> Interesting parts of KiCad source code to study:
> https://github.com/KiCad/kicad-source-mirror/tree/master/eeschema/sim
>
>
Qucs (schematic) requires Qt. We are still stuck with Qt4 + Qt3Support.
There is one experimental branch that build with Qt5, but most of the mouse
interactions are not yet ported.
Qucsator (simulator) does not depend on Qt.

Qucsator might be easier to use via a shared library. The libqucsator is
around for some time.
It might lacks a proper API, but in principle all the relevant classes can
be reached by with a interface class from KiCad.
The tricky think is that one must learn how to provide the netlist to the
simulator. The netlist grammar is unlikely to change anytime soon.
By default qucsator reads from stdin and writes to stdout. So, depending on
what you want to achieve, you might use the executable directly.
Be reminded that except for the s-parameter simulation (which is not
available on the other engines) the other simulation modes in qucsator can
be rather slow and not as robust as the other engines.

Qucs (schematic) code just now stared to be turned into a shared library
libqucsschematic (see develop branch). It is still messy and in a flat
namespace.
It knows how to convert the schematic into netlist, but this function is
not yet neatly exposed.
The schematic file format is proprietary and likely to change soon. It
looks like XML but it is not a valid XML.

I don't know in detail how KiCad turns its schematic into a spice netlist.
In any case, I think it is feasible to write a KiCad interface class to
libqucsator, find a way to produce qucsator netlists and consume result
data.

Regards,
Guilherme

References