How to use Xspice in KiCad

Hello everyone,
Is there anyone who can give me advice on how to use Xspice in Kicad? I can’t figure out what the code model of Xspice is, and especially how to use it.

Specifically, I tried using an ESOURCE to create a simple Laplace domain filter, so I should create an s_xfer model as written in the ngspice documentation (Laplace section). I select Xspice code model, type in the code, press OK, and everything gets erased.

 

 

I should note that I’ve never used Xspice before, and I found it a bit tricky to figure out how to use it by searching online, and I can’t find any examples in Kicad.
Yes, I know that Kicad is for PCB, indeed this is my first step to Xspice in order to simulate digital circuit in the future. I thought it was easy, but my ignorance overwhelmed me.

Forgive the simplicity of the question, thanks in advance, and best regards.

Ok, it was just a matter of reading the ngspice documentation more carefully. It seems that ESOURCE is really unnecessary and makes everything more difficult (now I understand why it’s only used as a buffer in the ngspice documentation).

Anyway, regarding s_xfer at least, all that was needed was to use a simple signal generator like VDC between in and out, strip it of any spice model, and insert a new one with filter as a model (on the schematic).

It all works, sorry for the time wasted, I lost patience messing around with the evil ESOURCE and posted the question too quickly.

 
 

By the way, ESOURCE seems to have a grudge against me, because even when used as a buffer, it causes issues in the simulation:

But maybe is only something that I am missing…

E source nodes 3 4 are the input port, 1 and 2 are the output (as with the E source in standard ngspice)…

3 Likes

I knew I wouldn’t come out victorious from the battle. A quick and simple fix, and ESOURCE works as a buffer (still can’t get it to work as a filter though).

Thank you very much @holger.

2 Likes