Help needed with Ngspice d_process usage

Hi,
I have been using Kicad for board design for quite a few years and now I am interested in full system level simulations using the capabilities of ngspice. I have made really good progress using some of the Xspice code models. I have, however not been very succesful using the d_process code model. I have followed the ISOTEL example of the motor control but when I call the motorforce_ngut.exe file, I get the message:
Message: ERROR: d_process failed to spawn.
Error: ngspice.dll cannot recover and awaits to be detached

My subcircuit looks like this:


.subckt DPROCESS_BLOCK d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11 clk reset w0 w1 w2 w3 w4 w5 w6 w7
Acontrol [d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d10 d11] clk reset [w0 w1 w2 w3 w4 w5 w6 w7] firmware
.model firmware d_process (process_file=“motorforce_ngut.exe”)
.ends

I am using Kicad 8.0.4 on Windows 11 Pro. I compiled the C files from the ISOTEL motor control project using GCC 7.4.0 If anyone can share some pointers, it will be greatly appreciated. And even better if a simpler example can be provided. The ISOTEL project is amazing but there is a lot to digest and quite possible I have not fully understood how to use d_process. Thank you very much.

I have no experience with Xspice (and this probably won’t make a difference) but I would encourage you to update to the latest stable version of KiCad, currently v8.0.7, in case the simulation behavior has been improved in the bug fix releases over the past few months. Again, no idea if it will actually make a difference, sorry.

Check my model of a buck converter here for a complete Kicad d_process example: Easier mixed mode simulation (and real world comparison!) - #4 by slh . It was originally based on the Isotel model by @uros.

There’s a good chance that you’ve run into a problem I found when I shared my first version ( Mixed mode simulation including C code and verilog ). Ngspice doesn’t get given the working directory properly so it doesn’t know where to look for the executable. My models have a change directory (cd) command in the ngspice control block on the schematic.

If you want to use gdb to debug the controller then check my first link as there’s a minor bug in ngspice in how you name the pipes.