Where To Find This Example
Download Project
Design Notes
Square Wave Harmonics
This project is a collection of square wave sources with different harmonic content, to illustrate the principles of harmonic balance circuit simulation. There is a series of similar schematics containing the square wave voltage source PORT_SQR. Each schematic has a different harmonic content specified, from one harmonic to 64 harmonics.
Results
The square wave results for each schematic with varying harmonic content can be seen the graphs. The graphs labels relate to the number of harmonics set in the corresponding schematic. Note the extremes, 1 harmonic will produce a pure sine wave while 64 harmonics is very close to an ideal square wave. The graph "Square wave time all" shows all the different harmonic settings in one graph.
Notice that there was a zero rise time and fall time set for the source for each square wave. As the number of harmonics is increased, the rise and fall times can be displayed in the response. The importance is that if the rise and fall time for each harmonic content were to be measured on the graphs, each would be different. Therefore, it is important in a simulation to distinguish between rise and fall time due to limiting harmonics, and rise and fall time due to actual circuit performance.
Specifying Harmonics
You can set the number of harmonics globally from "Options > Default Circuit Options > APLAC Sim". For this simulation the number of harmonics for each schematic is locally. To see this, select one of the schematics (with a left mouse click), lets say "square_wave_1harmonic" in the project tree (left side of project windows when "Proj" tab is selected on the bottom). Right click and select "Options ...". You then select the "APLAC Sim" tab to see that you can set the number of harmonics locally here. If you check all of these settings you will see that they are set accordingly to get the results seen in the graphs.
Schematics
Each schematic has three elements, the square wave voltage source PORT_SQR, a zero ohm resistor, and a termination port. The fifty ohm termination port impedance matches the fifty ohm source impedance of the PORT_SQR port. The zero ohm resistor simply creates two unique port labels; two terminations connected to one another would cause overlapping ports and is not allowed.
Schematic - square_wave_64harmonic
Graph - square wave time all
Graph - square 1 harm time
Graph - square 5harm time