Skip to content
Physics and Astronomy
Home Our Teaching Resources CDHW Electronics2 SimSheet-01.html
Back to top

PHY2028 SimSheet-01
Getting Started with Spice

Reminder

Performing simulations of circuits should be approached in the same systematic manner as the laboratory exercises. In particular, all relevant information should be recorded in 'notebooks' at the time the exercises are undertaken. These 'notebooks' may be electronic (e.g. PDF or Word documents) or paper-based. Source files must be included (include print-outs or copy-and-paste), and a disk copy kept. Work must be turned-in (use BART for paper or ELE upload for electronic submission) for marking by Monday 1430hrs and will normally be marked and returned at the next class. Use the University ELE Server to submit e-notebooks and monitor your marks.

Homework

Read the Quickstart Tutorial for Spice 3 and answer the following questions in your notes:

  1. In a Spice source file:
    1. Why is it not possible to specify a component on the first line?
    2. What is the purpose of a line starting with a '*' character?
    3. How would you represent a 10 Mohm resistor, shown on a circuit diagram as R6 connecting nodes 3 and 7?
    4. What is the meaning of the line: L18 4 8 5.0E-3 ic=1m ?
  2. Briefly describe the current and voltage polarity conventions used by Spice.
  3. There are no 'ammeter' components in Spice, so what is the recommended way to get it to determine the current flowing through a branch?
  4. What command will cause Spice to calculate the quiescent state of a circuit?
  5. Explain why you would expect to find at least one line starting .subckt in the source file used to analyse a circuit comprising three identical op-amps.

Getting your own version of Spice

There are many versions of Spice available, several of them free. Spice runs quite well on quite modest (by today's standards) machines. Students taking PHY2028 and wanting a version of Spice to run on their own personal computer should choose one that is compatible with Spice 3. There is a list of recommended versions for common operating systems on the School's Recommended Software.

Practical Session

We will be using the MacSpice 35f 2.10 on multiuser Mac OS X machines. MacSpice is compatible with, and a descendant of, Berkeley Spice 3f5. The original Spice built-in help command is rather primitive. The same information (and more!) is available in the MacSpice User's Guide.

Locate MacSpice in the /Applications folder, drag its icon into your Dock. The first time you launch MacSpice it will create a working directory inside your Documents folder and will assume that any filename which does not specify an absolute path refers to files in this folder. Locate TextWrangler in the /Applications folder. Double-click its icon to start the application. If this is the first time you have opened TextWrangler, the user manual and registration window will open and, if so, close them.

Solving a Resistor Network

Circuit 13.1 Resistor Network

Copy the circuit diagram into your notebook. Make sure that all nodes and all components are labeled clearly. Hand calculate the voltage at each node and the current flowing in each branch of your circuit.

Milestone 1

The first task will be to find the voltage at node 3 of circuit 13.1 (above). This will involve creating a source-file for Spice as follows:

  1. Choose a unique filename for the circuit, in this case it will be called CW121004-02.CIR, and include it on the diagram. (Use your initials for the first 2 characters and the date for the next 6. e.g. the file CW121004-02.CIR was the first document I created on 16 November 2003.)
     
  2. Launch MacSpice by clicking the icon you added to the dock (see above).
     
  3. Download the file CW121004-02.CIR into the MacSpice working directory.
    [Note: If you are using Safari for the Mac and have not changed its default behaviour, a mouse-down on the link will download the file to the Downloads folder (or the desktop on older iMacs). To specify another location, control-mouse-down on the link and select 'Download linked file' from the menu that appears.]
     
  4. Open CW121004-02.CIR with MacSpice and try, in order, the following interactive commands (links are to the explanations in the Spice User's Guide):
       
    List these, and describe the effect of each command, in your notebook. The parameters listed by show for the resistors and voltage source are explained in Appendix B of the userguide.
     
  5. Record the values of node voltages and branch currents found by MacSpice in your notebook and check they agree with the values you calculated above.

You can use the MacSpice edit command to edit the current source file, or to create a new one. For example, to create a new circuit called CW061031.CIR:
 
MacSpice 8 -> edit CW061031.CIR
 
Observe how MacSpice interacts with TextWrangler, the 'helper application', when you save changes and close the editor's document window.

Milestone 2

Draw and label the circuit (13.2) corresponding to the source file CW121004-03.CIR. Note: Spice 3 allows non-numeric names for devices and nodes, except in the case of ground which is always '0'.

Milestone 3

Circuit 13.3 Circuit for analysis.

Using what you have learned above, create your own Spice source file for circuit 13.3. Hence calculate the power dissipated by the 1K resistor and the voltage at the output. Explain why the calculated power associated with one of the voltage sources is negative.

Milestone 4

Circuit 13.4 Cube of 10kohm resistors

Circuit 13.4 is a cube with each side a 10K resistor. Use Spice to calculate the resistance between the diagonal corners (A and B) of the cube. [Hint: connect one corner to ground, and the other to a voltage source.]

Milestone 5

                                                                                                                                                                                                                                                                       

Validate   Link-check © Copyright & disclaimer Privacy & cookies Share
Back to top