# 幸运飞艇超稳计划群

MacSpice > Features

# Features

### Introduction

This page describes the implementation-specific features of MacSpice, further information is available in the MacSpice User's Guide and Release Notes. Broadly speaking, MacSpice is compatible with the original Berkeley Spice 3f4 as described in the Spice 3f4 User's Guide. If you want to learn Spice from scratch, refer to the Tutorials page.

### Colour PostScript Hardcopy

To make the hardcopy command produce colour PostScript use:


set hcopydevtype = postscript
set hcopypscolor


The variables 'hcopyheight' and 'hcopywidth' can be used to set the image height and width in points. For more details, refer to the Colour Schemes section of the Advanced Examples.

### Command Line Editing

the macspice console has command and file completion, and command-line editing keystrokes. users who switch between macspice and un*x shells should feel at home.

 CTL-A move cursor to start of line CTL-B or left-arrow move cursor back one char CTL-D delete forward from insertion point CTL-D at end of line prints a list of possible completions CTL-F or right-arrow move cursor forward one character CTL-H delete back from insertion point CTL-K delete from cursor to end of line CTL-N or down-arrow scroll down through history stack CTL-P or up-arrow scroll up through history stack CTL-T transpose two characters CTL-U delete entire line TAB automatically types the completion as far as possible OPT-ESC or F5 displays a dropdown list of possible completions

text outside the editable region can be selected and copied, but not changed. the variable 'ignoreeof' is now set by default because otherwise it is rather too easy to type ctl-d at the command prompt and lose everything. to get a list of all commands type a space followed by ctl-d at the prompt.

If the command contains history references, typing TAB will expand these.

### Convergence Aids

The simulator options 'gminsteps' and 'srcsteps' control the way MacSpice searches for the DC operating point. Setting one or both of these to the value 1 will cause MacSpice to use an adaptive step-size algorithm.

During a transient analysis, Spice increases the timestep when the going is good and cuts it back when things get tough. In particular, if the ratio of 'Rejected timepoints' to 'Accepted timepoints' displayed by the command rusage all exceeds about 10% the simulation will be extremely inefficient. Using the command:


set debug = timestep


MacSpice has a nodesets command that saves the state of its current analysis as a file of nodeset commands suitable for inclusion in a netlist. This is useful in cases where the operating point is difficult to find.

After a convergence failure, the command dump幸运飞艇超稳计划群 will display the node voltages and branch currents calculated by the final two interation and indicate the one(s) that failed to meet the convergence criteria.

### Cursor Measurements

when the cursor is positioned over a graph in a window, a help-tag displays the corresponding values. holding down the 'shift' key sets the origin for measurements of changes. double-clicking transfers the displayed value to the command line.

### DC Transfer Function

In addition to voltage and current sources, the DC Transfer Function幸运飞艇超稳计划群 can sweep the value of resistors and/or circuit temperature ('temp').

### Edit Command

The MacSpice edit command uses Apple Events to invoke a helper application and supports the ODB Editor Suite. It is strongly recommended that an ODB-compliant editor is used with MacSpice. If your favourite editor is not one of these, consider switching to the excellent . ODB allows tight integration between MacSpice and the editor. For example, MacSpice to pre-type an appropriate 'source' command in response to editor activity. If this is not required, it can be cleared by typing CTL-U (see above).

use the preferences menu to specify the helper application for the 'edit' command.

this table lists some popular editors that support odb:

EditorLicencePublisher
AlphaXCommercial
BBeditCommercial/Freeware
MacVimOpen Source
SmultronOpen Source
SubEthaEditCommercial
TextMateCommercial

### File Names and Paths

MacSpice uses Unix paths to specify files and folders, hence '/' is the path separator. A path that begins with a '/' is an absolute path. In MacSpice non-absolute paths are relative to the current directory, which can be inspected and/or set with the 'cd幸运飞艇超稳计划群' command.

macspice treats the single character '#' as a pseudo-filename signalling that a file, or folder, is to be selected using a navigation services dialog box. when this mechanism is used to open files, they can be sorted by date or name and you have instant access to recently opened files or 'favourites'. drag a folder or file from the finder into navigation services and it will open and reset the default to that location.

.
MacSpice 2 -> echo $sourcepath[2] /Users/cdhw/Library/Application Support/MacSpice/lib/scripts  The set command can be used to change the sourcepath list, e.g.  MacSpice 3 -> set sourcepath = ($sourcepath 'Secondary/test/' )
MacSpice 4 -> echo \$sourcepath[3]
Secondary/test/


