for a SPICE simulation I’m currently using an IPWL source with a couple of time and current inputs (around 10 datapoints). I want to extend this to around 100-1000 and my idea was to use an external .txt file to pass these to the simulation. Just creating a larger Sim.Params pwl=“…” string created an error.
I read through some spice documentation mostly pointing at “filesource” that i cant find in kicad. All other approaches to make the IPWL source read from the txt file failed for me, so I must be missing a critical part of documentation on this.
Yes, you may use the filesource. Attached you will find a small project I have made with 9.0.4. filesource.7z (7.5 KB)
You will need a symbol. I have simply mis-used the IPWL symbol, which has pins 1 and 2.
You will need a ngspice model for the filesource. An example for a filesource model delivering a current with single differential output at pins 1 and 2 is contained in fs_single.lib.
The input file the filesource model is looking for is given by the .param statement in the text box on the Eeschema canvas as “sine.m”. You may change “sine.m” to any other filename, including its path.
As an example sine.m contains the time (column 1), a sine wave (column 2) and a cosine wave (column 3, not used here).
Place the symbol, attach the model to the symbol, and run the transient simulation according to the workbook.
For further details and option please have a look at chapter 8.2.9 Filesource (PWL sourced from file) of the ngspice manual.