Author Topic: LT-Spice help, RL-circuit  (Read 3135 times)

0 Members and 1 Guest are viewing this topic.

Offline somlioyTopic starter

  • Regular Contributor
  • *
  • Posts: 128
  • Country: no
LT-Spice help, RL-circuit
« on: November 10, 2015, 12:46:22 pm »
Hello.

I'm trying to simulate this circuit, however I'm not getting the results I'm expecting. I've calculated the inductor-current by hand and by simulation in Matlab/simulink that the stationary current should end up at ~1.04A, but as you can see in the LTSpice simulation I'm only getting around ~0.95A. The inductor in LTSpice has a 1.5ohm series resistance. SW2 is open untill 0.5sec, so I'm currently only looking at the "charging" of the inductor-part in a simple RL-circuit.

Is anyone able to see what I'm doing wrong in my simulation?

For anyone interested the equations I'm working with:


« Last Edit: November 10, 2015, 12:48:43 pm by somlioy »
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: LT-Spice help, RL-circuit
« Reply #1 on: November 10, 2015, 12:47:40 pm »
LTSpice doesn't use ideal SPICE components, check the internal resistance of the switch and source.

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

Offline somlioyTopic starter

  • Regular Contributor
  • *
  • Posts: 128
  • Country: no
Re: LT-Spice help, RL-circuit
« Reply #2 on: November 10, 2015, 12:50:38 pm »
Hmm, must be the switch then, because the Source is set to 0 at series resistance.

Edit: And what dyu know, setting Ron to very low fixed the issue. Does LTSpice have any ideal switches?
« Last Edit: November 10, 2015, 12:53:09 pm by somlioy »
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: LT-Spice help, RL-circuit
« Reply #3 on: November 10, 2015, 01:24:38 pm »
No, there's no such thing as an "ideal switch", as that would break SPICE.  That is to say, it's a mathematical impossibility in real life, and a numerical nightmare in SPICE.  (You could make one using an IF() statement, but don't expect the simulation to run very well.)

The switch component more closely approximates an ideal MOSFET: the resistance varies smoothly from Ron to Roff over some range of input voltage, and therefore also hopefully over some range of time (continuity is paramount).

(Truly real switches have all sorts of nasties, from arcing and contact bounce, to tunneling, surface interfaces, and contact resistance, so aren't really reasonable to even begin to model accurately.)

Since you're adding resistance anyway, why not absorb the series resistance into the switch's Ron?  The total resistance is simply the total resistance. :)

Also, you can accurately and implicitly solve the equation you have provided: simply connect the voltage source (RS=0) to the resistor to the inductor, and set the inductor's initial current to 0.  (You may have to check the Configuration panel to make sure LTSpice doesn't override your initial condition.)

Tim
« Last Edit: November 10, 2015, 01:26:30 pm by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf