Product Documentation
PSpice Help
Product Version 17.4-2020, June 2020


Files and Commands

Using .PRB files

.PRB files are ASCII text files where displays, measurement functions, and macros are stored. Each of these are listed in a section in the .PRB file. The section begins with a section header:

[Displays]

[Measurement Function]

[Macros]

The sections can be in any order or not appear at all.

Comment lines begin with an asterisk *. Blank lines are ignored.

PSpice.PRB is shipped with your OrCAD applications. This file contains examples of measurement functions and can be used as templates for your own measurement function definitions.

Loading .PRB files

Certain .PRB files are automatically loaded by PSpice:

You can load a specific .PRB file after the global and local files are loaded by using the command line option -p. For example:

PSpice .EXE -P MYFILE.PRB

You can also use .PRB files by clicking the Load button in the Display Control, Measurement Functions, or Macro dialog boxes. Only the section is loaded from the .PRB file. For example, if you click Load in the Measurement Function dialog box, only the measurement functions in the specified .PRB file are loaded.

When you load a .PRB file that contains any displays, measurement functions, or macros with the same names as ones already loaded, the new ones replace the previous ones.

PRB file

A .PRB file is an ASCII file which contains three sections: one for measurement functions, one for macros, and one for display definitions. Each section begins with a header (e.g., [MEASUREMENT FUNCTIONS]).

Measurement functions are stored in a .PRB file. A single .PRB file can contain many measurement function definitions.

Text in a .PRB file

A .PRB file can contain any number of measurement function, macro, and display definitions.

Text in a .PRB file uses the following format:

Moving data to other applications

You can copy trace data to other applications in two ways: as data or as a bitmap.

Copying bitmaps to another application

Copying data to another application

Copying trace data to another application

You can copy and save trace data to other applications.

To copy trace data to another application

  1. Click the trace name in the plot legend to select the trace. (The name turns red when selected.)
  2. From the Edit menu, choose Copy.
  3. Open a file in another application, such as Microsoft Excel, Microsoft Word, or Notepad.
  4. From the Edit menu of the other application, choose Paste to paste the data in the file as numbers and text.
  5. Save the file.

Logging commands

You can use command logging to create a file of commands that you can use at a later date. This file is played back to repeat a series of commands.

To create a command file

  1. From the File menu, choose Log Commands.
  2. Type the name of a new file or select an existing file. If you use an existing file, it is over-written with the new command file.
  3. Click OK.
    All functional actions you make on the screen are logged to the specified file. The resulting file contains actions like opening files, setting axes, and adding traces.
  4. To stop logging commands, from the File menu, choose Log Commands again.
    Cursor movements are not recorded during command logging.

To run a command file

  1. From the File menu, choose Run Commands.
  2. Select the file from the list. If the file is in a different directory or drive, select the correct file or directory from the lists.
  3. Click OK. to play the file immediately on your screen.

Creating and changing macros

Macros can contain constraints, functions, and/or expressions of any or all of these. Macros are used when specifying a trace to add. Macros can refer to other macros, but recursive definitions are not allowed.

You can define, load, save, and delete macro definitions. Macros are stored in a .PRB file.

For more information, see the following topics:

To add a macro

In the Add Trace dialog box:

  1. From the Functions or Macros list, select Macro.
  2. From the corresponding list, select the name of the macro.
  3. Fill in the arguments list, using the macro syntax format:
    1. In the Node Names list, click the name of a digital node.
    2. Repeat step a for all arguments needed for the macro call.

To create a new macro

  1. From the Trace menu, choose Macros.
  2. In the Definition text box, type a unique name and a definition for the macro, observing the macro rules.
  3. Click the Save button to save the macro.
    If the macro name already exists, clicking the Save button overwrites the existing macro of the same name.

To modify an existing macro

  1. From the Trace menu, choose Macros.
  2. From the list, select a macro.
  3. In the Definition text box, edit the macro definition, observing the macro rules.
  4. To save the modified macro, do one of the following:
    • To save with the same name, click the Save button.
    • To save to a specified PRB file, click the Save To button.

To load a macro

  1. From the Trace menu, choose Macros.
  2. Click the Load button.
  3. Select the file you want to load and click Open.

To delete a macro

  1. From the Trace menu, choose Macros.
  2. Select a macro from the list.
  3. Do one of the following:
    • Click the Delete button. The macro is immediately removed from the list.
    • If the selected macro is being used by a current trace, you are warned that it is in use. To delete the macro anyway, click OK
      If you delete a macro that is being used by a trace, the trace is deleted too.

