Qspice¶
Class used interfacing with QSPICE.
- class spicelib.simulators.qspice_simulator.Qspice[source]¶
Bases:
SimulatorStores the simulator location and command line options and is responsible for generating netlists and running 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 Qspice simulation run.
A raw file and a log file will be generated, with the same name as the netlist file, but with .qraw and .log extension. You can however change the raw file name using the -r switch.
- 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, path='')[source]¶
Validates a command line switch. The following options are available for QSPICE:
-ASCII: Use ASCII file format for the output data(.qraw) file.
-binary: Use binary file format for the output data(.qraw) file.
-BSIM1: Use the charge-conserving BSIM1 charge model for MOS1, MOS2, and MOS3.
-Meyer: Use the Meyer Capacitance model for MOS1, MOS2, and MOS3.
-ProtectSelections <path>: Protect sections marked with .prot/.unprot with encryption.
-ProtectSubcircuits <path>: Protect the body of subcircuits with encryption.
-r <path>: Specify the name of the output data(.qraw) file.
The following parameters will already be filled in by spicelib, and cannot be set:
-o <path>: Specify the name of a file for the console output.
- Parameters:
switch (str) – switch to be added.
path (str) – path to the file related to the switch being given.
- Returns:
Nothing
- Return type:
list