Author Topic: KiCad ngspice and subcircuit parameters  (Read 1545 times)

0 Members and 1 Guest are viewing this topic.

Offline Bassman59Topic starter

  • Super Contributor
  • ***
  • Posts: 2501
  • Country: us
  • Yes, I do this for a living
KiCad ngspice and subcircuit parameters
« on: July 22, 2022, 10:10:11 pm »
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: [Select]
* 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

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?
« Last Edit: July 22, 2022, 10:11:57 pm by Bassman59 »
 
The following users thanked this post: tchiwam

Offline hvogt

  • Newbie
  • Posts: 9
  • Country: de
Re: KiCad ngspice and subcircuit parameters
« Reply #1 on: September 09, 2022, 01:57:07 pm »
Unfortunately you cannot simulate these libraries. This is due to the line
Code: [Select]
A1  Ai Bi 0 0 0  Yi 0 0  AND  tripdt={tripdt1}  td={td1} 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.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14447
  • Country: fr
Re: KiCad ngspice and subcircuit parameters
« Reply #2 on: September 11, 2022, 01:01:11 am »
Unfortunately you cannot simulate these libraries. This is due to the line
Code: [Select]
A1  Ai Bi 0 0 0  Yi 0 0  AND  tripdt={tripdt1}  td={td1} 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.

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


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf