-----Original Message----- From: LTspice@... [mailto:LTspice@...] On Behalf Of Roland Sent: 24 November 2009 16:04 To: LTspice@... Subject: [LTspice] help please...simple ways to create equation sources?
Hi everyone.
Is there an easy way to model a voltage or current source from a mathematical equation?
We are required to use LTspice in our EE circuits class to model some of the DC circuits in the lab, and I have also been using it as a check for problems I have worked out with paper and pencil. For simple DC analysis it works perfectly and is very easy to use to verify an answer obtained on paper.
Now enter the realm of working with differential equations in RLC circuits with sources consisting of a math function of time. It is not so obvious how to creat these type of source models when they are not simple sinusoids.
You need to use an "Arbitrary behavioural voltage or current source".
For example, a simple problem states the current through a 100uH inductor is I(t) = 20t*e^(-5t) A and wants a plot of the voltage. Obviously for such a simple problem can use the fact that V = Ldi/dt and with the product rule then V(t) = 2e^(-5t)*(1-5t) mV (I simplified the answer).
I certainly can draw a 100uH inductor and a "current" source from the LTspice symbols, but I am at a loss as to how to enter the equation for the current source into the model: I(t) = 20t*e^(-5t) amps so that I can view the voltage across and current through the inductor using the nice LTspice graphs.
There is a "BI" symbol which is easily overlooked. Go "Insert Symbol" and it's the first on the list after [Special Functions]. You can enter an arbitrary function for current using a wide range of formulea. I found a couple of potential "gotchas". Time is "time" not "t", and "20time" is interpreted as "20terra" you must put the "*" in. So I think for you problem you need:-
I=20*time*exp(-5*time)
But note that LTSpice won't simulate a perfect inductor. There will always be some "R" included. I also suggest that you read the help file section on this. Just search for "B" in the index.
If there is a tutorial dealing with all of this I would really appreciate the link.
There are lots of (LT)Spice tutorials but I don't think any would cover this stuff...