Open Naroek56 opened 5 years ago
Hey, this seems to run ok for me. Are you still experiencing issues? Can you post the full code you use to run the simulation from within PySpice? I'm running Linux, not Windows, so maybe there's a difference with that.
Yes, I'm still experiencing issues. I'm now using Python 3.8.0, Ngspice 31, Pyspice 1.3.2 and execute the code in JupyterLab. This is the full code:
from PySpice.Probe.Plot import plot
from PySpice.Spice.Netlist import Circuit
from PySpice.Unit import *
from PySpice.Spice.Netlist import SubCircuitFactory
circuit = Circuit("Electrical Circuit")
circuit.parameter("Cl=5n","Cl=5n")
circuit.parameter("Il=100n","Il=100n")
circuit.C(1,"cc",circuit.gnd,"c = Cl")
circuit.I(1,circuit.gnd,"1","Il")
circuit.A("int1","%id(1 cc)","2","time_count")
circuit.model("time_count","int",in_offset=0.0, gain=1.0, out_lower_limit=-1e12, out_upper_limit=1e12, limit_range=1e-9, out_ic=0.0)
simulator = circuit.simulator()
simulator.initial_condition(cc=0)
print(simulator)
analysis = simulator.transient(step_time=100@u_ns, end_time=100@u_us)
plot(analysis["2"])
The code works as long as I1 is directly connected to C1. However, when I use the code as written above it breaks the kernel. (message: "The kernel appears to have died")
Environment (OS, Python version, PySpice version, simulator)
Windows 10, Python 3.6.6, Pyspice 1.3.2, NgSpice 30
Expected Behaviour
Running simulation and plotting output node.
Actual Behaviour
Simulation runs indefinitely.
Steps to reproduce the behaviour
I'm aware that XSpice is only partially implemented, although I do not know whether this should occur or not. I'm using an example from the Ngspice manual. My code is:
This produces the following simulator (before simulation):
If I run this code separately in Ngspice it works, but with PySpice it runs indefinitely. Since the circuit works when I short-circuit 1 and cc I assume that A is not establishing a link properly.
Support/fix much appreciated!