Electronics > PCB/EDA/CAD

KiCad ngspice and subcircuit parameters

(1/1)

Bassman59:
I'm migrating from LTSpice to KiCad's ngspice support. There are a few libraries for LTSpice for simulating digital functions such as 74HCT_v.lib (log-in required).

The models in that library have three parameters for each subcircuit, such as:


--- Code: ---* 2-input NAND gate
* tpd 25n/9n/7n   12n
* tr 19n/7n/6n     7n
.SUBCKT 74HCT00  A B Y  VCC VGND  vcc1={vcc} speed1={speed} tripdt1={tripdt}
.param td1=1e-9*(12-3-3)*4.0/({vcc1}-0.5)*{speed1}
*
XIN1  A Ai  VCC VGND  74HCT_IN_1  vcc2={vcc1}  speed2={speed1}  tripdt2={tripdt1}
XIN2  B Bi  VCC VGND  74HCT_IN_1  vcc2={vcc1}  speed2={speed1}  tripdt2={tripdt1}
*  tripdt=1n
A1  Ai Bi 0 0 0  Yi 0 0  AND  tripdt={tripdt1}  td={td1}
*
XOUT  Yi Y  VCC VGND  74HCT_OUT_1X  vcc2={vcc1} speed2={speed1}  tripdt2={tripdt1}
.ends

--- End code ---

In LTSpice you set the actuals for each of these parameters by right-clicking on the symbol and adding: VCC=3.3 SPEED=1.0 TRIPDT=1e-9 to the SpiceLine field.

How do you pass these parameters in from a KiCad (6.0.6) schematic? Adding .param lines to the schematic doesn't work.  Adding them as a custom simulation setting after launching the simulation from the KiCad schematic doesn't work.

Any ideas?

hvogt:
Unfortunately you cannot simulate these libraries. This is due to the line

--- Code: ---A1  Ai Bi 0 0 0  Yi 0 0  AND  tripdt={tripdt1}  td={td1}
--- End code ---
which calls a partial, unpublished model only available in LTSPICE.

The next release ngspice-38 will contain the capability to efficiently simulate models for digiatal (e.g. 74xx series) devices.

SiliconWizard:

--- Quote from: hvogt on September 09, 2022, 01:57:07 pm ---Unfortunately you cannot simulate these libraries. This is due to the line

--- Code: ---A1  Ai Bi 0 0 0  Yi 0 0  AND  tripdt={tripdt1}  td={td1}
--- End code ---
which calls a partial, unpublished model only available in LTSPICE.

The next release ngspice-38 will contain the capability to efficiently simulate models for digiatal (e.g. 74xx series) devices.

--- End quote ---

Sounds cool. That's also exactly what I was looking for not long ago. I managed something with MicroCap, but not quite perfect.

Navigation

[0] Message Index

There was an error while thanking
Thanking...
Go to full version