Skip to content

Using XSpice to read charge #156

@Naroek56

Description

@Naroek56

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:

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)

This produces the following simulator (before simulation):

.title Electrical Circuit
.param Cl=5n
.param Il=100n
C1 cc 0 c = Cl
I1 0 1 Il
Aint1 %id(1 cc) 2 time_count
.model time_count int (gain=1.0 in_offset=0.0 limit_range=1e-09 out_ic=0.0 out_lower_limit=-1000000000000.0 out_upper_limit=1000000000000.0)
.options TEMP = 27°C
.options TNOM = 27°C
.ic V(cc)=0
.end

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions