Description
Environment (OS, Python version, PySpice version, simulator)
OS: Linux, Python 3.8.5 (Conda installation - version 4.92), PySpice 1.4.8, NGSpice 33
Expected Behaviour
Simple netlist file generated using a text editor should be parsed and imported with fixed capacitors and inductors represented as respective PySpice.Spice.BasicElement.Capacitor
and PySpice.Spice.BasicElement.Inductor
objects in the Spice.Netlist.Circuit
object returned by parser.build_circuit
Actual Behaviour
Fixed capacitor and inductor are represented as Spice.BasicElement.BehavioralCapacitor
and Spice.BasicElement.BehavioralInductor
objects, respectively. They should be represented as described above. This behavior prevents the practical use of PySpice for more complicated netlists. Notably, the resistor Rac does import correctly as a fixed resistor, represented by a Spice.BasicElement.Resisor
object.
Steps to reproduce the behaviour
# Minimal SPICE netlist example
##############################
'''
.title Sample Netlist
V1 N001 0 PULSE(0 100 0 100p 100p 1u 2u)
Cr1 N002 N001 10n
Lr1 N003 N002 10n
Lp1 N003 0 10n
Rac1 N003 0 20
.backanno
.end
'''
##############################
# Pyspice Modules
import PySpice.Logging.Logging as Logging
logger = Logging.setup_logging()
from PySpice.Doc.ExampleTools import find_libraries
from PySpice.Probe.Plot import plot
from PySpice.Spice.Library import SpiceLibrary
from PySpice.Spice.Netlist import SubCircuitFactory
from PySpice.Spice.Parser import SpiceParser
from PySpice.Unit import *
parser = SpiceParser(path='/path/to/netlist.cir')
circuit = parser.build_circuit(0)
print(type(circuit.Cr1))
# Returns <class 'PySpice.Spice.BasicElement.BehavioralCapacitor'>
print(type(circuit.Lr1))
# Returns <class 'PySpice.Spice.BasicElement.BehavioralInductor'>
# These respectively represent variable capacitors and inductors, not fixed capacitors and inductors