+ All Categories
Home > Documents > B2 Spice Version 5

B2 Spice Version 5

Date post: 07-Oct-2014
Category:
Upload: maria4now
View: 1,335 times
Download: 15 times
Share this document with a friend
Popular Tags:
163
B 2 Spice Version 5 USER’S MANUAL Manual by Thien Nguyen, Christopher Hsiong and Jon Engelbert © 1996 - 2005, Beige Bag Software, Inc. [email protected] www.beigebag.com (734) 332-0487
Transcript
Page 1: B2 Spice Version 5

B2 Spice Version 5

USER’S MANUAL Manual by Thien Nguyen, Christopher Hsiong and Jon Engelbert

© 1996 - 2005, Beige Bag Software, Inc. [email protected] www.beigebag.com (734) 332-0487

Page 2: B2 Spice Version 5
Page 3: B2 Spice Version 5

T A B L E O F C O N T E N T S

Introduction ......................................................................................................................................... 1 About B2 Spice v5 ......................................................................................................................... 1 System Requirements ................................................................................................................... 2 Package Contents.......................................................................................................................... 2 Technical Support .......................................................................................................................... 2 Installation ...................................................................................................................................... 2 About the user documentation ...................................................................................................... 2 Legal Notes .................................................................................................................................... 3

Please note:............................................................................................................................... 3 Copyright / Proprietary Protection............................................................................................. 3 License Grant ............................................................................................................................ 3 Limited Warranty ....................................................................................................................... 3 No Liability for Consequential Damages .................................................................................. 3

Overview ............................................................................................................................................. 4 Toolbox........................................................................................................................................... 4

Add Parts ................................................................................................................................... 4 Circuit Parameters..................................................................................................................... 4 Tests and Simulations ............................................................................................................... 4 Animation ................................................................................................................................... 5 Project Management ................................................................................................................. 5 Wizards ...................................................................................................................................... 5 Graph and plot control............................................................................................................... 5

Virtual Instruments ......................................................................................................................... 5 Wiring ............................................................................................................................................. 6 Windows ......................................................................................................................................... 6 Toolbars ......................................................................................................................................... 7 Choosing and Placing parts........................................................................................................... 7

Function ..................................................................................................................................... 8 Manufacturer.............................................................................................................................. 8 Name ......................................................................................................................................... 8 Part Palette................................................................................................................................ 8

Working with other applications..................................................................................................... 8 Modifying the Parts database........................................................................................................ 9 Schematic editing overview ........................................................................................................... 9

How to place parts..................................................................................................................... 9 Set model properties ................................................................................................................. 9 Set device properties................................................................................................................. 9 Change a symbol....................................................................................................................... 9 Wiring......................................................................................................................................... 9 Move, delete, duplicate parts .................................................................................................. 10 Undo/Redo............................................................................................................................... 10 Naming and numbering nodes................................................................................................ 10 Controlling part display............................................................................................................ 10 Combiners, Splitters and Rippers ........................................................................................... 10 Borders .................................................................................................................................... 10 Title Box and print displays ..................................................................................................... 10 Grids ........................................................................................................................................ 11 Autosave.................................................................................................................................. 11

Wizards......................................................................................................................................... 11 Tutorials ............................................................................................................................................ 12

Analog Tutorial #1 ........................................................................................................................ 12 Tutorial #1: Step 1 ................................................................................................................... 12 Tutorial #1: Step 2 ................................................................................................................... 12 Tutorial #1: Step 3 ................................................................................................................... 13 Tutorial #1: Step 4 ................................................................................................................... 14 Tutorial #1: Step 5 ................................................................................................................... 14 Tutorial #1: Step 6 ................................................................................................................... 16 Tutorial #1: Step 7 ................................................................................................................... 17 Tutorial #1: Step 8 ................................................................................................................... 20

Page 4: B2 Spice Version 5

T A B L E O F C O N T E N T S

Analog Tutorial #2.........................................................................................................................21 Tutorial #2: Step 1....................................................................................................................21 Tutorial #2: Step 2....................................................................................................................21 Tutorial #2: Step 3....................................................................................................................22 Tutorial #2: Step 4....................................................................................................................22 Tutorial #2: Step 5....................................................................................................................24 Tutorial #2: Step 6....................................................................................................................25 Tutorial #2: Step 7....................................................................................................................26 Tutorial #2: Step 8....................................................................................................................27

Tutorial - Creating a Part from a Circuit .......................................................................................28 Step 1 - Setting up the circuit for part creation. ......................................................................28 Step 2 - Creating the part ........................................................................................................29 Step 3 - Modifying the new part...............................................................................................29

Tutorial - Creating a Parameterized Subcircuit Part....................................................................30 Step 1 - Create a Parameterized Subcircuit Model Type. ......................................................30 Step 2 - Make a simulation model using the Parameterized Subcircuit Model you just created......................................................................................................................................32 Step 3 - Create a new Part with the simulation model............................................................33

Digital Tutorial #1..........................................................................................................................34 Insert an input...........................................................................................................................34 Insert two more input ports ......................................................................................................34 Insert a 3-input nand gate, an Inverter, and an output port....................................................35 Draw the wires..........................................................................................................................35 Test the circuit ..........................................................................................................................35 Save the Circuit ........................................................................................................................36

PCB Tutorial..................................................................................................................................36 How to add a new PCB package.............................................................................................36

Eagle to B2 Spice Tutorial ............................................................................................................40 Draw the Eagle schematic .......................................................................................................40 Import into B2 Spice.................................................................................................................41 Run a Test................................................................................................................................42

Tests and Simulation.........................................................................................................................44 Simulation .....................................................................................................................................44

Simulations ...............................................................................................................................44 Simulation Stimuli.....................................................................................................................45 Setting up probes for simulations ............................................................................................46 Simulation Options ...................................................................................................................46

Tests..............................................................................................................................................48 Test Stimuli...............................................................................................................................49 Distortion Test ..........................................................................................................................51 AC Sweep Test ........................................................................................................................52 Noise Test ................................................................................................................................52 AC Sensitivity Test...................................................................................................................53 DC Bias Test ............................................................................................................................54 DC Sensitivity Test...................................................................................................................55 DC Sweep Test ........................................................................................................................55 DC Transfer Function (TF) Test ..............................................................................................56 Device Parameters Test ..........................................................................................................57 Model Parameters Test............................................................................................................57 Transient Test ..........................................................................................................................58 Network Analysis......................................................................................................................60 Parameter Sweeping ...............................................................................................................60 Monte Carlo Test......................................................................................................................62

Tips for simulation success ..........................................................................................................65 Operating point success ..........................................................................................................65 Transient Success....................................................................................................................66 Special notes for the Opamp ...................................................................................................66

Toolbox ..............................................................................................................................................67 Add Parts Tab ...............................................................................................................................68

Page 5: B2 Spice Version 5

T A B L E O F C O N T E N T S

Parts by Function..................................................................................................................... 68 Parts by Manufacturer ............................................................................................................. 68 Parts by Name......................................................................................................................... 69 Parts Palette ............................................................................................................................ 70

Live Circuit Parameters Panel ..................................................................................................... 70 Animation ..................................................................................................................................... 72 Workspace ................................................................................................................................... 74

Project Menu............................................................................................................................ 74 Schematic Menu...................................................................................................................... 74 Graph Menu............................................................................................................................. 75

Wizards......................................................................................................................................... 75 Edit Graph .................................................................................................................................... 76

Edit Graph - Basic ................................................................................................................... 76 Edit Graph - Text ..................................................................................................................... 77 Edit Graph - Axes .................................................................................................................... 79 Edit Graph - 3D........................................................................................................................ 84 Edit Graph - Circle................................................................................................................... 84 Edit Graph - Histogram ........................................................................................................... 85

Legend.......................................................................................................................................... 85 Edit Plots ...................................................................................................................................... 86

Edit Plots - Edit Plot................................................................................................................. 86 Edit Plots - Plot List ................................................................................................................. 87 Adding Custom Plots............................................................................................................... 88

Virtual Instruments............................................................................................................................ 90 Virtual Ammeter ........................................................................................................................... 90 Distortion Meter ............................................................................................................................ 91 Frequency Plotter......................................................................................................................... 92 Function Generator ...................................................................................................................... 93 Gain Meter.................................................................................................................................... 94 Oscilloscope................................................................................................................................. 95 Power Supply ............................................................................................................................... 97 Transient Signal Recorder ........................................................................................................... 98 Voltage Meter (Voltmeter) ......................................................................................................... 100 Wattage Meter (Wattmeter) ....................................................................................................... 101

Toolbars .......................................................................................................................................... 104 Main Toolbar .............................................................................................................................. 104 Schematic Toolbar ..................................................................................................................... 105 Graph Toolbar ............................................................................................................................ 107

Windows.......................................................................................................................................... 109 Schematic Window .................................................................................................................... 109 Graph Window ........................................................................................................................... 109 Table Window ............................................................................................................................ 111 Text Window .............................................................................................................................. 111 Netlist Window ........................................................................................................................... 112

Graphs and Tables ......................................................................................................................... 114 Graphs........................................................................................................................................ 114

Graph Types .......................................................................................................................... 114 Editing the Graph properties ................................................................................................. 115 Editing Existing Plots and Adding New Plots ....................................................................... 115 Graph editing shortcuts ......................................................................................................... 116 Adding plots from other circuits and simulation.................................................................... 116 Moving around the graph ...................................................................................................... 116 Zooming................................................................................................................................. 117 Measurements in the graph .................................................................................................. 117 Text fields in the graph.......................................................................................................... 118 Printing................................................................................................................................... 118 Copying the graph picture..................................................................................................... 119 Digital timing diagrams .......................................................................................................... 119 FFT – Fast Fourier Transform............................................................................................... 119

Page 6: B2 Spice Version 5

T A B L E O F C O N T E N T S

Tables .........................................................................................................................................119 Circuit Probing.................................................................................................................................120

How to place probes ...................................................................................................................120 Probe sub-types: Db, Mag, Ph-deg............................................................................................121 Cross Probing .............................................................................................................................121

Symbol Editor ..................................................................................................................................122 Creating a Mosfet Symbol ..........................................................................................................122 Editing an Existing Symbol.........................................................................................................123 Change a Font ............................................................................................................................124 Variable Edit Field.......................................................................................................................124 Setting Conditional Properties and Digital Operations ..............................................................124 View Pin Names .........................................................................................................................125 Setting Pin Names ......................................................................................................................125

Working with CadSoft Eagle PCB ..................................................................................................127 Introduction to Eagle PCB integration........................................................................................127 How to import an existing Eagle Schematic into B2 Spice .......................................................128 How to build a schematic in Eagle and export it to B2 Spice for simulation.............................130 How to export a circuit back to Eagle Schematics ....................................................................135 How to export a B2 Spice circuit to Eagle PCB.........................................................................138 Packages ....................................................................................................................................142

Working with the Database.............................................................................................................144 What to do before modifying the database................................................................................144 Suggestions for class use ..........................................................................................................144 Suggestions for team projects....................................................................................................144 Creating a Part or Device from "Scratch" ..................................................................................144 How to Add a New Process Model ............................................................................................145 Adding a Manufacturer ...............................................................................................................145 Adding a New Category .............................................................................................................145 Deleting Parts, Models, Symbols, and Process Models ...........................................................145 Editing a Manufacturer ...............................................................................................................145 Setting Part Pins .........................................................................................................................146 Setting Simulation Model Parameters .......................................................................................147 Setting Simulation Model Pins ...................................................................................................147 Creating a New Device when the Simulation Model is already in the database......................148 How to Create a New Symbol from Your Simulation Model .....................................................148 Create a Simulation Model Using "Import Simulation Model" ...................................................149 Creating a New Device From Process Model Text Files ..........................................................150 Creating a Device from a Subcircuit Model Using the New Device from the Text File feature.....................................................................................................................................................150 Creating a New Simulation Model..............................................................................................151 Resolving Spice language incompatibilities...............................................................................152 Polynomial controlled sources ...................................................................................................152 Altering the Database from B2 Spice.........................................................................................152 Scope of Database Changes .....................................................................................................153 Incompatible model types...........................................................................................................153 Altering Devices from the B2 Spice Main Program ...................................................................153 Working with Printed Circuit Board (PCB) information..............................................................153

Creating a new Package........................................................................................................153 Assigning Packages to a Part................................................................................................154 Editing Package information ..................................................................................................155

Page 7: B2 Spice Version 5

I N T R O D U C T I O N

1

Introduction Congratulations on purchasing the best value in integrated circuit design, simulation, and analysis software. B2 Spice v5 contains a mixed mode simulator based partly on the Berkeley SPICE simulator and partly on the Georgia Tech XSPICE simulator. This means that you are getting industrial strength accuracy. Built upon the proven performance of B2 Spice A/D 2000 and B2 Spice A/D v4, V5's almost complete rewrite now brings you improvements and additions that will greatly expand the program’s functionality and usefulness. From new graphing to virtual instruments and scenario editors, V5 is now more powerful and cost effective than ever before.

The parts database is made up of parts from Analog Devices, Burr Brown, Comlinear, Motorola, National Semiconductor, Texas Instruments, Apex, Amp, Elantec, Maxim, Linear Technology, Zetex, and many more. V5 also adds new interactive devices, such as switches and fuses that you can control and have change with the changing circuit conditions. After you have completed the installation, we suggest you jump right into the tutorials to get acquainted with B2 Spice v5.

The best way to learn a program’s capabilities is to get down and dirty with it. We have a few Tutorials and sample circuits to get you started. Load up some sample circuits and choose Run Test Batch… from the Simulation menu. Follow along with the tutorials. This will get you oriented.

Then dive into the Toolbox and Virtual Instruments. Try the parts selection from the Parts Chooser, setting up tests and virtual instruments.

Right click on components in the schematic and double click on them. These will pull up dialogs and menus. For the graph, click and double-click and control-click on plot names in the menu.

We have put a lot of work into making the program easy to use and flexible. If there’s something you can’t figure out how to do, drop us an email and we’ll try to help.

About B2 Spice v5 B2 Spice v5 is intended to help you design analog, digital, and mixed mode circuits. Rather than working on your circuit design with physical components, which require expensive test equipment and a lab, B2 Spice v5 allows you to perform realistic simulations on your circuit without clipping wires or splashing solder. With B2 Spice v5, editing and simulating circuits is a quick, easy, even enjoyable process.

B2 Spice v5 supports the full Spice 3F5 set of commands, options, and models. This includes simulations such as DC Sweep, AC Sweep, Transient, Sensitivity, Pole-Zero, Fourier, Distortion analysis, and more. Models include no less than six distinct MOSFET models including BSIM3 and BSIM4, models for switches, several transmission line models, and much more.

B2 Spice v5 is an application with two separate subprograms: the B2 Spice main program, and the Database Editor. The B2 Spice main program is most frequently used. You’ll use it to create and edit your circuits, to set up the simulations, to run the simulations, and to view the results. The Database Editor is used for defining new parts or modifying those already in the parts bin. Each subprogram is covered in its own section.

The program features a large database of devices that should be sufficient for most circuits, and can be customized to meet your design needs. Some of these are catalogued in the Technical Reference section, along with the standard parameters and those available for customizing. The Database Editor section will explain how you can add more devices into the database.

B2 Spice v5 comes in various versions. Different versions will have features and abilities that others do not need. These differences will be discussed in the user manual.

Page 8: B2 Spice Version 5

I N T R O D U C T I O N

2

System Requirements • A Pentium II or later processor is required.

• 256 Mb RAM minimum.

• Windows 98, ME, 2000, XP or NT4 or later is recommended.

Package Contents The B2 Spice v5 package contains:

• The B2 Spice v5 CD-ROM (unless you downloaded it from our web site.) The Windows CD-ROM contains the set-up programs, and all of the files needed to setup your system for Windows platforms. The CD should also contain any updates to the documentation.

• This User Manual

This manual includes installation instructions, tutorials, reference descriptions for all menus, troubleshooting advice, a comprehensive device library.

• The Registration Form (unless you ordered from us directly, in which case we automatically register you.)

Technical Support If you have access to electronic mail, send comments to [email protected]. If you ordered directly from us, then you are automatically registered. Otherwise send a fax to us at (734) 332-0392, or call (734) 332-0487.

The best way to get technical support is by email. If you are having trouble and it occurs with a particular circuit, please email ([email protected]) the circuit along with your questions or bug reports. Phone support hours vary. Technical support is not available for student customers unless they are reporting a bug. However, if you use our forum on our web site then someone should be able to help you.

Also, visit our web site at www.beigebag.com for the latest patches and more.

Installation If you are using Windows 98 or NT4.0 or later, B2Spice supports the Windows Autoplay feature.

Simply insert the CD-ROM into your drive and the CD should automatically run the install program. Select the directory you wish to install the program into and the installer will install everything that is required to run B2 Spice.

If for some reason the autoplay doesn't automatically run the install program, run setup.exe from the top level of the CD-ROM.

About the user documentation There is more user documentation in the help file than you will find in the manual. In addition, you will find additional material on the CD-ROM such as sample circuits and some explanations of how they work. And you will find even more on our web site, such as a user forum and resources web page.

This user manual and help file is set up to make it easy for you to get to what you need. It includes information on every menu item in the program and discussions on how to perform various tasks.

Page 9: B2 Spice Version 5

I N T R O D U C T I O N

3

Changes and additions

Due to the lead-time involved with printing, there will be differences between the printed manual and the final program. Please check the CD or Program Directory for Errata and changes made after the user manual was printed.

Legal Notes

Please note:

Beige Bag stands for Beige Bag Software.

Software refers to the computer program contained in the sealed package, as well as all updates.

Documentation refers to the user manual and other written materials accompanying the software.

Product = Software + Documentation.

Copyright / Proprietary Protection

This Product is owned by Beige Bag or its suppliers and is protected by the United States and International copyright laws and international trade provisions. You must treat the Product like any other copyrighted material. This license and your right to use the Product terminate if you violate any part of this agreement. In the event of termination, you must immediately destroy all copies of the Product or return them to Beige Bag. Beige Bag is the sole copyright owner of B2Spice and B2Logic. Beige Bag certifies that it is the sole and exclusive owner of both above mentioned software programs and accompanying user manuals.

License Grant

Beige Bag grants you a nonexclusive license to use one copy of the software on one computer for archival purposes, or copy the Software onto the hard disk of your computer and retain the original for archival purposes. You may not: Copy the documentation, modify, translate, or merge the Software with another program, except for your personal use on a single computer; reverse engineer, disassemble, decompile, or make any attempt to discover the source code of this Software; sublicense, rent, or lease any portion of the Product.

Limited Warranty

Beige Bag warrants the disks on which the Software is distributed to be free from defects in materials and workmanship and that the Software will perform substantially in accordance with the Documentation for a period of ninety days from your receipt of the Product. This warranty (with the exception of material defective disks) only applies to those customers within the United States and Canada who purchased the program at the professional price. This warranty gives you specific legal rights. You may have others, which vary from state to state. Defective disks will be replaced to all customers.

No Liability for Consequential Damages

The Program is provided "as is" without warranty of any kind, either express or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The program should not be relied on as the sole basis to solve a problem whose incorrect solution could result in injury to person or property. If the program is employed, it is at the user's own risk and Beige Bag Software explicitly disclaims all liability for such misuse.

Page 10: B2 Spice Version 5

O V E R V I E W

4

Overview B2 Spice v5 allows you to enter a circuit design in the schematic editor, run simulations on the circuit, and view simulation results. B2 Spice v5 has now merged B2 Spice A/D v4’s distinct pure digital and mixed mode environments into one seamless simulator. Pure digital circuits can now be simulated interactively without the need to switch modes. Analog circuits now have interactivity also, in the form of the live circuit Parameters panel and interactive analog elements, as well as the Animation feature. Overall, this makes for much improved performance and ease of use.

Toolbox One of the big additions in B2 Spice version 5 is the new Toolbox. The Toolbox allows you quick access and navigation to all your project properties, parts in the current project, parts in your custom palette, and all the parts in the database. It also contains all the instruments and tests. With it, you can quickly select parts, control simulations and set virtual instruments needed to analyze your circuit.

Add Parts

In B2 Spice v5, the ability to choose parts has been greatly improved. Now in addition to the standard database browser where you can choose your part by name, or filter by category or keyword, you can now also select the exact part that you want by function, manufacturer, or name from a pop up menu.

Clicking on the "Add Parts" tab allows you to scroll through parts grouped by function, or by manufacturer or name. But the newest development is a “Parts Palette" that allows you to store your most often used part, or parts that exists in your company's inventory for quick and easy access. You can add and remove parts as your requirements change.

The first time that you go to select a part, the program will seem to hang, but is in fact pulling data from the parts database. This might take a few seconds and is completely normal. More importantly, this will only happen THE FIRST time you select a part. Once the program fills in the data, subsequent device selections will take an unnoticeable amount of time.

The Parts Palette is an area that allows users to populate with their most commonly used parts for quick access. You can add any part from the database and remove them at will. The palette will remain filled even after the program is closed.

For further discussion of choosing and placing parts, please see the section on Choosing and Placing parts.

Circuit Parameters

The Parameters tab contains a list of all the parts in your circuit that allow value changes, such as resistors, capacitors, etc... Next to each part is its current value. The purpose of this area is to allow quick value changes to part values as a Simulation is running. For more information, please refer to the section on the Parameter Tab.

Tests and Simulations

In B2 Spice v5, Tests and Simulations are now two distinct modes.

Simulations refer to a constant Time-Domain simulation that starts at 0 seconds and ends only when you pause or reset the simulation. Simulations allow the interactive change of device parameters and the instant monitoring of results in via Animation or Virtual Instruments.

Page 11: B2 Spice Version 5

O V E R V I E W

5

Tests are pre-defined analyses that you can run on your circuit to see how it behaves under various domains. DC, Operating Point, AC, Transient are some examples of tests that you can run. Each test can be selected, set up, and run from the pull down menu in the "Tests" tab in the Toolbox. Unlike Simulations, Tests are NOT interactive and results are displayed in a Graph or Table, NOT the Virtual Instruments.

For detailed descriptions on each Test, refer to the section on Tests. For a discussion on simulations, see the Simulation section.

Animation

Animation allows the graphical and text representation of the circuit state on the schematic using wire/part colors as well as symbols and text to represent the voltage, current, and power states of the circuit while a simulation is running. More details about the Animation can be found in the Animation section.

Project Management

The Workspace tab allows you total control over the all the files associated with a circuit.

The Workspace is set up in a collapsible tree-based structure. Each project can be expanded to show all the files associated with that project, including the circuit itself, the simulations, simulation results, and associated graphs.

You can add new files or close existing files in the Workspace by highlighting the project or file and going to the File menu and choosing the appropriate command.

Wizards

New for B2 Spice v5 is the implementation of a new Wizard. The idea behind the wizards is easy circuit creation. Just select the type of circuit that you wish to create, fill in a few choices and the rest of the work is done for you.

You can select to place the new circuit directly into your existing circuit or place it in to a new blank circuit to start a design.

Graph and plot control

When a graph window is active, the Toolbox will contain 3 additional tools: "Edit Graph", "Legend" and "Edit Plots". All aspects of the graph are controlled from these tool tabs. The Edit Graph tab controls the appearance of the graph itself, including the size, color and text on the graph, as well as the plot colors. The "Legend" tool tab allows you to view the various plots on the graph and information relevant to the plots.

The "Edit Plots" tool tab controls the plots in the graph and how they appear. Here you can add and remove plots from the graph, as well as making custom plots from a built in library of functions.

Virtual Instruments New to B2 Spice v5 is the addition of virtual instruments. Now you can select a variety of instruments to display the circuit state as the Tests are run.

The Instruments are shown on the right side of the B2 Spice's window. If the instruments are not being shown, click on the "Show Instruments" button at the top of the screen.

Page 12: B2 Spice Version 5

O V E R V I E W

6

To add more instruments, click the Add Meter button and select the desired instrument from the drop down box.

The Collapse All button minimizes all the displayed instruments to just their title bars.

The Expand All button expands all displayed instruments.

To set up a particular instrument, click the SETUP button inside the instrument window.

Instruments can be added in a variety of ways.

The most direct way is to use the Add Meter button to add them to the instrument panel. This method requires that the instrument's nodes and connections be set up.

The other method involves selecting the device equivalent of the instrument from the Parts Chooser in the Toolbox, placing it on the schematic and connecting it to the rest of the circuit. This automatically places the related instrument into the instrument panel and the connections are already set up. For instance, if you placed and connected a voltmeter device in the schematic, a pre-configured voltmeter virtual instrument will automatically be placed in the panel.

For more detailed information for each instrument refer to the Virtual Instruments section.

Wiring There are several ways to wire up a circuit. The standard method is to select the wire drawing (diagonal line) tool, then use it to lay down the wire one segment at a time. Click with the left mouse button to start a segment and click again with the left mouse button to end a segment. To end the entire wire, either click with the right mouse button or double-click with the left button. See the B2 Spice Toolbars section in the Help File for more information on the wire tool.

Another method for drawing wires is to click and hold on a pin with the selection arrow cursor and then drag a wire from it. This would save you from having to switch back and forth between the wire tool and selection tool. If there already is a wire from a pin, you can drag more of the wire from the pin using the same method. You can switch to the selection arrow at any time by holding down the shift and control keys.

Wires can be automatically drawn at 90-degree increments. Once this feature is turned on from the Edit->Schematic Options->General menu or the toolbar button, wires will be drawn at the nearest 90 degrees to where the wire was ended.

Once wires are drawn, they can be manipulated like any part. Wires can be selected, dragged and deleted. Wire corners can be dragged and repositioned also. Click on a wire section to select it. Shift clicking on wires will select multiple wires. The entire wire can be select at once by double clicking on any part of the wire. Once selected, the wire(s) can be moved like any other part. Pressing the delete button will delete the selection from the circuit.

Windows B2 Spice v5 has changed the way that windows are arranged and appear.

The biggest difference is that now all windows are "tabs" in a larger Project window. Projects contain all the files associated with a particular circuit, including any graphs, netlists, and other related files. All Project files will appear in one window with the different Project files as Tab at the top left of the window. If you load a new circuit, it will automatically open in a new Project Window. More than one Project can be open at once.

In the picture below, the main Project window contains the circuit (tut2), a graph (tut2-Transient-0-Graph), and the Log Window.

Page 13: B2 Spice Version 5

O V E R V I E W

7

To switch between to a different view, just click on the Tab that you wish to view.

If you right click on a window tab, you will get the following menu:

From the pop-up menu, you can choose to close the Tab, add a new Tab, or rename the Tab.

For more specific information on each type of window, refer to the specific windows section below.

Schematic Window

Graph Window

Table Window

Text Window

Netlist Window

The Project window can be arraigned so that the Tabs are displayed side by side or one atop another. To do so select the layout you wish from the Layout button in the toolbar.

Any layout chosen will arrange the Tab windows as indicated by the icon in the menu only for that project. If there are not enough tabs to split as chosen by the Layout button, the program will leave that pane empty. You can then fill it up with new tabs that you create. You can also drag existing windows to the empty frames. To move windows, drag the window tab to the window that you wish to move the existing window to.

Toolbars B2 Spice v5 is now mainly controlled by the Toolbox and Toolbars.

Toolbars are icons that are shortcut to menu commands, and are located below the menus.

B2 Spice has one main toolbar, common to all modes of operation, to control file and simulation functions. It also has two Window-specific toolbars to control the functions available for that window, depending on which window is currently active.

For detailed descriptions on each toolbar and what the buttons do, please refer to the Toolbar section.

Choosing and Placing parts

Page 14: B2 Spice Version 5

O V E R V I E W

8

B2 Spice v5 builds upon B2 Spice A/D v4's already easy and efficient ways of selecting parts and introduces new tools to make part selection as quick and easy as ever.

The newest method for placing parts is the Add Part tab in the Toolbox. In the Add Parts tab, parts can be browsed and selected in 4 ways:

Function

This is the default selection method, where parts are grouped by function in pop-up menus. Navigation is as easy as following the functions down to the specific function you want, which will then bring up a Parts Browser window with the desired function pre-filtered.

Manufacturer

A list of available manufacturers is available from the top window. Clicking on a Manufacturer name will filter the available parts list to show only the parts from a specific manufacturer. Double-clicking on a desired part will select the part for placing on the schematic.

Name

Parts can be filtered by the first letter in their names by clicking on the number or letter at the top of the window. Double-clicking on a desired part will select the part for placing on the schematic.

Part Palette

The parts palette is a customizable list of parts that you can fill up with your preferred parts. Just select the part from the list of database parts and click a button to fill the palette. The palette is persistent so any changes you make will be carried over even after restarting the program.

In addition to the Add Parts tab, you can choose from a list of the most commonly used parts directly from the Common Parts menu. This menu is a quick way of selecting a generic or popular example of a type of part. It also contains the basic parts common to most circuits, such as resistors, capacitors, and inductors.

In the Common Parts menu is a Choose Part command, which brings up a dialog box that allows you to quickly filter the database using a list of part functions. Typing in a name or part of a name in the filters and clicking the "Apply Filter to Database" button will show a list of parts containing the desired text. Selecting a function from any one of the function boxes will also further filter the parts list. Or you can type in a name in the Device Name field and click on the "Find" button to quickly filter the database for a part exactly matching the name.

Working with other applications There are several ways in which B2 Spice can work with other applications. You can import netlists that were generated by other circuit schematic programs and run simulations on them from the netlist interface. Conversely, you can save circuits as netlists and then open them in other circuit simulation programs.

You can import models for spice parts using the database editor.

You can make reports by copying text and graphics from schematics and graphs and tables and then paste it into other applications.

Also with B2 Spice v5, you can export to a variety of PCB programs. See the PCB section for more information.

In addition, we've added support for importing and exporting directly from CadSoft's Eagle PCB. Now with just a few clicks, you can export your design directly to Eagle Schematics or PCB Layout. From there it's just a matter of routing and sending your design off for manufacturing.

Page 15: B2 Spice Version 5

O V E R V I E W

9

You can also import Eagle schematics into B2 Spice for simulation and verification before sending it back to Eagle for Layout and routing. Simulation and PCB design have never been so easy. For more information, see the "Working with Eagle PCB" section as well as the tutorial on B2 Spice and Eagle data exchange.

Modifying the Parts database Using the Database Editor application that’s part of the B2 Spice v5 system, you can import models and parts into the parts database, modify and add symbols, change categories and manufacturers and more. You can also modify the parts database directly from the B2 Spice by storing changed symbols and models and parts back to the database.

Schematic editing overview The schematic editor allows you to enter your circuit design. When building a new circuit, you will add parts into the circuit window by choosing them from menus or the Toolbox and you will draw wires to connect the devices. Also, you will set properties for the devices to customize their behavior.

How to place parts

There is a set of parts in the Common Parts menu. Simply choose a part from the menu.

You can also use the Toolbox window on the left. In the Toolbox, you can select parts by choosing them from a variety of filters in the Parts tab, or you can select a part from a customizable Palette that you can fill with your most commonly used parts.

After you choose a part it will follow your cursor around the circuit window. To place the part, click the left mouse button.

Set model properties

Double click on a part to set its model properties. This also allows you to set the name of the device

Set device properties

Right click on the part, and then choose Edit Device Properties from the floating menu. This opens a window that allows you to name the part, edit its symbol, and choose a new behavior for the part and more.

Change a symbol

You can move the symbol’s name and property fields around by simply dragging them. Edit the symbol in more detail by right clicking on the symbol and selecting Edit Symbol. This will bring up the symbol in a separate window for editing. Also, you can choose from a set of pre-defined alternate symbols by right clicking on the symbol and choosing Select alternate symbol. After changing a symbol, you have the option of saving it back to the database so that next time you choose that part, it will have the new symbol.

Wiring

Drag a wire from a pin of a device and a wire will follow it. Let go and the wire will stay in the circuit. For precise wiring, use the wire drawing tool. Left clicks lay out the wire a segment at a

Page 16: B2 Spice Version 5

O V E R V I E W

10

time, and to end the wire, use the right-click or double click. Wires can be drawn with 90-degree angles by choosing checking the Use Perpendicular Wires Only checkbox in the Edit->Schematic Options->General menu. Wires can also be set to snap to the grid by choosing checking that option in the Edit->Schematic Options->General menu. For more detailed information, please see the help file's Technical Reference Section on Wiring.

Move, delete, duplicate parts

To move, delete or duplicate parts, you must first select it with the arrow selection tool by clicking on it. To move the part or parts, simply drag the selected parts to the new position and let go of the mouse button. To copy and paste parts, just use the appropriate Edit menu commands or Ctrl-C to copy and Ctrl-V to paste. To delete a part, press the delete key.

Undo/Redo

B2 Spice v5 has unlimited levels of undo and redo. To undo any changes to the schematic, press the CTRL-Z keys simultaneously or use the Edit->Undo menu command. To redo any undone changes, press the CTRL-Y keys or use the Edit->Redo menu command.

Naming and numbering nodes

Markers can be used to name a node or explicitly set a node name. Place the marker and double click on it to access the properties. Type in a name or number for the marker and the wire will take on the marker’s name or number.

Node names and numbers can also be controlled by either right clicking on the wire and selecting rename node/wire, or double clicking on the node name itself when node names are enabled.

Controlling part display

From the Edit menu, the Schematic Options command has a variety of options that control how parts are displayed in your circuit. These options, as the name suggests, allow you to show or hide the text that is displayed with the part. You can move part text fields that are external to the part itself, like it’s name or value field, by dragging it. You can also customize the font that the part text is displayed in. You can rotate parts using control-R combination. Each symbol can be scaled up or down in size by right-clicking on the part and selecting Scale symbol size. With some symbols, you can select a predefined alternate symbol by right-clicking on the part and selecting Select alternate symbol. Or for a complete custom part, choose Edit Symbol after right clicking on a part.

Combiners, Splitters and Rippers

Combiners and splitters allow you to distribute a multiple bit pin to single bit pins. They come in 2 or 4 pins for both in and out directions. By default, wires are distributed automatically B2 Spice from least to greatest bit. To customize wire distribution, double click on the combiner and splitter to set the wires manually.

Borders

You can turn off the borders by going to the Edit->Schematic Options menu or going to the View menu and unchecking the appropriate item.

Title Box and print displays

Page 17: B2 Spice Version 5

O V E R V I E W

11

The Title Box is on by default. To hide the titlebox and the print area lines, go to the Edit->Schematic Options menu or going to the View menu and unchecking the appropriate item. You can edit the text in the Title Box by going to the Edit->Title Block Fields. You can also choose how the title block will print out in the same dialog box.

Grids

B2 Spice v5 ’s circuit grid can be turned set to any resolution or turned off entirely. To turn off the grid, uncheck the Show Grid checkbox in the Edit->Schematic Options or View menu. The grid display can also be toggled from the toolbar.

Autosave

Your circuits are now automatically saved at certain intervals. In the event that you are forced to quit before you could save your work, just restart the B2 Spice program and any unsaved circuit will automatically open up as a “recovered” document. Make sure you resave these circuits using the Save As… command before doing any more work. You can turn off autosave or modify the save period by going to the File->Program Options menu.

Wizards New for B2 Spice v5 is the implementation of a circuit Wizard. The idea behind the wizards is easy circuit creation. Just select the type of circuit that you wish to create, fill in a few choices and the rest of the work is done for you.

You can select to place the new circuit directly into your existing circuit or place it in to a new blank circuit to start a design.

The Wizard appears on the left side of the program window in the Toolbox. If it is not showing, click on the Wizard tab to activate it.

Page 18: B2 Spice Version 5

T U T O R I A L S

12

Tutorials The following Tutorials are designed to familiarize you with the Operations and Capabilities of B2 Spice v5. Complete circuits are also included in the Circuits folder installed in the main program directory.

Analog Tutorial #1 A Simple B2 Spice Circuit

During 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 B2 Spice v5B2 Spice, which includes the Schematic Editor (to draw the circuit) and the Virtual Instruments. A picture of the finished circuit for this tutorial is shown below.

To complete the tutorial, go through the following steps:

Open the B2 Spice Program: Place the Devices Draw the Wires Set the Component properties Set up the Virtual Instruments Test the circuit Simulate the circuit. Save the Circuit

Tutorial #1: Step 1

Open the B2 Spice Program

After installing B2 Spice v5, go to the Windows START menu and navigate to the B2 Spice v5 menu and run B2 Spice v5. This will bring up a clean circuit window. The cursor will be in the form of the selection arrow. If the cursor is in the form of an hourglass, then the program is busy.

Tutorial #1: Step 2

Place the Devices

Pull down the Common Parts menu by depressing the mouse button while the arrow cursor is over the menu title, and while keeping the mouse button pressed down, move the cursor down to the entry named Resistor. When you release the mouse button, the ghost image of the resistor will be following the arrow. Click the mouse button where you want to place the resistor.

After placing the device, it remains selected. This allows you to duplicate or rotate the device

Page 19: B2 Spice Version 5

T U T O R I A L S

13

immediately after placing it.

Next, you will make a duplicate of this resistor. To duplicate the resistor, simply hit the space bar (this is a short-cut for the command Repeat Place Device in the Edit menu.) Place this second resistor to the right of the first resistor.

Next, choose Ground from the Common Parts menu and place it at the bottom of the circuit.

You will then need something to designate a node to be measured. There are several ways of doing this.

The first and easiest way of doing so is to choose a Voltmeter (Horizontal) from the Common Parts menu and place it above the rightmost resistor. The voltmeter is not an active part of the circuit. Its only purpose is to probe a voltage signal. You should notice that when you place the voltmeter, a voltmeter Virtual Instrument is also placed in the virtual instrument panel. Equivalent virtual instruments are also placed when you place an ammeter in the circuit. NOTE that a Voltmeter Virtual Instrument can be inserted without having to place a voltmeter device in the schematic. You can then manually set up the voltmeter instrument's node numbers and obtain the same information.

The second way of designating a node is by using a Marker device, also found in the Common Parts menu or from the Add Part tab, under Virtual Components. The marker has the advantage of being small and is also used to make virtual connections, designate subcircuit pins, and setting initial voltages and guesses. However, this does not add a Virtual Voltmeter into the instrument panel.

For this Tutorial, we will be using the Marker / Voltage Probe. Select it from the Common Parts menu and place it

Alternately, you can choose these devices from the Add Parts tab in the Toolbox window on the left of the screen. For instance, to select a resistor from the Parts Chooser Toolbox, click the “Passive Components” button to show the categories under it. Scroll down to the “Resistors” sub-menu and expand that to show all the devices, click on it. All the parts available in mixed mode can be found under the Part Chooser window.

The Part Chooser window can be sorted by Function (the default sorting), Part Name, or Manufacturer by selecting the respective option at the top of the window.

Tutorial #1: Step 3

Draw the Wires

First, choose the wire drawing tool from the toolbar at the top of the screen under the menus.

To keep it simple, start by drawing a single segment wire. Click at the rightmost end of the resistor (R). Release the mouse button and move the mouse, and the wire will follow the cursor. Move to the left terminal of the second resistor, and double click there. (Alternatively, you can click once with the left button to complete the segment, and then click once with the right button to release the wire from the cursor.)

After you are done with the wire, notice that at the points where the wire intersects the terminal of a device, there is a bold point where a connector is automatically inserted.

Now draw a wire composed of multiple segments. Click where you want to start the wire, at the top terminal of ground. Then move left to the location where you want the first segment of the wire to end, and click once there. Continue drawing segments until you reach the ground, and then double click. The second wire should now be complete. If there is still a wire following the cursor around, then click with the right mouse button to get rid of it. Finish drawing the wires necessary to connect up the circuit so that it looks like the following figure.

Page 20: B2 Spice Version 5

T U T O R I A L S

14

To clean up the circuit, click on the Selection Arrow cursor in the Toolbar in the upper left corner of the circuit window. With the selection arrow, you can move devices, vertices, and segments. Simply position the selection arrow so that its tip is on top of any device, line segment, or vertex, then depress the mouse button, and drag the item with the mouse button still down. Release the mouse button when the item is where you want it to be. All wires are rubber banded when you move objects around. If you want to delete an object, select it with the selection arrow, then choose Delete from the Edit menu. If you need more help, please consult the section titled Schematic Editing in Detail.

Tutorial #1: Step 4

Set the Component Properties

Switch back to the Selection Arrow by depressing the current tool. Since the Selection Arrow is the default tool, it will be active when no other tool is active.

You can also switch to the Selection Arrow temporarily by depressing the Shift-Ctrl keys. The cursor will remain the Selection Arrow until you release the keys.

Using the Selection Arrow, double click on the leftmost resistor. This brings up a dialog box in which you can change the resistance and name of the resistor. Set its resistance to 1000 Ohms (you can type in 1K). A picture of the dialog box is shown below.

Next, you will set the second resistor's value. Right mouse button click on the rightmost resistor, and choose Edit Simulation Model, then set its resistance to 2K. Finally, double click on the Marker and name it N1 if it is not already named so.

An important thing to note is that the node that the Marker is attached to will take the name of the Marker, and if more than one Marker is named the same, both will have a "Virtual" connection, meaning that the nodes will behave as if a wire is connecting them.

Tutorial #1: Step 5

Set up the Virtual Instruments

The first thing to consider is how the circuit will be simulated. There are two instruments that can inject a signal into the circuit - the Power Supply and the Function Generator. In this instance, we will use the Power Supply.

Page 21: B2 Spice Version 5

T U T O R I A L S

15

Click on the Add Meter button in the Instruments window and scroll down to the Power Supply and click once to insert it.

The Power Supply should now appear as a new instrument in minimal display. Click the Setup button in the power supply to expand the instrument for setup.

The first thing we need to set up is the node connections for the power supply. The power supply works by injecting its signal into the selected +V Positive node, selected by the drop down box. We want to inject the signal at the unconnected pin of the leftmost resistor. If the node numbers for the circuit are not already turned on, go to the toolbar and click on the Show Node button

to display the node numbers on the schematic. We now see that the node number we want is 1. Select that from the drop down box. Then select No Connection (NC) for the negative node. Set the voltage (nominal) to 5V and leave the Type as Regulated. (see the Power Supply documentation for more information on the rest of the properties)

Now we need to insert a Voltmeter to measure the output of the circuit. If you have already added a voltmeter to the circuit, then it should also appear in the virtual instruments window. If not, then go ahead and add one using the Add Meter button at the top of the instrument panel. You should see the following window (you might need to expand it by clicking on the down arrow on the right side of the meter's title bar)

Page 22: B2 Spice Version 5

T U T O R I A L S

16

The General tab controls the basic parameters of the voltmeter such as the nodes to be measured and the display settings. If the node numbers haven't been assigned automatically (done when you placed a voltmeter in the circuit) then set up the Voltage meter so that it's measuring from the node between the two resistors to Ground. You can leave the Range of the meter, which is the scale that the meter displays, at 100, or you can click on the Auto button to B2 Spice automatically pick a sensible scale. In this case, go ahead and click Auto.

The Functionality tab controls the behavior of the voltmeter and how it treats the measurements. In this tab, you should leave the input at DC and the function at Instantaneous.

Now run the simulation by clicking on the double green arrows in the toolbar. The Voltage Meter should show a steady 3.33V.

Tutorial #1: Step 6

Using the Live Circuit Parameter control panel

Now that we have the circuit at a steady state, we can now experiment with the Parameters tab in the Toolbox to see how the voltage at node N1 (the marker) changes in response to changes in other device values. B2 Spice v5 is one of the few programs that allow the interactive real-time changes in device parameters while a simulation is running, allowing you to immediately see the response to those changes.

Go to the Toolbox on the left of the program window. Click on the Parameter tab to display the Live Circuit Parameter control panel. The display should look like the following:

Page 23: B2 Spice Version 5

T U T O R I A L S

17

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 it's main value. The some will list even more parameters and All will list all available parameters. For our purposes, Few is enough.

Let us change the resistor R's resistance to see how it affects the voltage at node N1, as measured by the voltmeter in the Instrument panel. With the Simulation running (if it is not, press

the Run to restart the Simulation) click on the r.resistance box of the Live Circuit control panel. This should make it active and allow you to change the resistor's value by using either the text box in the top section, or 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. The voltmeter instrument should now be reading a steady 2.5V. Now change the resistor's value again, this time to 4K. The voltmeter should now be reading 1.67V. Clearly, raising the resistor's value will lower the voltage at node N1.

Now 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 voltmeter reading. As expected, the voltage at node N1 rises. Continue sliding the bar until you hit the leftmost position of the slider. The value for the resistor is now at 400 and the voltmeter reading should be at 4.17V. What if we want to continue lowering the value with the slider? This is where the Recenter button comes in handy. Clicking on it will make the current slider position (and value) the new midpoint of the slider. Go ahead and click on it. The resistor's value should remain at 400 but the slider bar should now be in the middle again. Now you can continue lowering the resistor's value to see what happens. When we lower the resistor value to 40, the voltmeter now reads 4.9V - still rising, but not as quickly!

You can continue to experiment with the various parameters in the Live circuit control panel to the effects on the circuit.

Tutorial #1: Step 7

Test the Circuit

The Simulation that we have used in the previous steps runs over the Time domain and runs continuously until stopped. If more advanced tests over non-transient domains are required, it is time to employ the Tests.

There are a few things that should be mentioned again before proceeding.

Tests require a source of some kind to stimulate the circuit. Any of the Virtual Instruments can be used for the non AC-based tests such as Transient, DC Sweep, Operating Point, etc... For AC-based Tests, an actual power device must be used in the schematic, set up as an AC source.

For this section, we will need to add another device to the circuit - the Voltage Source. From the Common Parts menu, select the Voltage Source and place and rotate it. You can also access the voltage source by using the Add Parts tab and navigating to the Virtual Component->Voltage Sources->Ideal Voltage Source

Page 24: B2 Spice Version 5

T U T O R I A L S

18

Connect the source to the rest of the circuit and the circuit now looks like this:

Double click on the voltage source and make sure the Constant radio button is selected. For the value, enter 5 and click Accept New Value. Click OK to accept the changes.

If you get a message saying the Device modifications are not allowed while the simulation is running, this means that the simulation in the previous step is either running or has been paused

but not reset. To reset the simulation, click on the reset arrow in the simulation control area.

Go back to the circuit and double click on resistor R and change the resistance back to 1K.

Go over to the Toolbox and click on the Tests tab to expand it. Locate the DC Bias test and check the first checkbox to enable a Basic DC Bias Test. Then click on the blue arrow next to the checkboxes to go to the Test setup. The box should look like the picture below:

Page 25: B2 Spice Version 5

T U T O R I A L S

19

Make sure that the Single Test tab is selected, as we do not want to run a Sweep or Monte Carlo analysis.

Now click the Run button from the Test setup window and the voltmeter value should change to 3.333 Volts (or 3333 mV).

The Operating Point Text window will appear after the simulation is complete. This shows the operating point results.

In this case, the DC operating point of the circuit is the steady state solution for the circuit. In general, the DC operating point is the solution of the circuit with all capacitors open, inductors shorted, and non-constant sources at their initial values.

This is a good start, but how does the voltage across R2 vary with respect to the voltage generated by the voltage source? To answer this question, perform a DC Sweep Test.

Activate the circuit window by going to the row of tabs at the top of the workspace and clicking on the circuit's name tab. (It may be called Circuit1, or tut1.ckt).

Page 26: B2 Spice Version 5

T U T O R I A L S

20

Click the Tests tab in the Toolbox if it's not already chosen. Check the Basic checkbox in the DC Sweep row in the Test tab and click on the blue arrow to set up the Test. In the setup window, select V1 for the source, dc for the Property box, and set the start, ending, and step values to 0, 10, and .5 respectively. If your voltage source is not named V, then enter the name of your voltage source for the name.

Finally, click the button in the Tests window. The following graph will appear charting the voltmeter's signal.

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. To read measurements from the graph, we need to use the Legend tab in the toolbox.

Click on the Legend tab of the toolbox. A Legend will appear listing all the displayed plots in the graph. Next to each plot in the legend is a text box displaying the Y value of the current mouse position. At the bottom of the Legend is a text box listing the current X value of the mouse location.

The graph has its own Toolbar with tools that you can use to further study the graph. Most

important of those are the Tracking Crosshairs , which follow the currently selected plot, the

Measurement tool, which measures the points on the graph between two mouse clicks, and the Calipers, which mark locations on the graph.

Note that the output voltage is 2/3 of the input voltage for any value of the input voltage. In later tutorials, you will learn more about displaying and customizing simulation results. For now, click on the graph to make it the active window, and select the Edit Graph tab on the toolbox and select the Basic tab. Here, you can change your graph settings such as setting the background color or showing the legend on the graph itself.

Tutorial #1: Step 8

Save the Circuit

Now choose Save... from the File menu. Since the circuit does not have a name yet, the computer will prompt you to name the circuit. Name it, then you can quit and take a break.

To generate a text file including the full circuit specifications in the SPICE programming language,

Page 27: B2 Spice Version 5

T U T O R I A L S

21

go to the File menu and select Netlist Operations->Create Netlist as a text form. This is useful if you want to feed the circuit specifications into a different SPICE simulator.

Analog Tutorial #2 Time and Frequency Analysis of an RLC Filter

In the previous example, we saw how B2 Spice can help in the analysis of simple DC linear circuits. Now, we present a linear, time-varying, RLC circuit shown in the following figure. Using this circuit, you'll learn how to analyze frequency response and transient response.

Follow the steps below to complete this tutorial:

Draw the Circuit

Specify Component Values

Connect Components with Wires

Set up the Simulation Specifications

Use the Virtual Instruments to measure the circuit

Run the Transient Simulation

Set up the AC Test

Run the AC Test

Perform DC Test

Tutorial #2: Step 1

Draw the Circuit

We assume that you have already tried Tutorial #1 and have the basic circuit editing skills. If you haven’t, you may want to look over Tutorial #1 now.

From the Common Parts menu or the Add Parts tab, choose the components: capacitor, resistor, ground, marker, and inductor.

In order to orient a component vertically, press ctrl-R before or after placing it, or if it is already placed, choose Rotate Clockwise from the Edit menu.

Place the components on the screen, rotating the capacitor and the resistor. If you make a mistake placing a component, you can delete it by first clicking on it with the selection arrow tool to select it, then pressing the delete.

Tutorial #2: Step 2

Page 28: B2 Spice Version 5

T U T O R I A L S

22

Specify Component Values

Enter the device parameters as illustrated in the table below. To set the device parameters for a device, double click on it with the selection arrow, then type in the values. Notice that the resistances of R4, the inductance of L2, the capacitance of C3, and the parameters specifying the voltage pulse waveform have all changed. INDUCTOR NAME L3 Inductance 1U Initial Current 0 CAPACITOR NAME C3 Capacitance 1N Initial Voltage 0 RESISTOR NAME R4 Resistance 50 MARKER NAME N1 MARKER NAME N2

1n represents 1 nano-unit. It can also be entered as 1E-9, or 1NF. 1U is 1 micro-unit, which can also be entered as 1E-6. B2 Spice is case insensitive, so you could enter 1 micro-unit as 1e-6, or 1E-6. Actually, all lower case letters will be converted to upper case. Also, the type of the unit is ignored, so 1NF is equivalent to 1ns, which is equivalent to 1n. 1 n, however, will be interpreted as 1, since spaces are illegal in values.

Tutorial #2: Step 3

Connect Components with Wires

Use the wire drawing tool to draw the wires connecting the components. If you make a mistake, and you wish to delete a line, then you must first select it, then press the delete key. To select a small line, click on one of its endpoints with the selection arrow tool, and then click on the other endpoint while depressing the shift key.

The circuit is hooked up and ready for analysis.

For the first part of the tutorial, the marker will not figure into the simulation as we will be running a Simulation and using Virtual Instruments to measure the circuit response. For the second part of the tutorial, when we will be running Tests, the markers specify which signals will initially be graphed, although the set of plots in the graph can be changed at any time after the Test.

Tutorial #2: Step 4

Set up and run the Simulation.

Recall that a Simulation is a continuous Time domain simulation and runs until stopped or reset. Since simulations do not produce a graph, we will need to use Virtual Instruments in order to stimulate and measure the circuit.

The first Virtual Instrument we need to employ is some sort of source to power the circuit. For this Simulation, we will be using a Function Generator.

From the Add Meter drop-down box in the Instrument Panel, select a Function Generator Instrument. The Function Generator will be injected at node N1. If you're not sure what the node names are, turn on the Node Name display using the Node Name toggle toolbar button. Set the negative node of the Function Generator to ground, or 0. Change the waveform to Pulse, and leave the voltage at 1, the Frequency at 1KHz, and the DC Offset at 0.

The Function Generator should now look like the picture below:

Page 29: B2 Spice Version 5

T U T O R I A L S

23

Now add an Oscilloscope to the Instrument Panel. Under the Traces tab, click the Input Trace 1 button to set up the first signal to measure on the oscilloscope. Set the input node to N1 and the ref node to 0. This will measure the voltage at node N1, which is where we are also injecting the source signal. Click on Input Trace 2 to set up the second signal. Set that input node to N2 and the ref to 0 and check the "Show" checkbox to display the signal.

B2 Spice will try to automatically set the X and Y-axis ranges to fit the signal into the graph window so you can leave all the other settings in the other tabs as they are. The Oscilloscope setup should now look like this:

Now in the main toolbar, click the double green arrow to start the simulation. However, nothing displays in the scope. There might be flashes of a signal, but no solid signals. When this happens, it's likely that B2 Spice is having trouble automatically setting one or both of the axes settings. Let's look at the axes settings to see what's happening.

Switch on the Vertical tab. The Vertical V/Div is automatically set at 1. We know that the reading at node n1 should be the signal injected by the Function Generator. Since the Function Generator's signal is set to 1V, the 1V/div for the Vertical V/div should at least display that signal.

Switch to the Timebase tab. The Timebase s/div setting is where the X-axis range is set. It should be set to "Auto" by default, but if you look, the setting is continuously being changed, probably due to the fact that one or both of the signals is throwing off the period calculations made by B2 Spice. In these cases, we will need to manually set a Timebase setting. To override this, click on the "manual" button. Let's set the signal to at least show the injected 1KHz signal. The period for our 1KHz pulse is 1ms. Since our graph has 10 divisions, the setting for time/div is 1ms/10 = .1ms, or 100us. So enter 100u into the Timebase box and either press the Enter key or click on the enter arrow to accept the change. Otherwise, the data may show 100u but B2 Spice will still be using the old value. Now we should see a single pulse in the scope's graph.

Page 30: B2 Spice Version 5

T U T O R I A L S

24

Tutorial #2: Step 5

If you closely study the signal in the scope, you'll notice that while the input signal injected by the Function Generator is a clean pulse, the output at node N2 is not. We need to be able to study just that region to see what is happening.

One way of doing so is to export the scope screen to a graph by going to the scope's Export tab and clicking the Copy to Graph button, which will copy the contents of the scope to a new graph. Using the graphing tools, you can pan and zoom in on portions of the graph but you will see that the resolution isn't detailed enough to see what's happening. And if you try to decrease the step size for the simulation then the simulation will proceed too slowly.

A good way around this is to use the Transient Signal Recorder to record just the first few nanoseconds of the pulse and output and study what is happening.

Go back to the instrument panel and insert a Transient Signal Recorder from the Add Meter drop-down box. Set up the Recorder so that Trace 1 measures node N1,0 and Trace 2 measures node N2,0. Make sure that the "Show Trace 2" checkbox is checked for Trace 2.

The Storage tab and the I-View tab allow specification of the Data Capture/Storage Intervals and the Interactive Viewing Intervals respectively. It's important to make a distinction between the two settings. The Data Capture Interval is what is being recorded and stored in memory. The Interactive Viewing Interval is how much of that memory is being shown on the display.

Since we want to examine the short time after the pulse rises or falls, set the Data Capture Interval to "All" and the Interactive Viewing Interval to "Fixed". This will make the start and duration boxes active. Set the start to 0 and the duration to 2u. This will tell the Recorder to store all data generated by the simulation but only display the first 2us of data on the graph.

Now reset the Simulation if it's not already reset and set the step size to a finer 50ns. Then press the start button to run the Simulation. You should now see the following signal in the Recorder window:

Page 31: B2 Spice Version 5

T U T O R I A L S

25

From this we can see that the signal at node N2 overshoots its steady state value, and then oscillates and settles back down to the steady state value.

Tutorial #2: Step 6

Set Up the AC Sweep Test

The AC Sweep Test generates the frequency response of the circuit.

Recall that for Tests, Virtual Instruments cannot be used so the Function Generator used in the previous Simulation will not work for this Test. We will need to add a Voltage Source to power the circuit. The voltage source will act as a sinusoidal signal (regardless of whether it is a pulse, sinusoid, exponential, single-frequency, piece-wise linear, or constant), and the frequency of that signal will be stepped through a range of frequencies while the response of the circuit is recorded at each step.

From the Add Parts tab, select the Ideal Voltage Source from the Virtual Components->Voltage Sources menu. Place it and then rotate it by pressing Ctrl-R once. Connect it so that the circuit looks like the picture below:

Double click on the Voltage Source and set the following properties:

Click on OK to accept the changes to the Voltage Source.

In the Tests tab of the Toolbox, select the AC Sweep Basic test. Expand the to the test setup page and enter 1MHz and 100MHz for the start and stop frequencies, Decade for Step Interval, and 5 for Steps per Interval. These latter two specifications tell the simulator to step 5 points each decade, and a decade is a factor of 10.

Page 32: B2 Spice Version 5

T U T O R I A L S

26

Tutorial #2: Step 7

Run the AC Sweep Test

Click the run button in the test setup, NOT the Simulation bar.

If you've been following the Tutorial, you'll now get an error saying that the circuit failed to converge and error messages in the Log. This is because the Function Generator used in the Simulation part of the tutorial is still injecting its signal into the circuit at node N1 and is conflicting with the voltage source hooked up to the same node. In these situations, you must be extra careful to remove any Virtual Sources from the Virtual Instrument panel before performing a Test.

Remove the Function Generator by closing it in the Instrument panel and rerun the test by pressing the run button in the Test panel again.

The results will be displayed in a new Graph window. When the test is complete, you will notice that the graph is in the form of a Bode plot. That is, the magnitude is plotted in decibels, 20*log(Y value), and the frequency is plotted on a log scale. Not all the right plots might be showing. To do so, click on the Edit Plots tab and click on the Plot List button at the top of the panel. What we need to show is the Db of v(n1) and v(n2). To get the signals in Db, click DB/Ph (Deg) radio button. That should then list the available plots in degrees and Decibels

The click on VDB(n1) and VDB(n2) and click the Add Select Source Plots button to add them to the plot. The graph should now look like the following:

Page 33: B2 Spice Version 5

T U T O R I A L S

27

We further need to add the Phase plots to the graph. Repeat the steps above but this time add the VP_DEG(n1) and VP_DEG(n2) plots to the Signal list.

Tutorial #2: Step 8

Perform a DC Sweep Test

The DC Sweep test records the DC operating point of the circuit in response to different constant values for the input.

Page 34: B2 Spice Version 5

T U T O R I A L S

28

Bring up the Tests tab in the Toolbox and select the DC sweep basic test. Select V1 (or the name of the voltage source) for the source, 0 for the starting value, 5 for the ending value, and .2 for the step value.

To run the test, click the Run Test button.

The result is a linear plot as in the following figure. In the steady state, all inductors act as short circuits, and capacitors act as open circuits, so the circuit acts as a single 50-Ohm resistor.

Tutorial - Creating a Part from a Circuit B2Spice allows you to take a circuit and turn it into a part. Almost any circuit can be turned into a part with just a few steps.

Step 1 - Setting up the circuit for part creation.

Using B2 Spice, create or Open a circuit that you wish to turn into a part.

For Mixed Mode circuits, the first thing you will need to do is to insert Subcircuit Port Markers into the circuit to designate where pins for the new part should go. Markers can be found under the Common Parts menu or the Virtual Devices menu in the Parts Chooser.

Once the markers are placed, double click on each one and type in a name in the Part Title field. This will be the name of the pin once the circuit is turned into a part. Then in the same dialog box, check the Use as Subcircuit Port box. This lets B2 Spice know that this marker is to be used as a port in the new part. The Marker Properties box should look similar to the one below.

Page 35: B2 Spice Version 5

T U T O R I A L S

29

For Digital circuits, Input and Output ports take the place of Markers. You can simply double click on the Input/Output port, name it, and check the "Use as Subcircuit Port" checkbox.

Step 2 - Creating the part

Once the Markers, or Input/Output ports in Digital mode, are in place and set up correctly, go to the File menu and choose Create Part from Circuit. The program will then prompt you for a name. Enter the name you wish for the new part 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 B2 Spice will then ask you to select a symbol from the Parts Database. Otherwise, click YES and B2 Spice will create a generic box symbol to be used with your part. The new part is now in the database and you're ready to customize the part.

Step 3 - Modifying the new part

Run the Database Editor and select Edit Simulation Model under the Edit menu. Select the part that you just created in B2 Spice and click Edit.

For Mixed Mode parts, Click on the Set Model Pins and you should see the dialog box below:

Page 36: B2 Spice Version 5

T U T O R I A L S

30

If all the parts in your circuit are pure analog parts, then you should check the pins over to see if they're correct.

If your circuit contained XSpice parts, you will have to designate whether the pin is digital or analog. If the pin is Digital, then you must also designate whether it is an Input or Output pin. If the pin is Analog, then input and output direction designation do not apply. Click Accept when you're done with each pin. Click OK when you're done setting the pins.

For Digital parts, Select and edit the digital simulation model you just created. In the Edit Simulation Model dialog box, click the Edit Pin Properties button to access the list of digital pin. You should set each pin's direction, state, and propagation delay. Click the Accept button to accept changes and move on to the next pin. Refer to the Database Editor Menu's Edit simulation model section for more information.

Once you're done setting the pin properties, close all the dialog boxes. All that remains is to alter the symbol if you want to rearrange the symbol pins and exit the Database Editor. In the B2 Spice pull up your new part and use it like any other part.

Tutorial - Creating a Parameterized Subcircuit Part Parameterized Subcircuit Parts are parts whose behavior can be modified with one or more parameters. In some cases, you will want to turn your subcircuit defined parts into parameterized subcircuits.

In this example, we will be creating a battery as a Parameterized Subcircuit Model part.

Step 1 - Create a Parameterized Subcircuit Model Type.

Run the Database Editor and go File->New Parameterized Subcircuit Model Definition.

This should bring up the dialog box shown below. In the Model Type Name, enter the name you would like to identify your new model by, making sure that there are no spaces in the name.

Then click on the Parameters tab. In the Parameter Name field, enter the name of the 1st parameter that you will be using, in this case, Voltage. In the data type, select the type of data of the parameter. Usually this will be a real or integer. In this example, the Data Type will be Real. Units and defaults are optional. Make sure the Use For Input box is checked. Leaving it unchecked will cause the parameter to not show up in other dialog boxes. The "Is Required" checkbox is for when you want B2 Spice to specifically use this parameter. If you check the box, then you also must enter a Default Value.

Click Accept when you're finished with the particular parameter. Note that you must click New Parameter to enter and edit a new parameter. Not doing so will overwrite the parameter that happens to be highlighted.

Page 37: B2 Spice Version 5

T U T O R I A L S

31

Then click on the Subcircuit Text tab. This is where you will be entering the actual subcircuit that you will be using your parameters in.

If you know what you're doing, you can start entering your subcircuit starting with the .SUBCKT statement and ending the .ENDS statement. This subcircuit will need to be in Berkeley Spice 3f5 format with XSpice extensions. Otherwise, copy and paste a subcircuit into the window. You can get the subcircuit text for an existing simulation model by editing the simulation model and copying its text.

Now all you have to do is incorporate your own parameters into the subcircuit. Enter your parameters in the form of a parameter or formula. All custom parameters must go in between the curly brackets {}. For example, if you had two parameters called X and Y and wish to have them added together in a subcircuit, the formula would be {X + Y}. Or getting fancier, you add X and Y and then multiply by 2. The formula would look like this: {(X + Y) * 2}. All standard mathematical operations are supported (+,-,/,*), power of (^), and any other operation supported in the graphing plot expression module of the B2 Spice. In the example below, note that the {voltage} has replaced the regular voltage number.

Once you're satisfied that everything is correct, click OK and continue to the next step.

Page 38: B2 Spice Version 5

T U T O R I A L S

32

Step 2 - Make a simulation model using the Parameterized Subcircuit Model you just created.

Go File->New Simulation Model and then click on the Spice or XSpice parameterized subcircuit and click OK.

Enter the model name, and in the Model Type, select the parameterized subcircuit type that you had created in the previous step. In this case, we will be using "Battery" in the Model Type.

The Set Model Pins... button allows you to edit the pins in your simulation model, if wish. The Create Symbol will create a new generic symbol using the pins in your subcircuit for symbol pins and named the same as your Simulation Model

Click on the "Parameters" tab, you can enter values for the parameters that you specified earlier. Or you can leave them blank for now and change it once you have the part in the schematic. For this example, we'll enter a default voltage of 10. Enter 10 in the Value box and click Accept. The window should look like the window below. Once you're done editing the simulation model, click OK to accept it.

Page 39: B2 Spice Version 5

T U T O R I A L S

33

Step 3 - Create a new Part with the simulation model.

Go File->New Device.

In the Part Name, enter the name you would like your new part have.

Select a symbol to use by clicking on the Select Primary button. If you had used the Create Symbol button in the previous step, look for a symbol with the same name as the simulation model. If you have an existing symbol you would like to use instead, select that.

Select the simulation model you created earlier by clicking on the Select button in the Simulation Model field.

Now you will have to match the simulation model pins to the symbol pin by clicking on the Connect Symbol Pins to Model Pins button. You will get a dialog like the one below. Click on a model pin in the left most box, click on a symbol pin in the middle box, and make the pairing by clicking on the Add New ==> button. If you mess up, you can select the pairing in the right box and click the <==Remove button to unmatch the pair. Click OK once you have used all the simulation pins.

Page 40: B2 Spice Version 5

T U T O R I A L S

34

Click OK to accept the part.

And that's it. To access your new part in the B2 Spice, go to Devices->Choose Part by Name and type in the name of your part. Pull your part up in the B2 Spice and double click on it to change your custom parameters. The parameters will be evaluated automatically as you run a simulation.

You can assign packages and pairings by using the drop down box to select a package, typing in how many parts come in a package, and then clicking on the Connect Part Pins to Package Pins button. More information about Packages can be found in the PCB tutorial.

Digital Tutorial #1 Build a three input And function

During this tutorial, you will build a three input And function out of a three input Nand gate (7410) and an Inverter (7404).

Insert an input

From the Add Part menu, go to the Digital Components->Instruments menu, which will bring up a dialog to browse the database pre-filtered to Digital Instruments. Choose Input from the dialog box. As you move the cursor around the circuit window, the input port should follow it. Click on the window with the left mouse button to place the input port. By default, it will be a one bit input port.

To get a feel for the program, click in the input port again. If you click on the name or value of the input port, you can drag it around the circuit. Click on the up and down arrows to change its value.

If you click on the end point of the pin sticking out of the input, you can drag a wire out from the pin. To delete the wire, first select it by clicking on the wire, then depress the Delete key, or choose Delete from the Edit Menu. See the section on deleting wires if you need more help.

Insert two more input ports

Use the space bar to Repeat place device and put the new input port below the first one.

Page 41: B2 Spice Version 5

T U T O R I A L S

35

Depress the space bar again to place a third input port below the second.

Insert a 3-input nand gate, an Inverter, and an output port

Go to the Add Parts tab and go to the Digital Components->Gates window. From the dialog box, scroll down to the “74LS10D” and select it. You can also type in part of the device's name into the "Name" field of the Filters. For instance, typing "LS10" will show only devices that contain that text somewhere in the name.

When you locate the 74LS10D, double click on it and then you should have the nand gate following the cursor around. Place the 3 input nand gate to the right of the 3 inputs.

Next, choose and place a 74LS04D from the Digital Components->Gates of the Add Parts tab. Then place it to the right of the nand gate.

Finally, choose "Output Port" from the Digital Components->Instruments and place it to the right of the inverter.

Draw the wires

Use the wire drawing tool and/or the selection cursor to draw wires. To switch between the tools, click on the button containing the diagonal line that goes from top left down to bottom right for the wire drawing tool, and the button containing the solid black arrow that points up and to the left for the selection cursor. To draw a wire with the wire-drawing tool, click once with the left mouse button to start a wire, and then click once with the left mouse button at each vertex of the wire. When the wire is complete, click with the right mouse button. To draw wires with the selection arrow, click on a pin of the device and drag with the left mouse button down to any point on the circuit.

You will know that the wire has made connections because there will be small circles indicating points where a wire meets a pin. These small circles also are used when three or more line segments intersect at a single point.

The circuit should look something like this:

Test the circuit

NOTE: Before we proceed, it needs to be note that the digital circuit will work interactively (depending on the input devices you use) with the free-run simulation or the Transient Test. However, if running the free-simulation, a timing diagram (graph) will not be available. The only way to generate a timing diagram is if you run a Transient Test. Please see the note below on Transient Tests and digital circuits.

If the cursor is not the selection arrow, then choose the Selection Tool by selecting the arrow from the Schematic Toolbar.

Free-Run Simulations: For digital simulations, where device propagation delays are in the nanoseconds, the step size of the simulation should be set so that each step will still allow you to see the resulting changes without slowing the simulation too much. A step size of 20ns is suggested but can be adjusted from there. To set the step size, go to the Simulation->Time Options dialog.

NOTE: Step Size is different from Step Ceiling. Step size specifies how large each Step of the simulation is when using the Step feature. Step Size does not factor into the Simulation when in

Page 42: B2 Spice Version 5

T U T O R I A L S

36

Walk or Run mode, where the simulation engine decides how large a step to take. Step Ceiling means that when a simulation is Walked or Run, the step size will not exceed the Step Ceiling.

Choose Step from the Main Toolbar. The simulation time will increase to 20ns, and the output’s value will remain at 0. Now set the value of the inputs to one by clicking on the up arrow

of each input. Using the probe tool, , you can probe the value and strength of any wire in the circuit. Simply position the left end of the probe tool on the wire, and depress the mouse button. You can also determine wire values from wire colors if you have that option turned on in the Edit->Schematic Options menu.

Choose Step from the Main Toolbar again. The simulation time will increase to 40ns, and the output value will change to1. Notice that you have to actually force the simulation time to proceed in order to get results from the simulator. This is very different from the lab, where time proceeds automatically and results seem to show up instantaneously.

Transient Tests: Digital circuits can also be run from the Transient Test. Usually, Transient Tests usually have a defined start and end time but with digital circuits, you can set the STOP time to –1 and when the Test is run, it will start at time 0, proceed by steps of STEP CEILING and have no end until you press the RESET button in the toolbar. The Pause, Step and Walk buttons will also function. This way, you can fully interact with the digital circuit and see the results in the graph as you see fit.

Repeating the steps above, but for the Transient Test will produce a timing diagram like the following:

Save the Circuit

Now choose Save from the File menu. Since the circuit does not have a name yet, the computer will prompt you to name the circuit. Name it, then you can quit and take a break. Congratulations! You have built a 3-input And function, similar to the 74LS11.

PCB Tutorial

How to add a new PCB package

B2 Spice v5 comes with most of the basic package shapes and information that you will need already in the database and assigned to a part. In the case that you find that a package you’re looking for isn’t in our database, you can easily add your own package and then assign it to the part of your choice.

The first step would be to make a general symbol of the package. The symbol itself is used for visual purposes only. Use the Database Editor’s File->New Symbol menu to draw a package symbol. For more information on symbol drawing, please refer to the Database Editor’s Symbol

Page 43: B2 Spice Version 5

T U T O R I A L S

37

editor section. For your convenience, we have already made a symbol for the DIP8, named “DIP8-pkg” that you can use if you want to skip making your own symbol.

To add a part, run the Database Editor and go to Edit->Edit Packages. You should see a dialog box listing all the existing packages in the B2 Spice database.

Make sure the package you’re looking for is not already listed. We have already created a finished package entitled “8DIP150_tutorial” for you to see how the finished package should look.

To begin adding the part, click the Add… button. Fill in the Package Name field. In our tutorial, it will be named “8DIP150” for an 8-pin DIP package. The Number of Pins field will be 8. The Description should be whatever you would like to use to describe the part. To select a symbol, click on the Choose Symbol button and then select the symbol that you created in the first step. If you would like to use the symbol that we have created, select the “DIP8-pkg” symbol.

The Names in other PCB languages box is used for assigning a name that will be recognized by the destination PCB program when you export the part. “8DIP150” is an arbitrary name, used internally by B2 Spice v5 only. The alias will be used when you export to a PCB program, which will have its own name for an 8 DIP package. B2 Spice v5 currently exports to the following programs:

Eagle

Orcad

SuperPCB

WinDraft

Ultiboard

For this example, we’ll be filling in the alias for Eagle. In the Alias box, fill in the alias that the PCB program has assigned to an 8DIP package. In this case, Eagle uses “DIP-08”. In the PCB Language box, fill in the name, which can ONLY be one of the 5 listed above. In this case, type in “Eagle”. Most PCB programs will have multiple libraries for their package. The Library file is used to identify, if necessary, the library that contains the DIP-08 package. Eagle has the “DIP-08” in a library called ” BURR.LBR”. Once you are satisfied the information is correct, click the Accept button to add the alias. Do so for any other PCB program that you might want to export to. The dialog box should now look like the following.

Page 44: B2 Spice Version 5

T U T O R I A L S

38

Click OK to accept the changes once you are done with the Package properties dialog box.

Assigning a PCB package to a part in the database

Package information by itself is of little value. A package has to be assigned to an existing part before the package information will be exported using the PCB export command.

To assign a package to a part, you will need to refer to the manufacturer’s data sheet for the part that you are editing.

Use the Database Editor and Edit the part that you wish to add the package to. For the tutorial, we will be assigning the 8DIP150 package. In the Edit Device dialog box, there should be a Package section that looks like the following picture.

Use the drop down box in that section to select the package that you created earlier. In the Parts Per Pkg box located elsewhere in the dialog box, type the number of part that come in the real package. This information can be found in the manufacturer’s data sheet. For this tutorial, only one part comes per DIP8 package. Now click on the Connect Part Pins to Package Pins button to assign package pins to actual simulation model pins. You should be presented with a dialog box like the following:

Page 45: B2 Spice Version 5

T U T O R I A L S

39

You should see 2 symbols and 3 boxes. The symbols show the part symbol, on the left, and the package symbol, on the right. Below each symbol is a box containing their pins. The "A" before each pin stands for the group. The arrow buttons between the boxes are used to assign and remove assignments. If there were more than one part per package, then there will be "B" and "C" pins, etc... If you would like to view the pins that have already been match and are no longer in the boxes, check the "show used pins" box and the used pins should appear in brackets.

To connect the first part pin, A.+IN with its package pin, in this case, package pin 3, click on both pins to highlight them. Then click the ==> button to assign the pairing. The pins should disappear from the part/package boxes and the matched pair should appear in the box on the right. If you made a mistake, just highlight the mismatch in the box on the right and click on the <== button to remove the matching. The rest of the matches are A.-IN and 2, A.OUT and 6, A.TRIM1 and 1, A.TRIM2 and 5, COM.+VS and 7, and COM.-VS and 4. The remaining package pin is unused and can be ignored.

The Add Special Pin.. button is for cases where you need assign a Vdd, Vcc, Vss, or Ground pin. This is usually more common with Digital parts.

The finished assignments should look like the following dialog box.

Page 46: B2 Spice Version 5

T U T O R I A L S

40

Once you’re done with pin assignments, click OK to accept the changes.

If you need help or need to look at a finished part/package assignment, you can browse the parts that we have already done to see how pins are assigned.

If you get error messages when trying to export to PCB, see the How To section for more help.

Eagle to B2 Spice Tutorial One of B2 Spice v5 features is integration with CadSoft's Eagle PCB. Now with B2 Spice, you can import from and export to Eagle PCB. Below is a simple tutorial covering how to make an Eagle Schematic with B2 Spice parts and then export it to B2 Spice for simulation.

This tutorial obviously requires that you have CadSoft Eagle 4.0 or higher and that you are already familiar with the use of Eagle.

Before starting, make sure that you have already unzipped the Beige Bag Eagle libraries into Eagle's lbr directory. Then unzip the ULP "bbSpice.ULP" into Eagle's ulp directory. Both the libraries and the ULP are included in the B2 Spice v5 installation, in a zip file called "bb_lbr_ulp.zip".

The Eagle schematic and resulting B2 Spice circuit are saved in the B2 Spice\circuits directory if you would like to skip parts. They are named "BB_Tut_1.sch" and "Eagle_Tut_1.ckt

Draw the Eagle schematic

Start Eagle and open a new schematic. Then add the following parts from the following BB libraries to the schematic:

Library: bb_parts_nopkgs_Source

Parts: VOLTAGE_SOURCE, GROUND

Library: bb_parts_nopkgs_Passive

Parts: (2) RESISTOR

Library: bb_parts_nopkgs_Analog_Meters

Page 47: B2 Spice Version 5

T U T O R I A L S

41

Parts: VOLTMETER

Arrange the parts and wire them up so that they look like the following schematic:

Use the "value" tool to make the first resistor 1K and the second resistor 2K.

Save the schematic and then run the ULP "bbSpice.ULP". This program should convert the Eagle schematic to a *.bdf file in the \Eagle directory. It should be named the same as the name you used to save the schematic.

Import into B2 Spice

Start B2 Spice v5.

From the FILE menu, select Eagle->New Circuit from Eagle file or Update Circuit from Eagle file. The "New" command will import the Eagle schematic into a new B2 Spice circuit. "Update" will import the Eagle schematic into the active B2 Spice circuit.

An Open File dialog box will appear. Navigate to the Eagle directory and then select the *.bdf file that was created from Eagle with the ULP program.

Once you click "open" in the dialog box, B2 Spice will begin the process of importing the Eagle file into the B2 Spice circuit. The cursor might flash between the arrow and hourglass as B2 Spice does the importing. B2 Spice will alert you with any errors.

Once done, the circuit should look like the following B2 Spice circuit:

Page 48: B2 Spice Version 5

T U T O R I A L S

42

The resistors should have their values already set. But the Voltage source will have to be set to 5volts constant DC by double clicking on the part and setting the "DC Value" box and checking the "Override Transient Initial Value" box. The dialog should look like the following:

click OK to accept the changes.

Run a Test

Now you can run a Test. You'll first have to set up the Test parameters. For this example, we'll run a DC sweep.

Go to the Tests tab and check the DC Sweep Basic checkbox. Expand the setup window by clicking on the blue arrow next to the checkboxes. Select the voltage source as the "Source" from

Page 49: B2 Spice Version 5

T U T O R I A L S

43

the drop down box. Then set the start, stop and step values to 0, 10, and .1, respectively. The dialog should look like the following:

Run the Test by clicking the button. The resulting graph should look like the following:

This was a simple example. You can also build Eagle schematics using non Beige Bag parts from the standard Eagle libraries. We've tried importing all the standard Eagle library parts into our database so the importing process can proceed without problems, but custom parts and newer parts should evoke a "part not found" error when you're trying to import into B2 Spice. If this happens, B2 Spice will still import the Eagle part, but only in symbol form and without a simulation model. This means that the part will not simulate with B2 Spice.

Page 50: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

44

Tests and Simulation Tests and Simulations

B2 SPICE v5 now has two simulation modes: Tests and Simulations. There are important differences between Tests and a Simulation. This difference must be understood before you can effectively use B2 Spice v5.

A Simulation is simply a continuous transient simulation, starting at time 0 and incrementing by a user-defined time period. Simulations can be paused and continued but run continuously until stopped, paused or reset. Simulation are stimulated and measured by various Virtual Instruments and can be manipulated with the Circuit Control Panel.

Tests, on the other hand, are run through a defined set of parameters and can test the circuit in various domains other than the time domain. These can include a circuit's AC response, its Noise output, as well as various other response tests. The results of Tests are displayed in a Graph and not virtual instruments.

Running Simulations

Time-based simulations require that you only press the green play button in the toolbar to run. But getting meaningful results require a few more steps. A simulation will need an input as well as some kind of virtual instrument to measure the result.

Inputs can be a Source Device found in the supplied database. These can include the voltage source or current source that can supply power to the circuit. Alternately, you can use the Power Supply or Function Generator in the Virtual Instruments to set up stimuli. To measure the results, you can use the Small Scope, Voltage Meter or one of the other meters found in the Virtual Instruments.

Set up the appropriate stimulus and meter, set the time step you want and click the green arrow to start the simulation. Click the red circle in the toolbar to pause the simulation. Clicking the green arrow again to resume simulation or click the rewind button to reset the time to 0. The current time is displayed in the simulation toolbar next to the control buttons.

For more information about simulations, please see the Simulation section.

Running Tests

One of the new aspects of Version 5 is the ability to run Tests. Tests are controlled from the Toolbox via pull down menus. To select a Test and to set it up, click on the "Tests" tab in the Toolbox. A list of the available tests is in the pull down box at the top. Select a test and its properties will appear. Click the "run test" button to start the test. To learn more about individual tests, please see the section on Tests

Simulation

Simulations

B2 Spice v5 has two modes for analyzing a circuit, a non-interactive Test mode with defined parameter for each Test, and an interactive Simulation, which runs indefinitely until reset by the user.

The Simulation mode is controlled by the main toolbar and consists of the Reset, Pause, Step, Walk, and Run buttons. These control the progress of operation of the Simulation. The Step Ceiling and Update Interval settings control how the Simulation progresses and how often the results are updated.

Page 51: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

45

Unlike Tests, the only thing required to run a Simulation is that you press the green Run button to start the simulation. Once the simulation is running, the simulation can be paused by clicking on the Pause button. Resume the simulation by again pressing the Run button.

The Step button increments the simulation time by one step and pauses. Each subsequent click of the Step button increments the simulation by another step.

The Walk button starts the simulation but increases the simulation by the walk factor, which can be set in the Simulation | Time Options menu.

The Simulation runs a continuous Transient simulation on the circuit starting at time zero and incrementing by the Step Ceiling setting. Results of the Simulation are displayed in either the Animated Schematics or any of the Virtual Instruments. The results are refreshed by the time specified in the Update Interval setting.

SPICE algorithms incorporate the behavior of a variety of devices including resistors, capacitors, inductors, mutual inductors, independent voltage and current sources, four types of dependent sources, switches, uniform distributed RC lines, and the five most common semiconductor devices: diodes, BJTs, JFETs, MESFETS, and MOSFETS. B2 Spice uses the SPICE algorithms and offers the same circuit capabilities.

Over the past 20 years, faculty and graduate students at the University of California at Berkeley have developed computer algorithms for analog circuit simulation. This project, and the resulting computer code, is known as SPICE. B2 Spice uses the Berkeley SPICE (with very few modifications) for all of the simulations. Since SPICE's algorithms have been in use in industry for a long period of time, you can be confident that the results you are getting from B2 Spice Version 5 are correct.

For B2 Spice A/D, we have incorporated pieces of the XSPICE program from Georgia Tech. XSPICE expands Berkeley Spice by providing for mixed mode simulation, a code-modeling module that makes it easier to add new models, and inter-process communications. Also, we have modified the DC transfer function to allow for more general parameter sweeps, and we have added Monte Carlo simulations and parameterized ac and transient simulations.

The BSIM4v4.4.0 model is another piece that we have added to the simulator. This was developed by the BSIM4 development team at UC Berkeley.

SPICE has default models of the semiconductor devices, however the parameter values desired need to be specified. The default model parameters are available when you create a new model in the database editor. The B2 Spice user can specify additional device models if these defaults are not adequate.

SPICE provides for several different types of analysis, including Operating Point, DC Sweep, AC sweep, and Transient. Both DC and Transient analyses are iterative processes which terminate when both the following conditions are satisfied:

1. Nonlinear branch currents converge to within a tolerance of 0.1% or 1 picoamp, whichever is larger.

2. Node voltages converge to within a tolerance of 0.1% or 1 microvolt, whichever is larger.

Failure to converge in DC analysis usually results from incorrectly specifying circuit connections, initial values, or model parameters. Regenerative switching circuits or circuits with positive feedback will often fail to converge, unless the OFF option is used for some of the devices in the feedback path.

Simulation Stimuli

The XSPICE simulator allows both analog and digital stimuli for Simulation.

You can use the voltage and current sources for analog stimuli and the digital source for a digital stimulus or you can use the Function Generator or Power Supply in the Virtual Instruments

Page 52: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

46

window. Note that when you place a voltage or current source in a circuit, B2 Spice automatically adds a corresponding Function Generator for you.

The voltage and current source's transient properties can be set in the transient page of their set-up screens. This allows sinusoidal, triangular, square, exponential, piecewise linear, etc. The digital source's transient properties can be set in its set-up screen as a piecewise linear. We may add a digital clock to the set of digital stimuli also.

Setting up probes for simulations

The voltmeter, ammeter, and marker all can be used to probe voltages and currents for all simulations. In order to use the marker as a voltage probe, check the checkbox by that name in its properties screen. The voltage across the voltmeter, current through each ammeter, and voltage at each marker will show up in the various Virtual Instruments depending on their transient or frequency requirements.

You can also probe the circuit using the Virtual Instruments. Note that virtual ammeters and voltage meters are added automatically. For more information, refer to the virtual instruments section.

Simulation Options

The simulation options have various purposes. The options are accessed through the Simulation | Set Simulation Options menu. The options are divided up into 4 tabs in the dialog: Convergence, Mixed-Mode, Miscellaneous and Signal Coverage. Temperature options can be found under the Miscellaneous tab.

Temperature options Temperature options can be found under the Miscellaneous Options tab.

To set the operating temperature for the simulation, use temp. Tnom is used to set the temperature at which the model parameters were measured. Don’t use this unless you created custom models and you know what temperature you measured their parameters at.

Convergence options There are a lot of options available to help with simulation convergence. This reflects the difficulty in getting some circuit simulations to converge.

Page 53: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

47

For operating point convergence, some particularly useful options are itl1, rshunt, reltol, gmin, gminsteps, vntol and abstol. Itl1 is the iteration limit for the operating point and increasing it from 40 to a higher value will help with convergence. Rshunt is the resistance from every node to ground. It defaults to a very high value (1e12). Lower values may help convergence, but lower values also could alter circuit behavior. Reltol, the relative error tolerance, can be increased to help convergence, but at the price of accuracy. If it's too high, then you may get incorrect results, as is the case with a simple feedback op-amp circuit with the opamp from the Common Parts menu. Gmin is the minimum conductance. It's used internally across junctions in transistors and diodes. If it's too small, the simulator can fail to converge. If you set it to high, however, it can affect the simulation results. Set it as high as possible without it affecting the simulation results.

Gminsteps is used in the gmin stepping part of the operating point solution. It tries to solve the circuit with various values of gmin. The higher the value of gminsteps, the better the chance for convergence.

Vntol and abstol go along with reltol in determining the error tolerance. They are useful when the node voltage or branch current approach zero and the relative tolerance becomes too constraining.

Itl6 is also helpful for operating point convergence.

Normally, itl6 should be left at zero. However, if the operating point won't converge even after using the options described above and other techniques given in the section on Operating Point Success, then Itl6 can be used. Itl6 activates the source stepping algorithm and sets the maximum number of total iterations for the source stepping algorithm. It is the same as srcsteps.

For dc sweep convergence, itl2 is useful. Increase it to help the simulator converge.

For transient convergence, a number of other options are relevant. itl4 controls the number of iterations in the transient solver at a given time point. Increase it to a larger value, e.g. 200, to help with convergence but this may not be enough.

Trtol and chgtol are not tolerance parameters. Trtol is related to truncation error in the Local Truncation Error timestep control algorithm that is used with the transient simulation. It is related to the timestep during the transient simulation. Chgtol is also used in the LTE algorithm. Its purpose is to prevent the transient from locking up. Both of these should not be used unless you are a spice expert.

Minbreak is the minimum break between timepoints while running a transient simulation. For very sharp transitions, minbreak should be reduced. Breakpoints are inserted by the piecewise linear sources and pulse sources and indicate changes in inputs to the circuit.

Pivtol and Pivrel are used in the numerical pivoting algorithm. Pivtol is the minimum acceptable value for a pivot and pivrel is the minimum ratio between a pivot entry and the largest entry in a column of the conductance matrix. Only expert spice users should use these.

Method switches between integration algorithms for calculating capacitor voltages and inductor currents for transient solutions. The possible values are gear for the gear method and trap for the trapezoidal method. The default is trap. Maxord goes along with the gear method and is the maximum order for the multiorder integration method. Higher values of maxord are more accurate but may slow down the simulation.

Mixed mode circuit options Some options relate to the analog to digital and digital to analog converters that B2 Spice automatically inserts between analog and digital portions of the circuit. The parameters bb_daOutlow, bb_daOutHigh, bb_adInLow, and bb_adInHigh are for low and high output voltages for d to a converters and for low and high threshold voltages at the input of a to d converters. Bb_daOutX is the indeterminate voltage at the output of the d-to-a converter.

Maxopalter is used in operating point analysis for the maximum alternations between analog and event solutions. Maxevtiter is the maximum number of iterations for event solution. Noopalter prevents the simulator from alternating between analog and event solutions. Ramptime is the transient analysis supply ramping time, but it only seems to be used with xspice models for the capacitor and inductor (rather than the regular spice capacitor and inductor.)

Page 54: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

48

ConvLimit enables convergence assistance for xspice models. ConvStep controls the size of the step between iterations on xspice model inputs. ConvAbsStep controls the maximum absolute step between iterations on xspice model inputs.

Miscellaneous options Defl and defw are the default mosfet length and width. You can override these in specific mosfets. They default to 100 microns if left blank. Defad and defas are the default drain and source mosfet areas.

Oldlimit uses old Spice2 mosfet limiting, and badmos3 uses the old mos model.

Bypass allows the device calculations to bypass updating values for unchanging elements.

Trytocompact is used with transmission lines.

B2 Spice A/D does not use Keepopinfo.

For more information on these options, see Inside Spice by Ron Kielkowski published by McGraw Hill.

Tests From the Toolbox's TESTS tab, you can select, set up, and control any number of tests that can be performed on your circuit.

At the bottom of each test panel are three tabs that allow you to run different variations of the selected Test. The first tab, Single Test, is a single run through the test, using the specified test setup parameters. A graph, table or both can be specified to display test results. The Preset Plots button will allow the specification of plots to display before the Test is run. Otherwise, B2 Spice will automatically plot any meter signals as well as signals specified by the use of Markers.

The Sweep tab allows the sweeping of multiple parameters over the test range. For instance, a resistor’s resistance can be stepped from 1K to 10K, with increments by 1K, over the range of a Transient Test. This will actually run 10 Test runs, with the first run having the resistor’s value at 1K, the second will run with the resistor’s value at 2K, and so on until the resistor’s value is 10K. You can do multiple level sweeps by specifying more than one parameter to sweep, but care must be used, as this will exponentially increase the number of Test runs. The Set up Sweeps button brings up a box that allows you to specify which parameters and how they are swept. The table format is similar to the Live Circuit panel. Select a parameter to sweep and click the Setup Sweep Parameter to set up the sweep parameters. In addition to the 2D graph options of the Single Test, Sweep Tests can be displayed in a 3D graph if the checkbox for the 3D graph is checked.

Page 55: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

49

The Monte Carlo is similar to the Sweep Tests, but values are varied at random, limited to a range that is user-specified. The Monte Carlo Setup specifies which parameter to vary and how to randomly vary it.

For more information on specific tests, see the sections below.

Initial Conditions / Nodeset / Device IC

Initial Conditions play an important role in both DC Operating Point and Transient simulations. For DC Operating Point, only the NODESET command applies.

However, the Transient simulation uses .Nodeset, .IC AND UIC (in the .Tran line). The differences are explained below.

The Transient Test setup contains three checkboxes, shown below:

The Net Voltage IC toggles the .IC line (below). The Device IC toggles the UIC line of the Transient's .TRAN command. And the Net Nodeset toggles the .NODESET line (below).

Page 56: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

50

When Device IC is checked, B2 Spice uses the "IC=" found in Diodes, Capacitor, Inductors, and Transistors to force

The Setup Net IC button (shown below) allows the use of a Initial Conditions file to be used when the Net Voltage IC box is checked

By default, the Net Voltage ICs are taken from the markers set in the circuit. However, if a Initial Conditions file has been saved from a previous run, you can use it as the starting point of a Transient Simulation. An IC file is generated from a Transient graph by going to the Special Functions->Save Final Data to Transient IC file command.

For more information on how to generate an Initial Conditions file, refer to the Graph Menu section.

The IC and NODESET statements are often confused. The main difference is that NODESET is used for the operating point of the circuit only, and IC is used for the initial state of a transient analysis.

.NODESET (Initial Node Voltage Guesses for operating point and initial transient state)

.nodeset v(<n1>) = <value> [v(<n2>) = <value2>] ...

e.g., .nodeset v(2) = 4.0 v(n3) = 3

The nodeset line helps the spice engine find the operating point for the circuit by setting the node voltages as specified. The restriction is released after the initial pass and the spice engine continues iterating to a stable solution. This statement may be necessary for convergence of bistable or astable circuits. In general, it should not be needed.

.IC (Initial Node Voltages for transient solution)

.ic v(<n1>) = <value> [v(<n2>) = <value2>] ...

e.g., .ic v(2) = 4.0 v(n3) = 3

The ic statement is used for setting initial voltages for a transient analysis. It is used differently depending on whether UIC is specified in the transient statement.

When UIC is specified in the transient statement, then the spice engine uses the node voltages specified by the "IC=" found in some devices to compute diode, capacitor, and transistor initial conditions. The spice engine skips over the dc bias (i.e. operating point) solution in this case. In this case, setting node voltages with the IC statement is equivalent to using the IC parameter on the device lines. The IC parameter can still be used on device lines, and if used, the device IC parameters will take precedence over the .IC statement. The user should take care to specify all dc source voltages in the IC statement because the SPICE engine won't automatically make use of them for the initial transient solution.

When UIC is not specified in the transient statement, the spice engine computes the dc bias (i.e. operating point) solution before the transient analysis. In this case, the spice engine forces the node voltages set in the IC statement to the desired initial voltages during the dc bias analysis. During the transient analysis, the spice engine removes the constraints on the node voltages. When UIC is not specified, the spice engine computes a consistent DC solution.

NOTE: If both the Net Voltage IC (.IC) and Net Nodeset (.NODESET) boxes are checked, the .NODESET command is ignored for the Transient's bias point calculations (.IC overrides .NODESET)..

Page 57: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

51

Test Stimuli

For AC simulations and other frequency based simulations such as noise and ac sensitivity, only analog stimuli are allowed and they are set on the front page of the voltage or current source's properties screen. Use the ac magnitude and phase parameters.

For Distortion simulations, only analog stimuli are allowed and they are set on the front page of the voltage or current source's properties screen. Use the disto1 and disto2 magnitude and phase parameters.

Distortion Test

The distortion analysis computes steady-state harmonic and (optionally) intermodulation products for small input signal magnitudes. If signals of a single frequency are specified as the input to the circuit, the complex values of the second and third harmonics are determined at every point in the circuit. If there are signals of two frequencies input to the circuit, the analysis finds out the complex values of the circuit variables at the sum and difference of the input frequencies, and at the difference of the smaller frequency from the second harmonic of the larger frequency.

The source(s) for the distortion analysis should have Use Disto checked, and values for magnitude and phase, as shown below. Phase should be specified in degrees. If phase is missing, it will default to zero.

The ratio of the frequencies is set along with other distortion parameters in the simulation set-up dialog.

According to the Berkeley Spice manual, the distortion analysis works in the following manner: A multi-dimensional Volterra series analysis is done using multi-dimensional Taylor series to represent the nonlinearities at the operating point. Terms of up to third order are used in the series expansion.

Distortion analysis is supported for the following non-linear devices: diodes, BJT, JFET, MOSFET (all levels), MESFETs. All linear devices are automatically supported by distortion analysis. If there are switches present in the circuit, the analysis continues to be accurate provided the switches do not change state under the small excitations used for distortion analysis. Below are the parameters.

If the parameter Use F2/F1 is not specified and no Voltage or Current source devices have Use Disto2 checked, then the simulator does a harmonic analysis on the circuit ( i.e. it analyzes distortion using only a single frequency, F1, sweeping it as in the AC analysis).

If F2/F1 is specified, then the analysis performs a spectral analysis. F2/F1 should be between 0 and 1. The analysis considers the circuit with sinusoidal inputs at two different frequencies, F1 and F2. F1 is swept according to the DISTO control line options. F2 is kept fixed at its frequency as F1 sweeps; the value of F2 is F2/F1 times START. Each independent source in the circuit may have up to two sinusoidal inputs for distortion, at F1 and F2 frequencies. The analysis provides results composed of all node voltages and branch currents at frequencies of F2, F1+F2, F1-F2, (2*F1)- F2, and F1.

F2/F1 should have as large a denominator as possible, i.e. it's better to use .49 than .50.

Page 58: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

52

AC Sweep Test

The AC test is used to view circuit behavior at different input frequencies. For example, a low-pass filter circuit could be analyzed to determine the cut off frequency for the filter, that is, the frequency above which the magnitude of the output is negligible.

Before running the analysis, B2 Spice shorts out all of the non-constant voltage and current sources that have zero for their AC magnitudes. The sources with non-zero AC values are treated as sinusoidal sources, with their specified peak-to-peak voltages/currents and phases, and zero offsets. (You can view/edit the AC values of voltage and current sources by double clicking on the components.)

With these voltage and current source values, the DC operating point is calculated, and all non-linear elements are replaced with their small signal models. If the DC operating point of the circuit with the sources shorted out is not where you want it, you may have to place some constant voltage sources in the circuit to compensate. Also, make sure that the voltage and current sources used as inputs have non-zero AC voltage/current values.

Like the DC analysis, you must specify the information for the AC Sweep analysis before you can execute it. The Start frequency and Stop frequency specify the range of frequencies for the analysis. The analysis starts at start frequency, stops at stop frequency, and takes place at (Steps per Interval) points per (Step Interval). A decade is a range from one power of 10 to the next, for example from 100 to 1000. The points are equally spaced on a log scale.

The default results will consist of plots for the magnitude and phase of the voltage across each voltmeter and the magnitude and phase of the current through each ammeter in the circuit. The magnitude can be displayed in either decibels or simply magnitude. The scale used for the graph is base 10 log along the x-axis. A decibel is 20*log(mag(x)), where x is a real or complex value. For instance, 1000 corresponds to 60 decibels (db), 100 correspond to 40 db, and 0.1 corresponds to -20db.

To actually run the AC analysis, you must click the Run button in the Test Setup for the type of test (Single, Sweep, or Monte Carlo), after specifying the AC Sweep options as described above.

Make sure that the AC magnitude of the sources is non-zero for the appropriate input source. Also, if you have non-constant sources with non-zero DC offsets, you may want to set their DC offsets to zero for the AC analysis.

Noise Test

This simulation analyzes device-generated noise over a range of frequencies. The user provides an input source and an output source and a range of frequencies. The simulator calculates the noise contributions of each device (and each noise generator within each device) to the output port voltage. The simulator also calculates the equivalent to the output noise referred back to the specified input source. This is what the program means by input noise. The calculated value of

Page 59: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

53

the noise over the range of frequencies corresponds to the spectral density of the circuit variable viewed as the square root of a stationary Gaussian stochastic process.

After calculating the spectral densities, the simulator integrates these values over the frequency range to arrive at the total noise voltage/current over this frequency range. This calculated value corresponds to the variance of the circuit variable viewed as the square root of a stationary gaussian process.

The output must be specified as a pair of node numbers, output, the output noise summation node number, and outputref, the output noise reference node number. View the node numbers in the circuit by using the option in the View menu by that name.

The input parameter should be the name of a noise source, i.e. either a voltage or current source.

The rest of the parameters specify the frequency interval over which the noise analysis will be performed and have the same meaning as they do for an AC analysis. The Include Noise Generator Contributions checkbox is optional. If it is checked, then noise contributions of individual devices will be shown as well. If not, then just the input noise and output noise will be shown.

As for specific noise sources, they include the "shot" noise associated with dc currents in semiconductors and the "thermal" noise associated with resistance. Semiconductors also display "flicker" (1/f) noise, however, the lack of a unified model requires the simulator to handle it on a "case by case" basis. There are flicker noise parameters available for transistors in the list of model parameters. The simulator can also provide the noise gain associated with the 1/f source.

The tabular results to a sample noise analysis are shown below.

First, the integrated noise results are shown. This represents the total input and output noises as a result of contributions from the discrete devices in the circuit. (namely, the resistor).

The results are the square root of what Berkeley Spice generates. This is because Berkeley spice gives values that are proportional to the noise power rather than the noise voltage.

AC Sensitivity Test

The AC Sensitivity test calculates the small-signal sensitivity of the output port to all device values and model parameters over a range of frequencies.

The output port can be specified using node numbers. To display node number, use the appropriate command in the View menu or press the Display Node Numbers button in the toolbar

An example of the set-up is shown below.

Page 60: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

54

Some sample results:

FREQ Re(vp0_acmag) Im(vp0_acmag)

+1.00k +1.00 -125.66u

+1.26k +1.00 -158.20u

+1.58k +1.00 -199.16u

+2.00k +1.00 -250.73u

+2.51k +1.00 -315.65u

+3.16k +1.00 -397.38u

DC Bias Test

The Operating Point analysis calculates and displays the voltage across voltmeters and the current through ammeters.

The results are displayed inside of the voltmeters and ammeters. No simulation will run unless you have previously set it up. To run the operating point analysis, select it from the Test toolbox, and check off the box for the operating point analysis. Next click the Run Test button. The following circuit shows the results of this simulation with the State Display options turned on. Note the 3.33 inside of the voltmeter and next to the wire. That's its steady state voltage at that node. Note the wire colors. The brighter red wire denotes a higher voltage than the deeper red wire. The black wire denotes zero voltage.

Page 61: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

55

The operating point results, consisting of the steady state voltage of each node in the circuit, and the current through each voltage source and ammeter, are also displayed in a text view.

Please see the State Display section for more information on State Displays.

DC Sensitivity Test

The sensitivity simulation calculates the sensitivity of the output port to all device values and model parameters. It allows dc sensitivity at the operating point.

To run the DC Sensitivity Test, select an output node and a reference node. If you are not sure which node to select, Show the Node Numbers from the View menu or use the Show Node Name button in the toolbar. The nodes should correspond to the output port that you wish to test.

For example, in the tutorial one circuit, the DC sensitivity is requested from node 2 to 0.

These results indicate that the output voltage is decreased by -1.221 mV for every 1 Ohm change in I(r). This is a small signal DC result.

DC Sweep Test

This analysis is often used to generate the input/output characteristics of circuits. In its most common form, the input can be a constant current source or a constant voltage source. However, we have added a new feature in B2 Spice. The input now can also be a temperature or a device parameter or a model parameter. The input is swept through a set of values, and for each value the DC operating point of the circuit is calculated. That is, all capacitors are opened, all inductors shorted, and voltage and current sources (except for the input) are set to their initial values.

If you want a temperature sweep, the name1 parameter must be specified as temp. If you want a parameter sweep, the name1 parameter must be in the form <device name>.<parameter name>. For example, to change the resistance of resistor R1, name1 should be R1.resistance. Actually, for some devices such as the resistor, if you specify name1 as R1 it will assume you mean the resistance of R1. Similarly, if you specify the name as the name of a voltage or current source, the simulator will assume that you mean the source's dc value.

Unlike the Operating Point Test, you must specify the information for the DC Sweep analysis before you can execute it. The Source ID is the input, which must be the name of a constant voltage or current source. The start value, step value, and stop value specify the range and intervals for the source. The analysis starts at start value, stops at stop value, and steps at intervals equal to the step value. The default results consist of plots for the voltage across each voltmeter and the current through each ammeter in the circuit. Customizing the results will be covered in detail later.

The State Display section controls the optional graphic representation as the simulation runs. Refer to the State Display section for more information.

To actually run the DC analysis, you must click the Run Test button, after setting the DC Sweep options as noted above.

Page 62: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

56

The DC Sweep is perhaps best illustrated with examples. Tutorial #1 has an example of the DC Sweep used on a linear resistive circuit. Tutorial #2 illustrates the DC Sweep on an RLC circuit, where the inductor is shorted and the capacitor opened.

DC Transfer Function (TF) Test

The Transfer Function simulation calculates the small signal transfer function by linearizing the circuit around the operating point. It generates the output impedance and gain seen across the circuit from an input source to an output port. All you need to do is specify the output port and the input source.

VC010

R1

1K 1 2

R2

2K 2 0

+3.33

IVOUT

2 0

0

For the tutorial #1 circuit, shown above, the transfer function is requested with the voltmeter as the output port (or nodes 2 to ground), and the voltage source (VC0) as the input port. Using Show Node numbers, you can see that the node numbers across the voltmeter are 2 and 0, as shown in the figure above.

Here are the results for the example.

Page 63: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

57

Device Parameters Test

This test shows operating point details for each of the primitive devices in the circuit. By default, it will display results for all devices in the circuit in a text window.

Model Parameters Test

Page 64: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

58

This test shows the operating point details for each of the process models present in the circuit. The results are shown in a table.

The following results from the Test display partial results from the tutorial three circuit.

Transient Test

The transient analysis generates the circuit's behavior over time, from tstart to tstop. The maximum interval between time steps, tmax, is critical to prevent the simulation from generating incorrect results. If tmax is too high, then sharp changes in the circuit's voltages may be overlooked by the simulator. The program gives you the option to linearize results, which will cause SPICE to generate a second transient graph, with results linearized at an interval of tstep. The Transient Test is similar to the default Simulation, but the time span is defined and the results are displayed in a graph instead of the virtual instruments.

Page 65: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

59

Net Voltage IC, Device IC, Net Nodeset and Setup Net IC all refer to Initial Conditions. Device IC specifies that any initial conditions specified in devices be used. Net Voltage IC specifies that the simulation use any Transient IC markers present in the circuit. Net Nodeset applies to any Nodeset Marker present in the circuit. Another IC option is to use the final state setting from a previous run as a starting point for the next run. This involves saving an IC file from a previous run and setting the IC File in the Setup Net IC button. For more detailed descriptions of Initial Conditions, please refer to that page.

Sometimes Spice has trouble converging on solutions with the transient analysis. If this happens, sometimes increasing capacitances and internal transistor capacitances specified in transistor models can relax the circuit enough to help convergence. Also, sometimes increasing the itl4 option (in the Simulation Options... dialog) from its default of 10 to around 40 can help.

The Linearize Results box allows the option of linearizing the Transient results after the simulation is complete. Linearizing will generate one or more new plots with evenly spaced data points based on the settings specified in the Linearize dialog box. During a Transient run, SPICE can automatically adjust the step size to try to arrive at a result and can result in uneven datapoints. Linearizing the results can readjust the plot so that the datapoints are evenly spaced according to the step size that is chosen in the Linearize dialog box, which appears after the simulation is complete.

The transient simulation can be followed with a fourier analysis if the APPLY FOURIER checkbox is checked. The fourier transform calculates the harmonics at the first 10 multiples of the fundamental frequency. The results from the transient analysis should be linearized first in order to get reliable results.

For good accuracy, Tmax of the transient analysis should be set no higher than period / 100, where period is 1 / fundamental frequency. One or more output variables can be specified for the output parameter. The output can be a pair of nodes defining a voltage, or a voltmeter name.

The following graph is the result of running a Transient test on Tut2.cpr

Page 66: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

60

Network Analysis

The network analysis determines the circuit’s behavior as seen through its port(s). It generates data in the form of Z (impedances), Y (admittances), S (scattering), and H (the inverse of S). In the case of a two-port analysis with Z results, the four results are Z11 (the input impedance), Z22 (the output impedance), and Z12 and Z21 (the cross-impedances). Network analysis is often used for analysis of circuits that operate at very high frequencies, and components operating at these frequencies are often modeled with tables of S-parameters.

The Network analysis setup is available from the Tests tab. The Connections tab is where the port information is configured. Network analysis is an analysis of a circuit with one or two ports. If only one port of a circuit is being analyzed, then only the first Port (labeled Port 1 in the setup) needs to be configured. The port can either be configured by node names or by selecting a part. If both ports are being analyzed, enable the Port 2 setup by checking the “Port 2” box and then setting the port like Port 1.

The Sweep tab is where the Network Analysis Test run is configured. Specify the range of the Frequency to analyze and the stepping interval. The Sweep can either be performed in Small Signal mode, which performs a small signal AC Sweep through a set of source frequencies, or in Large Signal mode, which performs a transient analysis at varying source frequencies.

The Output tab specifies how the resulting data should be displayed. The Parameter Set is only active if the graph is of Cartesian or Polar type.

Please note that in the Network Analysis setup, there is a separate section for displaying data in a graph or table. If a graph output is desired, check the GRAPH box and a graph of the type specified will be displayed. If a data table is desired, checking the TABLE box will generate the test results in a new table.

Parameter Sweeping

Every Test comes with an option to "Sweep" or Step a parameter over the entire run of the test. In other words, you can vary a particular parameter for each run of the Test.

For instance, you can Step a particular resistor's resistance from 1K to 10K by increments of 2K for a Transient Test. When you run the Transient test, the first transient run will be run with the resistor's value at 1K. The second transient run will be run with the resistor's value set at 3K, since the increment was set at 2K. Each step of the resistor's value will result in Transient test so the Transient test will be run 5 times, with resistor's values of 1K, 3K, 5K, 7K, and 9K. The combined results will be displayed in a graph.

To set up a sweep, select the test you would like to run from the Test tab in the toolbox and set up the test parameter. Then click on the "Sweep" tab in the Test setup.

Page 67: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

61

In the Sweep tab, click Set up Sweeps to enter the dialog to set up your sweep parameters. This will bring up the following dialog box (the data will depend on what you have in your circuit. The dialog box applies to Tut2.cpr):

To select a parameter to sweep, select the tab that contains the parameter you wish to vary. The Part Parameter tab contains the available parts and their parameters. The Part Model Names tab lists the available Parts' model parameters in the circuit. The Model Parameters tab lists the model parameters available. User Parameters are user-defined parameters that are set defined by the user. More information about User defined parameters is available in the user-defined parameters page. System Parameters refers to the parameters found in the Simulation->Spice Simulation Options dialog box.

Page 68: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

62

In the Parameter Setup section, the Start, End, and Step Interval define the first step, the maximum step and the increment to each step. The above example will step the resistance values at 1K, 3K, 5K, 7K, and 9K, for a total of 5 steps. Note that 10K is actually never reached since that the last step was 9K and stepping by 2K would result in 11K, which is larger than the maximum step value specified. Select Accept Changes to accept the changes. The sweep should now be displayed next to the parameter as well as in the Active Sweep Parameters box. Click on the Preview Scenario Array to see what the sweeps will look like.

Caution should be used in setting up sweeps as a large number of steps combined with a long Test run can result in very lengthy run test times.

Monte Carlo Test

Like Parameter Sweeping, Monte Carlo analysis can be run in conjunction with any tests. Just select the Test you wish to perform from the Test tab, set up the test parameters as described in the individual tests, and click on the Monte Carlo tab to set up a Monte Carlo analysis.

To set up a Monte Carlo analysis, click on the Setup Monte Carlo button. This will bring up the following dialog box:

Page 69: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

63

The number of runs (or number of times to randomly vary the chosen parameter) is set in the # Iterations box. For each run, a set of device parameters is assigned randomly according to the parameter's range and distribution type.

To select and set up the device parameters for variance, select the appropriate parameter from the available tabs. Resistors and capacitors distributions are set through their own buttons because Monte Carlo tolerance is built into the model and require its own setup. For other devices, use the Edit Distribution button to set up a particular parameter for Monte Carlo analysis. Clicking any one of these buttons will bring up the following dialog box:

The name of the Part/Parameter that you are setting the distribution for is displayed in the Parameter box. Use the Random Type drop down box to set the Distribution Type.

If you specify Tolerance as a percentage, then it will be interpreted as a percentage boundary on either side of the individual parameter's given value. The main types of distributions are Gaussian and Uniform. Gaussian distribution is the bell shaped distribution, and Uniform gives any value in the range an equal probability. To set individual parameter Monte-Carlo distributions, edit the model properties of any part in the circuit and if the model parameters are available, then you should see an area where you can edit the range and distribution type for the parameter.

Results of the Monte Carlo Test can be displayed in a 2D graph, or a Histogram, which displays the distribution frequency of the results. Each graph type is set up under the respective tab in the Monte Carlo setup area.

Page 70: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

64

When specifying the Histogram, the results will appear as a set of curves.

When running a Monte-Carlo simulation, at each simulation iteration, parameters are set to values that are different than their specified values according to their tolerances.

When you have more than one parameter being offset by a tolerance, sometimes you may want them to move together, and sometimes you may want them to move distinctly.

There is also the concept of a shared model. For example, every transistor has a set of shared model parameters and a model name that identifies that set of shared model parameters. If you add two default bipolar transistors to a circuit, then they will, by default, share the same model and model parameters.

With shared models, the varying parameters will share the same value even though they belong to more than one part. For example, if your circuit has two bipolar transistors that share the same model, and if you set the tolerance of bf to 5% and the value to 100, and then run a Monte Carlo operating point analysis, the two transistors will have identical forward betas (bf) for each iteration of the Monte-Carlo analysis.

There is a way to prevent models from being shared when you create them. Go to the Edit/Schematic Options menu item when your schematic is up front, then go to the General page and turn on the “New devices have unique models” checkbox in the Spice Options section.

Once a part is placed, there is a way to make it unique. Double-click on it (or select it then choose Edit Model from the Edit menu), then click on the “Make Model Unique” button and the model, if it was shared, will be made unique.

Resistors, capacitors, and inductors are special cases. With these types of parts, as you place them in the circuit, they don’t share model parameters. Semiconductor versions of these parts or temperature dependent versions are not included in this special case… they will behave as the transistors discussed above.

There is another way to tie together the tolerances among parameters from parts. This is with the “group” number. If two parameters share the same group number, then the number used to scale the deviation will be identical. For example, you could be using two resistors, and the first has a tolerance of 10% with a group number of one (1), the second a tolerance of 5% with a group number of one (1). Then, when you run the Monte-Carlo simulation, the second resistor will deviate from the base value by one-half of the amount that the first resistor deviates. These group numbers work across devices also.

How B2 Spice handles the default Monte-Carlo parameters.

With default parameters:

If the tie-together-defaults box is checked for a part-type in the Monte-Carlo defaults, then

Page 71: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

65

If part has no model:

then B2 Spice creates a “shared” model for it (or uses the shared model if it exists), and gives the parameter a unique group number.

Else if the part has a model already, but the parameter has no tolerance,

then B2 spice gives it a unique group number.

If NOT tie-together:

If part has no model:

then B2 spice gives it a unique model with a tolerance attached to the parameter with no group number.

Else if part has a model, and the model is shared, and the parameter has no tolerance, then …

B2 spice warns the user that he must go into the various models to make them unique first, then try again.

Tips for simulation success All simulations run an operating point analysis at least once during the simulation. If the operating point analysis fails, then the simulation will fail. If you are having problems with any one simulation, then the best approach for identifying the problem is to run an operating analysis by itself.

Operating point success

When you run a simulation, the simulation engine attempts to find a stable operating point for the circuit. In some cases, it fails. Possible reasons include circuit topology, bistable or unstable circuits, far-off initial node guesses. In addition, highly non-linear circuits are difficult for the simulator to handle and may require tweaking options. Error messages include "Iteration limit reached" and "singular matrix" or "gmin stepping failed". Look in log window after simulation is complete to find error messages.

Common problems/solutions include:

Check your node connections. Use Show Node Numbers from the View menu to check node numbers. Nodes with the same number are connected. Also, you can check the spice netlist for node numbers of devices. Often problems result from missed connections or unintentional connections.

Check for illegal configurations: For voltage sources in parallel, inductors in parallel and voltage source in parallel with inductor, add a small resistor in series with the voltage source or inductor.

For current sources in series, capacitors in series and current source in series with a capacitor, add a large resistor in parallel with the capacitor or current source.

Check for typos: A common error is confusing zero with the letter "O" for parameter values.

If you can't find a simple error in the circuit, then try one or more of following:

Increase itl1 (e.g. 200)

Use shunt resistances: Reduce RSHUNT (e.g. 1e9) low enough to have an impact on the convergence but not so low that it affects the behavior of the circuit.

Increase error tolerance: This is the option reltol.

Increase minimum conductance: Option Gmin.

NODESET: Set the initial guess at different troublesome nodes in the circuit. Do this by adding a Nodeset Marker, found under the Common Parts->Markers menu.

Active Devices Off: When Spice starts a simulation, it assumes, by default, that all active

Page 72: B2 Spice Version 5

T E S T S A N D S I M U L A T I O N

66

devices are in their active regions. Sometimes setting some active devices to OFF will help in circuits with hysteresis or with multiple feedback paths.

Transient Success

Common error message: Timestep too small. This occurs when the simulator gives up after reducing the timestep below the minimum time step.

There are several options you can try to improve the results.

Spice Simulation Option: Increase itl4 (transient iterations) , e.g. 200. This allows more tries before giving up.

Make your circuit more realistic. Most importantly, add junction capacitances on transistors. These are in model parameters for transistors.

Spice Simulation Options

Decrease shunt resistance: Decrease the value of the shunt resistance under the Convergence tab of the Spice Simulation Options.

Spice Simulation Option: RELTOL: This is the relative error tolerance. The default is 0.1%. Try increasing it by a factor of 10, to 1.0 %. This is very useful in solving convergence problems due to the small time step of the transient algorithm. Increase the absolute current tolerance

Special notes for the Opamp

The op-amp model used for the 5-pin opamp is highly non-linear and it will give the wrong results in some cases with default tolerances. To fix this, decrease the relative tolerance option to a very low value (e.g. 1e-7). In general, if the results are looking fishy, decrease the relative error tolerance.

Page 73: B2 Spice Version 5

T O O L B O X

67

Toolbox The Toolbox contains a number of tools that allow you to design, control and test your circuit, graph, or table quickly and efficiently.

The tabs shown are dependent on which type of document is currently active. The various tab layouts are shown below with some common tabs between all of them:

Schematic: Graph: Table:

The Toolbox contains the following tabs:

Add Parts - The Add Parts window will allow you complete control over the selection of parts. You can choose parts by their function by navigating through a series of expanding menus. Or you can select parts by manufacturers or by their names.

Also included is a Parts Palette that you can fill with your favorite or most commonly used parts for quick reference. Or you can fill it with parts that have been standardized by your organization.

Parameters - The Live Circuit Parameters Panel displays a list of all the devices in the circuit that have user-alterable values and lets you change them.

Tests - The Tests section of the Toolbox allows you to quickly set up a variety of tests (or simulations, in our previous programs) and run them.

Workspace - The Workspace tab allows you to manage your open projects and files, as well as managing the plots and simulations results of your tests.

Animation - The Animation enables graphical display of voltages, currents and power on the schematic through symbols, colors, and text.

Page 74: B2 Spice Version 5

T O O L B O X

68

Wizard - The Wizard allows quick creation of commonly used circuits, based on certain properties that you choose.

Edit Graph - (When a graph document is active) The Edit Graph tab allows you to control the appearance of your graph. Here you can set the graph's colors, background, axes, gridlines, and fonts. You can also save these setting as default settings so that subsequent graphs will appear as you prefer them.

Legend - (When a graph document is active) The Legend tab displays the list of plots in the graph, as well as the current values at the cursor as you move across the graph.

Edit Plots - (When a graph document is active) Edit Plots allows you to manipulate the existing plots, their colors, and add/remove any signal. You can also add custom plots using our built in library of mathematical functions and existing signals.

Hide - This hides the entire toolbox to allow you to work with a larger schematic area..

Add Parts Tab The Parts tab allows you to quickly and efficiently find the exact part you are looking for. Click on the "Parts" tab in the toolbox to access the Parts Chooser.

Parts by Function

The quickest method for locating just the right part is by function, where clicking on one of the main function buttons. This will bring up a menu of more specific sub-functions and will allow you to quickly navigate down to a specific part.

Parts by Manufacturer

If you're not sure what function the part you are looking for falls under, you can then click on the MANUFACTURER tab at the top to sort the list by manufacturer. Two windows appear, the top of which is the list of manufacturers available. Click on the Manufacturer's name to filter by that manufacturer.

Page 75: B2 Spice Version 5

T O O L B O X

69

Parts by Name

If you know exactly which part you want and know the name, you can click on the PARTS BY NAME bar at the bottom of the window. A list of parts will be displayed by alphabetical order.

There are two checkboxes at the top of the Parts Chooser window labeled "SPICE" and "PCB export". Check the "SPICE" box to display parts that have a SPICE model. Likewise, check the "PCB Export" button to display parts that have no simulation model and are used as symbol-only PCB parts.

These two checkboxes appear in all three filter modes, Function, Manufacturer, and Name. Check them to display the relevant parts only.

