Simulate with spice file - library file not found

Hi!

In the process of learning to simulate circuits I’m stuck.

I’m trying to simulate a simple circuit with a diode (1N4148) that I have in a spice library file. I select DIODE from the kicad library pspice. Then using “edit spice model” I select the library file and select the diode model. Everything seems ok. But…
When starting the simulation I get a warning: Could not find library file followed by the path to the file I selected in the spice model editor. (It is the exact same path as in the editor.)The simulation fails.

Using the latest daily build on Ubuntu 16.04

Ideas on how to solve this appreciated!

The error when starting simulation is:
Circuit: KiCad schematic
Original line no.: 6, new internal line no.: 9:
Undefined number [ONSEMI]
Original line no.: 6, new internal line no.: 9:
Cannot compute substitute
Copies=90 Evals=90 Placeholders=2 Symbols=1 Errors=2
Numparam expansion errors: Problem with input file.
Error: ngspice.dll cannot recover and awaits to be detached
Error: there aren’t any circuits loaded.

I know very little about how KiCad works but I noticed that the .sch file has all the components including the diode listed:
$Comp
L pspice:DIODE D1
U 1 1 5A3EB375
P 2800 2050
F 0 “D1” H 2800 2315 50 0000 C CNN
F 1 “DIODE” H 2800 2224 50 0000 C CNN
F 2 “” H 2800 2050 50 0001 C CNN
F 3 “” H 2800 2050 50 0001 C CNN
F 4 “D” H 2800 2050 50 0001 C CNN “Spice_Primitive”
F 5 “1N4148” H 2800 2050 50 0001 C CNN “Spice_Model”
F 6 “Y” H 2800 2050 50 0001 C CNN “Spice_Netlist_Enabled”
F 7 “/home/andersm/KiCad/library/spice/standard.dio” H 2800 2050 50 0001 C CNN “Spice_Lib_File”
1 2800 2050
1 0 0 -1
$EndComp

But in the the sch.v4 file all other components are listed except the diode.

That seems strange.

Think it is solved.
It seems like i had two different problems:

  • placing the spice-lib file outside the project folder generated the file not found error.
  • there was an syntax error in the Diode-model file.

From the source I gather that it checks for files in the project folder and in those given by env. variables.

Now I can run the simulation if I place the spice model file in the project folder.

:slight_smile:

1 Like