Pin numbering of passive components. Simulation side effect

A possibly unexpected side effect going from Kicad V8 to Kicad V9. The passives in spice netlists have their terminals swapped. That should not be a problem, but I see different simulation results:

Turns out, having a B source containing -i(r2) makes this matter. Turning R2 around solves the problem. Better still: abs(i(r2)) and in my case (current in one direction only) the rotation of the resistor is irrelevant again.

If rotating a resistor 180 degrees gives a different result in the simulator, then this has a strong smell of some kind of bug being triggered. Can you post a test project that shows this behavior?

There is no bug involved, at least not in the simulator. @JonnyDumb uses the current flowing through the resistor for controlling another source. Of course not only the amount of current, but also its direction are of importance. ngspice derives the direction from the netlist entry of a resistor:
R1 n1 n2 value
Current flow from n1 to n2 is a direction. If you now write
R1 n2 n1 value
the direction has been swapped, not in the running circuit but as told to the simulator.

1 Like