I drew the following circuit in Eeschema and ran the simulator.
The SPICE netlist looks lie this
.title KiCad schematic
.include "OPA657.lib"
XU1 VEE VCC inv ninv out OPA657
R1 inv 0 1kohm
R2 out inv 99kohm
V2 VEE 0 -5V
V1 VCC 0 5V
V3 ninv 0 DC 0 AC 1
.option noopac
.ac dec 10 1Hz 100MegHz
.end
I extracted the netlist and ran in ngspice33 windows version. I get the proper output. I have placed a .spiceinit in my USERPROFILE. So the op amp model does not cause a problem there. However this should also work in Kicad simulator, because of the .spiceinit file being present. But when I try this in simulator, I get the following error.
Circuit: KiCad schematic
Original line no.: 0, new internal line no.: 224:
Undefined number [if]
Original line no.: 0, new internal line no.: 224:
Expression err: if(choice==1,1,0)
Original line no.: 0, new internal line no.: 224:
Formula() error.
choice=1;ibias=2e-12;ioffset=1e-12;ta=25;ibiasdrift=0;ioffsetdrift=0;ibiasp=2.5e-12;ibiasm=1.5e-12;choice1= if(choice==1,1,0);choice2= if(choice==2,1,0);ib= choice1*ibias+choice2*(ibiasp+ibiasm)/2 ;io= choice1*ioffset+choice2*abs(ibiasp-ibiasm);
Original line no.: 0, new internal line no.: 354:
Undefined number [temp]
Original line no.: 0, new internal line no.: 354:
Cannot compute substitute
Original line no.: 0, new internal line no.: 358:
Undefined number [temp]
Original line no.: 0, new internal line no.: 358:
Cannot compute substitute
Original line no.: 0, new internal line no.: 231:
Undefined number [if]
Original line no.: 0, new internal line no.: 231:
Expression err: if(choice==1,1,0)
Original line no.: 0, new internal line no.: 231:
Formula() error.
choice=1;gm=1.51e-01;sbf=1;itailmax_x1=3;itailmax_y1=10e-3;itailmax_x2=5;itailmax_y2=10e-3;itailmin_x1=3;itailmin_y1=10e-3;itailmin_x2=5;itailmin_y2=10e-3;choice1= if(choice==1,1,0);choice2= if(choice==2,1,0);choice3= if(choice==3,1,0);choice11= if(choice==11,1,0);itailmax_slope=(itailmax_y2-itailmax_y1)/(itailmax_x2-itailmax_x1);itailmin_slope=(itailmin_y2-itailmin_y1)/(itailmin_x2-itailmin_x1);itailmax_intcp= itailmax_y1-itailmax_slope*itailmax_x1 ;itailmin_intcp= itailmin_y1-itailmin_slope*itailmin_x1 ;
Original line no.: 0, new internal line no.: 326:
Undefined number [itailmax_slope]
Original line no.: 0, new internal line no.: 326:
Cannot compute substitute
Original line no.: 0, new internal line no.: 330:
Undefined number [itailmin_slope]
Original line no.: 0, new internal line no.: 330:
Cannot compute substitute
Original line no.: 0, new internal line no.: 334:
Undefined number [choice1]
Original line no.: 0, new internal line no.: 334:
Cannot compute substitute
Original line no.: 0, new internal line no.: 537:
Undefined number [temp]
Original line no.: 0, new internal line no.: 537:
Cannot compute substitute
Copies=346 Evals=912 Placeholders=102 Symbols=204 Errors=18
Numparam expansion errors: Problem with input file.
Error: ngspice.dll cannot recover and awaits to be detached
Note: can't find init file.
******
** ngspice-32 shared library
** Creation Date: Fri Jul 10 12:37:34 UTC 2020
******
Error: there aren't any circuits loaded.
Can somebody please help?