jspice icon indicating copy to clipboard operation
jspice copied to clipboard

Node ids influence simulation result

Open Exopandora opened this issue 6 years ago • 2 comments

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
-------------

Exopandora avatar Jan 14 '20 13:01 Exopandora

Strange. I didn't think so, but apparently yes. I'll look into it when I have time.

timmolter avatar Jan 15 '20 08:01 timmolter

Apparently the first simulation yields results if you set the resistance of g0 and g1 greater than 0

Exopandora avatar Jan 24 '20 21:01 Exopandora