To delete a macro from another file

  1. From the Trace menu, choose Macros.
  2. Click the Delete From button.
  3. Select the remote or global .PRB file that has the macro you want to delete.
  4. Click Open to delete the macro.
    If you delete a macro that is being used by a trace, the trace is deleted too.

Macro syntax and examples

A macro can have a maximum of 80 characters, including macro name and arguments. Macros can refer to other macros, but recursive definitions are not allowed. Arguments are enclosed in parentheses ( ) without spaces. A line beginning with an asterisk * is a comment line. In-line comments are marked with a semicolon after the macro definition. Blank lines are ignored.

The macro format is:

<macro name>[(arg[,arg]*)] = <definition>

Examples

CSDF

When you (?) the Save Data in the CSDF Format option in the data collection options for simulation profiles, the simulation results are generated in generic ASCII text so that any computer link can handle the file transfer and so that any computer platform can process the data. The default file name extension for CSDF files is .CSD.

Binary

Binary files are compact and provide the quickest access to the waveform data.

However, binary files can present problems if you want to manipulate the data, or when you want to transfer the data file to a different type of computer. There are several problems that you can encounter. Examples include:

Specifying default command line options

To start PSpice with a set of customized options that will be used each time a simulation is run, you can modify the initialization file (pspice.INI).

  1. Open the file pspice.ini (located in the Windows directory) in any ASCII text editor, such as Notepad.
  2. Under the heading [PSpice ] add the following command line with the desired switches:
    PSPICECMDLINE=<option1> <option2>
  3. Save the file.

For more detailed information on defining simulation command line options in PSpice and a listing of the valid options, see the PSpice Reference Guide.

Configuring the pspice.INI file

The pspice.ini file is an ASCII text file that contains the initialization settings for PSpice and other applications that run with PSpice. It controls how PSpice application programs are started, and how their environment and initialization settings are defined. The pspice.ini file is created when you perform the installation process.

Under normal installations to your local hard drive, the pspice.ini file is located in the directory where the PSpice executable (pspice.exe) is installed (typically, in <installation>\tools\pspice). The file is divided into sections with title names enclosed in brackets.

Each section contains settings which follow the format:

<keyword>=<value>

where the <keyword> is the name of the setting and <value> defines the value of that setting.

For example, the first section is [PSPICE]. The setting:

LIBPATH=”C:\Cadence\SPB_17.4\tools\pspice\library”

indicates that the LIBPATH setting will point to the directory C:\Cadence\SPB_17.4\tools\pspice\library, where the PSpice model libraries are typically installed.

Changing the settings

When the pspice.ini file is created (during installation), the installation assigns default values to the settings. Most of the settings can be changed through dialog boxes within PSpice or Probe. However, some settings may only be modified with a text editor.

If you use a text editor to modify the settings in pspice.ini, be sure to close any PSpice applications that may be running. The changes you make to pspice.ini should be saved to the file. They will take effect the next time you start the programs.

You can change the default settings using any standard text editor, such as Notepad.

To change items that are configurable through the text editor, you should note that:

Section descriptions

The pspice.ini file consists of several sections that define the configuration settings for the various PSpice applications. The descriptions listed below provide information on the elements within each of these sections in pspice.ini. The descriptions provide details on the permissible <keyword> and <value> settings.

Several of the configuration settings described here will not appear in pspice.ini unless the default values have been changed.

For specific information about a particular section, click the buttons next to the section titles listed below. (The sections are listed here in alphabetical order for easy reference. They are typically arranged in a different order in the actual pspice.ini file.)

PART LIBS section

PART LIBS section

PART LIBS section

PART LIBS section

PROBE section

PROBE DISPLAY COLORS section

PROBE PRINTER COLORS section

PSPICE section

PSpice NETLIST section

SUBCKT SETTING section

PART LIBS section

The [PART LIBS] section lists the part libraries that are configured for use in PSpice Schematic to Capture translation. The individual entries in the listing can be edited in the form:

LIB1=<library name> [extension]

where <library name> is the name of the library file (ANALOG) and [extension] is the extension for the library file. You may list multiple extensions.

PROBE section

The [PROBE] section defines the configuration settings used by Probe. The following table describes the different settings. The settings are listed here in alphabetical order for easy reference, but they may appear in any order in the pspice.ini file.

