The Ngspice user’s manual (version 42)) includes discussions of quite a number of models, and an example of how to use each in command-line ngspice.
But I’m not clear on how to use them in Kicad. So, for example, we have the potentiometer model (section 12.2.34):
Apot r0 w r1 potmod
.model potmod potentiometer(position=0.45 r=1k log=FALSE log_multiplier=1)
OK, how does that translate into things I can do in Kicad?
-
I’m guessing that I could stick the “.model…” statement into a text on the Kicad schematic? Or should I put it somewhere in the component’s “Simulation Model” dialog? Or does it belong in a file?
-
I don’t know at all what to do with the “Apot r0…” line. I guess “Apot” should be replaced by the Reference Id (RV1 say) on the schematic? And potmod associates RV1 with the .model statement. The other three items are to do with the three pins, but I’m not sure what to do with them. But the biggest problem is, I don’t know where to put this statement. I tried inserting it in RV1’s Model Editor > Code tab text box. But on running the simulation it just got deleted.
-
I notice that this model is from a chapter of the manual relating to XSPICE. From Kicad, does XSPICE have to be enabled or invoked somehow?
-
Even when the above items are resolved, where do we then fill in pot resistance and wiper position?
-
I was kind of expecting that if a Potentiometer model was supplied with ngspice, that it would be selectable in the Simulation Model Editor window, and there would be slots to fill in resistance and wiper position. The manual’s discussion includes a lengthy table of other parameters in the model, so I thought they might also show up in the UI as a table.
I’d appreciate if someone would fill in a few clues!
EDIT: I was intending for this topic to be about the general principles of using a model from the ngspice manual, and happen to have used potentiometer as an example. There is a separate thread about potentiometer models that has seen some useful progress, here:
Where is the built-in potentiometer model?