# 11.1.9.7.2. Server¶

This module provides an interface to run ngspice in server mode and get back the simulation output.

When ngspice runs in server mode, it writes on the standard output an header and then the simulation output in binary format. At the end of the simulation, it writes on the standard error a line of the form:

@@@ \d+ \d+


where the second number is the number of points of the simulation. Due to the iterative and adaptive nature of a transient simulation, the number of points is only known at the end.

Any line starting with “Error” in the standard output indicates an error in the simulation process. The line “run simulation(s) aborted” in the standard error indicates the simulation aborted.

Any line starting with Warning in the standard error indicates non critical error in the simulation process.

class PySpice.Spice.NgSpice.Server.SpiceServer(**kwargs)[source]

Bases: object

This class wraps the execution of ngspice in server mode and convert the output to a Python data structure.

Example of usage:

spice_server = SpiceServer(spice_command='/path/to/ngspice')
raw_file = spice_server(spice_input)


It returns a PySpice.Spice.RawFile instance.

SPICE_COMMAND = 'ngspice'