代写Analogue Electronics / Electronic Engineering IX Laboratory Analogue Experiment 1 : An Introductio
- 首页 >> Algorithm 算法Analogue Electronics / Electronic Engineering IX Laboratory
Analogue Experiment 1 : An Introduction to SPICE
Introduction
This laboratory introduces a computer program which simulates the behaviour of electrical circuits. The program is a version of SPICE (Simulation Program for Integrated Circuit Engineering). The examples you will investigate are circuits associated with Analogue Electronics tutorials and lectures, but you can use SPICE throughout your course to investigate more complex electronic circuits.
SPICE was developed at the University of California at Berkeley in the 1970s, and for many years has been the most widely used circuit simulator in the electronics industry. You will be using PSPICE - a variant tailored specifically for PCs. This program enables you to build an electronic circuit design on the computer, simulate it using mathematical models for the devices you intend to use, and look at the modelled circuit properties before, after or during circuit construction.
The aims of this lab are to start to learn to use this advanced system and to construct a well-written lab report combining both experimental results and theoretical calculations. The material in the lab sheet is a basic start, but please feel free to play and experiment with the material given.
Note that this lab should be typed up and submitted with a proper scientific report format. You will be expected to export the simulation data required and analyse it, adding it to your report correctly, with accompanying text explaining what was done, your results, and the findings from these results. This data should be supported by theoretical calculations you have carried out, with any discrepancies found discussed and reasoned. The goal of any report is to make it possible for a reader who has no familiarity with the lab itself to understand the work conducted and the conclusions made.
Theoretical Background & Preliminary Analysis
Sketch the circuit to the right in a notebook. Calculate the voltages across each component, and the current flowing around the circuit. Record your analysis and your results in your lab book.
Sketch the circuit to the right in your lab book. If resistor R3 is 400 Ω, what is the combined resistance of the parallel components R2 and R3? Hence calculate the voltage between points X and Y, and therefore the current flowing through resistance R3. What is the power dissipated in R3?
If resistor R3 becomes very large, what will be the voltage across it and current through it? If resistor R3 becomes very small, what will be the voltage across it and current through it?
Opening PSPICE and Starting / Opening a Project
Start>CADENCE PCB 17.4-2019>Capture CIS 17.4. There will be a delay while the software is loaded and the licence server is accessed. You will then be given the option to select between two packages where you should select OrCAD PCB Designer Professional w/PSpice and CIS. (If your PC does not have this software installed, you can access it through the Glasgow Anywhere system by searching online, where you can log into a student remote desktop which will have the software installed).
Your first action must always be to open a project – either a new one when you are starting a design, or an existing one if you are returning to a previous design.
To create a new project :
Select File>New>Project from the menu bar.
In the New Project dialog box:
• Fill in a title for the project (e.g. AnalogLab1 – something suitable for later identification)
• Select the box titled Enable PSpice Simulation at the bottom of the menu.
• Click on the Browse key, select the drive H:\ in This PC and navigate to a suitable location. Click the Create Directory/ New Folder button and enter a suitable name for a subdirectory, e.g. AnalogElectornics1- Lab 1. Click on OK.
• Select this new directory and click on OK – the path and directory now show in the ‘location’ box. Click on OK in the New Project dialog box.
• Select the Create a blank project button.
• Click OK
This should open windows as shown below (some useful sections are flagged).
The Project Manager window (headed name.opj) shows the files associated with your design, and the resources which will be used, such as library files. The window PAGE1 is the Schematic Page Editor for your design. Click on it to make it the active window if necessary, and you will see a gridded area in which to draw your circuits, and the toolbar on the right hand side of the screen will activate.
To open an existing project :
In the future, you can open an existing design by
• Select File>Open.
• Locate drive H: and the appropriate subdirectory.
• Select the .opj file and click on OK.
• Expand the Design resources tree in the Project Manager window by clicking on the + boxes until you can see PAGE1 - double click on this to open the Schematic Page Editor
Basic Schematic Page Editor Operation
Zooming You can alter the size of the drawing sheet, zooming in to see details, or out to get an overall view of the sheet. Press key I to zoom in, or O to zoom out, or select menu View>Zoom , or right click for a pop-up menu.
Title Box Just as on a physical Engineering Drawing, there is a title box provided so that you can record useful project information. You should fill this in before you start any project.
• Click in the Schematic Page Editor window to activate it, if it is not already active.
• Scroll to the bottom right corner of the drawing sheet to find the title box.
• Zoom in if necessary
• Double click on the text <Doc>.
• Type your names in the Value box in the Display Properties dialog box and click on OK.
• Enter a title for the drawing in the <Title> field.
Types of SPICE Simulation
SPICE performs three main types of simulation, duplicating the three main types of physical circuit experiments:
• DC Analysis - we can select a DC input signal (such as that of a battery) and determine the steady state DC levels in the circuit, along with changes in these levels in response to other circuit changes.
• AC Analysis - we can select an AC input signal (such as that of a domestic power supply) and instruct SPICE to sweep this signal frequency over a selected range, so obtaining the magnitude and phase of the circuit response as a function of frequency.
• Transient Analysis - we can select an input signal which varies with time (usually a step function – i.e. investigating what happens in the first few moments of a system turning on), and we can examine the signal levels in the circuit as a function of time.
In today’s laboratory only DC analysis will be performed, and we will only compare our simulations with theory. However, in future laboratories, other types of analysis will be considered, and we will compare our simulation results both with theory and with experiment.
We will investigate the circuit to the right. To do an analysis we first use the Schematic Page Editor to place components (in this case resistors and voltage sources) and wire them into a circuit. Then a Simulation Profile is made, choosing the type of simulation (DC, AC or Transient). Finally the simulation is run and the results displayed, either by using quick analysis buttons, or a more powerful dedicated graphing tool called Probe.
Drawing a new Circuit for Analysis
The schematic below will be created, by picking a placing components from a parts library.
OrCAD Capture is a very powerful professional design tool. There are lots of libraries containing simulation information on thousands of devices and electronic components. We need to ensure the relevant libraries for our purposes are already loaded here.
Check that you have the correct parts libraries :
The row of buttons on the right hand side of the Schematic Page Editor allows us to modify our schematic. The top left button is the pointer. Just to the right of that is the place part button (looks like a small integrated circuit).
• Left-click on the place part button to open the place part window. This may look like the figure on the right hand side. It normally reveals a list of components which can be scanned through
• In the Libraries section ensure you have ANALOG, Design Cache, OPAMP and SOURCE. (the figure to the right only has the Design Cache library.
• If you need to add more libraries, go to add library, or click on the button that looks like a small rectangular sheet of paper.
• In folder pspice select the needed library then hit open.
• Once you have done this for all needed libraries, the place part window will look like the one below.
Select parts to place :
You can now select the required electronic components and position them on the drawing sheet.
• From the Place Part dialogue box, click on the ANALOG Library.
• Type ‘R’ into the box labelled Part.
• Ensure R is highlighted in the Part List
• Note that it is called R? and has a default value of 1kΩ.
The resistor will now move around the work-area with the mouse until you left-click on the mouse to secure it in place. Once positioned in the work area, the first resistor assumes the name R1 and ‘snaps’ to the grid, which is just visible. Each successive resistor will be numbered in sequence, even if you delete an earlier one.
Although each component must have a unique name (number), it can have any value you like. To exit from placing resistors, right click the mouse and select End mode, or simply hit the PC ESC key.
If you are unable to add libraries, all components needed for simulations can also be accessed by selecting Place at the top of the screen and navigating to the desired component.
Editing parts in place :
A component (resistor R1 here) can be made ‘active’ by a single left-click with the mouse (make sure you click on the very centre of the component, not the wires at the edge) . Once active (it will change colour from blue to pink), it can be moved around the work-area by holding down the left mouse button and moving the mouse. Double left-click over the name box (R1) to change the resistor name (it must still have “R” as the first designator to show that it is a resistor), or the value box (1k) to change its value from the default one.
To change the orientation of the resistor with respect to the grid:
• Make it active,
• enter the Edit menu and click Rotate,
• or press the R as a short-cut, or
• right-click on the active component and click rotate. (With this method you can rotate in either direction depending which mouse button does the final click – try it out.)
• Try all three methods to familiarise yourself with this operation. It will be used frequently.
You will notice that if you execute a single left-click with the mouse button after a resistor has been “picked- and-placed” from the Get New Part file and then move the mouse point, a new resistor is revealed whose reference number is incremented by one on the last. This new resistor can be rotated using either of the second to methods described above before it is located in a suitable position within the work-space.
The procedure of “drawing” extra resistors in this fashion can be repeated as many times as necessary. A single right-click, or hitting the ESC key will exit resistor placement. Obviously, this is a much quicker method of ‘drawing’ large numbers of resistors compared with accessing the Get New Part file repeatedly. Practice ‘drawing’ resistors this way; an unwanted resistor can be removed by highlighting it and then pressing the Delete key.
Remember to make regular backups of your work using Save or Save As from the File menu.
Ensure that two resistors are placed as part of the circuit schematic shown at the bottom of page 3.
Complete the placement of additional parts :
• Pick and place a DC voltage source (VDC) from the sources library give the DC voltage source a value of 10V .
• For the analogue ground symbol (GND_ANALOG) you will need to use the special ground symbol on the right hand menu. If needed go to add library, then in folder pspice select the SOURCE library then hit open.
• In the SOURCE Library choose the Part labelled ‘0’. This sets up a zero reference voltage. If your GND symbol does not have a ‘0’ next to it, your simulations will either run incorrectly or not work at all.
Wire up the circuit :
The final task in constructing the circuit diagram is to connect the components. This is done using the Place Wire button on the main menu bar of Schematics toolbar (below the pointer button).
• Place the cursor where you wish to start ‘wiring up’ the circuit.
• Press ‘W’ on the keyboard or alternatively press the wire button on the tool bar on the right. This accesses the wiring function.
• Click on one of the nodes of your components (shown as a red square) and move your cursor to the node you wish to connect.
• Once you have clicked on both of these nodes, a wire will form. connecting these components.
Circuit Simulation
This circuit is now ready for simulation. Since all the components have fixed (defined) values, PSPICE can in this instance simply calculate the different DC bias voltages and currents in the circuit.
• Click on the New Simulation Profile button on the toolbar at the top of the screen denotes as a sine wave with a green plus symbol.
• Call the new simulation ‘Sim1’ or something sensible. Ensure none is selected from the Inherit from box. Ensure there are no spaces or you will receive an error message.
• A Simulation Settings window will appear; simply click OK.
• Depress the ‘VD’ and ‘CD’ bias display buttons on the top toolbar.
• Click the Run PSPICE Simulation button.
You may see a new window opening, in which the results of the simulation are registered. If the circuit contains an error, a window will open giving details of possible reasons why PSPICE has been unable to carry out its calculations. If the simulation runs without errors, the message “Simulation Running ….” Will appear, and the Probe tool will open a graph with Time on its x-axis . It is likely that this will all happen in a backgrounded window – and since the results of this simulation are simple, there is no reason to use the Probe tool at this time.
Ensure that you are viewing the Schematics window. Press the ‘VD’ and ‘CD’ bias display buttons on the top toolbar to display the calculated values of the circuit currents and voltages as shown. Do these results agree with the theoretical analysis carried out at the beginning of the laboratory?
Submission:
For this section of your lab, please record an image of your circuit like that shown above with your voltage and current bias points shown. This should be accompanied with your matching theoretical calculations for the same circuit.
A more Complex Circuit Simulation – DC with a varying parameter
The next circuit contains one difference from the first one. An addition resistor, R3, has been placed in parallel with the fixed 400 Ω resistor. This resistor will be varied from 100 Ω to 1000 Ω and the voltage across the parallel combination and the currents through all components will be studied as it varies.
Add the extra resistor in parallel with R2. To let PSPICE know that the value of R3 must be varied during the simulation, we will use a PARAMETERS command which is selected from Get New Part (as PARAM, from the SPECIAL library) in the same way as a resistor. PARAM is placed in the work- area but is not initially attached to any component.
Varying a circuit parameter :
We set up a varying parameter with the following sequence of steps :
• Change the value of R3 to {RES1} – exactly as typed including the curly brackets. RES1 will be the name of our varying parameter. Note the name of the resistor should remain R3.
• Open Edit simulation profile (beside the New Simulation Profile button) on the main menu bar of Schematics.
• Open Analysis type and click on DC Sweep.
• In DC Sweep, activate Global Parameter: Type ‘RES1’ (without quotation marks) in the Parameter Name box, activate a Linear sweep, and check Primary sweep in the Options box. Finally set the Start, End and Increment values to 100, 1000 and 10 respectively. Click OK in DC Sweep.
This sets up a varying parameter, RES1, which slides from 100 to 1000 (Ω is assumed) and is associated with the value of R3. However, PSPICE also needs us to ‘give permission’ for this variable to exist. This is done by the following procedure (a pain, but it is how PSPICE works). Follow all of these iinstructions exactly and in order.
• From the Place menu in Capture, choose Part.
• Using the Place Part dialog box, add SPECIAL.OLB to the project.
• In the Libraries list box, select SPECIAL.OLB.
• From the Part List list box, select PARAM and click OK.
• Place an instance of the PARAM part on the schematic page.
• Double-click the PARAM part to display the Property Editor and click New Property.
• The Add New Property dialog box appears. Note: In the Property Editor window, you can display properties in row and column format. The pivot button can make this window clearer by swapping to a row view.
• In the Name text box, enter RES1, without curly braces.
• Specify the value as 100 and click OK. This creates a new property for the PARAM part, as shown by the new column labelled RES1 in the Property Editor window.
• Select the new cell RES1 and right click Display.
• In the Display Format frame, select Name and Value and click OK.
• Click Apply to update all the changes to the PARAM part.
• Close the Property Editor window.
This involved procedure allows RES1 to vary as described in the DC Sweep setup. PSPICE will perform. multiple simulations, each one with a different value of RES1, and store all the results to be plotted later. The circuit schematic is now ready for simulation and should be similar to the one shown below.
Performing and analysing a series of simulations :
Press the Run Simulation button. A series of simulations is started which will calculate DC results for the circuit at values of R3 between 100 Ω and 1000 Ω in steps of 10 Ω, storing the resulting data.
You may see simply an empty plot on the simulation window, this is normal as you have not instructed PSpice what to display. Navigate back to the schematic window and select the voltage probe (there are two with the letter ‘V’, ignore the button with two probe icons). Once selected you can move your cursor and click on any wire, which will then add a trace to your simulation. You can select and delete these at any time.
Plot the voltage at point X (the top of R2 and R3 in the schematic directly above) as a function of R3. When R3 = 400 Ω does the voltage at point X agree with your preliminary theoretical analysis? How about for much larger or smaller values of R3?
Submission:
In your simulation window on the top bar select Trace>Cursor>Display. This will generate two sets of cross- wires which can be moved across the graph using the ← and → keys. A box showing the numerical values of the voltage at point X and the resistance of R3 at the intersection of the cross-wires is also opened. Experiment with the left- and right-click buttons on the mouse to see how the two sets of cross-wires can be manipulated back and forth.
You should plot and compare the total current in the circuit, the current through R1, with the currents in the two branches of the parallel network, i.e. the currents in R2 and R3. This is not as straightforward as displaying the voltages, because the sign of each current depends on precisely how you drew the schematic diagram and the rotation of each component. Of course the sum of the currents through R2 and R3 should equal the current through R1. Check that it does (This can be done by inspecting the values on the table).
To export the data from the simulation you can select File>Export>Comma Separated File (.csv file). You will need to select which traces you wish you export, and give the file an appropriate name. This will allow you to transfer the points on your simulation to any spreadsheet program (your PC will come with a licensed copy of Microsoft Excel). Using Excel you can create a graph from your data points, which should be appropriately labelled, with a title, axis titles and fonts sufficiently large to read in your report.
From this section you should produce the following results. A plot of Voltage at point X, a plot with current traces through R1, R2 & R3 with the associated table (values copied into a table on your lab report), and theoretical calculations to support your findings.
Maximum Power Dissipated in a Load Resistor
The purpose of this short final experiment is to show that maximum power transferred from a sub- circuit to a resistive load does occur when the load resistance is equal to the internal resistance of the source (you may not have done this in lectures yet, and so the theory is sketched below).
Theory :
The circuit to the right is effectively split into two portions: the load resistor to the right of the terminals A and B, and the remainder of the circuit to the left of the terminals A and B. Just consider this left hand part. The Thévenin resistance of this part is the total resistance between A and B with the voltage source shorted, i.e. 100 Ω in parallel with 400 Ω. This means the effective resistance of the left hand side is 80 Ω. The maximum power transfer theorem says that you would expect maximum power dissipation in the load resistor R3 when the value of the load resistor was equal to the Thévenin resistance of the source, that is R3 = 80 Ω. We will test this using PSPICE.
Simulation :
Perform. a DC Sweep on the circuit tested above, this time with Start, End and Increment values of 10, 1000 and 5 Ω respectively. Note that PSPICE will not accept a start value of 0 Ω. Simulate the system over these values of R3. It is critical to edit the simulation parameters to produce the graph showing the maximum power dissipation.
Once your simulation is running you can show the power by selecting on the top bar Trace>Add Trace then selecting on Simulation Output Variables ‘W(R3)’
In Probe, plot the power dissipated by R3 versus the value of R3. Use the Cursor to determine the maximum power and the corresponding value of R3.
Submission:
Similarly to the previous section, you should export your data to a .csv file, and produce a graph on excel showing this data. With clear labelling.
Please support your findings with theoretical calculations.