Keyword Description

AUTOUPDATEINTERVAL

Controls the update interval for Probe waveforms. Valid settings are Auto, Seconds, or Percent. The default setting is AUTO.

AUTOUPDATEPERCENT

Specifies the auto update interval for Probe waveforms in percent, if AUTOUPDATEINTERVAL is set to Percent. The default is 10.

AUTOUPDATESECONDS

Specifies the auto update interval for Probe waveforms in seconds, if AUTOUPDATEINTERVAL is set to Seconds. The default is 10.

CURSORBOTTOM

Specifies the bottom position of the cursor box. The default is 0.

CURSORNDIGITS

Specifies the number of digits to be displayed for the cursor position. The default is 5.

CURSORRIGHT

Specifies the right position of the cursor box. The default is 0.

DGTLNAMELEFTJUSTIFY

Controls whether digital names are left or right justified. Valid settings are On or Off. The default is OFF, meaning right justified.

DISPLAYEVALON

Turns on the display of traces and marked points used by Display Evaluation in the currently selected plot, on the currently selected Y axis. Valid settings are On or Off. The default is OFF.

ERRORMSGDLGLEFT

Specifies the left position of the Error Message box. The default is -1.

ERRORMSGDLGTOP

Specifies the top position of the Error Message box. The default is -1.

HISTNDIVISIONS

Specifies the number of divisions for histograms. The default is 10 divisions.

HISTSHOWSTATSON

Specifies that the histogram statistics will be displayed in the Probe window. Valid settings are On or Off. The default is ON.

MARKDATAPOINTS

Specifies whether data points will be marked on Probe traces. Valid settings are On or Off. The default setting is OFF.

PRBFILE

Specifies the name of a global .PRB file which contains Probe macro, display, measurement function, and plot template definitions. The syntax for a typical installation is:

PRBFILE=<installation_directory>\tools\PSpice\Common\pspice.prb

PRINTERLINEWIDTH

Specifies the width of lines drawn during printing (in pixels). The default is 1.

SCROLLBARS

Controls display of scroll bars. Valid settings are Always, Never, or Auto. The default setting is AUTO.

PRINTSAMEASDISPLAY

Controls whether the Probe printout matches the display. Valid settings are 0 (Off) or 1 (On). The default setting is 0.

TRACECOLORSCHEME

Specifies the trace coloring scheme. Valid settings are Normal, Match, or Sequential. The default setting is NORMAL.

TRACESYMBOLS

Specifies how trace symbols will appear on traces in the Probe plot window. Valid settings are Always, Never, or Auto. The default setting is AUTO.

TRACEWIDTH

Specifies the trace width in the probe. The default is 1.

PROBE DISPLAY COLORS section

The [PROBE DISPLAY COLORS] section defines the color settings used by Probe. The following table describes the different settings. The settings are listed here in alphabetical order for easy reference, but they may appear in any order in the pspice.ini file.

To change the settings in the [PROBE DISPLAY COLORS] section, use the format:

<item name>=<color>

where <item name> specifies the Probe item and <color> specifies the color.

For example, the entry FOREGROUND=DARKGREEN results in graph axes being drawn in dark green, Or, BACKGROUND=CYAN results in the screen background changing to the color cyan instead of the default color black.

Alternatively, you may specify varying degrees of color by using the RGB (red, green, blue) value of the color you desire. For example, TRACE_2=255 0 0 is the same as TRACE_2=RED.

The available colors are: black, blue, brown, brightwhite, cyan, darkblue, darkcyan, darkgray, darkgreen, darkmagenta, darkred, green lightgray, magenta, red, and yellow.

In some cases you may want to limit the number of colors used for drawing. For a super VGA display, the default maximum number of colors (NUMTRACECOLORS) is twelve.

Keyword Description

BACKGROUND

Specifies the background color. The default setting is BLACK.

FOREGROUND

Specifies the foreground color. The default setting is WHITE.

NUMTRACECOLORS

Specifies the maximum number of trace colors. The default setting is 0 (one color). For color printers, set this to 12. After reaching the maximum number, Probe begins displaying the next trace color by repeating the first trace color, then the second, etc.

TRACE_1

Specifies the color of the first trace. The default setting is BRIGHTGREEN.

TRACE_2

Specifies the color of the second trace. The default setting is BRIGHTRED.

TRACE_3

Specifies the color of the third trace. The default setting is BRIGHTBLUE.

