Generating Charts From Multiple Runs or Measuring Pulse Widths

I have a multi-sheet schematic that when simulated produces repeating pulses on an output. Of interest is the width of a single pulse in milliseconds. The inputs can all be controlled by PWLs.

What I would like to do is vary a single input over time (e.g. using a PWL) and generate a chart showing the relationship between the input and the pulse width. I would like to automate this as much as possible because the number of runs that I have to do is quite large.

What options do I have?

Can I output a table of input value and pulse width for a given time which I could then import into Excel and generate a chart?

Or can I control the input configuration, running the simulation and measuring the pulse width all from pyspice?


UPDATE - pyspice looks promising. Appears after reading in the exported netlist I can manipulate the voltage sources that act as inputs and also add a .meas to get the pulse width. Still researching.

ngspice has its own scripting language (control language formely know as ‘nutmeg’), which offers all the options you have requested.

More info is available in the new ngspice control language tutorial . As the Eeschame/ngspice interface is somewhat limiting (e.g. loops are not available), best is to use external plain ngspice, started from Eeschema with the netlist generated by Eeschema and using an extra script. A description on this procedure is available at KiCad Eeschema as GUI for ngspice, tutorial for setting up the simulation .

Examples for using such .control sections with using internal or external ngspice are available at Simulation examples for KiCad/Eeschema/ngspice .


Thanks holger - I will take a look at it!