Strange negative current - Page 1
Forum section: electronics / general

author: David_R
author_rank: Newbie
timestamp: May 12, 2016, 03:44:39 am
content: Hi, I have an SPICE model for CD4007 NMOS and I'm using a DC sweep analysis varying the gate voltage, but I don't know why Altium is showing me a negative drain current.Here some picturesI just became aware that with this simple circuit the same happens

author: BobsURuncle
author_rank: Regular Contributor
timestamp: May 12, 2016, 04:46:23 am
content: I am not familiar with the software, but don't you have to define the direction in which you are measuring the current? If you don't define it then perhaps it defaults to giving it a sign with respect to the voltage across the element, so for example resistors would always have negative current and voltage sources would be positive - assuming it is delivering power.

author: David_R
author_rank: Newbie
timestamp: May 12, 2016, 05:02:03 am
content: Quote from: BobsURuncle on May 12, 2016, 04:46:23 amno, there are no options to define something like that, and it is supposed that a simulator always follows the passive sign convention so in this case the current should be positive

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 12, 2016, 07:43:45 am
content: Hover the mouse over R1's pins. Note the pin names (the defaults are 1 and 2, IIRC).Edit the resistor's simulation model. Note the pin connections (should be 1 = 1, 2 = 2?).Consult the SPICE spec on current flow direction in two terminal components (such as resistors, sources and etc.).Flip the resistor symbol, or swap the pin assignments, or multiply the current reading by -1, to invert it.TLDR: confusion over thesignof a current flow suggests a poor understanding of circuit fundamentals...Tim

author: T3sl4co1l
author_rank: Super Contributor
timestamp: May 12, 2016, 07:45:06 am
content: Quote from: BobsURuncle on May 12, 2016, 04:46:23 amFWIW, Altium uses a pretty much bog standard XSPICE backend. Results should be largely identical to pretty much every other simulator (which, in turn, are pretty much bog standard themselves).Tim

author: David_R
author_rank: Newbie
timestamp: May 12, 2016, 08:54:22 am
content: you can't say that men, I understand perfectly the basics concepts of circuits (maybe I'm overreacting with the title), there are a biggest potential at the top of R1 ,so the current should flow from drain to source and should be positive..... the name of the pin does not affect anything it is just a convension

author: BobsURuncle
author_rank: Regular Contributor
timestamp: May 12, 2016, 07:30:20 pm
content: Maybe you need to reverse the plug from your computer into the wall socket.

author: Cerebus
author_rank: Super Contributor
timestamp: May 12, 2016, 09:09:14 pm
content: Quote from: David_R on May 12, 2016, 08:54:22 amYes it does. SPICE tells you the current flow from pin 1 to pin 2 and sets the sign accordingly, if the current is flowing from pin 2 to pin 1 it will show the reverse sign. The first time you encounter this it seems weird because to the sane mind resistors do not have polarity, but in SPICE's warped mind they do.

author: David_R
author_rank: Newbie
timestamp: May 12, 2016, 09:57:52 pm
content: Quote from: Cerebus on May 12, 2016, 09:09:14 pmThank you, I just turned the resistor and it works