TRACE_4

Specifies the color of the fourth trace. The default setting is BRIGHTYELLOW.

TRACE_5

Specifies the color of the fifth trace. The default setting is BRIGHTMAGENTA.

TRACE_6

Specifies the color of the sixth trace. The default setting is BRIGHTCYAN.

TRACE_7

Specifies the color of the seventh trace. The default setting is MUSTARD.

TRACE_8

Specifies the color of the eighth trace. The default setting is PINK.

TRACE_9

Specifies the color of the ninth trace. The default setting is LIGHTGREEN.

TRACE_10

Specifies the color of the tenth trace. The default setting is DARKPINK.

TRACE_11

Specifies the color of the eleventh trace. The default setting is LIGHTBLUE.

TRACE_12

Specifies the color of the twelfth trace. The default setting is PURPLE.

PROBE PRINTER COLORS section

The [PROBE PRINTER COLORS] section defines the color settings used for printing from Probe. The following table describes the different settings. The settings are listed here in alphabetical order for easy reference, but they may appear in any order in the pspice.ini file.

To change the settings in the [PROBE PRINTER COLORS] section, use the format:

<item name>=<color>

where <item name> specifies the Probe item and <color> specifies the color.

For example, the entry FOREGROUND=DARKGREEN results in graph axes being printed in dark green. The default maximum number of colors is twelve.

The available colors are: black, blue, brown, brightwhite, cyan, darkblue, darkcyan, darkgray, darkgreen, darkmagenta, darkred, green lightgray, magenta, red, and yellow.

If you are using a four pen plotter, you will get the best results if you set the maximum number of colors to three. The first three trace colors will be used for the colors of digital traces.

Keyword Description

BACKGROUND

Specifies the background color. The default setting is BRIGHTWHITE.

FOREGROUND

Specifies the foreground color. The default setting is BLACK.

NUMTRACECOLORS

Specifies the maximum number of trace colors. The default setting is 12. After reaching the maximum number, Probe begins printing the next trace color by repeating the first trace color, then the second, etc.

TRACE_1

Specifies the color of the first trace. The default setting is GREEN.

TRACE_2

Specifies the color of the second trace. The default setting is RED.

TRACE_3

Specifies the color of the third trace. The default setting is BLUE.

TRACE_4

Specifies the color of the fourth trace. The default setting is YELLOW.

TRACE_5

Specifies the color of the fifth trace. The default setting is MAGENTA.

TRACE_6

Specifies the color of the sixth trace. The default setting is CYAN.

TRACE_7

Specifies the color of the seventh trace. The default setting is MUSTARD.

TRACE_8

Specifies the color of the eighth trace. The default setting is PINK.

TRACE_9

Specifies the color of the ninth trace. The default setting is LIGHTGREEN.

TRACE_10

Specifies the color of the tenth trace. The default setting is DARKPINK.

TRACE_11

Specifies the color of the eleventh trace. The default setting is LIGHTBLUE.

TRACE_12

Specifies the color of the twelfth trace. The default setting is PURPLE.

PSPICE section

The [PSPICE] section contains settings that are specific to PSpice. The following table describes the different settings. The settings are listed here in alphabetical order for easy reference, but they may appear in any order in the PSPICE.INI file.

Command line options for the PSpice applications are explained in much more detail in the PSpice Reference Guide.

Keyword Description

BACKUP

Specifies the directory in which backup copies are placed. The default is set at installation. This line can be edited in the form:

BACKUP=<directory>

where <directory> specifies the directory where backups will be written. If you are installing a network version, this directory cannot be write-protected and should be set to a local directory, not a network directory.

LIBPATH

Specifies the directories where the model, part, and package libraries are located. The default is set at installation. This line can be edited in the form:

LIBPATH=<directory>

where <directory> specifies the directory where the library files are located. (For more information, see the section on LIBPATH below.)

MATHEXCEPTIONS

Allows reporting of math exception errors. (The keyword is not included in the netlist.) Valid settings are Off or On. The default setting is ON.

OPTIMIZERCMD

Specifies the command used to run PSpice Optimizer. This line can be edited in the form:

OPTIMIZERCMD=<optimize r> [options]

where <optimizer> indicates the executable for starting Optimizer and [options] can be any of the available Optimizer switches.

PSPICECMDLINE

Specifies what command line options should be used when starting up PSpice. This line can be edited in the form:

