Potentiometer model in Big Muff circuit

Hi,
I am using Kicad 8.0.5 on Linux with ngspice 42. I was trying to simulate the Big Muff equalizer with the potentiometer model provided by Kicad/Eeschema.
Some results of the AC simulation do not make sense for an entirely passive filter: the gain exceeds 0dB.
Instead, the results seem reasonable when using two resistors instead of the potentiometer.

The transient results are fine.

Any idea of what exactly the problem is ? I really appreciate Kicad’s potentiometer for the possibility of fine-tuning the wiper position in simulation GUI.


Bug.cir (356 Bytes)

The intrinsic potentiometer model seems to be buggy when simulating small signal ac.
It will need some time to figure out how to fix the error.

In the meantime you may use the following potentiometer model:

* potentiometer model
* wiper position limited between 0.001 and 0.999
* author Holger Vogt, Oct. 3rd 2024

.subckt pot1 r0 wiper r1  r = {r} pos = {pos}

rupper r1 wiper r = {(1 - ((pos >=1) ? 0.999 : ((pos <= 0) ? 0.001 : pos))) * r}
rlower wiper r0 r = {((pos >=1) ? 0.999 : ((pos <= 0) ? 0.001 : pos)) * r}

.ends

in a circuit (standard ngspice) like

.title KiCad schematic
.save all
.control
version -s
.endc
.include pot_mod1.lib

V1 /Vin 0 DC 0 SIN( 0 1 1k 0 0 0 ) AC 1  
xpot 0 /Vout1 /Vin pot1 r=100k pos=0.45

.control
ac dec 10 10 100k
plot mag("/vout1") mag("/vin")
.endc

.end

So put the model into a file (e.g. named pot_mod1.lib) and attach it to the potentiometer symbol in the usual way.

Thanks @holger for the reply. Do you confirm that there is no way to tune the wiper position in the simulation GUI using a model like yours, in a separate file ?