Furthermore, you can also click on the alphabet shortcuts for a quicker find.

Page 76: B2 Spice Version 5

T O O L B O X

70

Parts Palette

Clicking on the Palette button, which will display a window that you can fill with a list of the parts that you want. This will allow you to build a list of your most commonly used parts for quick access and placement.

Fill the palette by selecting from the list of database parts in the lower window and clicking on the "Add Part" button. Remove parts from your palette by selecting it and clicking the "Remove" button.

Customizing the palette is as easy as selecting from the list of available database parts in the lower window and clicking the ADD PART button. Your selected part will appear in the top window, ready for selection and placement. Removing a part from the palette is as easy as selecting the part in the palette and clicking on the REMOVE button.

Live Circuit Parameters Panel Oddly named, but quite useful, pressing the Parameters tab reveals a small spreadsheet-like grid which lists all the parts in the circuit available for scrutiny (actually, only those parts which allow value changes, such as resistors, capacitors, current and voltage sources, and inductors, but not ground). Thus, the part’s name is displayed in the left cell, while its value is displayed in the right cell.

Clicking on the value allows the user to edit the value by typing in a new value or using the slider at the top of the tab to control the value. By using this in conjunction with a running Simulation, you can see what effects changing a part’s values will have to the function of the circuit immediately using either the Animation or Virtual Instruments.

Page 77: B2 Spice Version 5

T O O L B O X

71

In the picture above, you can see that the VP0 voltage source's dc value has been selected. The default value of 5, which is set in the device properties in the circuit, appears in the parameter modification area above the table.

Use the "All", "Some", "Few" (default) button to expand to shrink the list of displayed devices and properties. The "Few" button lists just the primitive devices and their values, such as a resistor's resistance, inductor's inductance, and so forth. The "Some" button will add more sources and their properties, and the "All" button lists every devices and parameter that is accessible in the program.

Once the simulation is running and the circuit is "Live" you can take advantage of the Parameters panel to modify device parameters in real time and see the immediate effects. You can change a

device's property by entering the value directly in the text box then pressing the accept button to use the value. Or you can just use the slider to adjust the value. The Recenter button has the effect of making the current value the center of the slider. This is handy when you hit the end of the slider's range and want to go further. In this case, clicking on the recenter button will make the slider's end value the new center which will then allow you to continue modifying the parameter.

If you select the All or Some listings, devices and their primitive models will be listed. When you select these parameters, you have the option of changing the model with one from the database. For instance, you can change the model of a diode by highlighting the diode and its model name

in the table. Then in the modification area, the accept button is replaced by a selection

ellipse . Clicking on the ellipse will bring up a dialog box that will allow you to select a new model from the database.

Please note that while the simulation is running, modification of device parameters by double clicking on the device itself is not allowed. You will receive a warning message telling you to use the Parameters panel instead.

Results of any changes due to the Parameters panel modifications are shown in a number of ways. If you have Animation (or State Display) turned on, the changes are reflected directly on the circuit itself in the form of colored wires and shapes on the wires. If you have the option to display text value, then the results are displayed as text readouts on the schematic also.

Perhaps the best way to examine the changes from the Parameters panel is to use the Virtual

Page 78: B2 Spice Version 5

T O O L B O X

72

Instruments, where you can examine various readings from specific nodes and devices. See the Instruments for more information on setup and use.

Animation Selecting the Visualization tab brings up the main Visualization window:

The main window is where you turn on or off the graphical representations for the circuit's Voltage, Current and Power states. If running a digital simulation, you can also control the display of digital wire states. Each state can be shown graphically, textually or both.

If displaying Graphically, the wires will be colored or have an animated symbol to indicate the wire state as a Simulation is running. Text display will have display the state as a text field, one to each node.

More detailed options for each State Visualization can be accessed by clicking on the respective Options button for each state. A picture of the four tabs are shown below:

Page 79: B2 Spice Version 5

T O O L B O X

73

Once you have specified that B2 Spice should display States on the circuit and have set up the display options, run the Simulation and the circuit's wire states should now change as the simulation proceeds. Wires will change colors and arrows and diamonds will indicate the relative strength and flow of the wire. Node voltages are displayed in moveable text fields.

When you change the circuit in a way that will change the node voltages, then the operating point is recalculated in the background and the values are re-displayed.

Page 80: B2 Spice Version 5

T O O L B O X

74

Workspace The Workspace tab is allows you to organize and control open Projects and files belonging to the project. Below is an example screen shot of the Workspace with some projects open.

The Workspace tab is organized as a Tree-Branch style navigation panel, with the project listed as the root, and all related files and graphs listed as braches when you click the "+" next to each root or sub branch. The "+" button only appears next to items that contain something below them.

If you right-click on each item, a context-sensitive menu will appear listing the available commands relating to the document type.

Each right-click menu contains a Bring to Front command that should activate that document.

Project Menu

If you right-click on a project root, the following will appear:

Clear All Projects - closes all open projects.

Refresh Workspace Tree - refreshes the display to reflect any changes in documents or graphs relating to the project.

Schematic Menu

Right-clicking on a schematic branch will pop up the following menu:

Page 81: B2 Spice Version 5

T O O L B O X

75

Open This Schematic – opens the Schematic as the main window in the schematic editor.

Rename Schematic - renames the schematic displayed in the windows tab.

Bring To Front – opens the selected circuit//schematic as the main window.

Close Schematic - closes the Schematic and asks if you wish to save it if it has been altered.

Remove Schematic From Project – removes the Schematic diagram from the schematic editor.

Graph Menu

Right clicking on a graph branch will pop up the following menu:

Bring Graph To Front - opens the selected graph as the main window.

Rename Graph - renames the graph displayed in the windows tab.

Wizards The idea behind the wizards is easy circuit creation, much in the same way as MS Word has a calendar and résumé creation wizard. For example, power supplies come in many forms with wildly different topologies. Although they appear simple enough, they imply a complex array of design headaches: what transformer winding ratio is needed, what are the capacitors’ values, which diodes to use? Furthermore, using a raw DC power supply with a voltage regulator brings many added calculations, such as drop out voltages. Fortunately, the power supply wizard makes it easy to plop a power supply right into an existing B2 Spice circuit.

First the basic fundamental type is selected (half-wave or full-wave). Second the expected load

Page 82: B2 Spice Version 5

T O O L B O X

76

for the power supply is specified (un-regulated or regulated). Next the desired output voltage, output current, nominal AC wall voltage and peak ripple voltage are entered. The wizard now has enough information to design a suitable power supply that will meet the user’s specified requirements. All that’s left is for the user decides whether to create a new B2 A/D Spice circuit or insert the new power supply into an existing B2 A/D Spice circuit.

If the user doesn’t want a power supply after all, the “Back” button allows him to go back into the outline of wizards to choose another.

Edit Graph The Edit Graph tab is only visible when the active window is a Graph.

The Edit Graph tab allows you to control the display properties of the graph, including the color of the graph, the grid displays, the text of the graph, the scale (log or linear), and other display properties.

Plot displays are not affected, and are controlled through their own tab: Edit Plots

The Edit Graph tab has four main sections (Basic, Text, Axes, and 3D), each with their own sub-tabs for even more display options. Each section is selected by pressing the desired button at the top of the Edit Graph tab.

Each setting page/tab has two buttons: Save Page and Save All. The Save Page saves the settings of the active page or sub-tab as the default for subsequent graphs. The Save All button saves the entire Edit Graph settings as default for all subsequent graphs.

Below are listed the four main areas of Graph control:

Edit Graph - Basic

The Basic section of the Edit Graph tab controls the overall appearance of the graph.

Page 83: B2 Spice Version 5

T O O L B O X

77

The properties controlled in this section are:

Show Axes checkbox - unchecking this box will turn off all gridlines and gridline labels. The graph will then consist of the plots in a gridless graph.

Background Color - The background color is the color of the graph window, not the color of the graph itself.

Graph Color - the color of the graph itself.

Scroll Arrows - toggles the arrows that allow scrolling of the graph. The scroll arrows appear as small blue triangles at the ends of the axes.

Show Legend - this checkbox control the display of the on-graph legend showing the visible plots and their plot colors. This is different from the Legend Tab which is part of the Toolbox.

Clip Points - When turned off, allows the plots to overrun the graph bounding box. When turned on, the plots are restricted to the graph area only.

Margins - Controls the 4 margins between the graph and the window edge.

Capture Graph to Clipboard - copies the graph window into the clipboard, ready to be pasted into another document. The Capture to File saves the graph to a file in various graphic formats.

Default Numeric Format/ Precision – defines the floating-point format. The style of the format and number of digits after the point can be chosen. Styles include metric suffix or scientific notations.

Edit Graph - Text

The Text section of the Edit Graph tab controls all aspects of the display text of the Graph.

Page 84: B2 Spice Version 5

T O O L B O X

78

The Text section has three sub-tab - Legend, Title and Footer and will be discussed below.

Legend The Legend tab controls the text properties of the in-graph legend.

Show Legend toggles the display of the legend.

Check boxes - toggle the availability of the check boxes in the legend that allow individual plots to be turned on or off.

Inverted - inverts the order of the plots listed in the legend

Font Series Color - when checked, displays the plot name in the legend in the same color as the plot line itself.

Position - controls the display position of the legend box.

Page 85: B2 Spice Version 5

T O O L B O X

79

Legend Style - selects the style for the legend.

Text Style - selects the style for the text of the legend

Vert. Spacing - controls the vertical separation between the plots in the legend.

Plot Color Marks - controls the plot line characteristics of the legend.

Title The Title sub-tab controls the text characteristics of the Graph Title

Text - the actual text of the graph title.

Show - toggles the display of the title

Size border to text - when checked, restricts the title's border to the actual text size. Otherwise, the border is as wide as the graph.

Background - the background color of the title box

Border color - the color of the title box border

Alignment - the placement of the titlebox, Left, Right, or Center.

Footer The Footer sub-tab controls the display of the optional footer for the graph. The options for the Footer are the same as the Title sub-tab.

Edit Graph - Axes

The Axes section of the Edit Graph tab controls the display properties of the graph's axes.

Page 86: B2 Spice Version 5

T O O L B O X

80

The Axes section is further divided into the following sub-tabs: Scale, Title, Place, Major, Minor, and Label and are discussed below.

The Select Axis drop down box specifies which axes are being edited. All the sub tabs apply only to the selected axis. The Show checkbox toggles the display of the selected axis.

Add New Axis button adds a new axis to the graph, effectively adding a new y-axis to the graph sharing a common x-axis with the existing y-axis.

Scale The Scale sub-tab controls the scale setting of the selected axis.

Page 87: B2 Spice Version 5

T O O L B O X

81

Auto - when checked, directs B2 Spice to automatically scale the selected axis.

Logarithmic – specifies a Log scale for the selected axis. When unchecked, the scale is linear.

Inverted - reverses the direction of the selected axis.

Max - the maximum value for the selected axis. The Offset setting is the pixels that separate the edge of the setting from the edge of the graph.

Min - the minimum value for the selected axis. The Offset setting is the pixels that separate the edge of the setting from the edge of the graph.

Interval/ Increment – sets the grid spacing of the axis. Select from Auto or set the spacing using a custom grid increment or the number of gridlines to use.

Title The Title sub-tab controls the naming of the selected axis.

Title Text – enter the title of the graph here.

Margin – set the left margin of the title text.

Angle – determines the angle of the title text. If you want the text to look vertical, set it to 90o.

Title Font – choose the font, font style and size of the font here.

Place The Place sub-tab controls the positioning and display of the selected axis

Page 88: B2 Spice Version 5

T O O L B O X

82

Vertical/Horizontal Start - takes a value of 0 to 100 (in percentage of the graph's height/width), and specifies the start of the selected axis.

Vertical/Horizontal End - takes a value of 0 to 100 (in percentage of the graph's height/width), and specifies the end of the selected axis.

Horizontal Position - specifies how far from the graph's edge the axes is placed.

Position Units – specifies the unit in percentage or pixels.

Axis Color - the color of the axis line.

Major The Major sub-tab controls the display of the Major gridlines for the selected axis.

Border Marks - toggles the major tick marks on the axis line corresponding to the major gridlines

Color / Style / Length - respectively controls the color, style and length of the tick marks.

Major Grid - toggles the display of the major gridlines in the graph and controls the color and style of the major gridlines in the graph.

Page 89: B2 Spice Version 5

T O O L B O X

83

Minor The Minor sub-tab controls the display of minor gridlines of the graph. Minor gridlines are divisions of the Major gridlines.

Border Marks - toggles the minor tick marks on the axis line corresponding to the minor gridlines

Color / Style / Length - respectively controls the color, style and length of the tick marks.

Minor Grid - toggles the display of the minor gridlines in the graph

Color / Style - controls the color and style of the minor gridlines in the graph.

Minor Tick count - the number of minor gridlines to show between major gridlines.

Label The Label sub-tab controls the text denoting the values of the tick marks/gridlines.

Multi-Line: - this is not in use at this time.

Page 90: B2 Spice Version 5

T O O L B O X

84

Round First - specifies whether the first grid mark is displayed

Label on Axis - specifies whether the very first and last marks are shown.

Style - the line style

Angle - the text angle for the grid/mark labels

Min Separation - the minimum separation between labels in pixels

Override Default Format – similar to Basic tab’s Default Numeric Format/ Precision. It allows the specification of the style of the floating point.

Edit Graph - 3D

The 3D section controls the 3D display properties of the graph.

Any 2D graph can be turned into a 3D graph by checking on the 3 Dimensions checkbox. Once this is checked, the properties of the 3D graph become active and are discussed below:

Orthogonal - checking this box puts the 3D graph into orthogonal mode and allows the adjustment of the orthogonal angle with the related slider. Checking this box disables the Rotation editing.

Zoom Text - toggles the "zooming" of the text via the associated slider or text box. This essentially shrinks or expands the text labels of the 3D graph.

Depth Ratio - controls the depth (or z axis length) of the 3D graph.

Zoom - enlarges or shrinks the graph

Rotation - rotates the graph about the Y-axis.

Elevation - rotates the graph about the X-axis

Horizontal Offset - the horizontal placement of the graph in the window.

Vertical Offset - the vertical placement of the graph in the window.

Perspective - adjusts (skews) the perspective. Use the slider to get the feel of the settings.

Edit Graph - Circle

Page 91: B2 Spice Version 5

T O O L B O X

85

This option applies and appears only when the graph being edited is a Polar Plot or Smith Chart. The only option available is the “CheckBoxCircle” which forces the Polar or Smith graph to display as a true circle instead of rescaling its X and Y axes independently with the size of the graph display.

Edit Graph - Histogram

This option applies and appears only when the graph being edited is a Histogram.

The Histogram’s minimum and maximum X axis setting can be changed instead of having to pre-specify them and rerunning the Test. The number of intervals can also be set from this dialog.

Legend The Legend tab only appears in the Toolbox when the active window is a Graph displaying the results of a Test.

Page 92: B2 Spice Version 5

T O O L B O X

86

The Legend displays all the visible signals in the graph in the top section

The selected signal is highlighted in the legend.

The Auto Zoom checkbox toggles the feature that scales the selected plot to fit the graph.

The Auto Highlight checkbox toggles the automatic increase of the selected plot's width by 1 to set it apart from the other plots.

Edit Plots this tab is only visible if the active window is a graph.

The Edit Plots tab controls the display of the Plots in the Graph.

Edit Plots is further divided into two sections - Edit Plot and Plot List and are discussed below

Edit Plots - Edit Plot

The Edit Plot section of the Edit Plots tab controls the display of the visible plots in the Graph.

The top section displays a list of the visible plots in the graph, with the active plot highlighted.

The controls below the visible plot list apply only to the selected plot.

Auto Zoom Mode - toggles the auto zooming of the selected plot to fit the graph window

Auto Highlight - toggles the highlighting of the selected plot by increasing the plot width by one.

Show Maxima - toggles the display of the various maximum values of the selected plot as various labels, including value, percentage, and other types.

Show Minima - toggles the display of the minimum values of the selected plot as various labels, including value, percentage, and other types.

Page 93: B2 Spice Version 5

T O O L B O X

87

Show Zeros - toggles the display of zero-crossings of the selected plot as various labels, including value, percentage, and other types.

Plot name - allows the customization of the selected plot's name

Plot color - color of the selected plot in the graph

Plot Line Thickness - the thickness of the selected plot, in pixels. Note that if Auto Highlighting is on, the Thickness is automatically increased by one.

Plot Line Style - the style of the selected plot's line on the graph.

Plot X-Axis - allows the association of the selected plot to a specific top or bottom axis

Plot Y-Axis - allows the association of the selected plot to a specific left or right axis.

New Left Axis – allows the selected plot to feature its own axis as a sub-graph.

Edit Plots - Plot List

The Plot List section of the Edit Plots tab controls which signal from all the available signals are displayed in the graph.

The Source Signals box displays all the available signals generated by the Test.

The Graph Signals box shows the list of signals currently shown in the graph.

Page 94: B2 Spice Version 5

T O O L B O X

88

To add an existing source signal to the list of displayed signals, select it from the Source Signals box and click the Add Selected Source Plots button. More than one source signal can be selected by holding down the shift or ctrl button while clicking on multiple signals.

The Group Family Signals applies to signals generated by a sweep or Monte Carlo test. These tests generate the same signal but over a range of specified device parameters. For instance, a sweep of a resistor's value(s) from 1K to 10K by 1K increments results in 10 signals, each varied by a resistance of 1K. These signals all belong to one family. When the Group Family Signals box is checked, only one signal from the family is listed and any commands applied to that signal apply to the entire family of signals.

The Add Custom Plot button allows you to use B2 Spice's built in library of math functions and any signal from the Source Signals to make your own custom plot. Please refer to Adding Custom Plots for more information on math functions and instructions.

Delete Plots will delete the selected plots in the Graph Signals box. Multiple signals can be deleted by holding down the shift or crtl key while selecting signals.

The Default Colors button will bring up a dialog box that will allow you to set the default colors for new plots in new graphs.

The Edit Expression button will bring up the Edit Plot dialog box that will allow you to edit the expression of the selected signal.

Adding Custom Plots

A custom plot is a plot defined by an equation using a combination of existing signals and B2 Spice's built in library of functions.

Clicking on the Add Custom Plot button brings up the following dialog box:

Type in the name for the new plot and then you can type in the expression directly into the Plot Expression field. The list of valid arguments (plots) is available in the bottom left of the window. You can double click on an argument to include it in your expression. The same applies to all the Functions and Operators windows.

Most of the functions are in alphabetical order, except for the absolute (abs) and root mean square (rms) functions, which appears at the bottom of the list. Expressions are evaluated in the standard order of (from high to low priority) Parentheses, Exponents, Multiplication, Division,

Page 95: B2 Spice Version 5

T O O L B O X

89

Addition and Subtraction. If you choose to use any of the accepted functions, you must place the argument(s) inside parentheses. For example, if you wanted the tangent of an argument, the expression would be: tan(argument).

Below is a list of all valid functions and examples of each

function meaning example equivalent

abs absolute value Abs(v(1)) |v(1)|

addinv additive inverse addinv(V(1)) -V(1)

atan inverse tangent atan(V(1)) atan2(Im(V(2),Re(V(2)))

atan2 inverse tangent atan2(V(2),V(1))

cos cosine cos(V(1))

db decibels db(V(1)) 20*log(mag(V(1)))

deriv derivative deriv(V(1),time)

diff differential diff(v(1), v(2)) v(1) – v(2)

divide quotient divide(V(2),V(1))

V(2)/V(1)

exp e to the power of V exp(V(1)) e^V(1)

group_delay group delay group_delay(V(1)[1])

-deriv(phase(V(1)[1]), freq)

imag Imaginary part imag(V(1))

integral integral integral(v(1), time)

Integral of v(1) over time

ln log base e ln(V(1))

log10 log base 10 log10(V(1)) log(V(1))

mag Magnitude Mag(V(1)) sqrt(Im(V(1))^2+Re(V(1))^2))

multinv multiplicative inverse multinv(V(1)) 1/V(1)

ph phase (in radians) ph(V(1)) atan(V(1))

ph_deg phase (in degrees) ph_deg(V(1)) ph(V(1))*180/pi

pow V1 to the power X pow(V(1),3) V(1)^3

product product product(V(1),V(2))

V(1)*V(2)

re Real re(V(1))

rms Root mean square Rms(v(1), time)

sin sine sin(V(1))

sqrt square root sqrt(V(1))

sum sum sum(V(1),V(2)) V(1)+V(2)

tan tangent tan(V(1))

Signals generated from Sweep and Monte Carlo Tests will have a [N] after them to denote the number of the simulation run. To use this as a formula, just type it as it appears in the plot list. For instance, with group delay, the formula should look like the following:

group_delay(v(1)[n])

where [n] is the number of the sweep or simulation run. Similarly, the integral function should look like the following:

integral(v(1)[n], time)

Page 96: B2 Spice Version 5

V I R T U A L I N S T R U M E N T S

90

Virtual Instruments New to B2 Spice v5 is the addition of Virtual Instruments. Now you have eleven instruments to measure your circuit manipulate and measure your circuit.

Note that virtual instruments are not saved with the schematic, but the Project only. If you wish to save the virtual instruments used with the schematic and simulation, you must save the schematic project.

Virtual Ammeter Purpose: The easy measurement of current flowing through a part.

Pressing the “Setup” button toggles the length of the ammeter, so that when its setup is complete, the ammeter becomes only as tall as its display band.

Procedure: Working backward works best here.

First choose a part in a B2 Spice circuit and then choose a pin on the part. This can be set under the General tab.

The next option is the ammeter’s display range. The meter displays its measurements in two ways: text and a moving bar graph. The bar’s length expands and contracts with the current being measured, which makes it an analog readout. When the measured current exceeds the

Page 97: B2 Spice Version 5

V I R T U A L I N S T R U M E N T S

91

ammeter’s range, the bar changes color from its normal blue to red. Pressing the “Auto” button overrides the fixed range and auto adjusts the range to twice the highest current reading it sees.

Under the Functionality tab, choose whether the current signal is a DC or AC one. If the signal is AC, then choose whether the RMS (Root Mean Square) value, Average, Absolute Average, Peak-to-Peak, or the peak value should be used. Then select a sample period for the ammeter.

Behind the scenes, the ammeter instrument severs the wire connection to the selected pin and then it bridges that gap with a SPICE ammeter in the netlist sent to the SPICE engine.

Note that a virtual ammeter is automatically inserted into the virtual instruments display if an ammeter device is placed into the schematic.

Distortion Meter Purpose: The easy measurement of distortion generated within a circuit, usually an amplifier.

Procedure:

First specify an input and an output node. An input and output node must be chosen, as the distortion meter needs an input to inject a pure signal, which will compare the output’s signal against in calculating the distortion in the output signal.

Second a test frequency needs to be entered (usually 1kHz for audio circuits). You can also set the Amplitude and offset of the test signal.

The next option is what the distortion meter measures.

A pure signal has no harmonics, as it contains only one frequency, whereas an impure signal can hold many frequencies, which are usually even multiples of the original single frequency. Thus a pure 1kHz signal can gives rise to 2kHz, 3kHz, 4kHz harmonic frequencies. (Non-harmonic frequencies are called “beats,” which are measured with “intermodulation distortion,” IM, meter. Usually, all the added frequencies are higher than the fundamental, pure input signal, but not always. Certain digital circuits, for example, can give rise to sub-harmonic signals.)

The Total Harmonic Distortion (THD) figure is the sum of all the harmonically related signal’s contribution to the signal’s magnitude. Thus, if 0.9 volts of a 1-volt output signal is made up of fundamental frequency and 0.1 volts is made up of the fundamental’s second harmonic frequency, the THD equals 10%. The distortion meter can display THD of a circuit or just one of the first five harmonics.

The option to display the results as a percentage or in dBs is quite straightforward. One percent distortion equals the distortion’s contribution to the output signal being –40dB down in amplitude relative to the output signal. The formula is:

Page 98: B2 Spice Version 5

V I R T U A L I N S T R U M E N T S

92

DB = 20Log (distortion signal / output signal)

The distortion meter’s display range should be set to the maximum amount of distortion the user is willing to accept. The meter displays its measurements in two ways: text and a histogram. The bar’s length expands and contracts with the distortion being measured, which makes it an analog readout. When the measured current exceeds the distortion meter’s range, the bar changes color from its normal blue to red. Pressing the “Auto” button overrides the fixed range and auto adjusts the range to twice the highest distortion reading it sees. Pressing the “Setup” button toggles the length of the Distortion Meter, so that when its setup is complete, the Distortion Meter becomes only as tall as its display band.

Frequency Plotter Purpose: The easy measurement of a circuit’s frequency response.

Procedure: This instrument displays its measurements in a small graph.

The Input/Output tab allows you to set up the test in regards to the circuit. Under this tab, choose two nodes in a B2 Spice circuit or an input part. (Behind the scenes, the Sweep

Page 99: B2 Spice Version 5

V I R T U A L I N S T R U M E N T S

93

instrument adds a voltage source to the circuit or if there is already a voltage source connected to the node and ground, it takes over its settings.) You should also choose two output nodes. Then select a Signal Amplitude and you are ready to run the test.

Set up the sweep for the test under the Sweep tab. Here you can set whether the graph’s display should reflect a logarithmic or linear labeling of frequency. Select a starting and ending frequency and the number of steps per interval for the test to run.

Set up the graph under the Graph Settings tab. Here you can control the graph's display of both the amplitude and the phase across the frequency sweep’s range. The Y-axis settings are the maximum and minimum limits of the graphs display, with the option to set the graph display to linear or in dB. Pressing the “Auto” button overrides the fixed Y-axis tick makings and it auto adjusts the graph’s Y-axis limits to twice the highest current reading it sees. The X-axis settings are the beginning and ending frequencies.

The last tab, Export, allows you to export the graph to various formats, including graphic files, text tables, or even copy it to the Project's graph window. You can even copy the graph into memory to paste into other applications.

Pressing the “Setup” button toggles the length of the Sweep meter, so that when its setup is complete, the sweep meter becomes only as tall as its display band. Press the Amplitude/Phase to switch between the two modes. Press the "Run Sweep" button to proceed with the test.

Moving the cursor across the graph and clicking on it reveals the frequency and the dB or phase under the cursor.

Function Generator Purpose: The creation of sine, triangle, and square waves to be injected into a circuit.

Page 100: B2 Spice Version 5

V I R T U A L I N S T R U M E N T S

94

This instrument is functionally equivalent to the SPICE voltage source, but it adds easy frequency and amplitude changes. A node within the circuit must be specified to receive the function generator’s output signal. (the reference node is assumed to be ground.) The DC offset of the function generator’s output can be adjusted up and down.

Pressing the “Setup” button toggles the height of the Function Generator, so that when its setup is complete, it becomes only as tall as its display band.

Gain Meter Purpose: The measurement and display of relative strength of two voltages (AC or DC) across or inside a circuit in dBs (decibels).

Signals often differ by great magnitudes. The miniscule output voltage from a moving-coil phono cartridge (.1mV) becomes amplified to 1000 volts peak-to-peak at the tube-amplifier’s output tube’s plate. The ratio between these two voltages is 10,000,000. But expressed in dB (decibels), this ratio becomes only 140 dB, a figure that is much more manageable. Aside from compressing large ranges, dBs allow for easier math. For example, given three identical gain stages that produce a voltage gain of 31.6 times the input, placed in series, what is the total gain? It’s time to find the calculator. But a ratio of 31.6 in dB is 30 dB, which can directly be multiplied by 3 to yield 90 dB of gain, which is much easier.

0.00001 -100dB

0.0001 -80dB

0.001 -60dB

0.01 -40dB

0.1 -20dB

1 0dB

10 +20dB

100 +40dB

1,000 +60dB

10,000 +80dB

100,000 +100dB

Alternatively, a linear display of relative signal strength can be used by pressing the “Linear” button. The display will then show the second signal divided by the first signal.

Page 101: B2 Spice Version 5

V I R T U A L I N S T R U M E N T S

95

To measure the ratio between two signals in or through a circuit, the Gain Meter must be attached to two nodes and their references (usually, ground). The gain meter displays its measurements in two ways: text and a moving bar graph. The bar’s length expands and contracts with the ratios/gain being measured, which makes it an analog readout. When the measured signal gain exceeds the gain meter’s range, the bar changes color from its normal blue to red. Pressing the “Auto” button overrides the fixed range and auto adjusts the range to twice the highest distortion reading it sees.

The Functionality tab allows you to select between AC (mediated-coupled), where the meter functions as if it were coupled via a capacitor) or DC (direct coupling), where the meter reads the instantaneous voltage directly without processing. If the signal is AC, then choose whether the RMS (Root Mean Square) value, Average, Absolute Average, Peak-to-Peak, or the peak value should be used. Then select a sample period for the ammeter.

Pressing the “Setup” button toggles the height of the Gain Meter, so that when its setup is complete, it becomes only as tall as its display band.

Oscilloscope Purpose: Allow us to look into a circuit’s functioning by showing voltage over time.

Unlike a gas engine, an electronic circuit’s functioning cannot be gleaned from looking at the circuit board. Yes, the topology might be deciphered, but not the actual functioning of this particular circuit board, as a part might be blown or sitting in a cold-solder joint. With the aid of an oscilloscope, we can see a circuit’s functioning and the actual voltage movements over time.

As a Digital Storage Oscilloscope (DSO), it has two input traces and an adjustable timebase, trigger source, and vertical signal scaling.

Page 102: B2 Spice Version 5

V I R T U A L I N S T R U M E N T S

96

Each channel can be selected and edited by clicking on the Input Trace 1 or Input Trace 2 button in the Traces tab. Selecting a trace allows the signal node, the plot color and width and label to be set. (Plot widths over one pixel slow down the drawing of the waveform.) Additionally, the signal’s gain and vertical and horizontal offsets can be set. Also note that each trace can also be set as DC or AC input mode. This can play an important part in getting a signal to display correctly in the scope. Please see the note at the bottom on the difference between AC and DC mode.

Vertical (Voltage per Division) scaling can be manually set by clicking the Manual button then either pressing the little up and down arrowed buttons or by directly editing the value in the edit box. Clicking on Auto will automatically set the vertical min and max settings based on the signal's max and min values. The timebase (Seconds per Division) is set in the same way but can also be set to Auto to allow B2 Spice to automatically select the timebase (x axis).

Page 103: B2 Spice Version 5

V I R T U A L I N S T R U M E N T S

97

The trigger source can be set to either channel 1 or 2 or another node in the circuit (Ext). The trigger mode can be set to AC or DC, and the triggering level can be adjusted in the Trigger Above and Below boxes. The Trigger Edge selects they how the signal is triggered.

The display can be frozen by pressing the “Run” or "Single", allowing complex waveforms to be seen clearly and measured. The Run buttons stops the display at the point the button is pressed. The "Single" button stops the display after one complete drawing of the scope screen. Moving the vertical and horizontal sets of calipers displays either the vertical voltage or the percentage of the oscilloscope’s left axis and the amount of time or the equivalent frequency implied along the bottom axis. The calipers can be activated in the Vertical and Timebase tabs, for vertical and horizontal calipers respectively.

Pressing the “Setup” button toggles the height of the Small Scope, so that when its setup is complete, it becomes only as tall as its display band.

*NOTE: There are two modes to the Oscilloscope - AC and DC, both for the Trace Inputs and Trigger setup. DC (Direct Coupled) shows the "real" voltage of the signal, which takes on importance if there is any DC offset. If you select the input mode as AC, a capacitor is inserted in series with the input to block out any DC signal present and pass only AC signals, which will then be centered around 0 volts. This is useful if you wish to examine signals showing a small variation around one constant value. In other words, AC mode removes any offset, thus centering the signal at 0V.

This is especially important when dealing with the trigger setup. If a signal has a peak-to-peak voltage of 2V and an offset of 1V, it would be a sine wave centered at 1V. If the trigger mode was set to trigger on a DC rising edge greater than 0, nothing would show up on the scope since in DC mode, the signal's rising edge never gets to rise above 0. If you then changed the trigger mode to AC, the signal would show up on the scope since the signal would then be centered at 0V and the rising edge would trigger the display.

Power Supply Purpose: To provide a quick and convenient means of supplying voltage to a circuit.

Page 104: B2 Spice Version 5

V I R T U A L I N S T R U M E N T S

98

Much like an actual bench power supply, the power supply instrument provides a selectable output voltage(s). Both regulated and unregulated power supply types are available and the actual current delivered to the circuit is displayed. Unlike an actual bench regulated power supply, the power supply instrument allows a degraded mode, where it functions like an unregulated power supply with ripple on its output, much like an actual raw DC power supply.

The output voltage is set in voltage-selection edit box. If voltage-regulated performance is desired, then select the Regulated button for type. On the other hand, if you wish to simulate a cheap power supply, such as a wall-wart, then select Unregulated for type and set the regulation to 25%, the noise to 500mV and the current to the idle current of your circuit. The regulation percentage refers to the over voltage an unregulated power supply develops when unloaded. Thus, a 10-volt/1-amp power supply with 10% regulation will output 11 volts when it isn’t delivering any current and 10 volts when delivering its rated output current of 1A. 0% regulation means the power supply is indifferent to output current variations, as it produces a constant output voltage. The power supply noise’s frequency equals twice the wall voltage’s frequency, for example, 120 Hz, when the wall voltage is at 60 Hz. The noise’s waveform is selectable.

Pressing the “Setup” button toggles the height of the Power Supply instrument, so that when its setup is complete, it becomes only as tall as its display band.

Transient Signal Recorder The transient signal recorder is designed to record up to two signals for either a predetermined period or the entire length of the simulation run and save the data to a file.

Setting up the Transient Recorder is as simple as specifying the Trace node(s) and reference node(s) and then setting up the capture window.

The Traces tab is where you set up the signal(s) to record. The Traces tab has separate sub-tabs that allow you to set up Trace 1 and Trace 2.

Page 105: B2 Spice Version 5

V I R T U A L I N S T R U M E N T S

99

For each trace, make sure that the Show Trace box is checked. By default, Trace 1 is always showing, but if you wish to display Trace 2, you need to check the box. Select an input node and

Reference node using the drop down box or using the probe tool , which will allow you to "sample" a node in the circuit and have that node number automatically entered into the respective field. If the circuit's node numbers are not showing, you can display them by clicking

on the Show Node Names button in the toolbar. Additionally, you can select the Gain and Vertical Offset and Width of the trace can be set here. Keep in mind that wider widths can slow down the drawing of the signal and simulation.

The Storage tab sets up the Recorder's capture and display properties.

The Data Capture/Storage Specification specifies what length of data to save. The Data Capture's All setting captures and saves the data for the entire length of the simulation run until you stop the simulation. The Most Recent button activates the Duration box and allows you to specify a certain period of data to save. If you specify the most recent 5 seconds to capture, and the simulation runs for 23 seconds, only the data from seconds 18-23 are captured. Everything else is discarded. The Fixed button activates both the Start and Duration boxes and allows you to specify that a certain time interval's data is kept. If you specify a start of 1 second and duration of 5 seconds, then only the data from seconds 1 to 6 are kept. Note that the Duration is not the

Page 106: B2 Spice Version 5

V I R T U A L I N S T R U M E N T S

100

same as a stop time. It specifies the LENGTH of time and not a fixed time.

The Interactive Viewing Interval is similar to Data Capture/Storage Specification but the former specifies what the instrument window displays. Again, the Interactive Viewing settings are independent of the Data Capture settings. The All, Most Recent, and Fixed boxes function like the Data Captures settings, but this only affects the graph display. Note that even data that is not displayed in the graph can be retained for saving to a file. If a Most Recent viewing interval of 50ms is specified and the Data Capture setting is set to All, then only the most recent 50ms of data is shown, but ALL the data is being stored in memory and can be saved to a file.

The Graph settings specify what data to display in the graph window.

Selecting the Use I-View Settings will display the graph determined by the I-View settings. Selecting Use Graph Settings will use the graph’s toolbar options instead. You can even specify labels and introduce X-axis and Y-axis calipers for a more accurate analysis.

The Export tab allows you to save the data (specified by the Data Capture/Storage Specification setting) to either the clipboard to be pasted into another program or saved directly to a file.

Voltage Meter (Voltmeter) Purpose: The easy measurement of the voltages present in a circuit.

Page 107: B2 Spice Version 5

V I R T U A L I N S T R U M E N T S

101

Procedure: Working backwards works best here.

First click the General tab to set up the voltmeter's nodes. Choose a node for the positive and negative nodes using the drop down box or by using the "Probe" tool next to the drop down boxes. Using the probe tool and clicking on a node that you would like to measure automatically selects that node in the drop down box. You should also be aware that voltmeter instruments are automatically inserted if you place a voltmeter part in the schematic.

The next option is the voltmeter’s display range. The meter displays its voltage measurements in two ways: text and a moving bar graph. The bar’s length expands and contracts with the voltage being measured, which makes it an analog readout. When the measured voltage exceeds the voltmeter’s range, the bar changes color from its normal blue to red. Pressing the “Auto” button overrides the fixed range and auto adjusts the range to twice the highest voltage reading it sees.

The Functionality tab allows you to select whether voltage signal is a DC or AC one.

If the signal is AC, then choose whether the RMS (Root Mean Square) value should be used or the peak value. Then select the period over which the voltmeter measures.

Pressing the “Setup” button toggles the height of the voltmeter, so that when its setup is complete, the voltmeter becomes only as tall as its display band. Note that a voltmeter virtual instrument is automatically inserted if a voltmeter part is placed in the circuit.

Wattage Meter (Wattmeter) Purpose: The measurement and display of power dissipation by a circuit element.

Page 108: B2 Spice Version 5

V I R T U A L I N S T R U M E N T S

102

Energy (power over time) is measured on a watt-hour meter, such as the one that connects each house to the power company’s lines. If we remove time from the equation, we end up with a power meter, as a power meter measures the instantaneous dissipation of power, much in the same way a speedometer measures a car’s instantaneous speed. The measuring of power dissipated in a purely resistive circuit with a DC voltage source is trivial, as power equals voltage against current, P = VI. The math becomes a little trickier with AC-power sources, as the waveform dictates the averaging formula used to find the power dissipated. Circuits containing reactive parts, such as capacitors and inductors, on the other hand, are much more complex to measure.

Pure reactive components dissipate zero power, which makes sense in a DC circuit, as the capacitor passes no DC current and the inductor displaces no voltage. Yet, in an AC circuit, the reactive components “seem” to dissipate power, as current passes through the capacitor and the inductor sees a voltage drop. This counterfeit power is called “reactive power;” it is measured not in Watts, but in VARs (Volt-Amps-Reactive). In contrast, actual power is labeled “true power” or “active power” or “real power;” it is measured in Watts. To these two powers, a third must be added, “apparent power.” Much in the same way as impedance (Z) is the combination of reactance (X) and resistance (R), apparent power is the combination of pure power with VAR. Apparent power is measured in VAs (Volt-Amps) and its mathematical formula symbol is “S.” Transformers are rated in VAs. For example, a 100VA transformer might hold a secondary with a 10Vac winding that can sustain 10A of current output, which if attached to a 10-ohm resistor would realize 100 watts of true power (P) and 100 VA of apparent power (S), but zero VAR of reactive power (Q). And if hooked up to a 265µF capacitor, the transformer would realize 0 watts of true power and 100 VA of apparent power and 100 VAR of reactive power. If the 10-ohm resistor and 265µF capacitor were placed in series and hooked up to the transformer’s secondary, the transformer would realize 50 watts of true power and 70.7 VA of apparent power and 50 VAR of reactive power. The power triangle shown below displays the relationships between the three powers. (Note how Pythagoras theorem nicely applies to the values from the previous example and how apparent power will always be equal to or greater than pure power.)

Page 109: B2 Spice Version 5

V I R T U A L I N S T R U M E N T S

103

Connecting the power meter to a circuit can be done in two ways in the Circuit Setup tab: by selecting an individual part or by selecting two nodes within the circuit.

The Meter Options tab control the display of the meter.

The meter displays its measurements in two ways: text and a moving bar graph. The bar’s length expands and contracts with the power being measured, which makes it an analog readout. When the measured current exceeds the power meter’s range, the bar changes color from its normal blue to red. Pressing the “Auto” button overrides the fixed range and auto adjusts the range to twice the highest power reading it sees.

The Measure Power As section specifies how the instrument measures Wattage.

Real/Active - In contrast to apparent or reactive power, actual power refers to the power dissipation by resistive components. It is labeled "true power" or "active power" or "real power", and is measured in Watts. Its mathematical formula symbol is "W".

Reactive - Pure reactive components dissipate zero power, which makes sense in a DC circuit, as a capacitor passes no DC current and an inductor displaces no voltage. Yet, in an AC circuit, the reactive components "seem" to dissipate power, as current passes through the capacitor and the inductor sees a voltage drop. This counterfeit power is called "reactive power" and is measured not in Watts, but in VARs (Volt-Amps-Reactive). Its mathematical formula symbol is "Q".

Apparent - Much in the same way as impedance (Z) is the combination of reactance (X) and resistance (R) apparent power is the combination of pure power (P) with reactive power (VAR). Apparent power is measured in VAs (Volt-Amps) and its mathematical formula symbol is "S". Transformers are rated in VAs.

Power Factor - Power Factor (PF) or Total Power Factor (TPF) equals the ration of real power (W), which performs the actual work of creating heat, light, motion, etc., over apparent power (VA) that is the combination of real power (W) and reactive power (VAR).

Pressing the “Setup” button toggles the height of the voltmeter, so that when its setup is complete, the voltmeter becomes only as tall as its display band.

Page 110: B2 Spice Version 5

T O O L B A R S

104

Toolbars There are 3 toolbars that display in B2 Spice - the Main toolbar, the Schematic toolbar, and the Graph toolbar. The Schematic and Graph toolbar are specific to that type of tab window only and will only appear if the particular type of tab window is active. The Main toolbar appears throughout the program independent of the window currently active.

Main Toolbar - appears regardless of which window is active

Schematic Toolbar - present only when a schematic is the active window

Graph Toolbar - present only when a graph is the active window

Main Toolbar

File Functions

New Circuit Project, Open, and Save. The New Circuit Project button will open a new project with a blank schematic. The Open button will bring up a standard Open File dialog and will allow you to open a variety of saved files. The Save button will save the active schematic.

Print

Prints the currently active document.

Cut, Copy and Paste

Cut, Copy and Paste. The Cut button cuts the selected schematic item and places it into the scrap memory to be pasted. The Copy places the selected schematic item into the scrap memory to be pasted. The Paste button pastes the item in the scrap memory to the schematic.

Simulation

These buttons control the Simulation. In order, the buttons are Reset, Pause, Step, Walk, and Run. The display box shows the current simulation time.

Step Ceiling

This toolbar item controls the step ceiling of the Simulation. Decrease the value to obtain finer resolutions in your simulation. Increase it to speed up the simulation at the cost of accuracy.

NOTE: Step Size (found in Simulation->Time Options) is different from Step Ceiling. Step Size specifies how large each Step of the simulation is when using the Step feature. Step Size does not factor into the Simulation when in Walk or Run mode, where the simulation engine decides how large a step to take. Step Ceiling means that when a simulation is Walked or Run, the step size (automatically calculated by the simulation engine) will not exceed the Step Ceiling.

Update Interval

Page 111: B2 Spice Version 5

T O O L B A R S

105

This toolbar item controls the Update Interval for such things as the Virtual Instruments display and the meter text in the schematic. A smaller update interval will refresh the Instruments and Meter Text more quickly and give a more accurate display of the current circuit state at the cost of simulation speed. A larger value will do the reverse.

Schematic Toolbar The Schematic Toolbar only appears if a schematic is the active window.

The symbols above are shortcuts for program tools. They are explained in detail below.

Selection Arrow

This is the most commonly used tool and does not have an icon in the toolbar. This tool is the default tool and will automatically be activated if you deactivate any of the other tools in the toolbar. It is used to select device vertices, line segments, and text comments. It can also be used to drag out a rectangle around a group of devices, segments, and comments to select them as a group. Furthermore, it is used to move selected objects around the schematic.

By double clicking with the arrow on devices, you can set their properties.

Double click on text blocks to edit them.

Wire tool

This is used to draw the line segments that make up the wires. It starts a new segment every time you click down, and ends when you double click, right click, or press the escape button.

Magnifying Glass

This is used to zoom in and out of a particular region of the circuit. The Zoom In magnifying glass will either work with a single click or you can hold down the right mouse button and drag a rectangle around a region to zoom in on. The Zoom Out magnifying glass works with a single click only.

Text tool

This is used to put text and labels into the circuit.

Probe tool

This tool allows you to probe wire states.

Show/Hide Grid

This button allows you to toggle the grid display of the schematic.

Snap to grid

This button allows you to toggle the Snap to Grid function of the schematic. When on, the pins on

Page 112: B2 Spice Version 5

T O O L B A R S

106

a device and wires will always line up with a gridpoint. When off, device pins and wires can be placed regardless of a gridpoint.

Show/Hide Node Names

This button allows you to toggle the display of node names on the schematic.

Show/Hide Part Names

This button allows you to toggle the display of Device names on the schematic.

Show/Hide Part Values

This button allows you to toggle the display of Device values on the schematic, such as resistance, capacitance, etc....

Animation Display Control

These buttons allow you to toggle the display of the Voltage/Current/Power animation display for the running simulation, including free-run simulation. In order from left to right, the icons are for Voltage Text, Voltage Graphics, Current Text, Current Graphics, Power Text, and Power Graphics.

Toggle Perpendicular Wiring

This button allows you to toggle perpendicular wiring. When pressed, wires are only allowed to be at 90-degree angles. Otherwise, wires can take any angle.

Show/Hide Border

This button allows you to toggle the alphanumeric border along the top and left of the schematic.

Show/Hide Title box

This button allows you to toggle the display of title box in the schematic.

Show/Hide Page Boundaries

This button allows you to toggle the display of the printed page boundary as a dashed line.

Probes

This button brings up a menu that will allow you to select current and voltage probes for cross-probing. Please refer to the Cross Probing section for more information.

Layout

This drop down menu allows you to select how to display the work windows.

Zoom The zoom drop down box allows you to quickly set a zoom level instead of using the magnifying

Page 113: B2 Spice Version 5

T O O L B A R S

107

glass to zoom in and out. Click the Zoom button and a drop down list of pre-set zooms will appear. Click on one to apply it.

Show/Hide Instruments

This button toggles the display of the Virtual Instruments panel, allowing more schematic area to be displayed when hidden.

Graph Toolbar The Graph toolbar only appears if a graph document is the active window.

Scale buttons

These buttons control the scaling of the graph. From left to right, the buttons are:

Scale to fit all - scales all the visible plots to display in the graph window

Scale to fit horizontally - scales the visible plots to fit length-wise, leaving the vertical scaling unchanged.

Stretch horizontally - expands all visible plots horizontally, leaving the vertical scaling unchanged.

Compress horizontally - compresses all visible plots horizontally, leaving the vertical scaling unchanged.

Scale to fit vertically - scales the visible plots to fit height-wise, leaving the horizontal scaling unchanged.

Stretch vertically - expands all visible plots vertically, leaving the horizontal scaling unchanged.

Compress vertically - compresses all visible plots vertically, leaving the vertical scaling unchanged.

Logarithmic scaling – converts the axes to a logarithmic scale. The minimum axis value must be greater than zero to apply the logarithmic mode.

Zoom Out

This tool zooms out of the graph vertically and horizontally.

Selection Arrow

This is the default tool, which is used to select a specific plot or control the calipers.

Pan

This tool activates the pan tool. With it, you can click on the mouse button and hold it down while dragging the graph. This will quickly allow you to move the entire graph.

Zoom In

Page 114: B2 Spice Version 5

T O O L B A R S

108

This tool allows you to draw a rectangle around a certain area to zoom in to.

Crosshair

This activates the crosshair cursor, which will show a vertical and horizontal line following the cursor over the graph.

Tracking Crosshair

This activates the tracking crosshair, which is like the crosshair tool, but the crosshair will follow the currently selected plot only.

Delta Measuring tool

This tool allows you to quickly measure the X and Y differences between two points on a graph. Click once at the first point, hold down the mouse button, and move to the second point. A vertical and horizontal line will show you the location of the first and current position while vertical and horizontal change are displayed in the Horz-D and Vert-D boxes in the info box at the bottom of the graph.

Annotation

This allows you to add comments or labels to your plots.

3D rotation tool

This tool activates the 3D graph which allows you to drag and rotate the graph and view it 3-dimensionally by drag-rotating the graph.

3D view toggle

Switches between 2D and 3D views. When in 3D mode, use the 3D rotation tool (above) to reposition the graph view.

Auto Zoom-to-Plot

This toggles the Auto zooming of plots, where the currently selected plot is automatically scaled to fit the graph window.

Auto Highlight

This toggles the automatic highlighting of the selected plot. The highlighting is accomplished by increasing the plot line width by 2 pixels.

FFT tool

The Fast Fourier Transformation (fft) tool allows you to perform an fft analysis of one or more signals in your graph.

Calipers

The calipers are two vertical and two horizontal lines that can be repositioned on the graph to mark certain positions. Check each box toggles the display of a caliper. Each caliper can be dragged to the desired point and will remain static through subsequent simulation runs

Page 115: B2 Spice Version 5

W I N D O W S

109

Windows

Schematic Window The Schematic Window contains the work area where the actual circuit is created and edited.

The schematic window has its own toolbar and toolbox.

The schematic window is where the circuit is drawn and simulated. The simulation is controlled by the simulation controls in the Main Toolbar and results are show interactively in the Virtual Instruments panel.

A project can have more than one schematic. New schematics can be added using the New... command, specifying that the new schematic be added to the current project.

Graph Window The graph window is where all results of Tests are displayed. There are several different types of Graphs, depending on what type of Test is being run. The graph types available are: Cartesian, Polar, Smith Chart, and Histogram. There is also a 3D view for each graph. Please see the section on Graphs and Tables for more information on each type of Graph. Also refer to the Toolbox | Edit Graphs section for more details on customizing each type of graph.

Page 116: B2 Spice Version 5

W I N D O W S

110

Cartesian Graph

Histogram

Polar Plot

Smith Chart

The graph window is usually generated automatically when a Test is run.

The graph window contains a Status Bar, located at the bottom of the graph window. It displays such information as current cursor position as well as caliper information if the calipers are active, and Delta data, which indicates the difference between two points.

The graph has its own toolbar and toolbox to control its display and properties. Plots and Graph appearance are controlled in the toolbox.

Plot display and the manipulation of Plots are controlled with the Edit Plots tab. In this tab you can also add a custom plot or change the properties of any plot.

Graph display is controlled with the Edit Graph tab. The overall appearance of the graph, from text display position, axes properties and graph colors are controlled here.

New graphs can be added to the project by using the New... command and specifying that the new graph be added to an existing project.

Graphs are saved with the project only if the option is set in the File | Program Options menu. Otherwise, they can be saved separately by using the File | Save or Save As commands.

Page 117: B2 Spice Version 5

W I N D O W S

111

Table Window The table window displays a Test result in text format instead of a Graph window.

The table does not have a toolbar and shares a toolbox with the other windows.

Tables are usually generated when a Test is run and a table output is specified. Otherwise, you can create a table from an existing graph by making the graph active and going to the Special Functions | Create Table from Graph menu.

A new blank table can be inserted into the project by going to the File | New... command.

Tables are not saved with the project. However, you may save the table in a *.txt format by going to the File | Save Table As command.

Text Window The text window handles a variety of jobs. It displays the Netlist if one is created. It also displays the log from Simulations and Tests. Finally, it acts as a blank text document that you can keep notes in.

Page 118: B2 Spice Version 5

W I N D O W S

112

A text window has no toolbar and no unique toolbox.

Depending on the need, a text document can be automatically generated or a new blank one can be specified.

If you generate a netlist from your schematic, a text document is automatically created and filled in with the netlist.

A test window Log is created automatically when you run a simulation or test and B2 Spice needs to list warnings or errors.

A blank text window can be created by using the File | New... command.

Netlist Window The Netlist window is a specialized Text window and is exclusively for netlist editing and simulations. It displays the full B2 Spice netlist and has its own menu commands for running simulations.

Page 119: B2 Spice Version 5

W I N D O W S

113

A new netlist window can be created by going to the File->New…->New Netlist Project command which creates a blank netlist document. A netlist then can be copied and pasted into the window for simulation or typed in by hand.

Alternatively, a netlist can automatically be generated from an existing schematic by opening the schematic and using the File->Netlist Operations menu. Create Netlist as a text form generates a netlist from the schematic as a new text window in the Project. This kind of netlist cannot be simulated and is only for examination. The netlist can then be copied to a netlist project for simulation, or saved as a netlist that can be opened and simulated.

Create Netlist Document in New Project from the same menu will generate a netlist from the active schematic and create a new project for the netlist. The difference is that this netlist can be simulated. Currently, in order to run a simulation from the netlist, the simulation setup will need to be entered as part of the netlist. Any simulation options or parameters will also need to be typed in. Once the simulation parameters are entered, go to the Simulation menu. A netlist simulation can be Run, Walked, Stepped, and Paused. The simulation toolbar will also work in place of the menu commands.

For more details about setting up a netlist simulation, refer to the program help file under “Netlist Language”.

A graphical interface for the netlist is planned but has not been implemented.

.

Page 120: B2 Spice Version 5

G R A P H S A N D T A B L E S

114

Graphs and Tables

After running a simulation, results are displayed in Graphs or Tables. Graphs typically contain plots of voltages or currents or functions of these quantities versus time or frequency. Graphs can also contain digital plot of digital highs and lows versus time if a circuit produces mixed mode results. Tables can contain all sorts of data such as steady state values or parameter values (for the show or showmod simulations) or they can show the same data as the graph, but in tabular text format. The following sections give hints on what can be done in each of these environments.

Graphs The most common output for Tests is the Graph. Signals that have been pre-specified in the Test setup or have designated with Probes will appear in the graph when a test is run.

After the test is complete, the graph and its plots can be modified to display relevant results. Among the actions that can be performed is the addition of new plots, applying various functions from our library of mathematical functions, and adding new plots from the Test run or from different Test runs.

Graph Types

B2 Spice comes with several types of graphs, depending on what Test is being run and what kind of data is being displayed. The default graph for most of the available Tests is the Cartesian graph with a regular X-Y axis. Polar Plots and Smith Charts are also available but only when the Network Analysis is being run.

Cartesian Graph The Cartesian graph is by far the most common type of graph. It displays data in a standard X-Y coordinate system.

Smith Chart Smith charts are generated by the Network Analysis Test. The two axes represent a conversion from S-parameters to Z-parameters where S is related to reflection and transmission, and Z is for the various input-output impedances. The way that the smith graph is set up, the S-parameters are plotted on a Cartesian grid, but then by reading the warped grid, you get the Z-parameters.

Polar Graph Polar graphs are generated by the Network Analysis Test. The magnitude and phase can be determined from the placement on the graph. In order to determine the frequency index at the point, first select the signal that you are interested by clicking on it in the legend, and then click on the point that you are interested in, and the point should become highlighted and information on the point will be displayed in the legend.

Histogram The Histogram is only produced by a Monte Carlo Test. The results of a Monte Carlo test can be analyzed by looking at the distribution of a summary value from each of several plots. The summary value could be the mean, maximum, minimum, maximum difference, first rise time, first fall time. To do this, set up the Monte Carlo test and under the Histogram tab of the Monte Carlo setup dialog, check the “Show Histogram” checkbox. Signals to be displayed in the histogram can be pre-specified by click on the “Preset Plots” button and using that dialog to display signal

Page 121: B2 Spice Version 5

G R A P H S A N D T A B L E S

115

Mean, MaxDiff (Maximum Difference), Maximum, or Minimum functions. When the Test is over, a histogram will appear and will display the distribution of results without regard to which run generated which results.

Histogram plots are translucent

Editing the Graph properties

All properties of the graph that can be altered can be accessed through the Edit Graph tab in the toolbox. Properties that can be changed include foreground and background colors, text properties, gridline styles, on-graph legend display, axes properties, title properties, scale settings, and 3d graph properties.

Please refer to the Toolbox section for more information on each of the separate sections and specific items of the Edit Graph tab.

Editing Existing Plots and Adding New Plots

To edit plots, go to the "Edit Plots" tab. The “Edit Plot” button has various functions for editing the display properties of plots already displayed in the graph. The “Edit List” button has the capability to add and remove signals from the graph, including the ability to add custom plots (see next item).

An existing plot can be added by selecting a plot from the list of available Source Signals window and then click on the Add Selected Source Plots button to add it to the list of shown plots. Plots in the graph can be removed from the graph altogether by using the “Delete Plot” button after selecting from the list of graph signals.

The Complex Settings section allows modifications to signals with complex parts. Clicking on a complex setting will apply that setting the to the list of Source Signals, which can then be added to the graph.

If Use Deep Plots is checked the signals from within a subcircuit part will also be available for plotting. (Found under the Simulation->Simulation Options menu).

Click on Edit Plot to set the plot's properties. The dialog for editing the plot is the same as that for creating a new plot.

To add a new custom plot, go to the Edit Plots tab in the toolbox, click on the Plot List button at the top of that window and choose “Add Custom Plot” at the bottom of the form. In the dialog that appears, type in the name for the new plot and then type in the expression directly into the Plot Expression field. The list of valid arguments (plots) is available in the “Legal Functions” box and the available operators are listed in the “Legal Operators” box. All the available signals are listed in the “Signal Sources” box. Double-click on an argument to include it in the expression. The same applies to all the Functions and Operators windows.

Expressions are evaluated in the standard order of (from high to low priority) Parentheses, Exponents, Multiplication, Division, Addition and Subtraction. If any of the accepted functions are used, the argument(s) must be placed inside parentheses. For example, the expression for the tangent of an argument would be: tan(argument).

Page 122: B2 Spice Version 5

G R A P H S A N D T A B L E S

116

For multiple simulation run simulations such as AC and DC Sweep and Monte Carlo, simulations will have a [N] after them to denote the number of the simulation run. To use this is a formula, just type it as it appears in the plot list. For instance, with group delay, the formula should look like the following: group_delay(v(1)[n]) where [n] is the number of the sweep or simulation run. Similarly, the integral function should look like the following: integral(v(1)[n], time).

Another way to add plots to the graph is by using the schematic’s probes. Switch to the schematic window and select a current or voltage probe from the probe drop-down box in the toolbar. Placing a probe on a wire (for voltage probes) or a part pin (for current probes) will automatically add the relevant signal at the wire or pin to last active graph. Please refer to the PROBING section for more information on using probes.

Graph editing shortcuts

Certain elements of the graph can be quickly edited by a combination of keyboard keys and mouse clicks.

A regular left-button mouse click on a plot will make it the active plot. The active plot can then tracked and zoomed in on.

Holding down the Shift key while clicking on a plot will bring up the Edit Signal Plot dialog box. This will allow the plot’s underlying equation to be edited. Most signals are raw voltage/current signals, but various math functions can be performed to transform the data. Refer to the Edit Plots section in the Toolbox for more information and the list of available functions.

Holding down the Control key while clicking on a plot will switch the toolbox to the Edit Plots->Edit Plot window. See the Toolbox section for more information.

Holding down the Control key while clicking on an axis will activate the Edit Graph->Axes view.

Holding down the Control key while clicking on the graph’s Title will activate the Edit Graph->Text view.

Adding plots from other circuits and simulation

B2 Spice now has the ability to add plots from other graphs to the current graph or a new graph. To do so, make sure that the graph the active graph is the one having the signals added to it. Open the Edit Plots tab, and click on the “Plot List” button. In the “Source Signals” section, use the “Source” drop down box to select the project that contains the signal to be added. The “Source Signals” list will then show all the available signals from that project. Add the desired signals as discussed in the “Adding New Plots” discussion, listed above.

Moving around the graph

Page 123: B2 Spice Version 5

G R A P H S A N D T A B L E S

117

There are several options for moving around the graph. The most conventional method is to use the scroll buttons on the graph. For the graph, there are no scroll bars. To scroll the graph, use the blue scroll arrows at the left and bottom edges of the graph. If there are no arrows, they can be turned on by going to the Edit Graph tab, Basic button, and checking the “Scroll-Arrows” checkbox.

Another method for moving around the graph is the Pan tool, which is the button in the shape of a hand in the Graph toolbar. Clicking and holding down the mouse button will pan the entire graph.

If your mouse has a scroll wheel, rolling the wheel while the schematic is active will scroll the schematic up/down. Holding the CTRL key down while scrolling the mouse wheel will scroll the schematic left/right.

Zooming

To zoom in on a particular plot, first make sure that from either the Edit Plots->Edit Plot window or

the Legend tab, the “auto-zoom” checkbox is enabled or click the Auto zoom button in the graph toolbar. Now when a signal is selected in the Legend tab or the Edit Plots->Edit Plot window, the graph will automatically resize to fit the selected plot in the full graph window. A plot can also be selected and zoomed-in on by clicking on the plot itself in the graph window.

To zoom in on a specific point on a plot, select the Magnifying Glass Tool from the toolbar. Click-drag on the graph to draw a region to zoom in on.

To zoom out, use the Zoom Out tool or click-drag a large zoom selection using the Zoom In tool. Also, the “scale all to fit size” toolbar button can be used to restore the original zoom and scale.

If your mouse has a scroll wheel, pressing the keyboard’s SHIFT key while scrolling the wheel up will zoom into the schematic. Scrolling the mouse wheel down will zoom out of the schematic.

Measurements in the graph

Finding the difference between two points on a graph

To find the difference between two points of a particular plot, select the Measurement Tool from the toolbox. A line will appear and mark the starting point. While dragging the mouse along the window, a vertical and horizontal line will extend from the first clicked point and extend to the cursor. The vertical and horizontal difference is displayed in the graph’s status bar located at the bottom of the graph window. There is a difference for the X-axis and one for the Y-axis. When the mouse button is released, the difference region will be set and will not change until a new region is set.

Locating the X and Y values of a graph Regardless of the currently active tool, when the cursor is in the graph region, its X and Y position are always displayed in the graph's status bar under "X-Cursor" and "Y-Cursor". In addition, if the Legend tab is displayed, the current X and Y values for each plot is displayed next to its name.

The selection arrow is the default tool when in the Graph. However, two other tools exist to mark the cursor position in the graph. The first one is the crosshair tool, which draws a vertical and horizontal line extending the length and width of the graph, following the mouse position. This cursor is just a crosshair and does not track a specific plot. The X-Cursor and Y-Cursor values

Page 124: B2 Spice Version 5

G R A P H S A N D T A B L E S

118

are marked at the crosshair position.

There also exists a crosshair tool that has the ability to track the currently selected plot. Clicking on the tracking crosshair tool will enable the crosshair display, but as the mouse moves around the graph, the crosshair will follow the selected plot and the X-Cursor and Y-Cursor values will display the values of the plot the cursor is tracking.

Calipers

Another method of measuring points on the graph is by using the horizontal and vertical calipers. These are enabled by checking the appropriate checkboxes in the graph's toolbar. When enabled the calipers are horizontal/vertical lines that can be repositioned around the graph. When only one horizontal or vertical caliper is enabled, it marks the current X or Y position of the caliper and is shown in the graph status bar as "V-Caliper" (displaying the Y value) or "H-Cal (dX)" (displaying the X value. However, when both calipers are enabled, the "V-Caliper" and "H-Cal (dX)" values now display the respective difference between the two calipers. In addition, if both the vertical calipers are displayed, the status bar also displays a value for "H-Cal (1/dX)" which is the frequency demarked by the vertical calipers.

Text fields in the graph

Free-Text Field

To add a text field to the graph, click on the Text Tool in the Graph’s toolbar . Then click on the graph at the point where the text field should go. This will place a new generic text field on the graph. To edit the text, click the same text field again using with the text tool still active, or using the selection tool, double click on the text field. If the next text field needs to be moved, switch back to the arrow (selection) tool from the toolbar and click-drag the text field to the new location. To remove a text field, use the selection tool to highlight the text field and click the Backspace or Delete button on the keyboard.

Labeling a specific plot point To label a specific point on a plot, follow the instructions for adding a generic text field to the graph. Switch back to the selection tool and select the text field and then click on the plot point that the label should point to. The label should then have an arrow pointing to that point on the plot, with the actual point values as the text. The text field can be manipulated like a regular text field, as discussed above. To remove a text field, use the selection tool to highlight the label and click the Backspace or Delete button on the keyboard.

NOTE: the label will apply to the nearest data point, not on the exact point that you click on the plot.

Minima, Maxima, and Zero-crossing points Individual plots can have its minima, maxima, and zero-crossing points labeled on the graph. To add these labels, open the Edit Plots tab in the toolbox, click the “Edit Plot” button, select the signal that will have the labels applied to by highlighting it in the plot list, and then checking the appropriate Minima, Maxima, or Zeros checkboxes. The drop down boxes next to each checkbox specify what format the labels will appear in.

To remove the labels, highlight the desired plot in the Edit Plots->Edit Plot list and uncheck the appropriate Min/Max/Zero checkbox.

Printing

Page 125: B2 Spice Version 5

G R A P H S A N D T A B L E S

119

B2 Spice has two modes for printing: Black and White, and Color. In Black and White mode, the background color will be temporarily changed to white, and the gridlines and plots will be changed to black and printed. This will save on toner or ink when printing. In Color mode, the graph will print as-is, meaning that if the background were black, the printout would also have a black background, which will use more toner/ink. This should be kept in mind if many graphs will be printed. The Print Preview function will show what each mode will look like before printing.

Copying the graph picture

The Edit->Copy Graph Picture command copies a picture of the graph to the clipboard. From the clipboard, the picture can be copied into word processing documents or into other application documents. Also, there is a File->Export command that will bring up a dialog box with different export options for the graph. From that dialog box, the graph can be saved as various graphical formats as well as raw binary or text format.

Digital timing diagrams

Digital signals can also be displayed on the graph. If a circuit generates digital signals, those signals will be displayed in the graph on their own axes. Highs and lows will be displayed, and multiple bit signals will display their values on the plot itself.

Currently, digital signals are displayed on one graph with any analog signal also generated by the Test. Future versions may have an option to display digital signals on a separate graph window.

FFT – Fast Fourier Transform

FFT (Fast Fourier Transform) has been moved from being a part of the Transient Test to being a part of the post-processing (Graph) window. Because of this, the FFT can now be performed on any signal in the Test results.

First, run any test that will produce a graph. In the graph toolbar, click on the FFT button . Use the Target Signal drop-down box to select the existing signal that the FFT will be performed on. The Sampling Frequency and Fundamental Frequency are automatically calculated from the parameters of the originating graph. Select the stop and start range (for AC graphs, the Start/End Time really refers to a Start/End Frequency even though the dialog says TIME). Clicking OK will then generate a FFT graph in a new window.

The FFT graph can then be further modified by clicking on the Spectrum button located in the lower left button of the graph. This will bring up a dialog box with options for Basic parameters, Averaging parameters, Peaks, Bands, Order, Phase, as well as information options.

Tables In addition to a graph, output can be displayed as a table of raw numbers. There are several methods for generating table data. The first is via the Test setup where in addition to graphical output; tabular output can also be specified. The second method is if a graph already exists, the

graph-table toggle button can instantly toggle back and forth from a graph view to a table view. The toggle button is located in the graph toolbar and toggles between table and graph view with each click. The last method is to generate a table from a graph view by using the “Special Functions->Create Table From Graph” menu command. The difference between this method and the toggle button is that the menu command will generate a new window that can be printed.

The table formatting, such as number properties, font properties and table formatting can be altered from the Edit->Edit Table Settings menu.

Page 126: B2 Spice Version 5

C I R C U I T P R O B I N G

120

Circuit Probing One of the new features of A/D v5 is the ability to place probes at various points in the circuit and have the resulting voltage or current appear in the graph. Additionally, moving the probes will also update the resulting signal in the graph if a graph is available.

Probes do not have to be placed before running a Test to work. You can just as well place a probe after having run a Test to instantaneously update the graph with new plots.

How to place probes Probes can be placed via the Probe drop down box in the toolbar. The drop-down box is located next to the “Layout” button:

When the probe button is clicked, a drop down list of available probes will appear:

Select the probe appropriate to the application and place it. A probe symbol should then appear next to the cursor and follow it around until the mouse button is clicked to place it. The probe will look like a red triangle:

The v_probe1 is a voltage probe, denoted by the V at the top of the triangle.

The most important thing to remember about probes is that while voltage probes can be placed anywhere along the circuit, current probes ONLY work when placed on a device pin.

The following picture, containing two voltage probes are correct since voltage probes will work either on a device pin or anywhere along the circuit:

However, in the following picture with three current probes, only I_PROBE1 and I_PROBE3 will display a signal in the graph. I_PROBE2 will not display anything since it does not lie on a device pin:

Page 127: B2 Spice Version 5

C I R C U I T P R O B I N G

121

Probe sub-types: Db, Mag, Ph-deg There are three different sub-types of voltage and current probes, depending on what form of data the signal should be displayed as in the graph. For Transient and DC tests, only the straight Voltage and Current probes are relevant since those Tests do not generate complex signals. However, when running AC-based tests, both the current and voltage probe can display signals in Decibels (Db), Magnitude (Mag), or Phase in degrees (Ph-deg).

When the Test is configured, the probe signals should be automatically listed in the presets signals list. Run the test and the probe signals should appear in the graph.

Cross Probing The real power behind the probes is the ability to interactively change the graph signals without having to rerun the Test. Once the Test is complete and a graph is displayed, returning to the schematic and moving the probe will update the signal to reflect the voltage or current at the new location.

Any new probe added to the schematic will result in a new signal being added to the graph. Likewise, any probe deleted from the schematic will also be deleted from the graph.

Some important notes to keep in mind when using probes:

• current probes need the Simulation->Simulation Options->Signal Coverage->”Generate Extra Signals” box checked or else some current signals will not exist.

Current probes need to be placed on a device pin.

Page 128: B2 Spice Version 5

S Y M B O L E D I T O R

122

Symbol Editor The Symbol Editor can be invoked from both B2 Spice and the Database Editor. The main difference is that while both can edit and save symbols, only the Symbol Editor from the Database Editor can create a new symbol. The B2 Spice's Symbol Editor can only modified a symbol in the schematic and then save it to either back to the schematic or save the changes to the database.

Below are specific topics and examples for the Symbol Editor invoked from the Database Editor.

Creating a Mosfet Symbol The best way of learning how to work with Symbols is if you make one yourself. This tutorial will familiarize you with different drawing tools, show you how to fill in a polygon, and how to name pins and name the symbol.

The above symbol is the finished symbol of a 4 terminal mosfet. The numbers next to the symbol are for reference only and are not part of the symbol. The larger dots are the locations of each pin. Note that four pins have been placed.

Start up the Database Editor program. Under the File Menu of the Database Editor, choose New Symbol to open a new, blank window. Select the Line tool by using the Toolbar or selecting the tool under the Draw command.

Select the Line Tool.

You will first draw the symbol, then name the pins. Draw a line by holding down the left mouse button and dragging. Release the mouse button when the line is drawn.

You can use the Polygon tool to draw a closed arrow at the drain, or else draw a couple of lines to have an open arrow.

Page 129: B2 Spice Version 5

S Y M B O L E D I T O R

123

Every time you click the left mouse button you can change the direction of your polygon. Single click on the right mouse (or double click with the left) to stop the polygon drawing tool and to finish your polygon. You don't have to connect back to the original point. The polygon will automatically close back to the first point.

To fill in the color of the head of the arrow (or polygon), the arrow must be selected first. Note that only objects made with the polygon, rectangle, and circle tool can be filled. If you create the arrowhead with individual lines instead of the polygon tool, you will not be able to fill in the arrow. Use the Selection Tool to select the arrow. Fill in the head of the arrow by using the Set Fill Color... under the Edit menu. Check the Fill the Graphic box and click on Fill Color.

Choose the desired fill color and click OK.

Next, name each pin. Since we are going to use this symbol for a MOSFET, we should name the pins by their default names, i.e., gate, drain, source, and substrate. Select the Pin tool from the tool bar or from the Draw menu.

Select the pin tool.

Click on the leftmost pin to open the Pin Name dialog box. In the Pin Name box, type in “GATE” and click OK.

Using the Pin tool click on the top-right pin and name this pin “DRAIN”. Click OK when done.

Follow the above procedures for naming the middle-right pin “BULK” and the bottom pin ”SOURCE”.

Next, you will provide fields for displaying the part’s title and one of its model parameters, VTO.

Select the Text tool.

Drag a text box above and across the top of the symbol. Click the mouse in the text box and type in [title]. Drag a text box below the title field, and across the top of the symbol. A text editing box will appear when you finish dragging the text field. Type in VTO=[VTO]. Note that this is the letter O, not the number zero. When you use this symbol in the B2 Spice, the title field will be replaced with the name of the part instance. And the [VTO] portion of the VTO field will be replaced with the value of VTO for that model.

Finally, choose Save from the File menu to save your symbol in the parts database.

Editing an Existing Symbol Symbols can be edited from both the B2 Spice and Database Editor. To edit a symbol from the

Page 130: B2 Spice Version 5

S Y M B O L E D I T O R

124

B2 Spice, right click on a device in the circuit and select "Edit Symbol" from the menu. To edit a symbol from the Database Editor, go to the Edit menu, select "Edit Symbol", select the symbol you wish to edit and press the Edit button.

Once you open the symbol for editing, you can add, delete, and modify objects for the symbol.

Lines, rectangles, ellipses, text boxes, and pins can be edited.

To delete any object, select it and press the Delete Key.

To move and object, select it and drag the object to the new position. The cursor should have a small 4 direction arrow at the bottom to indicate the program is in Move mode.

Only lines, ellipses, and rectangles can be resized.

To resize an object, select it and move the cursor to the corners or ends of the object. The cursor should change to an arrow with a plus sign (for lines) or a two pointed arrow (for boxes and ellipses). Click and drag to resize the object.

Pins and text fields can be edited by double clicking on them or using the Text or Pin tool to click on existing items.

Save your changes when you are done. Changes saved in the Database Editor are global. In B2 Spice, you will have to decide whether or not the changes are global. Refer to "Scope of Database Changes" in the "Working with the Database" section.

Change a Font Fonts are stored in the database, however the color is not. To change the font, highlight the text and select Set Custom Font under the Edit menu. Choose the desired font, font style, font size and click OK.

Variable Edit Field These are edit fields whose values will get replaced depending on the particular part instance in the B2 Spice. For example, [title] will always get replaced with the part's title. For a resistor, [resistance] will be replaced with the resistor's resistance. You can have any instance parameter or process model parameter's name inside of the brackets

Setting Conditional Properties and Digital Operations The Database Editor has the ability to create interactive parts with conditional graphics – graphics that react to mouse clicks and pin states. This is most useful in digital simulations where some inputs such as buttons will change appearance with each click.

For instance, if you edit the toggle switch (symbol “toggle”) symbol, you will see that it is actually made of several conditional graphics. The dialog box for the Digital Conditional Properties is shown below.

Page 131: B2 Spice Version 5

S Y M B O L E D I T O R

125

The Related Pin Name points to the pin whose condition is being tested. In this case, if the pin “port” is high, the right leaning switch is visible, and is otherwise invisible. With the left-leaning switch, the graphic is visible only if the pin state is low and is invisible otherwise.

The large rectangle overlaying the two switch graphics is the area where a mouse click will affect the pin value. The dialog box for the toggle switch is shown below.

Every time a click is detected inside this area, the pin “port” is toggled from high to low or vice-versa. The pin value is evaluated by the conditional properties discussed above and the graphic changes accordingly. To make the click region an invisible graphic, go to the Set Digital Conditional Properties dialog box (shown above) and uncheck both “visible” checkboxes. The “condition to evaluate upon click” should be set to some condition other than “no condition.”

View Pin Names To view a list of pin names for a symbol go to the View Menu and select View Pin List... to open the box that displays the list of pin names. You may also view each individual pin name by selecting the Pin tool and clicking on the pin itself. The Pin Name box displays the name of the selected pin.

Setting Pin Names When creating a part, the symbol's pin names must match the pin names of the simulation model. The pin names of the simulation model can be modified to match the names of the symbol pins in the Database Editor. However, if the pins in the symbol are named correctly ahead of time, then this will save you a step. Most built-in simulation models have easy to remember names, such as

Page 132: B2 Spice Version 5

S Y M B O L E D I T O R

126

R+ and R- for the pins of the resistor. If you don't know the simulation model's pin names, then use meaningful names for the symbol pins. Some examples of symbols that already have set pin names are:

Symbol Pin Names buf-4 (4 pin buffer) IN, +VS, OUT, -VS Capacitor C-, C+ Controlled Current Source S+, S- Controlled Voltage Source S+, S- Diode D+, D- Ground Gnd Inductor L+, L- Lossless Transmission Line P1+, P2+, P2-, P1- Lossy Transmission Line P1+, P2+, P2-, P1- Marker M Meter M+, M- Mos nmos-3 Gate, Drain, Source Mos pmos-4 Gate, Drain, Bulk,

Source Mos pmos-3 Gate, Drain, Source Mos pmos-4 Gate, Drain, Bulk,

Source Mutual Inductor L1-, L2+ N-Channel Mosfet Gate, Drain, Source Opamp 5-pin +IN, -IN, +VS, -VS, OUT Resistor R+, R- Switch Close SW+, SW- Switch Open SW+, SW- Urc IN, OUT, REF Voltage Source V+, V- Voltmeter-Vert M+, M- Voltmeter M+, M- Zener Diode D+, D-

Page 133: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

127

Working with CadSoft Eagle PCB

In these pages we will show you what capabilities are available and how to use them.

General Introduction

How to import an existing Eagle Schematic into B2 Spice*

How to build a schematic in Eagle and export it to B2 Spice for simulation*

How to export a circuit back to Eagle Schematics*

How to export a B2 Spice circuit to Eagle PCB*

* This all assumes that all the necessary custom Eagle libraries and ULP have already been placed in the correct Eagle directories. The custom libraries and ULP should be in a "bb_lbr_ulp.zip" file in the B2 Spice directory. Unzip all the *.lbr files to Eagle's "libraries" directory and unzip the *.ulp file into Eagle's "ULP" directory.

Introduction to Eagle PCB integration Transferring an Eagle schematic to B2 Spice

Eagle users invoke a user-language program (bbspice.ulp) to export their schematic into a text file that has a .BDF extension. This text file is edif-like in format, but not exactly edif, so it can’t be exported to other programs. The user must start up B2 Spice if it isn’t already running. From within B2 Spice, the user can choose to create a new circuit from the .bdf file using the command “New Circuit from Eagle File”, or to update an existing B2 Spice circuit using the command “Update Circuit From Eagle File.” The user may want to choose Update Circuit… if he has already created the circuit in B2 Spice, and the user changed the circuit in Eagle since the original B2 Spice circuit was created, and now the user wants to update the circuit layout in B2 Spice to reflect the changes in Eagle without losing the model information (e.g. resistances or voltage source waveforms) that he entered in the B2 Spice circuit.

What to do after transferring the circuit

When you create a new B2 Spice circuit from an eagle circuit, the circuit will initially be in mixed-mode. If you wish to run a pure digital mode simulation, then switch the circuit into digital mode. Any parts that have both digital-mode and mixed-mode models, e.g. the 7400n nand gate, will automatically use the correct model when you run a simulation.

When in mixed-mode, any parts without valid mixed-mode simulation models will be red. Similarly, when the circuit is in digital mode, any parts without valid digital-mode models will appear in red. Investigate the red parts, and if these parts should be simulated, and if so, then choose simulation models for them, or replace them with parts from Beige Bag’s libraries.

Voltage and current sources may need to be added and their transient or AC properties may need to be specified. Other parameter values may need to be customized, e.g. the beta for a transistor, or resistance values, or tolerances for monte-carlo analyses.

Parts and Models:

We have created eagle libraries for all of our parts, around 15,000 parts in all. Because of speed considerations in Eagle, these parts are split up into many libraries whose names start with ‘bb_’. They are split up first according to whether or not they have packages, and then according to the part’s functionality. The parts with no packages are in libraries whose names start with ‘bb_nopkg’.

All of the parts in the beige bag (‘bb…’) libraries will transfer over to b2 spice as simulate-able parts. However, parts that are from eagle libraries may or may not simulate in b2 spice. There are close to 1000 eagle library parts that match up with b2 spice parts and these will simulate in B2 Spice.

Page 134: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

128

The parts that have no packages will not transfer to pcb’s, obviously. The thousands of parts that do have packages, however, are perfectly good eagle schematic parts that will transfer over to circuit boards and eagle pcb.

Problems:

Eagle buses are not done in a way that works for B2 Spice. In B2 Spice, wire can be put through a wire-combiner part to make a multiple-bit-wire, a.k.a. a bus. In eagle, special thick lines are used for buses and the wire-combination seems to be implicit in the bus name. Eagle buses will be left blank in the B2 Spice schematic. We could have implemented them as single-width wires, but that would have caused more problems because the simulations would not have run correctly. Once the circuit is in B2 Spice, we recommend that you insert wire combiners and/or wire splitters at the edges of the buses and then draw the wires for buses.

B2 Spice Schematic to Eagle schematic.

From within B2 Spice, the user can create an Eagle script using “Create Eagle Schematic Script.” Then, from within Eagle, choose to execute that script file. This will place parts from the eagle libraries into appropriate places on the screen, rotate or flip them if they have been rotated or flipped in B2 Spice, and layout the wires.

Problems

Unfortunately, this is not bulletproof. Parts may be “off” by up to a few grid points, especially if they have been rotated or flipped. This is because our calculations of the center of parts in B2 Spice are sometimes a bit off of the calculation in eagle. Also, when rotating and flipping parts, the small differences can be magnified.

If parts have been rotated or flipped in Eagle before being imported into b2 Spice, then these same parts are exported back into eagle in a circuit, then the rotation/flip orientation is lost.

B2 Spice Parts Database

Our parts database now has an extra 10,000 parts that are missing simulation models and are useful for schematics and pcb only. These parts came from Eagle, and we are very grateful that they agreed to let us import them from their libraries. If you only want to use simulate-able parts to your B2 Spice circuit, then turn on the “model” filter for the parts tree. This will show only parts with simulation models. If you only want to use parts with packages in your circuit, then turn on the “package” filter in the parts tree.

B2 Spice Schematic to Eagle pcb.

From within B2 Spice, the user can create an Eagle script using the File | Eagle | Export to Eagle Schematic or Export to Eagle PCB. Then, from within eagle’s board layout module, the user runs that script to create a rats-nest representation of packages and wires that the user can the manually layout in eagle pcb.

How to import an existing Eagle Schematic into B2 Spice The heart of the integration between Eagle PCB and B2 Spice v5 is the ability to export any Eagle schematic to B2 Spice. Below is an illustration of the process.

We will take an Eagle schematic and export it to B2 Spice.

The first step is to make sure that you have already unzipped the Eagle libraries and the ULP needed to convert Eagle schematics to B2 Spice into the appropriate Eagle subdirectories. The zip file should have been installed with B2 Spice in the same directory and is named "eagle_lbr_ulp.zip". Unzip the ULP file to Eagle's ULP directory and the *.lbr files the Eagle's LBR directory.

Run Eagle and open any Eagle schematic.

Page 135: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

129

Export the schematic by running the ULP "bbSpice.ULP", which should translate the schematic into a format that B2 Spice can read.

Once the ULP is finished running, look in Eagle's root directory for the file that was created. It should be named the same name as the schematic that it was made from, with a .BDF extension. For example, if your schematic was named "your_schem.sch", the ULP output will be called "your_schem.BDF".

Run B2 Spice and go to the "File->Eagle->New Circuit from Eagle file". A dialog box will pop up asking you to locate the BDF file that was created by the ULP. Select it and B2 Spice will start the process of importing the Eagle schematic.

During this process, B2 Spice will import each part, seeking part matches in its database. If it finds a match, the part will be inserted automatically. If not matching part is found, only the symbol will be imported. These parts will not have any part in any simulations you run and will be

Page 136: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

130

displayed in RED.

Also if your schematic was made using Eagle version before version 4, then if B2 Spice doesn't find a symbol match in the database, it might pop up an error message like the following:

This is just telling you that B2 Spice cannot find an equivalent symbol in the Database and will import the symbol directly. Like the symbol-only parts that B2 Spice finds in the database, these directly imported symbols will also NOT have a simulation model and will not figure in any simulations. You can choose to view all these messages by clicking "yes" or you can bypass this by clicking "no".

Also, you might receive an error message saying that B2 Spice does not support Eagle buses.

This is just warning you that any buses in your Eagle schematic would not have been imported into B2 Spice. In this case you will have to manually use B2 Spice's rippers and combiners in place of Eagle's buses.

The imported schematic should now be displayed in a B2 Spice circuit.

How to build a schematic in Eagle and

Page 137: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

131

export it to B2 Spice for simulation In this example, we will be looking at building a circuit in Eagle and exporting it to B2 Spice for simulation.

The first step is to make sure that you have already unzipped the Eagle libraries and the ULP needed to convert Eagle schematics to B2 Spice into the appropriate Eagle subdirectories. The zip file should have been installed with B2 Spice v5 in the same directory and is named "eagle_lbr_ulp.zip". Unzip the ULP file to Eagle's ULP directory and the *.lbr files the Eagle's LBR directory.

Start Eagle and bring up a new schematic. You will need to place the following items:

- 8 resistors from the RCL library. You can either use the US or EU symbols and any package, depending on your needs. For this example, the R-US R0603 was used.

- 2 capacitors from the RCL library. You can use either the US or EU symbols and any package, depending on your needs. For this example, the C-US025-024x044 part was used.

- 9 grounds from the supply1 library

- 4 OPAMP_IDEALs from our bb_parts_nopkgs_OpAmp library.

- 4 VOLTMETER2s from the bb_parts_nopkgs_Analog_Meters library.

- 1 VOLTAGE_SOURCE from the bb_parts_nopkgs_Sources library.

Place the parts so that they are roughly in the following positions. You might need to rotate some parts to get them in the right orientation. The OPAMP_IDEALs will first have to be mirrored and then rotated into the correct position. The schematic so far should look something like this:

At this point, it bears noting that some parts were used from Beige Bag's libraries (bb_parts_*.lbr) and some parts were used from Eagle's own libraries. The parts pulled from the Beige Bag libraries will correspond with a part in B2 Spice so they will import with a simulation model and will be included any simulation. As a rule, most parts from Eagle's libraries will not have a Beige Bag equivalent, meaning that those parts will not simulate. They will still be imported into B2 Spice but will be symbol-only parts and will not be included in the simulation. However, standard parts like resistors, capacitors, inductors, ground, and certain other parts that we've mapped into Beige Bag parts will automatically have their equivalent Beige Bag parts inserted and will have simulation capabilities. For a full list of the mapped parts, run Beige Bag's Database Editor and go to the "Edit->Edit Eagle-B2 Spice part and pin maps" menu. You can also add more mappings here if you find a good match between your Eagle parts and Beige Bag parts.

The next step to take is to wire the schematic. Wire the schematic so it will look like the following picture:

Page 138: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

132

You will now add values to the devices. Assign all the resistors with a value of 10K. Both capacitors will have a value of 0.0159u.You will not need to assign values to the OPAMPS, VOLTMETER2s, and VOLTAGE_SOURCE. The OPAMPS are subcircuits and have all their values assigned inside the subcircuit. The VOLTMETERS2's are just meters and need no value assigned. The VOLTAGE_SOURCE will have to be assigned in B2 Spice as there are more values than can be assigned in Eagle.

You can just as easily skip this part and assign values after importing it into B2 Spice. But in this case, we'll assign the values in Eagle and have them exported to B2 Spice automatically.

After assigning the values, save the schematic and you're ready to export the schematic to B2 Spice.

To export to B2 Spice, click on the "ULP" button or File->Run... in Eagle and select the ULP "bbSpice.ULP". If it's not there, make sure that you have unzipped the ULP from the zip file that was installed in the B2 Spice A/D directory. See the note in the second paragraph for more details.

Once the ULP is finished running, look in Eagle's main directory for the file that was created. It should be named the same name as the schematic that you saved, with a .BDF extension. For example, if your schematic was saved as "new_schematic.sch", the ULP output will be called "new_schematic.BDF". If you didn't save your schematic before running the ULP, look for "untitled.BDF".

Run B2 Spice and go to the "File->Eagle->New Circuit from Eagle file". A dialog box will pop up asking you to locate the BDF file that was created by the ULP. Select it and B2 Spice will start the process of importing the Eagle schematic. During this process, B2 Spice will import each part, seeking part matches in its database. If it finds a match, the part will be inserted automatically. If not matching part is found, only the symbol will be imported. These parts will not have any part in any simulations you run and will be displayed in RED. Hopefully, all the parts will come in without problems.

The first thing to do is to check over the parts and wiring to make sure that all looks right. If a part is displaying in red, it means that a matching simulating part in B2 Spice could not be found. This circuit should not have that problem as long as you're using the latest versions of Eagle and B2 Spice.

The next thing to do is to set up the components so that they are ready for simulations. The capacitors and resistors should already have their values assigned from Eagle. You will then need to set up the values of the voltage source. To do so, double click on it and you will be presented with the following dialog box.

Page 139: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

133

In the DC Value box, type in 5 for the value. Then click on the "small signal AC and Distortion" tab at the top of the dialog box. There you will find AC parameters that you'll need to set. The dialog box should look like the following:

In the AC properties area, type in a Magnitude of 1. Make sure to check the "Use" checkbox.

OK the dialog box to accept changes.

The OPAMPS need no changing as they're subcircuit parts pre-set with the parameters need for simulations. You can right-click on them and select "Edit simulation model" to examine the subcircuits.

The VOLTMETERS also need no changing as they're just probes that will show up as signals in the graph after you run the simulation. You can change their names to something meaningful if you wish. Double click on the voltmeters to set their names.

Page 140: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

134

Now all that remains is to set up a Test and run it. Click on the Tests tab and check the AC Sweep/Single box. Click the blue arrow next to the AC Sweep checkboxes to expand the Test setup. You should see a dialog box like the one below:

Place a check next to the AC (AC Frequency Sweep) box to enable AC simulation and then click on the box itself to set up the AC simulation properties. You should see a dialog box like the one below:

In the "Start Frequency" box, type in 100. In the "Stop Frequency" box, type in 10K. In the "Steps/Interval" box, type in 100. Leave the rest as is.

Click OK to accept everything and get back to the circuit page. Click the green double arrows

in the toolbar to start the simulation. The resulting graph should look like the following:

Page 141: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

135

Biquad-Small Signal AC-0-Graph

Frequency 100 1k 10k

0.131 -6.58 -13.3

-20 -26.7 -33.4 -40.1 -46.8 -53.5

Notice that the signals on the graph correspond to the voltmeters placed in the circuit. You can still add other signals by choosing the node to plot, or even making your own custom plot with the built in functions.

This should give you a quick tour of the process of building a schematic in Eagle and bringing it in to B2 Spice for Testing.

How to export a circuit back to Eagle Schematics In this example, we will be looking at how to export a B2 Spice schematic back to Eagle and any issues that arise with that.

Once you have your circuit laid you in B2 Spice and you're ready to send it back to Eagle, go to the "File->Eagle->Export to Eagle Schematics" menu and type in a name for the file and where to

Page 142: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

136

save it.

B2 Spice will then create a Script file that Eagle can read.

Once that is done, run Eagle and have it execute the script file that was just created in B2 Spice. Eagle will then start placing parts from the script file. During this process you might receive some error messages saying that Eagle wasn't able to find a device and will list the device@library. This is most common when you're using a version of Eagle before version 4. Make note of the part and try finding a replacement once the importing process is done.

Also, you might receive messages asking if you want to connect certain nets. This is due to the differences between Eagle and B2 Spice and how wires are named, drawn and exported. It is usually fine to go ahead and connect the nets.

Once the Script is done executing, you might notice that some devices seem to be misplaced on the schematic by one grid point or so.

Page 143: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

137

This is due to the fact that Eagle uses a Center point as a reference in placing devices. In some devices, the symbol is drawn such that the center point cannot fall on a grid and will have to be drawn on a grid around the actual center point.

When B2 Spice exports a device, it will locate a devices true center and use that to place the device. However, since B2 Spice uses a different coordinate system than Eagle, devices that have centers different from the TRUE CENTERS can end up being misplaced. There is nothing that we can do about this. You will have to adjust these parts by hand.

Page 144: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

138

The finished schematic.

How to export a B2 Spice circuit to Eagle PCB In this example, we will look at exporting a B2 Spice schematic to Eagle layout and then using the Autorouter to route the board.

Run B2 Spice and open the circuit that you wish to export to Eagle PCB.

Page 145: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

139

You will first have to make sure that each Device has the correct package or else it will go over to Eagle as an unfound part or one that is using a "dummy" package.

When you're satisfied that all package information is correct, export to Eagle PCB by going to the "File->Eagle->Export to Eagle PCB". This command creates an Eagle Script that can be read by Eagle Layout.

Once this is done, run Eagle and create a new empty board. Then run the script that was generated by B2 Spice. Eagle should start reading in the script and placing packages on the blank board.

Page 146: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

140

The next step is to place the packages according to your needs.

Page 147: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

141

Then use the autorouter to have Eagle automatically route the board for you.

Please note that this is just a quick example and should be in no way interpreted as correct PCB design and methodology. We just wish to illustrate the process of exporting from B2 Spice to Eagle for layout and routing.

Page 148: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

142

Packages Devices in B2 Spice are made up of a Part and its Package information.

To set up or edit a Device's Package information, Edit a Device. In that dialog box, you should see a Package section.

You should first type in how many parts come in a particular package by typing that number in the Parts per Pkg box in the Edit Device dialog box. Then use the drop-down box, shown above, to select a package. Then just click on the Connect Part Pins to Package Pins button to get a dialog box like the one below, where you can assign part pins to specific package pins.

You should see 3 text boxes. The one on the left below the Symbol is the available symbol pins. If there is more than one part per package, the part section is denoted by the first letter of the pin name. For instance, the B.a above denotes the "a" pin of the second, or "B" section of the package. There are 4 parts per package for the 7400 above, so the sections go from A to D.

The middle text box below the package outline is the package pin.

The right text box shows all matched Part-Package pins. Unused pins are shown in their respective boxes.

To make a connection, highlight a part pin, highlight a package pin, and then make the pairing by clicking on the ==> button. The part pin and package pin will disappear and the pairing will appear in the right most box. Continue the process until all the part pins are used. Not all the

Page 149: B2 Spice Version 5

W O R K I N G W I T H C A D S O F T E A G L E P C B

143

package pins must be used, but all the part pins must be used.

Click OK to accept the package information setup.

Page 150: B2 Spice Version 5

W O R K I N G W I T H T H E D A T A B A S E

144

Working with the Database

What to do before modifying the database Make a backup. If you have the program on CD-ROM, then you can always reload the database from CD-ROM. However, if you don't have a CD-Rom, then you should make a copy of the database before modifying it just in case you mess up some parts. Also, you could use the empty database as your database for custom parts. In the B2 Spice and in the database editor, it's easy to set the database back and forth among multiple databases as you use the program.

Suggestions for class use If used in a classroom and no changes are allowed, then make it read-only. If students need to make changes to parts or add new parts, then they should have their own copies of a custom database that they can switch to for their parts.

Suggestions for team projects If multiple users are working on a design, then they can make modifications to the database, but they must each be pointing to the same copy of the program database in order to take advantages of changes that they make.

If many users are using the program over the network and they don't wish to share changes that they make to the database, then each would need his own database copy.

Creating a Part or Device from "Scratch" A part consists of a simulation model and a symbol.

From the File menu of the Database Editor choose New Device. The Edit Device dialog will appear.

Fill in the Part Name field to specify the device's name. Specify the category, manufacturer, and description to help specify the part. These fields can be left blank. The description and keywords are helpful for searching for the device.

To choose the simulation model, click on Select below the Simulation model field. This will bring up a list of simulation models that you can choose from. Choose the symbol from the list of symbols in a similar manner by clicking on Select Primary below the symbol field.

If the symbol or the simulation model is not already in the database, then you will need to create them. To learn how to create a new simulation model, see the section on Creating a New Simulation Model.

There are two ways to create new symbols. One is to have the program create it for you from the simulation model. To learn how to have the program create a new symbol for your part from the simulation model, see that section.

For the part to be valid, the pins on the simulation model must match up with the pins on the symbol. If you let the program automatically create a symbol from the simulation model, then there is a guaranteed match. However, there will be cases when you need to specify the pin names on the simulation model so that they match up with those of the symbol. The Connect Symbol Pins to Model Pins button is provided for that purpose and it brings up another dialog box where you can specify which model pin connects to which symbol pin. See the section on Setting Simulation Model Pins for more information.

Page 151: B2 Spice Version 5

W O R K I N G W I T H T H E D A T A B A S E

145

How to Add a New Process Model If you are at the main window of the Database Editor then choose New Process Model from the File menu.

Or from the Quick List, discussed above, double click on Process Model and click New...

Fill in the Model Name field to specify the process model's name. Specify the type of model as this will decide the parameters available to you. Fill in the description and manufacturer to help find the part. These fields may be left blank. Click OK when done.

Adding a Manufacturer If the name of the manufacturer is not on the list you will need to add it. To add a new manufacturer go to the Edit menu of the Database Editor and select Edit Manufacturer or double click on the Manufacturer quick access. This will open the Edit List of manufacturers. Click Add and type in the new manufacturer’s name.

Adding a New Category If the category you want is not on the list you will need to run the Database Editor and open the Edit List of categories dialog box. Double click on the Categories quick access item. You can also open the Edit List box by choosing New Category from the File Menu or Edit Category from the Edit Menu.

To add a new category, click on the Add... button and the Category Entry dialog box will appear. Type in the name of your new category and then click either the Analog or Digital sub-category and they will appear in the Parent box. Click OK to accept the addition.

Deleting Parts, Models, Symbols, and Process Models You can use the Database Editor to delete parts, models, symbols, and process models by going to the Edit menu and selecting Delete. From the sub-menu you can select the object that you wish to delete. Or you can double click on the respective items from the quick access menu, which will bring up the Select window showing all available objects. Select the item from the list, and press the "delete" button.

A note on deleting: If you delete a Part, the Database Editor will assume that you wish to delete every component of that part, including symbol and process/simulation model. But the program will ask for a confirmation before deleting each component so that you can keep a symbol if you don't wish to delete it. Also, if the component is being used by another part, then you will receive an error message if you try to delete that component.

Editing a Manufacturer To edit or rename a manufacturer, first choose Edit Manufacturers from the Edit menu of the Database Editor. Then choose the manufacturer name that you want to change, then click on the Rename button. This will bring up the window shown below. Make your changes in the Rename box.

Page 152: B2 Spice Version 5

W O R K I N G W I T H T H E D A T A B A S E

146

Setting Part Pins You will only need this if you wish to manually set pins instead of setting the simulation model's pins. Normally, if you have already set the simulation model pin names, the pins for the parts will automatically match the part's pins.

From the Edit Device dialog of the Database Editor, select a device that you want to set the pins for and click on the Connect Symbol Pins to Model Pins button to open the Match Simulation Model Pins with Symbol Pins dialog box.

Pin names for the simulation model will appear on the left side of the pin name box. The default pin name will be the same as the pin numbers if this is a subcircuit model, otherwise they will be the default pin names for built-in simulation model types.

The right column of the left list is the corresponding symbol pin name. You will need to choose a symbol pin to match each simulation model pin. It is important to match up the pins correctly because the simulator will later need this information to be correct to simulate the part correctly.

Limit pin names to 10 characters or less. For spaces use underscore ( _ ). Dashes are not accepted.

Click OK when all pins have been matched up.

Page 153: B2 Spice Version 5

W O R K I N G W I T H T H E D A T A B A S E

147

Setting Simulation Model Parameters From the Edit Model dialog box of the Database Editor click on the Simulation Guts tab. Click on the appropriate row, and then type the value in the value field. If it is a True/False parameter, you will choose between True and False. If you don't want to specify the field, leave it blank or 'x', or click in the Given checkbox to make it not given. If you enter a value in the box, accepting it will automatically make it given. When you are done specifying a parameter, click on Accept to store it and go to the next parameter.

Setting Simulation Model Pins From the Edit Simulation Model dialog of the Database Editor, select a model and click on the Set Model Pins button under the General tab to open the Set the active flag for simulation model pins dialog box.

Pin names for each model pin will appear on the left side of the pin names box. The default pin name will be the same as the pin numbers if this is a subcircuit model, otherwise they will be the default pin names for built-in simulation model types.

You can set aliases for the pin names, which is especially valuable for subcircuits with meaningless numbers for the pin names. Often, the subcircuit text will include the pin number/ alias relationships. It is important to name the pins correctly because, when you use this model in a part, the symbol's pins will need to match up with these model pins.

Limit pin names to 10 characters or less. For spaces use underscore ( _ ). Dashes are not accepted.

Once you have decided what the pin names will be, click the mouse on the Alias box and type in the names. Hit return or click Accept to keep the name. Otherwise the name is not kept.

The Active button will be set unless you would like to inactivate a pin. One instance where you

Page 154: B2 Spice Version 5

W O R K I N G W I T H T H E D A T A B A S E

148

might choose to deactivate a model pin would be a bipolar transistor, where the substrate may be deactivated. If a pin is inactive, then the part will not use that pin, nor will it be used by the simulator either.

If the circuit is an XSpice part, then you will have to also designate whether the pin is an Analog pin or Digital pin with the respective checkboxes. Further, if the pin is Digital, then you must also designate the direction of the pin by selecting the Input or Output checkbox.

Click OK when all pins have been named and set to the desired activation.

Creating a New Device when the Simulation Model is already in the database From the File menu of the Database Editor, choose New Device Based on Simulation Model to open the Select Model window. Choose a simulation model from the Model Bin and click the Select Button.

When you select the simulation model, the program automatically creates a new part with this simulation model as its model, and with the same name, category, manufacturer, description, and keywords as those of the simulation model. Next, the program will ask you if you would like to edit the pin names for the simulation model. If you have not set the pin names yet, or would like to edit the pin names, click YES.

All that's left to do is specify the symbol for this part. The program will ask you if you would like to create a new symbol for the part. Click YES, if you would like the program to create a symbol for you. Click NO, if you would like to choose an existing symbol for the part.

NOTE: If you get a warning message that reads Inconsistency between symbol and simulation model. Try another combination or change simulation model or pin names, most likely your pin names do not match with the symbol. Double check your pin names to see if they are consistent with the symbol. For more information, see the section on Setting Model Pins.

How to Create a New Symbol from Your Simulation Model

Page 155: B2 Spice Version 5

W O R K I N G W I T H T H E D A T A B A S E

149

You can create a new symbol once your simulation model is loaded into the library. From the File Menu of the Database Editor choose New Symbol based on Simulation Model to open the Select Model dialog box.

Select the model for which you would like to create a symbol and click Edit to open the Edit Model dialog box. Click on the Create Symbol button the program will automatically create a symbol for you. When you import your simulation model into the database using the New Device from text file feature or the Import Simulation Models feature, the program will automatically ask you if you would like to create a symbol.

Your new symbol will be named the same name as your model name. If you create a new symbol by clicking on the Create Symbol button you will be notified that a symbol has been created successfully.

Create a Simulation Model Using "Import Simulation Model" The difference between this technique and the New Device From Text File feature is this feature only generates simulation models, not complete parts. This technique applies to both process model descriptions and subcircuit models found in text files.

Under the File Menu of the Database Editor choose Import Simulation Models

An Open dialog box will appear for you to locate the subcircuit file. Locate the file and click OK. Follow the same steps as in the New Device From Text File feature to choose the category, enter the description, keywords and choose the manufacturer at the Defaults for New Simulation Models window. Click OK when done. (see below)

A message will indicate that you loaded your subcircuit file (or process model) and a simulation model was created, assuming that it was successfully loaded.

The program will then fix the polynomial controlled sources for the device if any, and notify you of problems. Click OK after each message box. When your device is loaded successfully, the program will notify you of that.

IF YOUR FILE DOES NOT LOAD, MAKE SURE THE SOURCE FILE IS NOT OPEN IN ANOTHER APPLICATION.

If you later want to create a part from this model, then see the instructions on creating a new device from a simulation model.

NOTE: When you use the Import Simulation Model feature, more than one model may be uploaded if there are multiple subcircuit files within the file that you are importing. For each part, the program will guide you through the same process.

Page 156: B2 Spice Version 5

W O R K I N G W I T H T H E D A T A B A S E

150

Creating a New Device From Process Model Text Files This method uses the same procedures as loading a subcircuit simulation model. The difference is you will enter the model description rather than the subcircuit description. You may use the New Device from text file feature or Import Simulation Models feature to load your part. Follow the same procedures for both features.

In a process model you will have a ".model" line with parameters.

Creating a Device from a Subcircuit Model Using the New Device from the Text File feature Manufacturers of discrete parts provide text/description of simulation models that can be loaded in the Device Library. These will be in the form of text files that will either have .SUBCKT in the text, or .MODEL in the text.

From the File Menu of the Database Editor, choose New device from text file... You will be prompted with the following message Start by choosing the file that contains the model's contents. Click OK.

An Open window will appear so you can browse for the file that contains the subcircuit description or part you would like to load. Locate the file and click OK.

Next, you will next be asked to set the descriptive parameters for the model. Click OK.

The Defaults for the New Simulation Models window will appear.

Use the pull down menu to select a category or click on the ellipsis button to view/edit/add Categories. Type in the description of the model. Type in the keywords to help search for the model. Then select the manufacturer by using the pull down menu or clicking on the ellipsis button to view/edit/add manufacturers.

A message will let you know that you have successfully loaded the device and created a simulation model for the device. Click OK.

After you click OK, the program will go through and fix the polynomial controlled source in the model, if any. Click OK after each of these dialog boxes.

The program will indicate that you successfully loaded your part. Click OK.

You will be asked if you would like to further edit the simulation model properties for (your device). Click YES if you would like to make changes to your new device's simulation model

Page 157: B2 Spice Version 5

W O R K I N G W I T H T H E D A T A B A S E

151

properties or if you want to set pin names so that they will match with an existing symbol's pins. See Setting Pin Names for instructions how to set pin names.

Click NO if you do not want to edit the device.

After you have set the pin names and clicked OK for the pin properties and the edit model windows, a message will ask if you would like the program to automatically create a symbol for your new part. Click YES if you would like a new symbol to be automatically created.

Click NO if you would like to use an existing symbol or one that you have created earlier. If you click NO the Select Symbol dialog box will open for you to choose an existing symbol.

See Creating a New Symbol or Creating Your Own Custom Symbol for details on how to create a new symbol.

Finally, the program will indicate when you have successfully created a new part. You will be asked if you want to edit the part properties for (your new part). This is another chance to edit any of the properties of the simulation model (pins, categories, manufacturers...) or part properties (simulation model, symbol, categories, key words...) Click NO if you are satisfied with your part's settings.

The part will be added to the database when you click YES.

NOTE: There may be more than one subcircuit file within a file. The program will load the entire file so you will be prompted for each model that is successfully loaded.

Creating a New Simulation Model From the File menu of the Database Editor choose New Simulation Model. You will be presented with the following dialog box:

Select the appropriate Model type and click OK.

The Edit Model window will appear

Fill in the Name field to specify the simulation mode's name. Specify the category, manufacturer, and description. These fields can be left blank. Specify the Model Type by using the scroll arrow button

For the Category click on the ellipse button. The SELECT CATEGORY window will appear. Click on the Category you want and click SELECT.

Next, to set the simulation guts for the simulation model, click on the Simulation Guts tab.

If your model type is a SUBCIRCUIT the simulation guts will be blank. You will need to enter the subcircuit text for this part into the empty text field. If you already have this text in another file, you can copy and paste the subcircuit text.

If your model type is other than a Subcircuit you will need to set parameters for the device. If you need help with this, see the section on entering parameters.

Some devices or parts require that a process model be set. To set the process model click on the Select Process button, and then select a process model from the list that appears. If the process model for your simulation model is not in the list, then you need to add a new process model.

Page 158: B2 Spice Version 5

W O R K I N G W I T H T H E D A T A B A S E

152

Resolving Spice language incompatibilities

Polynomial controlled sources

B2 Spice A/D does not support polynomial controlled sources within subcircuits. In the Database Editor, when you edit a subcircuit model, you can check for incompatible polynomial sources using the button Check controlled sources. In addition, there is a button you can use to fix these sources where possible within the subcircuit.

The polynomial sources are lines of the form:

(E|F|G|H)xxx node node POLY(n) inputs coefficient-list,

e.g., E1 1 2 poly(3) (3,0) 1 0 0 3

The spice line above means a voltage controlled voltage source where the voltage across nodes 1 and 2 is determined by the function: v(1,2) = 1 + 0 + 0 + 3* v(3)^3

Spice 3, which B2 Spice is based on, supports a more general form of controlled source which includes polynomial controlled sources as a subset. This new "device" is the non-linear dependent source, also known as the arbitrary source.

General Form:

Bxxx N+ N- <I=EXPR> <V=EXPR>

e.g., B1 0 1 I=cos(v(1)) + sin(v(2)) + v(1)^2

With the spice2 example given above,

E1 1 2 poly(3) (3,0) 1 0 0 3

the corresponding spice3 (and B2 Spice) implementation is:

BE1 1 2 V= 1 + 3 * V(3)^3

B2 Spice has the capability to convert from spice2 polynomial controlled syntax to spice3 arbitrary source syntax when they are embedded in subcircuit models.

Using the Database Editor, create the simulation model from the text file containing the subcircuit model. Depending on how you do this, the Database Editor may automatically convert the polynomials for you. If not, choose the button named Fix Controlled sources and the database editor will perform the conversion.

E.g. (the first line is commented out- it's the old polynomial controlled source.)

* egnd 99 0 poly(2) (3,0) (4,0) 0 .5 .5

begnd 99 0 v =0 + .5 * v(3,0) + .5 * v(4,0)

Altering the Database from B2 Spice The B2 Spice also has the ability to alter Devices, Simulation Models, and Symbols. By default, changes made in the B2 Spice are only stored in the circuit, but you can also save any Device changes back to the database.

Often you will find yourself changing a Device's properties, Simulation Model, or Symbol from within the B2 Spice. When you make the changes and save them, the changes only affect that specific item and only in that specific circuit. In other words, the changes are not universal. When you want to make the changes universal and permanent, you will have to save the changes back to the Database.

The following three menu items, available from within the B2 Spice when you right click on a

Page 159: B2 Spice Version 5

W O R K I N G W I T H T H E D A T A B A S E

153

Device, can store Devices, Simulation Models, and Symbols back to the database. Store Device to Database Stores the entire Device, including its symbol and simulation model, back to the database.

Store Simulation Model to Database Stores just the simulation model back to the database

Store Symbol to the database Stores just the symbol back to the database

Be aware that some simulation models and symbols are used by more than one device and any changes you make raise the possibility that you will render other devices inoperable. For instance, if you change pin names or delete pins, parts that use the same symbol will not work. So be sure of what you are saving before you save it back to the database.

Scope of Database Changes Any changes you make to the Database are not retroactive, meaning that any device already in a previously created circuit will not have any changes you might have made to the same device in the Database. This also applies to the device's simulation model, process model, symbol, etc.... If you want the changes to apply to a part previously in a circuit, you will have to delete and replace the device in the circuit.

Incompatible model types Some netlist languages such as that from Pspice use models that are either not in B2 SpiceA/D or are defined with a different set of parameters. In the Database Editor, when you edit a subcircuit model, you can check for incompatible models using the appropriate button. In addition, there is a button you can use to fix these models where possible within the subcircuit.

Altering Devices from the B2 Spice Main Program You can also edit any device from within the B2 Spice itself. Refer to the B2 Spice menus.

Working with Printed Circuit Board (PCB) information Each device in B2 Spice A/D should have a Package associated with it. Packages specify the physical properties that manufacturers supply the device in. Packages contain information such as pins, number of parts that come in a package, the name and description of the package, and a drawing of the package outline itself.

Package information is not used in Spice itself, but becomes important when you wish to export your circuit to a Printed Circuit Board (PCB) program, where you can lay out the finished circuit and route it.

Creating a new Package

B2 Spice A/D comes with a large library of Packages. However, new packages and forms might make adding a new package necessary. Currently, we only offer support for the following PCB

Page 160: B2 Spice Version 5

W O R K I N G W I T H T H E D A T A B A S E

154

programs: WinDraft, SuperPCB, Eagle, Orcad, Pads, and Ultiboard.

To enter a new package, you will have to run the Database Editor.

First, create a new symbol using the “File->New Symbol” command. This will bring up a blank document in which you can draw a rough outline of the new package. See “Creating and Editing symbols” for more information on drawing and saving new symbols. It is not necessary to add pins to this symbol as it is just used as a visual guide to package selection.

Once the symbol is drawn and saved, go to the “Edit->Edit Packages…” menu and click on the Add…button. This will bring up the following dialog box.

Enter the Name, Number of Pins, and Description of your new package. For the Symbol Name, click on the Choose Symbol button and select the symbol that you had earlier created.

In the “Name in other PCB languages” section, enter the name of the package as it is used in the PCB program in the Alias box, the name of the PCB in the PCB Language box, and the library file, if any, in the Library file box. Then click Accept. Please use the following notation for the various programs we support:

WD – WinDraft, SuperPCB – SuperPCB, Eagle – Eagle PCB, Orcad – ORCAD, Pads – PADS, Ultiboard – Ultiboard.

If you wish to remap the pins from your part to the PCB program’s package, click on the Remap Pins button.

Assigning Packages to a Part

In order to complete your design in a PCB program, each part in your circuit will need a Package assigned to it.

To assign a Package to a part, go to the Database Editor and edit the part that you wish to assign a Package to. In the Package section of the dialog box, use the pull down menu to select the Package you want to associate with the part. Then fill in the number of parts that come in the Package then click on the Connect Part Pins to Package Pins button. You will see the following dialog box:

Page 161: B2 Spice Version 5

W O R K I N G W I T H T H E D A T A B A S E

155

The left picture is a picture of the symbol, based on the simulation model. The right picture is a rough outline of the actual package. Match the Package pins to the model/symbol pins by clicking on the model/symbol pin in the left pin fields and its corresponding package pin on the right then hit the right arrow button to make the match. If you made any mistakes, selecting the matched part and package pins and then clicking on the left arrow will undo the match. With Ground or Power plane pins, select the special pin type from the “Special Pin” box and type in COM for the Group.

Editing Package information

There will be occasions where you will need to edit a part’s Package information. You can do this in one of two ways –from the Database Editor for permanent and universal changes or an “on the fly” temporary and unique change in the circuit itself from B2 Spice.

To change the package information for a part permanently, run the Database Editor and edit the part that wish to alter the Package information for. From there, you can change the package assigned to the part by using the pull down menu in the “Package”

Page 162: B2 Spice Version 5

I N D E X

156

Abstol ........................................................ 46 AC Frequency Sweep ................25, 50, 133 AC Sensitivity ........................................... 52 Add Parts ....4, 8, 13, 17, 21, 25, 35, 66, 67

Function ............................................... 67 Manufacturer .................................... 8, 67 Name................................................ 8, 68

Ammeter ................................................... 89 Autosave................................................... 11 bb_adInHigh ............................................. 47 bb_adInLow .............................................. 47 bb_daOutHigh .......................................... 47 bb_daOutLow ........................................... 47 Borders ..................................................... 10 Calipers............................................ 20, 107 capacitor .......................................46, 47, 64 Cartesian ................................................ 113 Cartesian Graph ..................................... 109 Change a Font........................................ 123 Chgtol........................................................ 46 Circuit Wizard ...........................5, 11, 67, 74 ConvAbsStep............................................ 47 Convergence options ...................46, 47, 64 ConvLimit.................................................. 47 ConvStep .................................................. 47 Create Part from Circuit ........................... 28 Creating a Mosfet Symbol...................... 121 Database ................................121, 123, 143 Database Editor.......................................... 9 DC Sensitivity ........................................... 53 DC Sweep.............. 1, 19, 20, 27, 45, 54, 55 Defad ........................................................ 48 Defl............................................................ 48 defw .......................................................... 48 Device Output Parameters....................... 56 Digital Components ............................... 34 Distortion Meter .................................. 90, 91 Eagle.8, 37, 40, 41, 43, 126, 127, 128, 129,

130, 131, 134, 135, 136, 137, 138, 140, 153 Importing From .................................... 40

Edit Graph............ 5, 67, 75, 76, 78, 83, 109 Edit Plots.............. 5, 26, 67, 75, 85, 86, 109 Error message.......................................... 64 Export to Eagle....................................... 126 Export to PCB......................................... 126 Font......................................................... 123 Frequency Plotter ..................................... 91 Function Generator .. 14, 17, 22, 23, 25, 26,

44, 45, 92, 93 Gain Meter .......................................... 93, 94 Gmin ................................................... 46, 64 Gminsteps................................................. 46 Grids ......................................................... 11 ground....................................................... 46 Histogram ...........................62, 84, 109, 113 Inductor .........................................46, 47, 64 Initial guess............................................... 64

Inside Spice...............................................48 Itl1 ....................................................... 46, 64 Itl2 ..............................................................46 Itl6 ..............................................................46 Layout......................................... 7, 105, 138 Legal Notes .................................................3 Legend............................................ 5, 67, 84 Log Scale ..................................................26 Marker .......................................................64 Maxevtiter..................................................47 Maxopalter.................................................47 Maxord.......................................................46 Method.......................................................46 Minbreak....................................................46 Miscellaneous options ..............................48 Mixed Mode...............................................47 Mixed mode circuit options .......................47 Model Output Parameters ........................56 Model Parameters..............46, 64, 121, 143 Monte Carlo 19, 51, 60, 61, 62. See Tests –

Monte Carlo MOSFET .......................................... 48, 121 netlist ...........................................................8 Netlist.............................................. 110, 111 Network Analysis ............................. 58, 113 node names...............................................10 Noise .................................................. 44, 51 Noopalter...................................................47 Opamp.......................................................46 Operating Point .....5, 19, 27, 45, 46, 47, 53,

54, 63, 64 Operating point success ...........................64 Oscilloscope................................. 23, 94, 96 Parameterized Subcircuit Part..................30 Parameters...............................................69 Parameters Panel....................................66 Parameters tab......................... 4, 16, 30, 60 parts palette.................................................8 Parts Palette................................... 4, 66, 69 PCB .................................................. 36, 126 Pins..........................................................143 Pivrel..........................................................46 Pivtol ..........................................................46 Polar Graph.............................................113 Polar Plot .................................................109 Polynomial...............................................151 Polynomial controlled sources ................151 Power Supply .............14, 15, 44, 45, 96, 97 probes........................................................46 Process Model ........................................143 Ramptime ..................................................47 Reltol .................................................. 46, 64 Rshunt ................................................ 46, 64 Show Node ......................15, 53, 55, 64, 98 Simulation..................................................44 Simulation Model ....................................143 Simulation Options ....................................46 Simulations............................. 4, 44, 63, 143

Page 163: B2 Spice Version 5

I N D E X

157

Smith Chart .....................................109, 113 Sources ...................................................151 Srcsteps ....................................................46 subcircuits ...............................................143 Suggestions for class use ......................143 Sweep ............................See Tests - Sweep Symbol Editor..........................................121 Symbols ..........................................121, 143

Conditional Properties .......................123 Creating..............................................121 Digital Operations ..............................123 Editing.................................................122 Variable Edit Field ..............................123

System Requirements ................................2 Technical Support.......................................2 Temperature .............................................46 Temperature options ................................46 Tests......................................................4, 66

Ac Sweep ...................................1, 25, 51 Monte Carlo....................................49, 88 Sweep.......................................48, 59, 88

Time Options ...........................................35 Tips for simulation success ......................63 Title Box ..............................................10, 11 Titlebox ..................................................105 Toolbars ..........................................6, 7, 103 Toolbox .....1, 4, 5, 6, 7, 8, 9, 11, 13, 16, 25,

28, 44, 48, 66, 76, 84 Transfer Function......................................55 Transient Signal Recorder..................24, 97

Transient success .................................... 64 Transient Test...............................48, 57, 59 Trtol........................................................... 46 ULP ......................................................... 126 Undo ......................................................... 10 virtual instruments .. 1, 4, 13, 15, 17, 44, 46,

57, 89, 90 Virtual Instruments

Add Meter .............................................. 6 Collapse All ............................................ 6 Expand All .............................................. 6

Virtual Instruments ............................... 5, 69 Visualization ......................................... 5, 71 Vntol.......................................................... 46 Voltmeter ..............................13, 15, 99, 125 Wattmeter ............................................... 100 What to do before modifying the database

............................................................ 143 Window

Graph Window ................................... 108 Schematic Window ............................ 108 Table Window .................................... 110 Text Window ...................................... 110

Windows ..................................................... 6 commands ............................................. 7 tabs......................................................... 6

Wiring...................................................... 6, 9 Working with the Database.................... 143 Workspace......................................5, 66, 73


Recommended