• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

LTspice: plot of basic L circuit

Status
Not open for further replies.

mikewax

Member
:sorry: hi i'm tracing the current through a 1uH inductor but it looks like the trace of a 1mOhm resistor. can someone tell me what i'm doing wrong?
thanx, mike
test.png
 

alec_t

Well-Known Member
Most Helpful Member
Welcome to ETO!
Add some resistance in series with the inductor. 1000A is a tad unrealistic!
 

mikewax

Member
Welcome to ETO!
Add some resistance in series with the inductor. 1000A is a tad unrealistic!
but even an ideal inductor is supposed to have inductance, right? like VL = di/dt there's supposed to be some opposition so i don't get how it arrives at the 1kA number. <edit>and it STARTS at 1kA. i backed up the time scale to ns, to ps. it's starting at that value</edit>
n thanx for answering
 
Last edited:

ronsimpson

Well-Known Member
Most Helpful Member
Changed 1F cap to 1uF.
Changed your voltage source from a battery to a pulse source.

"Initial condition" is one of the problems. The program saw the voltage on C1 was going to charge to 5V so it started out with the voltage at 5V.
By using a pulse source, I started out with 0V, at time zero moved to 5V, then at time 10mS moved back to 0V.
upload_2016-11-6_17-34-31.png
 

Attachments

mikewax

Member
Changed 1F cap to 1uF.
Changed your voltage source from a battery to a pulse source.

"Initial condition" is one of the problems. The program saw the voltage on C1 was going to charge to 5V so it started out with the voltage at 5V.
By using a pulse source, I started out with 0V, at time zero moved to 5V, then at time 10mS moved back to 0V.
i don't understand. voltage V1 is supposed to start at 5 and the voltage at Vcap is supposed to start at 0. so spice is just not plotting what i'm telling it to plot. but when you change the voltage source to Pulse, then it interprets the circuit at face value and plots it correctly. WTF?
 

ronsimpson

Well-Known Member
Most Helpful Member
voltage V1 is supposed to start at 5 and the voltage at Vcap is supposed to start at 0
No.

If this was true then a simple amplifier circuit will need time to "stabilize" before you can look at it. (example the capacitors on the power supply) What spice does is try to determine a steady state for your circuit. In your case it will start out with 5V on the cap.

What I did was to make a voltage source that goes 0,5,0 volts. (note the first 0 is for time before "o")
 

mikewax

Member
ok Ron thanx. so it's making an assumption about what i want to see. but with a 1F cap, that's QUITE an assumption.
the first zero is the initial voltage?
is there a more direct way to specify initial condition?
 

ronsimpson

Well-Known Member
Most Helpful Member
is there a more direct way to specify initial condition?
.
.IC -- Set Initial Conditions
The .ic directive allows initial conditions for transient analysis to be specified. Node voltages and inductor currents may be specified. A DC solution is performed using the initial conditions as constraints. Note that although inductors are normally treated as short circuits in the DC solution in other SPICE programs, if an initial current is specified, they are treated as infinite-impedance current sources in LTspice.

Syntax: .ic [V(<n1>)=<voltage>] [I(<inductor>)=<current>]

Example: .ic V(in)=2 V(out)=5 V(vc)=1.8 I(L1)=300m
I have not used this in a while but I think if you have this on the schematic somewhere:
.ic V(C1)=0 the voltage on C1 will start out at 0 volts.
.ic I(L1)=300m the current on L1 will start out with 0.3A. (watch out you might need -0.3 not +0.3 depending on how you connected to L1)
 

ronsimpson

Well-Known Member
Most Helpful Member
Welcome Mike,
Please fill in you location. It helps up know more. If some one is helpful push their like button.
thanks.
 

Ratchit

Well-Known Member
:sorry: hi i'm tracing the current through a 1uH inductor but it looks like the trace of a 1mOhm resistor. can someone tell me what i'm doing wrong?
thanx, mike
View attachment 102101
No resistance, no problem with calculating the current. The current for no resistance is Vo*t/L , where Vo is a step function. The curve a straight line starting from zero and goes as high as you can name if the voltage source can supply it, and you wait long enough. Notice that as L becomes smaller and smaller, the given formula produces output current values that are similiar to a dead short.

