Lesson 3: Introduction to Simulation
Lesson 3: Introduction to Simulation
Wave Bounce Diagrams are useful visualization tools, and can assist in the learning of some RF concepts. However, it is impractical to try to solve actual circuits using this tool... especially over many frequencies.
Section 1: Using Mason to Solve Circuits
Step 1: How to place a control element
Figure 3.1: Selecting an item
These steps show you how to place control elements or parts.
Figure 3.2 Placing an item
Figure 3.3: Right click to stop placing an item
Step 2: Place the control elements
The next step is to place the Frequency block and two ports as shown in Figure 3.4.
Figure 3.4: Place these control elements using the techniques from Step 1
The ports have an associated impedance; this is equivalent to the source and the load impedances as seen in Figure 3.5. In particular, the Port 1 impedance is the source impedance (it will stay 50Ώ). The Port 2 impedance will be the load impedance, and will later be changed to 100Ώ in a later step. By making the load resistor into a port, we can easily measure the power that is transmitted to the load.
Figure 3.5: Source (50Ώ) and load (100Ώ) impedances
Step 3: Add a simple transmission line
Add a simple transmission line from the “mason_lumped_elements” library (using the same steps from Step 1).
Figure 3.6: Add a simple transmission line
Step 4: Fix the Width of the Value Field (if needed)
Left click on the transmission line and you will see a pop-up window. First notice the little horizontal line circled in red in Figure 3.7. It is just to the right of the Value text box. You want to grab that with a left click and drag that line as far as you can to the right (outside of the box is good). You will now be able to see and edit more text in this field.
Figure 3.7: First fix the width of the value text box
Step 5: Modify the Parameters
The next step is to change the values of the simple transmission line. This is a multi-step process.
Clock on the property to modify (e.g., z0 = 50).
Use the right arrow key to edit the text without deleting the argument
Backspace to delete the undesired value (e.g., 50)
Add the text for the desired value (e.g., 70.71)
Also modify the theta to be 90 (by default, degrees)
Click on the right port and make its impedance 100 (by default, ohms)
Figure 3.8: Modify the transmission line properties
Step 6: Connect the transmission line to the Ports
Use the wire tool to connect the transmission line with the ports. These are the nets (or nodes) of the circuit. Click on the picture to expand, if you need help locating the wire tool.
Figure 3.9: Add the lines using the wire tool
Step 7: Generate the symbol references
This is very important and many errors can be traced to improperly generated symbol references. You can manually provide references (which is why this is not automated), but it is safer to generate automatically. First, bring up the “Generate Symbol References” dialog.
Figure 3.10: Bring up the Generate Symbol References dialog
Forgetting to “Generate Symbol References” will generate errors, and is a common mistake to make when first using Mason. Try to remember this step!
Unless you are doing something advanced, make sure you click “All Sheets” and “All references”. Changing the “Start at value” can be useful when integrating Mason designs to those of other schematic tools within the layout.
Figure 3.11: Generate Symbol References dialog
Step 8: Run Mason and Plot
Figure 3.12: The Mason Toolbar in TinyCAD
The Mason Toolbar in TinyCad performs five functions. We only only use the first three in this example.
M: Runs Mason
C: Opens the console
P: Runs the Plotting program
Press M (you'll be prompted to save the file, which is required), then press C (the text that Mason spits out will be displayed), then press P (the plot program will open).
This is the actual simulation code. While this is where all the magic happens, the experience should be fairly transparent for the user.
This is the text that Mason outputs as it runs. The console updates in real time as Mason is running, but sometimes Mason exits too fast to see the text. Sometimes useful debug information can be found in this file.
Section 2: Mason Plot
The plotting program is hopefully fairly intuitive. You can resize the window to resize the plot.
Figure 3.13: Initial plot when using Mason Plot
Add the text S_2_2 on a second line below S_1_1 as shown in Figure 3.14. Click the refresh button.
Figure 3.14: Adding a second plot
To get the image in Figure 3.15, follow these five steps.
Click on Rect as a Plot Type, and click Refresh.
Change the Freq Unit to GHz, and click Refresh
Change the Start Freq to 0.5, the Stop Freq to 2, and the Step Freq to 0.1, and click Refresh
Change the Y Step to 10, and click Refresh
Figure 3.15: Displaying the logarithmic scale in the plot program
This plot shows the transmission line does a good job of matching the 50Ώ source impedance to the 100Ώ load impedance.
Of note is the difference between the Plot Types "Rect" view and the "Arg" view. These are both rectangular plots, however the "Log" view will plot phase as being only between +/- 180 degrees, while the "Arg" view will unwrap in degrees.
The equation that can be used in this program may be fairly involved, as shown in Figure 3.16. A full description (and most up to date list) of what can be used in equations is at: http://sites.google.com/site/circuitmason/wiki/muparser.
Figure 3.16: Insertion loss calculation
The blue line is the insertion loss, how much energy is burned up in the transmission line; the flat 0dB line means no power was burned up in our lossless transmission line. The red line relates the actual power delivered to the load [note: Mason adjusts the S-Parameters to make up for the difference in source and load impedance]. The difference between the power delivered to the load, and the power burned up in the transmission line, is the amount of power that was reflected back to the source.
Also of note is the difference between the Plot Types "Log" view and the "Arg" view. These are both rectangular plots, however the "Log" view will plot phase as being only between +/- 180 degrees, while the "Arg" view will unwrap in degrees.
Section 3: Observations
The reader has just gone through many steps to create a simulation (with practice, this is a quick simulation to set up). At this point, it is useful to shift focus away from learning how to perform the simulation, and consider what we are simulating. In particular, we are performing an RF analysis of the same circuit that we analyzed for steady state voltages in the previous lesson.
By selecting a transmission line that is 90˚ at our frequency of interest, 1GHz, we have created a “quarter-wave transformer”. In particular, when the transmission line's impedance is the geometric mean of the source and load impedance, then at that frequency the reflection will be minimized. The geometric means is:
Looking at Figure 3.15, we observe that at 1GHz, the system is perfectly matched. No energy is reflected back to the source, and Figure 3.16 shows us that all of the energy is delivered to the load. We could have gotten this result (at a single frequency) with a Wave Bounce Diagram using complex voltage waves. However, in about the time it would take to do the Wave Bounce diagram at a single frequency, we have the match versus frequency. Looking at Figure 3.15, we can quickly observe that the match stays pretty good from 0.8GHz – 1.2GHz, or a 40% bandwidth.
Even if one has certain expectations of how an RF circuit should behave, simulating the circuit can provide greater insights and will generally be less error prone than solving by hand.
Copyright 2010, Gregory Kiesel