PSPCIECMDLINE= -<switch> <filename>

where -<switch> indicates the and <filename> is the name of the corresponding file to be opened. Valid switches are: -i = custom .INI file -p = measurement function file

SET_OPTION_FLAG

Forces the use of SPICE2 time steps when simulating transmission lines. This is not included in the default settings. This line can be inserted in the form:

SET_OPTION_FLAG= OLDTLINETSTEP

LIBPATH

This variable is originally set during installation to the directory:

LIBPATH=C:\Program Files\Orcad\Capture\ Library\PSpice

If you install the PSpice applications into another directory, then a corresponding subdirectory will be created under your named directory.

For example, if you specify C:\Mydir as the directory where PSpice should be installed, then your LIBPATH variable will be set to:

LIBPATH=C:\Mydir\Orcad\Capture\Library\ PSpice

You can specify more than one directory for LIBPATH by separating the paths with a semicolon (;). When a library file is referenced, PSpice will search for the file in the directories in the order specified by this variable. You can change the LIBPATH variable by editing this line in the form:

LIBPATH=<directory>;<directory>;...;<directory>

For example, if you want PSpice to search for model library files in more than one place, you could set the variable to:

LIBPATH=C:\Program Files\Orcad\Capture\ Library\PSpice ; D:\ProjectA\Library

In this case, PSpice will look first for a library file in C:\Program Files\Orcad\Capture\Library\PSpice. If it finds the specified library file here, it will stop searching. Otherwise, PSpice will then search for the specified library file in D:\ProjectA\Library.

PSpice NETLIST section

The [PSpice NETLIST ] section contains settings that specify which model library files should be processed when generating a PSpice simulation netlist.

The typical setting created during installation will appear in the form:

LINE1=.lib “nom.lib”

You can specify more than one library file to include in the netlist generation process. The library files you specify will be searched in the order in which they are listed.

For example, if you have three different sets of model libraries that should be searched and processed during netlist generation, list them as follows:

LINE1=.lib “nom.lib”

LINE2=.lib “projectA.lib”

LINE3=.lib “projectB.lib”

For more specific information on how to set up Library and Include files for processing simulation netlists, see the help and user guide for the particular front-end tool you are using.

SUBCKT SETTING section

The [SUBCKT SETTING] section defines how various parameters in subcircuits are processed when a hierarchical netlist is generated. The following table describes the different settings. The settings are listed here in alphabetical order for easy reference, but they may appear in any order in the pspice.ini file.

This section must be added in order to disable the automatic assignment of the global pin name prefix “$G_” to hidden pin names when hierarchical netlists are generated.

Keyword

Description

CREATESUBCKTFORMULTDEVICE

Controls whether subcircuits are created for multiple devices template when a hierarchical netlist is generated. Valid settings are Yes or No. The default setting is YES.

LOCALIZEHIDDENPIN

Controls whether hidden pin names for subcircuits are localized when a hierarchical netlist is generated. Valid settings are Yes or No. The default setting is NO.

SORTPIN

Controls whether pin names for subcircuits are sorted when a hierarchical netlist is generated. Valid settings are Yes or No. The default setting is YES.

Calculating Hysteresis Core Loss

The Hysteresis Core Loss application calculates the area of the B-H curve, which is the integrated average of B-H loops, on the basis of the specified time range, that is, the start time and end time.

If the specified time range covers more than 50 B-H loops, the area of the B-H curve is calculated using the first 50 B-H loops. If the specified time range covers less than 50 B-H loops, the area of the B-H curve is calculated using the number of the loops covered within the specified time range.

The following figures illustrate an example where the circuit is in the transient state.

Figure 12-1 Transient State of the circuit

Note that in Figure 12-1, the time range for the B-H loops is from 0 to 4 seconds and the B-H loops, as shown in Figure 12-2, do not overlap as the B-H values are different for each loop.

Figure 12-2 B-H Curve of the Circuit’s Transient State

The following figures illustrate an example of the steady-state behavior of the circuit in the specified time range of 4 to 10 seconds.

Note that the B-H loops, as shown in the Figure 12-4, overlap as the circuit is in its steady state. The core loss of the circuit’s steady state is calculated if the specified time range is from 4 to 10 seconds.

Figure 12-3 Steady State of the circuit

Figure 12-4 B-H Curve of the circuit’s steady state

For accurate core loss calculation, specify a value for the maximum step size that generates optimal number of data points.


Return to top