Can measure a current through a component, but not voltage across

Well, the title is describing the question already…
As an extension to this question: It would also be okay when I could enter expressions for the values that should be shown onto the graph, e.g. (V(Net-(R1-Pad1)) - V(Net-(R1-Pad2))).
Written here between (…) as is also required when expressions are used in the “value” fields of passive components, besides B-sources of course.

I do not understand your question (the title).

Measuring current through a device and measuring voltage across a device are different things. Of course they may be related somehow, but linearily dependent only for a resistor.

Measuring current through a device in ngspice is available by putting a voltage source with dc 0 in series to the device (pin). The current through this voltage source is registered.

You may add eqations to the instance line of resistors, capacitors, or inductors (similar syntax as B source) like
R1 1 0 R='TIME > 5m ? 10k : 1k'
by putting the
R='TIME > 5m ? 10k : 1k'
into the value field.
R='(V(Net-(R1-Pad1)) - V(Net-(R1-Pad2)) * 10'
in the value field should be possible as well.
With this notation again current can be measured explicitely only with a 0V voltage source put into the branch (e.g. in series to a pin) you are interested in.

ngspice-36 now has a .probe command which allows to measure currents through any (or all) device pins and voltages between any two device pins (even of different devices). This is however not yet supported by the Eeschema/ngspice interface.

1 Like

First of all: I see that one can also use single quote characters instead of (…) to enter an expression.

And yes, I can put an expression with voltages as “dynamic” resistance.
But - to be precise -: I simply want to probe a voltage across both terminals of e.g. a resistor, similarly to probing via the graphical probing tool, where a current would be selected when I point at one of the ends of a resistor.
The fact that the list under “Add Signals” only shows many currents but only voltages related to GND already shows the limit (it is here where I tried an expression in the Entry-field “Select by name”.

I think I’d export the net and then read&evaluate this in .ngspice-36.

Hi Rob

I know it’s an old question.
What i do is just to probe the two pins.
Then I add a cursor for each and take the difference.

It would be nice however if it would be possible to
add expressions when adding signals.

Or maybe probing using ctrl key like in ltspice.

I’m still on an older version of Kikad.
Not sure if changes have been made to this.