spaces and strange characters in pathnames need quote protection. bash(1) style single-, double- and backslash-quoting can be used as required.

The cd command is used to change and identify the current directory. Used without an argument it resets the current directory to the the '~/Documents/MacSpice/' directory that was created when MacSpice was first run,

    MacSpice 5 -> cd
Current directory is: /Users/cdhw/Documents/MacSpice/


To change the current directory to /Volumes/MP1/CAO/SPICE/cir/ type

    MacSpice 6 -> cd /Volumes/MP1/CAO/SPICE/cir/


to check the current directory without changing it use

    MacSpice 7 -> cd .
Current directory is: /Volumes/MP1/CAO/SPICE/cir/


The command-completion aids described above are particularly useful with cd. For a more Mac-like experience, type

    MacSpice 8 -> cd #


, which will allow selection of a folder using a standard navigation dialog.

### File Types and Formats

IconTypeExtensionOpen actionNotes
TEXT .cir .net
.src .sp3
MacSpice -> source filename MacSpice Source File
RAWT .rawt MacSpice -> load filename MacSpice Text Rawfile.
RAWB .rawb MacSpice -> load filename MacSpice Binary Rawfile.

The format of the rawfiles created by the write command is specified by the filetype variable. In addition to the standard 'ascii' and 'binary' values, MacSpice defines the filetype 'tabbed'. This is a tab-delimited format intended to facilitate import of results into other data-analysis applications.

macspice (v3.0.0 onwards) uses utf-8 encoding to read and write files and commands. earlier (carbon) versions of macspice used macroman encoding.

### Graphs

The base pen-thickness used to display graphs is selected automatically and depends on the fontsize selected. This can be overridden by the Format menu. The command 'set pensize = N' where 1<= N <= 10 is measured in points, can also be used to override the default behaviour. Default behaviour is restored by 'set pensize = 0' or 'unset pensize'.

### Memory Conservation

many of the memory leaks that affected spice 3f4 have been cured in macspice. i've paid particular attention to the frontend, for example the script:

    let j = 0
while j < 10000
let j = j +1
end
repeat 10000
define f(a,b) 100*b+321*a
let k = f(j,j+4)
undefine f
end
unlet j k


does not leak. this property allows industrial-strength optimisation problems to be tackled.

The m2wx85.cnmand delcirc, which has the same syntax as setcirc幸运飞艇超稳计划群, can be used to delete a loaded circuit and recover its memory.

The memory usage indicated by rusage excludes the amounts required to create and maintain windows (these use a separate allocation zone). Commands like destroy, delcirc, unlet, etc. can be used to recover memory. Graphs make their own copy of their data at the time they are created. If you destroy vectors that are owned by a suspended simulation - don't 'resume' it, use 'delcirc' to get rid of the thing.

### Optimizer

MacSpice includes a sophisticated optimize幸运飞艇超稳计划群 command. This uses a numerical procedure to minimize functions of several variables with optional constraints. The function may be as simple as a quadratic equation, or as complicated as the result of running a suite simulations.

### Save

The standard save command has been enhanced by defining new qualifiers 'alli' and 'allv'.

 save all Voltage nodes and voltage source branch currents, but not semiconductor internal nodes. save allv Voltage nodes, including semiconductor internal nodes, and source branch currents. save alli Terminal currents for all semiconductor devices.

### Spice 2 'POLY' Sources

Spice 2 poly sources in the netlist are converted to the Spice 3 (usually B) equivalents. The results should be inspected using the listing command.

MacSpice is able to check for new versions and update itself. The update information comes via幸运飞艇超稳计划群 a type of RSS feed known as an 'appcast'. Users have a chance to inspect release notes before deciding whether they want to update. The checks can be performed on request, by using the 'Check for Updates...' menu item, or automatically roughly once a week. Automatic updates can be switched on or off using the 'Preferences...' panel or with the defaults(1) command from the terminal. For example,

    macos% defaults write uk.co.cdhw.MacSpice SUEnableAutomaticChecks -boolean yes


enables automatic checking, and setting the value to 'no' disables it.

### Vectors

Expressions like 'let foo[2] = 99' work in MacSpice and incorporate index range checking. It also has a semicolon operator to facilitate construction of vectors and n幸运飞艇超稳计划群-dimensional matrices. For example, typing the commands:

 'let foo = ((11;12);(21;22))' creates a 2×2 matrix, 'let bar = (foo;(31;32))' creates a 3×2 matrix, 'let baz = (1;(3,4);5)' creates a complex vector with 3 elements.