Table of Contents.
Lesson 1: Creating a net list and a Simple Simulation.
Lesson 2: Introduction to and applications of frequency analysis.
Lesson 3: Introduction to and applications of transient analysis. This page.
Lesson 4: Locating, modifying, and installing vacuum tube models.
Lesson 5: Operating point of vacuum tube circuits. Introduction to stepping and plate curves.
Lesson 6: Using stepping to do frequency response of a tone control.
Lesson 7: Transient analysis of unregulated power supplies.
Lesson 8: Transient analysis of power supply regulators.
Lesson 9: Transient and frequency analysis of amplifiers with feedback.
Lesson 10: Lossless transformers.
Lesson 3
Introduction to and applications of transient analysis.What you will learn in Lesson three. How to:
- Set up a generator to mimic the mix of DC and AC found at the plate of a tube or output of a rectifier.
- Examine how a low pass RC filter effects the output of the above generator.
- Examine how a high pass filter effects the output of the above generator.
- Examine the effect a low pass filter has on square waves.
- Examine the effect a high pass filter has on square waves.
- Examine the turn on characteristics of an unregulated power supply.
- Measure the amount of ripple in an unregulated power supply.
- Do a square wave test on an amplifier.
- Measure distortion in an amplifier.
Things That are very Hard to Remember.
That step by step procedure given in lesson one has been placed in a text file which can be downloaded by holding the control key while pressing enter on the link.
On my computer the file opens as if it were a webpage. Control enter on the link will open the file in a separate window. That way you can refer to it without closing the lesson page. Control tab will switch between the two windows.Here is more information you can look up because it is so hard to remember. Control enter on this link for the same reason as above.
Preliminary comments.
Transient analysis for the sighted means looking at graphic displays of quantities that change rapidly with time. Such varying values will generate a great deal of printed data. Maybe too much. Although the definition of "too much" may depend on who is doing the reading and how grate is the need for the information. I will attempt to present useful procedures for obtaining the output in printed form and hope the reader can acquire enough skill in operating the program to adjust the amount of output to suit himself.Procedure from Lesson one.
The step by step procedure has been placed in a text file which can be downloaded from right here.
On my computer the file opens as if it were a webpage. I recommend holding the control key as you press enter on the link to open the file in a separate window. That way you can refer to it without closing the lesson page. Control tab will switch between the two windows.COMING SOON to this space, A Downloadable File listing syntax of the netlist and spice directives. Stay tuned.
Setting up a generator to output a mix of AC and DC.
Starting now I'm going to do a little less hand holding than I have been. The syntax for a sine generator is,
Value = Sin(DCV ACPV Frequency)
Where, DCV is the DC voltage of the generator.
ACPV is the peak AC voltage of the generator, and
Frequency is frequency.
There are additional parameters but we don't have to deal with them at this time.
For the moment the generator will be the only thing in the netlist. The syntax is,
V1 0 n1 Value ; comment.
Arrow across these syntax statements to be sure you know where spaces are supposed to be and where they are not supposed to be.
Since you are new to the ".tran" directive I'll give you full help with it. It is,
".tran 0 1.0015s 1s 100us"
This means the transient analysis starts at zero time but data is not saved.
The analysis runs until 1.0015 seconds.
Data is saved starting at one second.
The maximum time step is 100 u s which is 0.1 m s.
If the transient analysis were under as tight control as the frequency analysis this would yield 10 points per cycle of the input wave. However, if LTspice thinks you have made a poor choice it will move the points closer together so there will be more of them. That is what was done.
When you save your netlist I suggest a file name of ftb-fig-03-01. The correct extension will be attached automatically.
So what did you get?What you should have gotten.
The text table should have begun with 1.0 and a bunch more zeros in the first column and 5.0 and a bunch more zeros in the second column. The second column values will rise and get very close to 6 but never get there. Maybe if you had set the maximum time step to 1 u s it would have but that would have been sure to generate a much longer table. The values will decrease again and cross 5 and approach 4 but never quite get there. They will cross 5 again, approach 6 and should end at 5.0 with a bunch more zeros, but it doesn't. It seems as if the table was cut off prematurely. That's why I had you extend the time for longer than one full cycle.This sine wave that never passes through zero is an example of what you might find at the collector of a transistor. Also, although the wave form is different it is also analogous to the output of the simplest of all power supplies, a rectifier followed by a single shunt capacitor.
Low Pass Filter.
Now add the following lines to your netlist.R1 1 2 10k ; Filter resistor.
C1 2 0 0.15uf ; Filter capacitor.You will probably feel obligated to add them after the V1 generator line but to be perfectly honest about it it won't make one whit of difference where you put it as long as it is before the "end" line. Experiment if you like. Put them before the generator, one before and one after, both after the .tran directive. LTspice just doesn't care.
You should have gotten a sine wave that began at 4.95 volts , passed through 5 and topped out at 5.05 volts. It still has an average value of 5 volts but the amplitude is down to 0.1 volts peak to peak. What happens if you make the capacitor bigger, say twice, 5 times and 10 times. Notice that the DC level is unaffected but the AC amplitude can be reduced to as small as you have capacitors to put in the circuit.
This is the power supply function of this circuit. The AC represents the ripple in the power supply and we want to make it as small as we can. Although the effect of load current will reduce the DC component somewhat we can minimize this by making the resistor small and the capacitor bigger to make up for it.
High pass filter.
Since you are still a neophyte at this you may want to delete the lines for R1 and C1 and completely replace them. The alternative would be to edit the lines but that is for experienced users. The new lines are,C1 1 2 3.3uf ;
R1 2 0 10k ;Now you see, or should have seen, that the output signal at node 2 starts out very close to zero, almost makes it to 1, crosses zero, almost makes it to minus 1 and returns to zero again.
What have we seen? The AC part of the signal has been passed on to the output while the DC component has been effectively removed. This is the interstage coupling capacitor function.
A square wave generator.
To generate a square wave the function is known as "pulse". So here is the syntax.
Pulse(Low High Delay Risetime Falltime OnTime Period NumberOfCycles)
Low and High are the voltages of the low and high levels. They do not have to be symmetrical about zero. They can be anything that takes your fancy.
Delay is the time before the generation of waves begins.
Risetime and Falltime are the rise time and fall time of the wave. If entered as zero the default is 1/10 of the period. For a quicker rise and fall a value must be entered.
The OnTime is the time that the wave is high. To make it a true square wave it must be half the value of the period.
The period is 1/frequency just as with any other wave shape.
NumberOfCycles allows limiting the number of cycles for some special simulations. If the value is omitted or entered as 0 the generator runs for the full time of the simulation.
For this simulation the syntax is "pulse(-1 1 0 1us 1us 0.5ms 1ms)".
Square wave and low pass filter.
First of all if you haven't saved file "FTB-fig-03-02" lately, do it now.
Then load file "FTB-03-01".
Do the following right now, not in a few minutes.
Press alt-F and select "Save as" from the menu. In the file name box change 01 to 03. Tab to save and press enter.
Now change the V1 line value from "Sine etc, etc," to "pulse(-1 1 0 1us 1us 0.5ms 1ms)".
Now change the value of C1 to 0.01uf and save the netlist.
Run the simulation, export the text file, and read it.
The output takes a short time to follow the first transition from -1 to the 0.9 region. It finally makes it up to 1.00 etc at 0.188 ms. Notice that there is a big time jump from 2.60e-4s to 5.01e-4s. The programmers must have put in a test for an unchanging value and programmed a skip.
Change the capacitor to 0.1 uf and run it again. Then change to a 1 uf and run. What kind of wave form are you getting now.
Square wave and high pass filter.
First of all if you haven't saved file "FTB-fig-03-03" lately, do it now.
Then load file "FTB-03-02".
Do the following right now, not in a few minutes.
Press alt-F and select "Save as" from the menu. In the file name box change 02 to 04. Tab to save and press enter.
Now change the V1 line value from "Sine etc, etc," to "pulse(-1 1 0 1us 1us 0.5ms 1ms)".
Now change the value of C1 to 0.01uf and save the netlist.
Run the simulation, export the text file, and read it.
Notice a very rapid transition from -1.24e-2 to +1.18 between the first and second points. Then a gradual decay towards zero reaching +1.33e-2 before making another sudden transition from that value to -1.18 volts between 5.010e-4s and 5.015e-4s. The rapid rises and falls are the rises and falls of the original square wave being coupled through the RC filter. But after the transition the capacitor is unable to hold the charge for very long and it decays towards zero until another transition comes along.
Change the capacitor to 0.1 uf and run it again. Then change to a 1 uf and run. What kind of wave form are you getting now.
Transient analysis of a power supplies' turn on characteristic.
When modeling a power supply for a simulation there is no real need to include the transformer. This would become necessary if transformer saturation needed to be taken into account. In the models used here the transformer will be represented only by the resistance of its windings. The transformer secondary will be represented by two series generators each one with a resistor in series with it, and the connection between the two grounded as in a center tapped secondary with the center tap grounded.Verbal Description of Power Supply.
On the left are two voltage generators connected in series. The positive of the bottom one is connected to the negative of the top one. The node connecting the two generators is grounded. The positive of the top generator connects to one end of R1, a 50 ohm resistor. The other end of R1 connects to the anode of a diode, D1, 1SR154-600. The cathode of D1 connects to a node named C1. The negative of the bottom generator connects to one end of R2, a 50 ohm resistor. The other end of R2 connects to the anode of D2 another 1SR154-600. The cathode also connects to the node named C1. The positive end of a 40 u f cap, C1 connects to the node named C1. The negative end of the capacitor C1 is grounded. A resistor, R3, 500 ohm, connects from node C1 to node C2. The positive end of another 40 u f cap, C2, connects to the node named C2. The negative end of the capacitor C2 is grounded. A resistor, R4, 500 ohm, connects between nodes C2 and C3. The positive end of a third 40 u f cap, C3, connects to the node named C3. The negative end of the capacitor C3 is grounded. One end of a load resistor, R5, 2.13 k ohms connects to node C3. The other end of R5 is grounded. End verbal description.Netlist for Power Supply.
* C:\...\LTspiceXVII\FTB-fig-03-05.asc.
V1 0 N001 SINE(0 226 60) ; Top half of transformer secondary.
R1 N001 N002 50 ; Resistance of top half of transformer secondary.
D1 N002 C1 1SR154-600 ; Top diode.
V2 0 N003 SINE(0 226 60) ; Bottom half of transformer secondary.
R2 N004 N003 50 ; Resistance of Bottom half of transformer secondary.
D2 N004 C1 1SR154-600 ; Bottom diode.
C1 C1 0 40µf ; First filter cap.
R3 C1 C2 500 ; First filter resistor.
C2 C2 0 40µf ; Second filter cap.
R4 C2 C3 500 ; Second filter resistor.
C3 C3 0 40uf ; Third filter cap.
R5 C3 0 2.13k ; Load resistor.
.lib standard.dio ; Location of diode model.
.tran 0 0.4 0 8.33333ms ; Transient 0 to 0.4 seconds, step 8 and 1/3 msec.
.endDon't forget to save the file. Call it "FTB-fig-03-05.asc"
In this netlist I am surprised to see something that I thought wouldn't work. I am referring to C1 being connected to a node named C1 etc. I must admit that I am letting LTspice generate these netlists. The lists are then edited to be in the same order as the verbal description. That's how I knew the location of the model file for semiconductor diodes.This netlist generates a lot of data in spite of my asking for data points every half cycle of the line frequency. Start by looking at the beginning and a few points after. Then find the time close to 8.3333 ms, 8.3e-3. Next look near 17 ms then 25 ms. After that double the time for the next examination. 50 ms, 100 ms, 200 ms, and 400 ms. If you look closely at the C1 voltage just before 400 ms you will see some ripple with a period of 8.33 ms.
Measuring the ripple.
Measuring the ripple with accuracy requires a circuit modification. At each point where we want to know the ripple we must attach a high pass filter to remove the DC which is zero frequency and pass the higher frequency Ac where the frequency is 120 Hz in north America. This will consist of a 1 u f capacitor in series and a 10 k ohm resistor to ground. The nice thing about netlists is that things don't have to be in order. The three nodes where we want to measure the ripple are C1, C2, and C3. Let's make three new nodes and name them H1, H2, and H3. H is for hum. So you need to add the following three lines to add the capacitors. Add them after the R5 line.
C4 C1 H1 1uf.
C5 C2 H2 1uf
C6 C3 H3 1uf.
After that add these three lines to add the resistors to ground.
R6 H1 0 10k.
R7 H2 0 10k.
R8 H3 0 10k.
One more change. We need to let the simulation run longer and join it in progress.
Enter this new tran directive.
.tran 0 0.8s 0.7s 8.3333ms This tells LTspice to run the simulation for 0.8 seconds but don't start recording data until 0.7 seconds have elapsed.
At this point save the file as FTB-fig-03-06.asc.
After you export the data as text select H1, H2, and H3 from the list. You won't have nearly as much data to read this time.Square Wave Test.
I'm not going to ask you to type in the netlist for a complete power amplifier. Instead I'll give you a simple one transistor circuit. With a little trickery going on in the emitter circuit.Verbal Description.
On the left is a voltage generator, V1, which depending on the context can generate either a 1 volt sine wave or a 10 mv square wave. The negative side of V1 is grounded and the positive end goes to C1, 1 u f. The other end of C1 goes to node B. Node B also connects to one end of R2, a 6.4 meg ohm resistor. The other end of R2 goes to the positive side of V2 a 20 volt DC generator. The negative side of V2 is grounded. Node B also goes to the base of the transistor, Q1, 2N3904. The emitter of Q1 goes to node E. Node E goes to ground through R1, a 4.7 ohm resistor. In parallel with R1 is C2 a 4.7 u f capacitor. The collector of Q1 goes to node C. Node C also connects to one end of R3, 10 k ohms. The other end of R3 connects to the positive side of the 20 volt generator, V2. Node C also goes to one end of C3, 1 u f. The other end of C3 goes to node out. Node out goes to ground through a 100 k ohm resistor. End verbal description. It gets more complicated, doesn't it. I never promised you a rose garden. I think this is the point where we separate the serious student from the casual observers. If you are really serious you will try to make the netlist from the verbal description. If you don't try you'll never learn to do it for yourself.Spice Netlist.
You don't really have to type in the entire comment about the number of connections to the transistor.
* C:\...\LTspiceXVII\CE Amplifier.asc ; Partial path and file name.
V1 N001 0 PULSE(-10mv 10mv 0 1us 1us 0.5ms 1ms) AC 1 ; Square or sine wave depending on spice directive.
C1 N001 B 1µf ; Coupling and DC blocking cap.
R2 N002 B 6.4Meg ; Base current bias resistor.
V2 N002 0 20 ; 20 volt DC Vcc.
Q1 C B E 0 2N3904 ; Amplifying device. I was surprised to find four nodes listed for the transistor.
* Some semiconductor devices have four leads. Sometimes the fourth lead is a connection for grounding
* the metal can of the device. MOS devices have a substraight which is brought out to a lead so it
* can be connected to the most negative part of the circuit. Sometimes this is ground, but
* sometimes it isn't. It doesn't matter if the fourth lead is present or not, it must be
* grounded whether it exists or not.
R1 E 0 4.7 ; Emitter degeneration resistor.
C2 E 0 4.7µf ; Emitter partial bypass cap.
R3 N002 C 10k ; Collector load resistor.
C3 out C 1µf ; Output coupling and DC blocking cap.
R4 out 0 100k ; Simulation of next stage load.
.lib standard.bjt ; Location of transistor model.
.op ; Directive to find DC operating point.
;.ac dec 3 1 10Meg ; Run frequency response from 1 Hz to 1 MHz. ; indicates disabled.
.tran 0 1.0015s 1s 1ms ; Transient 0 s to 1.0015 s start watching at 1 s.
.endType this in, run it, export the data, and read it. As you look at the output You will see the spikes caused by a rise at high frequencies. If you are not quite sure what you are looking at try this. Instead of exporting the voltage at the node named out, export the voltage at N001. This will show you what a square wave looks like in a text file.
You might want to look at the frequency response. To do this place a semicolon in front of the ".tran" directive and remove the semicolon from in front of the ".ac" directive. Than run and export. Remember to export the voltage at node "out".
Measuring Distortion in an Amplifier.
If you performed the last step in the section above go back and place a semicolon in front of the ".AC" directive and remove the semicolon from in front of the ".tran" directive.
Change the first part of the value of V1 from "PULSE(-10mv 10mv 0 1us 1us 0.5ms 1ms)" to SINE(0 10mv 1kHz). Leave the AC 1 part alone.
Place a semicolon at the beginning of the C2 line.
Add the following line after the ".tran" line.
.four 1kHz V(out)
After making these changes select save as, and change the file name to FTB-fig-03-06.cir.
Press control R but don't export the data to the text file.
It is already there. Press control L. The spice error log will open and the focus should be on it. Down arrow through the lines until you come to total harmonic distortion. It will be about 5%. That's about right for this kind of circuit.End of Lesson 3.
If you can honestly checkoff each item on the list under the heading "What you will learn in lesson 3", you can go on to lesson 4, assuming I have written it by then.
This page last updated March 10, 2020. Home.