# How to make this switch to act more realistic in LTspice

A series RL circuit is connected to a voltage source for a very long time and passes 1A constant current.ยจ

All of a sudden a switch between the voltage source and the RL circuit is opened and the circuit is let alone with its natural response as below switch 1 to switch 2:

I wanted to illustrate this by using LTspice. So I set the initial current for the inductor as 1A and used the built-in switch component in LTspice as follows:

The current I(L2) in the above plot is exactly how we predict in real life and obeys the first order differential equation solution ect.

The inductor Vl's behaviour above is also how we would predict as it starts from a negative voltage and ends up as zero, as a back-emf.

But as a value it does not represent the real life measurements. In real life the back-emf voltage would never go that much as -1GV. I tried to tweak some parameters of the switch but failed to reduce the back-emf voltage in the simulation. Obviously something is missing which exists in real life (?)

What could be added or adjusted so that this switch causes more realistic back-emf?

• -1 For changing the question after you got an answer. – The Photon Nov 17 '17 at 20:02
• You were too quick man. ;P – user1245 Nov 17 '17 at 20:03

The trouble with all the switches in LTSPICE and others is that they are not switches. The are resistors with different values. Note your Roff is 100Meg and you are starting out with 1A in the circuit hence the big values.

If you want it to act like a real life you would need to add some parasitics, especially capacitance back to ground. But that wont help you with the switch closed.

You could try an .ic of 0V at the top of the switch though

Ultimately, you would be better to show the whole schematic of the original and have two switches that do the changeover.

• Adding cap across the switch? – user1245 Nov 17 '17 at 20:05
• Across the inductor. – Trevor_G Nov 17 '17 at 20:06
• Yes .setting ic v(n002)=0 back-emf now starts from -10V. Why does this happen? – user1245 Nov 17 '17 at 20:08
• Because without that, at start you had 1A going through 100M (the switch) at that node. – Trevor_G Nov 17 '17 at 20:09
• That is odd. ANyhoo.. you don't really need the switch if you are setting the current with .ic – Trevor_G Nov 17 '17 at 20:15

You are opening the switch, which is very different from shorting the R-L circuit.

If you change the voltage source to a dependent source and give it a step from (say) 1V to 0V at 0+ you'll have a situation similar to the image.

Just because it shows a switch does not necessarily mean you need to simulate a switch.