Author Topic: LTspice polarise resistor shock  (Read 1621 times)

0 Members and 1 Guest are viewing this topic.

Offline robintTopic starter

  • Regular Contributor
  • *
  • Posts: 105
  • Country: gb
LTspice polarise resistor shock
« on: February 20, 2023, 10:30:02 am »
I am now revisiting the LTS tool for a little potboiler of mine and see that the latest ver (from LTS IV)  is now jumped to LTS 7.  I am having to relearn here so its a bit of a slog.  FWIW its an indispensable tool and forces design thinking rather than the dirty suck-it-and-see approach by rank amateurs. 
I hope Im in the right place for my discussion here - pls mods re-direct as necessary as there's no obvious forum category here.

enough intro

There are many little quirks and inherent bugs? to learn workarounds which LTS users are fully aware.

One that completely floored me was that resistor models have an inherent POLARITY.  Fell off my stool back then.  In a word it makes a difference which way round you insert the resistor to your circuit - just like a battery.  GO FIGURE :P :-DD

Sadly there is no obvious tag to show polarity on the schematic or any dropdown info (like +/-).  This can so easily catch you out especially if its not obvious which polarity you have with applied voltage - like a wheatstone bridge type cct)

I have a simple solution, but its so obvious that the 10^6 users over 20 years must have thought of it.  It involve putting a simple dot on the symbol to show positive end.  I can post the trivial .asc file here to help anyone else but I fear that there must be a fatal flaw to such a simple method.

Would any experiences users here please deflate my hypothesis - its bothering me.





A little knowledge is a dangerous thing in the Lithium world
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 20363
  • Country: gb
  • 0999
Re: LTspice polarise resistor shock
« Reply #1 on: February 20, 2023, 12:57:01 pm »
SPICE is just a glorified calculator. All currents and voltages are differential, thus have a sign, so every component has a positive and negative terminal. Normally it doesn't make any difference, but seeing a negative current when one would normally expect it to be positive is a bit confusing. I agree, it would be nice, if there was a way to make it show the positive and negative on non-polarised components.
 
The following users thanked this post: robint

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13217
Re: LTspice polarise resistor shock
« Reply #2 on: February 20, 2023, 01:03:03 pm »
Pin order for two pin components in a SPICE netlist is significant. <shock><horror> Film at 11! <horror></shock>  :horse:

Its no different to choosing the 'wrong' direction for one of the current loops in a mesh analysis - it all comes out 'in the wash' with the only difference being the sign of the numerical result for that loop current, or in the case of SPICE, for that component current.  It only becomes important when that component current is used in other calculations not directly related to the nodes it is connected between. (e.g. behavioural sources), where the convention for formally laid out schematics is to insert a 0V voltage source as a current probe point which has indicated polarity. 

However, after you've run a LTspice analysis, when selecting nodes or currents to plot the cursor shows a red arrow indicating the direction of positive current when hovering over a two pin component, so redefining resistor symbols to add polarity symbols is unnecessary, and will cause problems if you want to share your schematics.

For further entertainment, look at the currents through the four identical capacitors in series in the attached sim!
 
The following users thanked this post: robint

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: LTspice polarise resistor shock
« Reply #3 on: February 20, 2023, 02:52:12 pm »
The icon shows always the same direction (thus indicating the node 1 and 2), current direction regardless..
Readers discretion is advised..
 

Offline exe

  • Supporter
  • ****
  • Posts: 2647
  • Country: nl
  • self-educated hobbyist
Re: LTspice polarise resistor shock
« Reply #4 on: February 20, 2023, 02:56:13 pm »
FWIW its an indispensable tool and forces design thinking rather than the dirty suck-it-and-see approach by rank amateurs.

Ha-ha-ha, you don't know how I (ab)use LTSpice)
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13217
Re: LTspice polarise resistor shock
« Reply #5 on: February 20, 2023, 07:03:58 pm »
The icon shows always the same direction (thus indicating the node 1 and 2), current direction regardless..
Yes.  To elaborate on both your answer and my comment that it indicates the direction of positive current: For two pin components, the 'plot current' mouse cursor arrow always points from the first pin (node) to the second pin in the corresponding SPICE netlist line, and that direction of current flow is defined as positive.
 
The following users thanked this post: robint, iMo

Offline TimFox

  • Super Contributor
  • ***
  • Posts: 9003
  • Country: us
  • Retired, now restoring antique test equipment
Re: LTspice polarise resistor shock
« Reply #6 on: February 20, 2023, 07:15:03 pm »
Personally, I use SPICE itself (with the original line-oriented syntax).
The SPICE models for two-pin devices always specify the two nodes in order of polarity.
It can be tricky to keep track of current-flow direction, but the software is self-consistent.
 
The following users thanked this post: Ian.M

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6420
  • Country: de
Re: LTspice polarise resistor shock
« Reply #7 on: February 20, 2023, 08:45:53 pm »
I'm totally unable to reproduce this issue (mind you, I'm using ngspice).
Running a simulation, and then running the simulation again after rotating a resistor 180 degrees give 100% the same result.
Never seen this before, never heard of this before, cannot confirm.
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 5570
  • Country: va
Re: LTspice polarise resistor shock
« Reply #8 on: February 20, 2023, 09:00:05 pm »
A depiction :)
Readers discretion is advised..
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13217
Re: LTspice polarise resistor shock
« Reply #9 on: February 20, 2023, 09:00:47 pm »
I'm totally unable to reproduce this issue (mind you, I'm using ngspice).
Running a simulation, and then running the simulation again after rotating a resistor 180 degrees give 100% the same result.
Never seen this before, never heard of this before, cannot confirm.

... except that the simulated current through the resistor (e.g. I(R1) ) will have the opposite sign (but same magnitude).

As I commented earlier, this makes a difference if you use I(R1) in the expression controlling a behavioural source.

« Last Edit: February 20, 2023, 09:02:24 pm by Ian.M »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf