Basic Tutorial Lesson 13: Creating a New Part from Your Analog Circuit
Contents
What You Will Learn
RF.Spice A/D allows you to take a circuit and turn it into a user defined part. Almost any circuit can be turned into a part with just a few steps. The new device is stored in RF.Spice's Parts Database. You can create multiple instances of your new device in any circuit. In this tutorial lesson, you will learn how to use RF2.Spice's Device Manager. You will create a voltage multiplier circuit as shown below and then will turn it into a new database device. in this lesson, you will also learn how to set up a parametric sweep in RF.Spice A/D.
Building the Voltage Doubler Circuit
RF.Spice A/D consists of two separate applications: the Workshop and Device Editor. in this first part of this tutorial lesson, you will build a voltage doubler circuit in the Workshop. Here is a list of the parts needed for your circuit:
Part Name | Part Type | Part Value |
---|---|---|
V1 | Voltage Source | Waveform = Sinusoidal, Amplitude = 5V, Frequency = 1MHz, Offset = 0V |
C1 | Capacitor | 1n |
C2 | Capacitor | 1n |
D1 | Diode | Defaults |
D2 | Diode | Defaults |
IN | Subcircuit Port Marker | N/A |
OUT | Subcircuit Port Marker | N/A |
GND | Subcircuit Port Marker | N/A |
Connect the part as shown in the figure below and place a ground.
Markers have many uses in RF.Spice A/D. First and foremost, they are used to identify and label the nodes of a circuit. When creating a new part out of your circuit, you need to use markers to designate the input/output nodes or pins of your new device. In other words, you need subcircuit port markers. To place a Subcircuit Port Marker, you can use the keyboard shortcut Alt+R, or alternatively, you can go to the Markers Submenu of the Parts Menu and pick up the right marker type.
If two nodes in a circuit have markers with the same name, then those two nodes are considered to be identical or connected to each other. |
For analog and mixed-mode circuits, you use Subcircuit Port Markers to designate the ports and device pins. |
Running a Transient Test of the Voltage Doubler Circuit
To make sure that your voltage doubler circuit works properly, run a quick transient test with the following parameters:
Start Time | 0 |
---|---|
Stop Time | 10u |
Linearize Step | 10n |
Step Ceiling | 10n |
Preset Graph Plots | v(in), v(out) |
Run the transient test and you will get a graph like the one shown in the opposite figure. You can see that after 8 microseconds, the output voltage is an almost clean DC of 8.71V. An ideal voltage doubler would produce a DC voltage of 10V. The discrepancy here is due to the junction voltage drops at the two diodes.
Creating a New Part
Before creating your new part, you need to make some decisions. Do you want to create a part that functions a one-port DC voltage source with an internal sinusoidal source? Or do you want to create a signal conditioning device that takes a time varying signal at its input port and generates a doubled DC voltage at its output port? In this lesson, you will choose the latter case. Therefore, you do not need the sinusoidal voltage source as part of your new device. Go ahead and delete it!
At this point, you are ready to create your new part. Go to the Workshop's File Menu and select "Create Part from Circuit...", or simply use the keyboard shortcut "Ctrl+M". The program will then prompt you for a name. Enter the name you wish for the new part, say, "MyVDoubler", and click OK. Then the program will ask if you would like it to create a symbol for your part. If you already have a symbol ready, click NO and Workshop will then ask you to select a symbol from the Parts Database. Otherwise, click YES and Workshop will create a generic box symbol to be used with your new part. The new device "MyVDoubler" is now in the database and you're ready to use it or further customize it.
After you create a new part either from the Workshop or using Device Editor, you need to close the RF.Spice A/D application and re-open it to update the Parts Bin. |
Using Your New Part in a New Circuit
Your new device "MyVDoubler" must by in your Parts Bin and ready to use. Start a new RF.Spice A/D project in the Workshop. Open the Parts Bin in the "Add Part" tab of the Toolbox. Open the "Name" tab and click the letter "M" to display all the part names starting with M. Scroll all the way down to find your new part. Double-click on it and place its ghost on the schematic. You should see a rectangular box like in the figure below.
Keep in mind that since you asked the program to create a symbol for your new device automatically, the new symbol might be far from good-looking (as you can see from the above figure). But don't worry - you can change the symbol and improve its appearance as you will do later. For the time being, you would like to see if your new device functions correctly as you would expect. Double-click the device to open its property dialog as shown in the figure below.
Notice the new symbol appearing in the property dialog of the part. Click the button labeled "Edit Model..." on the right side of the dialog. A new dialog open ups with the title: "Edit Subcircuit Text" as shown in the above figure. Here you see the Netlist code for your model, which is in fact the Netlist representation of your original voltage doubler circuit minus the voltage source. You can edit this Netlist model at any time if you like. Close both dialogs and return to the Schematic Editor.
Now, insert a new sinusoidal voltage source with an amplitude of 5V and a frequency of 1MHz identical to the previous section of the lesson. Connect it to the "IN" port of your device. Connect the "GND" pin of your device to the new circuit's ground. At the "OUT" pin of the device, place a large 1M resistor as a sort of "Open" load. Your new circuit should like the figure below:
Run the same transient test as before from 0 to 10 microseconds. This time look for the voltages at nodes 1 and 2. The resulting graph is shown in the opposite figure. It is almost identical to the previous graph that you got when testing your original voltage doubler circuit. Congratulations! Your new device works!!!
Running a Parametric Sweep
The reason you placed a large 1M resistor at the output of your device was to reproduce the same conditions as in your original circuit just for the purpose of verification. Next, you will explore the effect of resistive loading on your device. You will use RF.Spice's "Parametric Sweep" capability for this task. The goal is to vary the resistance of R1 and observe the effect on the output voltage, hoping that your new device still continues to provide a clean DC voltage twice as large as the input amplitude. The test type you will perform is still "Transient" as before.
Bring up the Transient Test from the Tests Toolbox, and set the parameters for the test as follows: