Changes

Analog Tutorial Lesson 1: A Simple Voltage Divider Circuit

955 bytes removed, 14:16, 4 November 2015
/* Saving Your Circuit */
{{projectinfo|Tutorial| A Simple Analog Voltage Divider Circuit |b2TUT1_1.png|In this project, the basic concepts of RF.Spice A/D are demonstrated, and a simple voltage divider is examined.|
*Voltage Source
*Data Graphs
*Data Tables
|All versions|{{download|http://www.emagtech.com/contentdownloads/project-file-download-repository|ProjectRepo/AnalogLesson1.zip Analog Tutorial Lesson 1|[[EM.Cube]] 14.8}} }}
=== What You Will Learn ===
In this tutorial you will build a linear circuit consisting of a voltage source and two resistors. The purpose of this tutorial is to help you become comfortable with the [[RF.Spice A/D]] Workshop, which includes the [[Schematic Editor]] for drawing circuits and the Data Manager for plotting your simulation results. A picture of the finished circuit for this tutorial is shown below:
== Opening the RF.Spice A/D Program ==
After installing [[RF.Spice A/D]], double click on the "RFSpice" icon on your desktop to start the application. Or go to the [[Windows]] START menu and navigate to the [[RF.Spice A/D]] menu and run the application from there. This will bring up a clean circuit window. The cursor will be in the form of the selection arrow.
== Placing the Parts ==
There are many different ways in [[RF.Spice A/D]] to place a part in your circuit. All these methods do the same job. So it is simply a matter of personal preference which method to choose. Generic parts can be accessed from the Parts Menu. You can also click on the Add Part Toolbox on the left side panel and browse the parts database alphabetically or using other criteria or filters such as a part's function or manufacturer.
{{Note | Most generic parts in [[RF.Spice A/D]] have intuitive Netlist-compatible [[Keyboard Shortcuts|[[Keyboard Shortcuts|[[Keyboard Shortcuts|[[Keyboard Shortcuts|[[Keyboard Shortcuts|[[Keyboard Shortcuts|[[Keyboard Shortcuts|[[Keyboard Shortcuts|[[Keyboard Shortcuts|[[Keyboard Shortcuts|[[Keyboard Shortcuts|[[Keyboard Shortcuts|[[Keyboard Shortcuts|[[Keyboard Shortcuts|[[Keyboard Shortcuts|[[Keyboard Shortcuts|[[Keyboard Shortcuts|keyboard shortcuts]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]. You can easily place them in your circuit by simply typing their shortcut on your keyboard. All [[Keyboard Shortcuts]] keyboard shortcuts are case-insensitive.}}
Once you select your part, the mouse cursor changes to a ghost of your selected part. Move the mouse to a location in the main window where you want to place your part and left-click to drop it. After placing the part, it remains selected. This allows you to duplicate or rotate the device immediately after placing it.
In many cases, you may prefer to rotate a part or flip it vertically or horizontally. While the part is selected, use the [[Keyboard Shortcuts|keyboard shortcuts]] {{key|Ctrl+R}} or {{key|Ctrl+Alt+R}} to rotate it clockwise or counterclockwise, respectively. Or use the [[Keyboard Shortcuts|keyboard shortcuts]] {{key|Ctrl+F}} or {{key|Ctrl+Alt+F}} to flip it horizontally or vertically, respectively. You can also do the same operations using the program [[menus]] or contextual [[menus]], which can be accessed by right-clicking on the selected part.
{{Note|As soon as you place a new part, you can click the right mouse button to rotate the part sequentially as many times as you like.}}
You can easily copy, paste cut or delete an part in your circuits. First, select the part and then select the corresponding items from the '''Edit Menu''' or the contextual menu. Alternatively, you may use the standard [[Windows]] [[Keyboard Shortcuts|keyboard shortcuts]] {{key|Ctrl+C}}, {{key|Ctrl+V}} and {{key|Ctrl+X}} for copying, pasting and cutting and the {{key|Delete}} key for deleting a selected part.
{{Note|Using the keyboard's {{key|Space}} bar duplicates the last placed part.}}
== Drawing the Wires ==
There are several ways to connect parts by wires. The formal way of doing that is using the Wire Tool. Click the '''Wire Mode''' [[File:b2Wire_Tool.png]] button of the '''[[Schematic toolbar|Schematic Toolbar]]''' or select the '''Wire Mode''' item of the '''Edit Menu''', or simply use the keyboard shortcut {{key|Ctrl+W}} to enter [[RF.Spice]]'s Wire Mode. The mouse cursor turns into a cross shape. You can draw a multi-segment wire between any two points anywhere in your circuit. Each left mouse click will start a new segment. You can end a wire segment by clicking the right mouse button or double-clicking the left mouse button. Of course, to connect two parts, you should draw a wire between two pins of the two parts. Once you are done with wiring, you must return to the normal Select Mode. This is done by clicking the '''SelectMode''' [[File:b2Select_Tool.png]] button of the '''[[Schematic toolbar|Schematic Toolbar]]''' or by selecting the '''Select Mode''' item of the '''Edit Menu''', or by simply pressing the keyboard's {{key|Esc}} key.
By default, [[RF.Spice A/D]] restricts the wire segments to perpendicular lines. To be able to draw arbitrary oblique wires, you need to deselect the button labeled "'''Restrict Wire Drawing to Perpendicular Lines'''" [[File:b2Perpend_Tool.png]] on the '''[[Schematic toolbar|Schematic Toolbar]]'''.
{{Note|[[RF.Spice A/D]] also offers a much easier way of wiring parts without changing the drawing mode. If you click on a pin of an unselected part and start dragging the mouse, a wire comes out of that pin, stretches as long as you drag the mouse and ends wherever you drop the mouse. In this way, you can draw a wire between any two part pins and connect them.}}
Using one of the methods described above, connect your voltage source and two resistors. Once you are done with the wires, notice that at the points where the wires intersect the terminals of devices, there is a bold point where a connector is automatically inserted.
{{Note|All [[RF.SpiceA/D]] circuits require a ground. You can insert a ground using the keyboard's {{key|Insert}} key or by simply typing {{key|0}} on your keyboard.}}
Insert a ground at the bottom of your circuit on the wire the connects the bottom pins of your voltage source and vertical resistor.
== Setting the Part Properties ==
Every device in [[RF.Spice A/D]] has a label or name and a number of [[parameters]]. Almost all parts have default parameter values when they are first created and placed in your circuit. You can change either the label or the parameter values at any time. The parameter values can be modified and set permanently or they can be varied temporarily during a sweep analysis. To change the label or parameter values of a part, double-click on it to open its '''Property Dialog'''.Double-click the voltage source symbol in your circuit to open its property dialog as shown in the figure below. Change the DC voltage of the source to 5 Volts in the box labeled "Value". At this time, you will leave all the other [[parameters]] at their default choices. Next, double-click the vertical resistor to open its property dialog as shown in the figure below. Change its resistance to 2K. You will keep the horizontal resistor at its default resistance value of 1K.
<table>
<math>V_{R2} = \frac{R_2}{R_1+R_2} V_s = \frac{2}{3} V_s</math>
To start a live simulation, click the "'''Go/Run'''" [[File:b2Run_Tool.png]] button of the '''[[Main toolbar|Main Toolbar]]''', or select the "'''Go/Run'''" item of '''Simulate Menu''', or simply use the keyboard shortcut {{key|Ctrl+G}}. You will notice the timer window next to the Run button starts showing the passage of time. However, you won't be able to notice any other change on the screen. You can view the value of voltages, currents or powers on your circuit. To do so, you should press one of the buttons [[File:B2V_Tool.png]], [[File:B2I_Tool.png]] or [[File:B2P_Tool.png]] on the '''[[Schematic toolbar|Schematic Toolbar]]''' to display '''Voltage Text''', '''Current Text''' or '''Power Text''', respectively. To hide the texts, press the relevant buttons once again to deselect them. The following figures show the voltage and power texts.
<table>
</table>
Keep in mind that since your voltage source is DC, the voltages, currents or powers do not change a function of time. Therefore, you will continue to see fixed values of these circuit quantities. To stop a live simulation, click the "'''Stop/Reset'''" [[File:b2Stop_Tool.png]] button of the '''[[Main toolbar|Main Toolbar]]''', or select the "'''Stop/Reset'''" item of '''Simulate Menu''', or simply use the keyboard shortcut {{key|Ctrl+E}}.
Before moving to the next section of this tutorial, let us verify the results that you have got so far. The current in your circuit is given by:
[[Image:b2TUT1_7.png|thumb|570px|Live circuit parameter control panel.]]
Now that we have the circuit at a steady state, we can experiment with the [[Parameters]] tab in the Toolbox to see how the voltages change in response to changes in other device values. [[RF.Spice A/D]] is one of the few programs that allows interactive real-time changes in device [[parameters]] while a simulation is running, allowing you to immediately see the response to those changes. Click on the '''[[Parameters]]''' tab of the '''Toolbox''' on the left side panel of the program window to display the "Live Circuit Parameter Control Panel". The display should look like the opposite figure. The radio buttons at the top of the screen labeled '''All''', '''Some''', and '''Few''', control how many of the available [[parameters]] to display. The '''Few''' button displays only the most basic [[parameters]] such as a device's model and its main value. '''Some''' will list even more [[parameters]] and '''All''' will list all the available [[parameters]]. For our purposes, '''Few''' is enough.
Let us change the resistance of the horizontal resistor R1 to see how it affects the output voltage across the vertical resistor. With the simulation running, click on the r1.resistance box of the Live Circuit control panel. This should make it active and allow you to change the resistor R1's value by either typing a new value in the text box in the top section, or using the slider to drag the value up or down. Let's first try changing the value by using the text box. Erase the existing value of 1K and type in 2K. Click on the return arrow next to the box or press the Enter key to accept the change. As the resistance of R1 and R2 are now equal, the output voltage should change to 2.5V. Next, use the slider to lower the resistor's value. Click on the slider bar and drag it down (to the left) slowly and watch what happens to the voltage text label. As expected, the output voltage rises. Then, drag the slider in the opposite direction to the right to increase the resistance of R1. The output voltage will drop.
You can continue to experiment with the various [[parameters]] in the live circuit control panel to investigate their effects on the circuit.
== Running a DC Bias Test ==
[[File:b2TUT1_8.png|thumb|250px420px|The Test Panel.]]
To run a test, you need a little bit of advance planning. All the test results will be displayed in graphs or tables in separate windows. [[File:b2TUT1_10RF.png|thumbSpice A/D]]offers a variety of test types for different analysis purposes. The simplest one is the '''DC Bias Test'''. As part of your test planning, you must identify your project's observables, that is the circuit quantities you are particularly interested in and would like to plot them in a graph or list them in a table. In this tutorial lesson, as you saw earlier, all the voltages, currents and powers are fixed and do not change. Therefore, there is nothing to graph. However, you can find the DC bias operating point of your circuit.
To run a testFirst, you need a little bit go back to your circuit and double click on resistor R1 and change its resistance back to the original value of advance planning1K. All Then, go to the test results will be displayed in graphs or tables Toolbox on the left side panel and click on the '''Tests''' tab. Select DC Bias option by checking the leftmost check box in separate [[windows]]the "basic" column. [[RFThe Tests Dialog should look like the opposite figure.Spice A/D]] offers a variety of Click the "'''Setup'''" button in the DC Bias test types for different analysis purposesrow to open the test settings dialog. The simplest one Test Settings Dialog is also shown in the opposite figure. Make sure that the '''DC Bias Single Test'''. As part of your test planning, you must identify your project's observables, that tab is the circuit quantities selected as you are particularly interested in and would like do not want to plot them in run a graph Sweep or list them Monte Carlo analysis at this time. Also, make sure the check box labeled "'''Table'''" is checked in a tablethe "Output Results Options" section of the dialog. In Click the "Run Test" [[File:b2RunTest_Tool.png]] button of this tutorial lessondialog, as you saw earlieror alternatively, all select '''Run Test Batch''' from the '''Simulate Menu''' or use the keyboard shortcut {{key|Ctrl+B}}. The operating point quantities of your circuit including the node voltages, and the currents and powers of all devices are fixed and do not change. Therefore, there is nothing to graph. However, you can find tabulated in a separate window at the DC bias operating point bottom of your circuitthe Workshop as shown in the figure below.
First, go back to your circuit and double click on resistor R1 and change its resistance back to the original value of 1K. Then, go to the Toolbox on the left side panel and click on the '''<table><tr><td> [[Tests]]''' tabImage:b2TUT1_10. Select png|thumb|250px|Table showing the DC Bias option by checking the leftmost check box in the "basic" columnbias test results. The [[Tests]] Dialog should look like the opposite figure.</td></tr></table>
Click the "'''Setup'''" button in In this case, the DC Bias test row to open operating point of the test settings dialogcircuit is the steady state solution for the circuit. The Test Settings Dialog should look like In general, the figure below: DC operating point is the solution of the circuit with all capacitors open, all inductors shorted, and all the non-constant sources at their initial values.
Make sure that the '''Single Test''' tab is selected as you do not want to run == Running a DC Sweep or Monte Carlo analysis at this time. Also, make sure the check box labeled "'''Table'''" is checked in the "Output Results Options" section of the dialog. Click the "Run Test" [[File:b2RunTest_Tool.png]] button of this dialog, or alternatively, select '''Run Test Batch''' from the '''Simulate Menu''' or use the keyboard shortcut "'''Ctrl+B'''". The operating point quantities of your circuit including the node voltages and the currents and powers of all devices are tabulated in a separate window at the bottom of the Workshop as shown in the figure below: ==
[[File:b2TUT1_12.png|thumb|250px|DC Sweep Setup dialog.]]
You had a good start. But how does the output voltage (across R2) vary with respect to the voltage generated by the voltage source? To answer this question, you will next perform a DC Sweep Test. If you are still in the Test Settings Dialog, you need to go back to the Tests Dialog. To do so, click the right arrow button at the top of the dialog or click the button labeled {{key|All Tests}} at the bottom of the dialog. Uncheck the DC Bias test and instead check the '''DC Sweep''' at its leftmost check box in the "Basic" column. Then, click the {{key|Setup}} button in the DC Sweep test row to open the test settings dialog again. This time, the Test Settings Dialog should look like the figure below:
In this case, the DC operating point of the circuit is the steady state solution for the circuit<table><tr><td> [[File:b2TUT1_13. In general, the DC operating point is the solution of the circuit with all capacitors open, all inductors shorted, and non-constant sources at their initial valuespng|thumb|left|500px|Edit Plot List dialog.]] </td></tr></table>
== Running A From the "Source" drop-down list, select "v1", with the "'''Property'''" set to "'''DC Sweep '''". Set the Start Value to 0, End Value to 5 (Volts) and Step Value to 100m (millivolts). Make sure again that the '''Single Test ==''' tab is selected. Also, make sure the check box labeled "'''Graph'''" is checked in the "Output Results Options" section of the dialog. Before running the test, you have to instruct B2.Spice what you want to plot at the end of the test. Click the button labeled "'''Preset Graph Plots...'''". A new dialog opens up, which looks like the figure shown above. The dialog contains a tabled titles "'''Signal Name'''" that lists all the signals available for graphing. Select '''v(2)''' from the table by highlighting it and click the button labeled {{key|Add->}} to move the signal to the other table on the right titled "'''Graph Name'''". You can add different signals and can further change the list items using the {{key|<-Remove}} button. Click the OK button of the dialog to accepts changes and close it.
This was a good start{{Note|The voltages are defined by referring to the nodes of the circuit. But how does the output voltage v(across R22) vary with respect to means the voltage generated by the voltage source? To answer this question, you will next perform a DC Sweep Test. If you are still in the Test Settings Dialog, you need to go back at Node 2 reference to the [[Tests]] Dialogground. To do so, click the right arrow button at the top of You can see all the dialog node numbers or click labels by clicking the button labeled "'''All Show Node Names" [[TestsFile:b2Nodes_Tool.png]]'''" at the bottom button of the dialog. Uncheck Schematic Toolbar or using the DC Bias test and instead check the '''DC Sweep''' at its leftmost check box in the "Basic" columnkeyboard shortcut {{key|Ctrl+Alt+N}}. Then, click the "'''Setup'''" button in the DC Sweep test row to open the test settings dialog again. This time, the Test Settings Dialog should look like the figure below: }}
{| border="0"|-| valign="top"|[[File:b2TUT1_12.png|thumb|left|250px|DC Sweep Setup Dialog]]| valign="bottom"|[[File:b2TUT1_13.png|thumb|left|440px|Edit Plot List Dialog]]|-|} From the "Source" drop-down list, select "v1", with the "'''Property'''" set to "'''DC'''". Set the Start Value to 0, End Value to 5 (Volts) and Step Value to 100m (millivolts). Make sure again that the '''Single Test''' tab is selected. Also, make sure the check box labeled "'''Graph'''" is checked in the "Output Results Options" section of the dialog. Before running the test, you have to instruct B2.Spice what you want to plot at the end of the test. Click the button labeled "'''Preset Graph Plots...'''". A new dialog opens up, which looks like the figure shown above. The dialog contains a tabled titles "'''Signal Name'''" that lists all the signals available for graphing. Select '''v(2)''' from the table by highlighting it and click the button labeled "'''Add->'''" to move the signal to the other table on the right titled "'''Graph Name'''". You can add different signals and can further change the list items using the "'''<-Remove'''" button. Click the OK button of the dialog to accepts changes and close it.  {{Note|The voltages are defined by referring to the nodes of the circuit. v(2) means the voltage at Node 2 reference to the ground. You can see all the node numbers or labels by clicking the "Show Node Names" [[File:b2Nodes_Tool.png]] button of the [[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|[[Schematic toolbar|Schematic Toolbar]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] or using the keyboard shortcut "'''Ctrl+Alt+N'''".}}  [[File:b2TUT1_15.png|thumb]]If you display/activate the nodes in your circuit, your schematic must look like the following figure:
<table>
<tr>
<td> [[File:b2TUT1_15.png|thumb|300px|The voltage divider circuit with node labels enabled.]] </td>
</tr>
</table>
Now click the "Run Test" button [[File:b2RunTest_Tool.png]] of the dialog once again to run the DC Sweep test. A new graph appears at the bottom of the Workshop on a separate tab next to the DC Operating Point table of the previous test. The graph is shown in the figure below:
|-
| valign="top"|
[[File:b2TUT1_14.png|thumb|left|600px720px|The output voltage plot.]]
|-
|}
As you expected, the graph is linear with a positive slope of 2/3. You’ll notice that as you move the mouse over the graph, the location of the cursor is listed in the status bar at the bottom of the graph. Each graph has its own toolbar and menu with tools that you can use to further examine the graph. Probably, the most important and useful of these are the '''Tracking Crosshairs''', which can be activated by clicking the
"Track Selected Plot" [[File:b2TrackCH_Tool.png]] button of the '''[[Toolbars#Graph_Toolbar |Graph Toolbar]]'''. Also, each graph has additional tabs in the '''Toolbox'''. These include '''Edit plots''', '''Edit Graph''', '''Edit Axes''' and '''Tracker''' tabs. These tab appear in the Toolbox side panel only when the graph is active. For example, using the Edit Graph tab, you can change the title of the graph and its background color, while using the Edit Plot tab, you can change the color of individual signals. [[B2RF.Spice A/D]] allows you full customization of your graphs including adding new graphs based on mathematical expression involving the existing signals. == Saving the Circuit ==
== Saving Your Circuit ==
Now choose Don't forget to save your project. Choose '''Save...''' from the '''File Menu''' or use the keyboard shortcut {{key|Ctrl+S}}. Since the circuit does not have a name yet, the program will prompt you to name the circuit. Name it"AnalogLesson1.CPR", then you can quit and take a break. Besides saving the project in RF.Spice's native circuit project file format with a "'''.CPR'''" file extension, you can also save the schematic of your circuit in the schematic file format with a "'''.SCM'''" file extension, or save the "Netlist" version of your circuit in a text file with a "'''.CIR'''" file extension.
<p>&nbsp;</p>
[[Image:Back_icon.png|40px]] '''[[RF.Spice_A/D #RF.Spice_A.2FD_Tutorials | Back to RF.Spice A/D Wiki Tutorial Gateway]]'''
28,333
edits