LTSpice Simulation
Guide Slides
Prof. Heng CH has created a very comprehensive guide on how to setup LTSpice and how to run simulation.
Please download it from Canvas or here:
Accelerate Simulation
If you are facing the problem that the simulation runs extremely slow, go to "setting"
, and select "SPICE" panel .Make sure you choose "Gear" under the Default Integration Method.
This will accelerate your simulation.
Note: if you already selected Gear but your simulation stopped halfway and never moved forward, consider redoing the recoding of signals.
Tricks to power up OpAmps
Use Net labels to tidy up your schematic. In the below example, all ports labeled -Vcc is supplied with -5V from the power source at the bottom, similarly, all ports labeled Vcc is supplied with 5V.
Remember to include the library files
Always remember to include the OpAmp library files by writing them into the SPICE directive.
An example of a schematic used OpAmp LM6172, LM7171B, and AD8056.
The file name following ".inc" should be the same as the library file downloaded from Canvas. And make sure they are under the same folder as your schematic.
Feed recorded signal (.dat) as simulation input
If you want to test the performance of your LTSpice design, you can feed the recorded noisy signal as the input of the circuit, and probe the waveform at the output to observe, or save the output as a .wav file, then feed it into GNURadio to see what's the PSR count of the filtered signal.
To do so:
- Right-click the power source, under "style", choose "PWL FILE="..."".
- Fill in the path to the .dat file, or simply click "Browse" and select the file
- Use Net Name to label your output, i.e. vout
- Add analysis command line ".tran 0 4ms"
- Add this line in the SPICE directive: ".wave name_the_file.wav 16 4e6 vout".
- 16 is the number of bits, ranging from 1 to 32. The higher the bits the slower the simulation
- 4e6 is the sample rate of the simulation. Similarly, the higher the sample rate, the slower the simulation. You need to make sure this sample rate is the same at the GNURadio setting (4MHz).
The sample rate of your LTSpice simulation should match the sample rate of your opamp_file.grc fs_in.