Skip to content

Commit

Permalink
Solving the issue with the QSPICE raw file extension.
Browse files Browse the repository at this point in the history
The QSPICE and LTSPICE raw files are not compatible
  • Loading branch information
nunobrum committed Aug 26, 2023
1 parent d4a3839 commit aa65e43
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions PyLTSpice/sim/qspice_simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
class Qspice(Simulator):
"""Stores the simulator location and command line options and is responsible for generating netlists and running
simulations."""
raw_extension = '.qraw' # In QSPICE all traces have double precision. This means that qraw files are not compatible
# with LTSPICE

"""Searches on the any usual locations for a simulator"""
if sys.platform == "linux":
Expand Down Expand Up @@ -105,9 +107,8 @@ def valid_switch(cls, switch, path='') -> list:

@classmethod
def run(cls, netlist_file, cmd_line_switches, timeout):
raw_file = Path(netlist_file).with_suffix('.raw').as_posix()
log_file = Path(netlist_file).with_suffix('.log').as_posix()
cmd_run = cls.spice_exe + ['-o', log_file] + ['-r', raw_file] + [netlist_file] + cmd_line_switches
cmd_run = cls.spice_exe + ['-o', log_file] + [netlist_file] + cmd_line_switches
# start execution
return run_function(cmd_run, timeout=timeout)

2 changes: 1 addition & 1 deletion PyLTSpice/sim/run_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def run(self):
if self.retcode == 0:
# simulation successful
self.print_info(_logger.info, "Simulation Successful. Time elapsed: %s" % sim_time)
self.raw_file = self.netlist_file.with_suffix('.raw')
self.raw_file = self.netlist_file.with_suffix(self.simulator.raw_extension)

if self.raw_file.exists() and self.log_file.exists():
if self.callback:
Expand Down
1 change: 1 addition & 0 deletions PyLTSpice/sim/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def run(cls, netlist_file, cmd_line_switches, timeout):
"""
spice_exe = []
process_name = ""
raw_extension = '.raw'

@classmethod
def create_from(cls, path_to_exe, process_name=None):
Expand Down

0 comments on commit aa65e43

Please sign in to comment.