Basic Tutorial Lesson 13: Creating a New Part from Your Analog Circuit

From Emagtech Wiki
Jump to: navigation, search
Tutorial Project: Creating a New Part from Your Analog Circuit
B2TUT5 1.png

Objective: In this project, you will first build and test a voltage doubler circuit and you will then turn it into a reusable database part.

Concepts/Features:

  • Diode
  • Markers
  • Subcircuit Port Marker
  • Transient Test
  • Parametric Sweep
  • Sweep Parameter

Minimum Version Required: All versions

'Download2x.png Download Link: Analog Lesson 5

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
The Marker's property dialog.

Connect the part as shown in the figure below and place a ground.

The voltage doubler circuit.

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.

Attention icon.png 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.
Attention icon.png 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.

The results of transient test of the voltage doubler circuit.

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.

Attention icon.png 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.

B2TUT5 12.png

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.

The new part's property dialog.
The new part's subcircuit model text.

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:

The results of parametric sweep transient test of the voltage doubler circuit.

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!!!

The results of the transient test of your new circuit with the new MyVoltageDoubler part.

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:

Start Time 0
Stop Time 10u
Linearize Step 10n
Step Ceiling 10n
Preset Graph Plots v(in), v(out)

Don't forget to uncheck the "Basic" check box of Transient Test from the previous step of this tutorial lesson. Instead, check the middle check box in the "Sweep" column as shown in the figure below. Click on the Setup button to open the Transient Test Setup Dialog, also shown below. Note that this time the "Sweep" tab is active at the lower portion of the dialog.

Transient Test Settings Dialog
Sweep Settings Dialog

Click the "Sweep Setup..." button of the dialog to open up the Sweep Settings Dialog as shown in the above figure. This is where you set up all your sweep parameters and their ranges and other properties. In this case, you will sweep the resistance of R1. Note that the top table of the dialog list's all the parts in your circuit along with their individual parameters. For example, you can see the "resistance" of the resistor "r1" and all the specific properties of the sinusoidal voltage source "v1" including its peak amplitude "Va" and frequency "Freq". Click on the first row of the table to highlight the resistance of "r1". In the middle section of the dialog titled "Parameter Setup", you will see the name "r1.resistance". Select the radio button "Sweep Parameter". You will sweep the resistance with the values 1K, 10K, 100K and 1M. So select the "Decade" option for "Interval Type". Set the start and end values at 1k and 1M, respectively, with the number of steps per interval equal to 1. Click the "Accept Changes" button. The sweep parameters with its values now appears in the bottom table. It shows 4 iterations based on the range you just defined.

Attention icon.png When you have more than one sweep parameter, you can changes their hierarchical order using the "Move Up" and "Move Down" buttons. The order is important for plotting families of curves.

Close the Sweep Settings Dialog and return to the Transient Test Setup Dialog. In the "Output Results Options" section of dialog, check the "Graph" box. Open the Edit Plots List Dialog and keep only the output voltage signal v(2) in the Graph table. Click the Run button to run the transient sweep test. The graph shown in the opposite figure will appear at the bottom of the Workshop. It shows the output voltage signal for the successive values of the resistance R1. As you can see, once the resistance falls below 100K, the circuit fails to function properly and ripple start to appear. At R = 1K, the output voltage is a sawtooth waveform with a peak amplitude of only 5V as the sinusoidal input.

The results of parametric sweep transient test of the voltage doubler circuit.

 

Back icon.png Back to RF.Spice A/D Tutorial Gateway