I’m trying to model a simple electrical circuit with XSPICE elements. For example, the electrical circuit from Chapter 27.1 (Ngspice user manual):
from PySpice.Spice.Netlist import Circuit test = """XSPICE Vin1 1 0 DC 0V AC 1.0 SIN(0V 1V 1000Hz) Ccouple 1 in 0.000001 Rzin in 0 19.35k Aamp in aout gain_block .model gain_block gain (gain=-3.9 out_offset=7.003) Rzout aout coll 3.9k Rbig coll 0 1e12 .control run display tran 0.00001 0.003 plot i(Vin1) .endc .end """ circuit = Circuit(test) simulator = circuit.simulator(temperature=27, nominal_temperature=27) analysis = simulator.transient(step_time=0.00001, end_time=0.003)
When I try to run it I get an error:
File ".../.local/lib/python3.7/site-packages/PySpice/Spice/RawFile.py", line 223, in _read_header_line raise NameError("Unexpected line: %s" % (line)) NameError: Unexpected line: Reducing trtol to 1 for xspice 'A' devices
So there are two questions:
- If I understand correctly, the error is caused by the ngspice message “Reducing trtol to 1 for xspice ‘A’ devices”. Is it possible to avoid this error? When adding a line “option trtol=1” after the line “.control” I get the following error:
NameError: Expected label Title instead of No. of Data Rows
- Is it possible to set the value of trtol and other Simulator Variables by using any pyspice command?
I am using Spyder 4, PySpice 1.4.3 and ngspice-30 (DEFAULT_SIMULATOR = ‘ngspice-subprocess’) in the Debian linux operating system.
Thank you in advance!