XSpice Code Model Example

Is there any example that uses Built-in SPICE model: XSpice Code Model ?
Or any good documentation describing how to properly setup Sim.* fields, etc.

I cannot figure out how to create a symbol with pins and bind it with some A* model.

I can only found all of them using as an external subcircuit.

1 Like

That’s exactly how you should use it.

The subcircuit allows you to keep The A-line and associated .model line together, copes with the code model syntax and provides the proper pin assignment.

But this then always requires an external library. What I did for Eagle is that base definitions already came with a library for all of the available Xspice models.

Still interested to learn what is then the purpose of Built-in Xspice model, if you maybe know?

Probably development has started, but is not finished.

There is some dicscussion/development going on:

but the basic issues are not yet touched (symbols, instance lines, models).

2 Likes

Code models require the instance line (the Axx … line) and a associated .model line. How to add that without an (external) library?

This external library has to be done once, then saved in a dedicated library to become an internal library. A role model for this is available in the Simulation_SPICE library: There is Simulation_SPICE.kicad_sym with all its symbols, but there is also a Simulation_SPICE.sp which contains models for the generic opamp symbol available in Simulation_SPICE.kicad_sym.

1 Like

Thank you for replies. Have done it with subcircuits, have issues not finding lcouple and core models in latest kicad v8.

Anyway, can kicad v8 use external ngspice engine, as I also need to use my modified xspice core model to support mode=3 ?

Eeschema–>File–>Export–>Netlist–>Spice–>Run External Simulator Command–>Export Netlist

Path to ngspice has to be set before ‘Export netlist’.

I meant for integrated plot, … I am using export to run ngspice manually already due to lack of the models.

This topic was automatically closed after 90 days. New replies are no longer allowed.