Wattage and current in Spice

I’m new to Spice in Kicad and can’t figure out how to measure current and wattage. Is it possible, and how so? Thanks!

Current is easier, although it would be a nice feature to get the probe to add the current automatically if clicked on a component instead of a node.

Anyway, you need to add the desired signal manually from the list as shown below:

Wattage is voltage*current, but I’m not sure that the KiCad Simulator currently supports plotting a function consisting of multiple voltages and/or currents. Maybe someone else here knows? If not, I can show you how to farm out this task to LTspice (if you have it available).

I do not know much of ngSpice (yet), but it seems logical to me that it would be possible to define some mathematical formula to add a new variable in a text box in KiCad and pass that along to ngSpice (just like the “.ac dec 20 10 10Meg” ) and ngspice adds it to it’s netlist. You would have to read the ngSpice manual to dertermine if this is possible and how to handle it.

Edit / Oops:
This probably would not work. See:
https://forum.kicad.info/t/how-to-improve-the-kicad-ngspice-interface/15880/12?u=paulvdh

Your reply gives me hope, but I can’t get it to work yet.

First, I may not have the absolute latest version, so I will download from the nightly updates and hope that is my problem.

That said, going from your step 1 to step 2 is easy. I can’t make the jump to step 3. There is stuff missing there. Like a button allowing me to select a signal to add. I get the window but no options.

To cover my bases, I did check Help and Online manuals but found nothing.

Comparing directly to LTSpice and OrCAD spice, having a button to press to show current and wattage seems like a very big thing to add to the list of things to improve in this spice program.

Another approach may be:

I think there are voltage to voltage sources, and voltage to current sources and other weird converters as predefined spice components. With those and a resistor or so you can probably add a “probe and measurement” conversion section to your schematic & netlist. which can then be probed.

1 Like

Heads up thinkin’! That’s a good idea for a workaround. I guess the most straightforward way is to use a behavioral voltage source. You would then need to know your node names for the voltage across the component(s), or label them yourself.

I whipped up something really quick. The netlist generator does not like if nodes don’t connect to anything so I had to add dummy resistors R3 and R4 for everything to parse correctly. Probably a bug. I dunno. Not gonna really deal with it since I got scolded last time for posting observations instead of filing bug reports. Anyway, here are my results:

1 Like