Ratch
 

ronsimpson

Well-Known Member
Most Helpful Member
and goes as high as you can name
In LT Spice the voltage source has a place to add a resistance. Right click on voltage source, "series resistance". If not filled in there is a default value.
Same thing for inductors. "series resistance" For real parts, there is a resistance of the wire.

In the real world, a car battery and wire might have 0.01 ohms. (don't really know) and a inductor might have 0.5 ohms. In the real world, when the current hits 24 amps the wire burns out. You don't really reach 1000 amps.
 

Ratchit

Well-Known Member
In LT Spice the voltage source has a place to add a resistance. Right click on voltage source, "series resistance". If not filled in there is a default value.
Same thing for inductors. "series resistance" For real parts, there is a resistance of the wire.

In the real world, a car battery and wire might have 0.01 ohms. (don't really know) and a inductor might have 0.5 ohms. In the real world, when the current hits 24 amps the wire burns out. You don't really reach 1000 amps.
Perhaps so, but I was calculating the current equation for a nonexistent inductor with no resistance, and energized with a step voltage. That appears to be what was wanted in post #1.

Ratch
 

mikewax

Member
yes it was, just to see how long to saturate an L of 4.7uH so i could make a buck circuit. but why would i need a step voltage function i don't get it.
 

crutschow

Well-Known Member
Most Helpful Member
yes it was, just to see how long to saturate an L of 4.7uH so i could make a buck circuit. but why would i need a step voltage function i don't get it.
You need a step function because Spice normally calculates the steady-state DC bias conditions before it does the transient response.
To prevent that you can start the simulation without that calculation by using the uic, upload_2016-11-7_0-4-27.png, in the Simulation Command.
The results then are:

upload_2016-11-7_0-10-56.png
 

Ratchit

Well-Known Member
yes it was, just to see how long to saturate an L of 4.7uH so i could make a buck circuit. but why would i need a step voltage function i don't get it.
Well, you have to have some kind of voltage curve don't you? A common step function is what you get when you switch on DC. If you want me to calculate a pulse, square, triangle, or whatever, then specify what you need.

Ratch
 

ronsimpson

Well-Known Member
Most Helpful Member
just to see how long to saturate an L of 4.7uH
A 4.7hH "spice" coil will never saturate. It is not a real world coil.
A 4.7hH "spice" coil could have 0 ohms. Spice tries not to allow that because we get into infinity. (1/0, and other numbers)

Back in post #1 you connected a 1V source to a 0 ohm coil. (the voltage source has a default 0.001 ohm internal resistance) so the current went to 1000A. Then two minutes later you want to measure the current and are unhappy about the 1000A. If you did this in the real world; solder a coil across a car battery and it burns out long before you can get to the current meter. The battery probably mostly discharged.

Points to think about:
1) When you hit "run" time has gone by. Before you hit run all the caps have charged up and the coils reached some current level.
2) Hitting run puts a meter into your circuit. (scope probe) The circuit was alive before and has come to a steady-state DC bias conditions.
3) Saturation is a function of the coil's core material, size, etc. You have not put any of that into spice.
4) Spice is not like the real world much like video games are not real. (shocking thought) To get close to real; you need to enter more information and understand limitations.

I hope you are not unhappy with me, but you just started with this program and it is hard at first. I know you want to make a buck PWM. I can help with that. (most of us will help) Please tell us what you want made. If you have a circuit up and working, then you can make changes and see what happens. I think we need to get past this "getting started" problem and jump into seeing something working.
 

MikeMl

Well-Known Member
Most Helpful Member
Further expanding on Zappers posting: Here are four different ways to do this. 31a and 3b are the preferred ways. 3 and 3a frequently have undesired consequences...

InitialIndCur.jpg
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top