It does work if you do what I have suggested above.
Currently you have two different text boxes in your drawing. That is wrong.
Delete the text box containing the ‘L1 …’.
Double click onto the text box containing ‘.tran …’.
A editor text box with the header ‘Text Properties’ opens.
Add a line underneath the line ‘.tran …’ with the contents ‘K1 L1 L2 1’. Store by ‘ok’. Now you have two lines in the text box:
.tran 1n 1000n
K1 L1 L2 1
Then start the simulator. What you see is: constant voltages everywhere. You have coils, and you need an ac voltage. For transient simulation, double click onto ‘dc 5 ac 0’ on the voltage source and add a sine wave ‘dc 5 ac 0 sin 0 1 10Meg’. If you then run the simulator, you will see v(a), v(b) as sine waves as well.
Attached you will find your file from yesterday, modified and o.k with my Eeschema (5.0.0, version info see below). This file differs from your today’s file (text compare) only in that your file resorts to some rescue libraries that I do not have.
Could you check if current nightly is also affected? Would be good to know as the 5.1 release is planned to be released shortly. (I would guess that such a regression would get a high priority.)
// Entries in the vector below have to follow the order in SPICE_FIELD enum
const std::vector NETLIST_EXPORTER_PSPICE::m_spiceFields = {
“Spice_Primitive”,
“Spice_Model”,
“Spice_Netlist_Enabled”,
“Spice_Node_Sequence”,
“Spice_Lib_File”
};
Checked sourcecode its no line in code for export KXXX.
Only thing it have - include librarys, but it work fine from component properties. and ‘.’ directives. But ngspise doesn’t understand '.Kxxxx ’ it wont starting simulation with that.
Sorry for long post. Don`t know how to make spoiler here.
Well I also have couple other bug report for pspice relative mater, so I will listed here for just reference since this issue isn’t new, but developer think they fix it:
For me it is difficult to understand what you try to achieve.
There are two ways running a simulation in KiCad:
Use the integrated ngspice
Generate a netlist and simulate externally with whatever simulator (e.g. PSPICE).
**Set current directory to project before run custom simulator
What do you mean by: “ngspice tool do not understand windows system absolute file path that automatically send by KiCad” ? Could you give an example?
** simulation: TEMP sweep not able to plot anything
You are using eeschema/ngspice in a way that has not been intended by the devs and that is not supported. KiCad sends the netlist, .tran etc. command and a ‘run’ command to ngspice and gets back all simulation results for plotting. Your setup generates its own simulation command and issues a request for plotting, both from inside of ngspice. Whereas running the simulation this way is possible, it is not possible to plot the data, because shared ngspice does not have its own plot interface, and eeschema does not know about the data generated by ngspice. So you only might save the data by ‘write’ command and use an external plotting program (e.g. stand-alone ngspice).
**Can’t start a multi-line SPICE directive with a commented-out line
Did you check with a recent nightly if this has been fixed? If not, I could have a look.
** ngspice use net name “0” (Zero) as a reference ground not GND
This is wrong. ngspice always understood GND. Internally it will be transformed into ‘0’. ‘0’ is required somewhere as a reference. If you do not want this automated translation, you may give the command ‘set no_auto_gnd’. Then you have to provide your own ‘0’ somewhere in the netlist.
If you intend to generate a netlist compatible with an external other simulator, you have to state that clearly in your bug report. And then the devs have to decide if this should be supported.
This is the issue when I try to run simulate externally… ngspice seem to not able to run my netlist file, and it very hard to run under interactive mode when I have to type so much for the “absolute” path. When I start Kicad under my current netlist folder, everything run automatically and avoid type so much for absolute path. But if I start KiCad form the Windows -> Start menu it just not working with absolute path.
I think you can try it yourself. Make a simple simulation schematic. eeschema->Tools->Generate Netlist file… -> Spice -> run simulator with Simulator Command: "c:\ngspice\bin\ngspice.exe
You would get “absolute_path_to_netlist_file” : Invalid argument on the ngspice.
Also, I found that the ngspice.exe did not find it own init file correctly, but if the “current” path is set to where the netlist file at. Then copy the spinit file to that folder. I will be able to run my simulator by using the Simulator Command: “c:\ngspice\bin\ngspice.exe sim.cir” perfectly.
I think both KiCad and ngpsice need to fix. But that most importance is the fix from KiCad so that I can run other netlist simulation directly from the ngspice console without typing long absolute path of every netlist file, and what about the include path that I use as relative from the netlist file where include statement at.!
Copy C:\Program Files\KiCad\share\kicad\demos\simulation into C:\KiCad, to get C:\KiCad\simulation\laser_driver. This just serves as an example for an arbitrary eeschema project placed into an arbitrary folder.
Set the access for the whole directory tree C:\KiCad to full access for all users. This allows KiCad to read and write to this directory without the need for having admin rights.
Install recent KiCad nightly 5.1rc.
Run eeschema
Open file c:\KiCad\simulation\laser_driver\laser_driver.sch
Replace the text box entry
.tran 10p 150n
by
.tran 10p 150n
.control
run
rusage
set filetype=ascii
write c:\Kicad\laser.out "/in" "/out"
plot "/in" "/out"
.endc
File–>Save current sheet
Tools–>Generate netlist file…–>Spice
Select ‘Default format’
Simulator command: C:\Spice64\bin\ngspice.exe
Button: Generate netlist
Button: Save (Store laser_driver.cir to C:\KiCad\Simulation\laser_driver)
Button: Run Simulator
Voila:
ngspice.exe simulates the file laser_driver.cir and plots the resulting output. No problem finding the spinit file. No need to type anything in addition. No “absolute_path_to_netlist_file” : Invalid argument response.