XyceSimulator

Class used interfacing with Xyce.

class spicelib.simulators.xyce_simulator.XyceSimulator[source]

Bases: Simulator

Stores the simulator location and command line options and runs simulations.

process_name: str

the name of the process in the task manager

classmethod run(netlist_file, cmd_line_switches=None, timeout=None, stdout=None, stderr=None, cwd=None, exe_log=False)[source]

Executes a Xyce simulation run.

A raw file and a log file will be generated, with the same name as the netlist file, but with .raw and .log extension.

Parameters:
  • netlist_file (str | Path) – path to the netlist file

  • cmd_line_switches (list | None) – additional command line options. Best to have been validated by valid_switch(), defaults to None

  • timeout (float | None) – If timeout is given, and the process takes too long, a TimeoutExpired exception will be raised, defaults to None

  • stdout (_FILE, optional) – control redirection of the command’s stdout. Valid values are None, subprocess.PIPE, subprocess.DEVNULL, an existing file descriptor (a positive integer), and an existing file object with a valid file descriptor. With the default settings of None, no redirection will occur. Also see exe_log for a simpler form of control.

  • stderr (_FILE, optional) – Like stdout, but affecting the command’s error output. Also see exe_log for a simpler form of control.

  • cwd (str | Path | None) – The current working directory to run the command in. If None, no change will be done of the working directory. This may not work as wanted when using the simulator under wine.

  • exe_log (bool) – If True, stdout and stderr will be ignored, and the simulator’s execution console messages will be written to a log file (named …exe.log) instead of console. This is especially useful when running under wine or when running simultaneous tasks.

Raises:
  • SpiceSimulatorError – when the executable is not found.

  • NotImplementedError – when the requested execution is not possible on this platform.

Returns:

return code from the process

Return type:

int

spice_exe: list[str]

The executable. If using a loader (like wine), make sure that the last in the array is the real simulator.

classmethod valid_switch(switch, parameter='')[source]

Validates a command line switch. The following options are available for Xyce:

  • -capabilities: print compiled-in options and exit

  • -license: print license and exit

  • -param [device [level [<inst|mod>]]]: print a terse summary of model and/or device parameters

  • -doc [device [level [<inst|mod>]]]: output latex tables of model and device parameters to files

  • -doc_cat [device [level [<inst|mod>]]]: output latex tables of model and device parameters to files

  • -count: device count without netlist syntax or topology check

  • -syntax: check netlist syntax and exit

  • -norun: netlist syntax and topology and exit

  • -namesfile <path>: output internal names file to <path> and exit

  • -noise_names_file <path>: output noise source names file to <path> and exit

  • -quiet: suppress some of the simulation-progress messages sent to stdout

  • -jacobian_test: jacobian matrix diagnostic

  • -hspice-ext <option>: apply hspice compatibility features during parsing. option=all applies them all

  • -redefined_params <option>: set option for redefined .params as ignore (use last), usefirst, warn or error

  • -subckt_multiplier <option>: set option to true(default) or false to apply implicit subcircuit multipliers

  • -local_variation <option>: set option to true(default) or false to enable local variation in UQ analysis

  • -delim <TAB|COMMA|string>: set the output file field delimiter

  • -o <basename>: <basename> for the output file(s)

  • -per-processor: create log file for each procesor, add .<n>.<r> to log path

  • -remeasure [existing Xyce output file]: recompute .measure() results with existing data

  • -nox <on|off>: NOX nonlinear solver usage

  • -linsolv <solver>: force usage of specific linear solver

  • -maxord <1..5>: maximum time integration order

  • -max-warnings <#>: maximum number of warning messages

  • -prf <param file name>: specify a file with simulation parameters

  • -rsf <response file name>: specify a file to save simulation responses functions.

  • -a: output in ascii format

  • -randseed <number>: seed random number generator used by expressions and sampling methods

  • -plugin <plugin list>: load device plugin libraries (comma-separated list)

The following parameters will already be filled in by spicelib, and cannot be set:

  • -l <path>: place the log output into <path>, “cout” to log to stdout

  • -r <file>: generate a rawfile named <file> in binary format

Parameters:
  • switch (str) – switch to be added.

  • parameter (str) – parameter for the switch

Returns:

the correct formatting for the switch

Return type:

list