jspice
jspice copied to clipboard
Node ids influence simulation result
I was wondering if component ids need to have a specific letter at the beginning because this:
NetlistBuilder generated = new NetlistBuilder()
.addNetlistResistor("g1", 0, "c1", "0")
.addNetlistResistor("g2", 0, "c2", "0")
.addNetlistResistor("r1", 10, "c2", "c3")
.addNetlistDCVoltage("a", 9.0, "c3", "c1"); //<-- specifically this component id
JSpice.simulate(generated.build());
results into this:
----nodes----
I(a) = NaN
V(c1) = NaN
V(c2) = NaN
V(c3) = NaN
----components----
I(g1) = NaN
I(g2) = NaN
I(r1) = NaN
-------------
Here the same simulation with v instead of a for voltage:
NetlistBuilder generated = new NetlistBuilder()
.addNetlistResistor("g0", 0, "c1", "0")
.addNetlistResistor("g1", 0, "c2", "0")
.addNetlistResistor("r1", 10, "c2", "c3")
.addNetlistDCVoltage("v", 9.0, "c3", "c1"); //<-- specifically this component id
JSpice.simulate(generated.build());
results into:
----nodes----
I(v1) = -0.9
V(c1) = -0.0
V(c2) = 0.0
V(c3) = 9.0
----components----
I(g1) = NaN
I(g2) = NaN
I(r1) = -0.9
-------------
Strange. I didn't think so, but apparently yes. I'll look into it when I have time.
Apparently the first simulation yields results if you set the resistance of g0 and g1 greater than 0