Author Topic: Strange negative current  (Read 3147 times)

0 Members and 1 Guest are viewing this topic.

Offline David_RTopic starter

  • Newbie
  • Posts: 9
  • Country: co
Strange negative current
« on: May 12, 2016, 03:44:39 am »
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  |O.

Here some pictures



I just became aware that with this simple circuit the same happens


« Last Edit: May 12, 2016, 04:06:19 am by David_R »
 

Offline BobsURuncle

  • Regular Contributor
  • *
  • Posts: 82
  • Country: us
Re: Strange negative current
« Reply #1 on: May 12, 2016, 04:46:23 am »
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.


« Last Edit: May 12, 2016, 04:49:56 am by BobsURuncle »
 

Offline David_RTopic starter

  • Newbie
  • Posts: 9
  • Country: co
Re: Strange negative current
« Reply #2 on: May 12, 2016, 05:02:03 am »
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.

no, 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
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22386
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Strange negative current
« Reply #3 on: May 12, 2016, 07:43:45 am »
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 the sign of a current flow suggests a poor understanding of circuit fundamentals...  :-//

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 22386
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Strange negative current
« Reply #4 on: May 12, 2016, 07:45:06 am »
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.

FWIW, 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
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline David_RTopic starter

  • Newbie
  • Posts: 9
  • Country: co
Re: Strange negative current
« Reply #5 on: May 12, 2016, 08:54:22 am »
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
 

Offline BobsURuncle

  • Regular Contributor
  • *
  • Posts: 82
  • Country: us
Re: Strange negative current
« Reply #6 on: May 12, 2016, 07:30:20 pm »
Maybe you need to reverse the plug from your computer into the wall socket. 
 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 10576
  • Country: gb
Re: Strange negative current
« Reply #7 on: May 12, 2016, 09:09:14 pm »
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

Yes 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.
Anybody got a syringe I can use to squeeze the magic smoke back into this?
 
The following users thanked this post: David_R

Offline David_RTopic starter

  • Newbie
  • Posts: 9
  • Country: co
Re: Strange negative current
« Reply #8 on: May 12, 2016, 09:57:52 pm »
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

Yes 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.

Thank you, I just turned the resistor and it works
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf