diff --git a/examples/probe/switches-manual-p92.cir b/examples/probe/switches-manual-p92.cir index 481b8f2bc..5f5060d77 100644 --- a/examples/probe/switches-manual-p92.cir +++ b/examples/probe/switches-manual-p92.cir @@ -1,6 +1,6 @@ Switch test .tran 2us 5ms -.probe I(w1) I(s1) I(s2) I(s3) ; alli +.probe I(w1) I(s1) I(s2) I(s3) P(s2) P(w1); alli * switch control voltage v1 1 0 DC 0.0 PWL (0 0 2e-3 2 4e-3 0) * switch control voltage starting inside hysteresis window @@ -25,7 +25,7 @@ s3 30 0 2 0 switch1 ON .model switch1 sw vt=1 vh=0.2 ron=1 roff=10k * w1 40 0 vm3 wswitch1 off -.model wswitch1 csw it=1m ih=0.2m ron=1 roff=10k +.model wswitch1 csw it=1m ih=0.2m ron=1k roff=10k * .control run @@ -40,5 +40,6 @@ plot v(30) vs v(2) retraceplot ; <-- get hysteresis loop plot v(40) vs vm3#branch retraceplot ; <--- current controlled switch hysteresis plot i(s1) i(s2) i(s3) plot i(w1) vs i(vm3) +plot s2:power w1:power .endc .end \ No newline at end of file diff --git a/src/frontend/inpc_probe.c b/src/frontend/inpc_probe.c index 8a6c3b6bf..4f9fef46c 100644 --- a/src/frontend/inpc_probe.c +++ b/src/frontend/inpc_probe.c @@ -851,7 +851,14 @@ void inp_probe(struct card* deck) continue; } char* thisline = tmpcard->line; - numnodes = get_number_terminals(thisline); + + /* special treatment for controlled current sources and switches: + We have three or four tokens until model name, but only the first 2 are relevant nodes. */ + if (strchr("fgsw", *instname)) + numnodes = 2; + else + numnodes = get_number_terminals(thisline); + int err = 0; /* call fcn with power requested */ err = setallvsources(tmpcard, instances, instname, numnodes, haveall, TRUE);