Spectrum Software
spacer
Industrial Strength Simulation
select:

divider

 

News:

Spectrum Software has released Micro-Cap 11, the eleventh generation of our SPICE circuit simulator.

For users of previous Micro-Cap versions, check out the new features available in the latest version. For those of you who are new to Micro-Cap, take our features tour to see what Micro-Cap has to offer.

 

divider

 

MC5 File Hierarchy

 

The file hierarchy is important to know when running circuits that are not in the DATA directory. The order and location that MC5 searches for files can have an impact on the circuit simulation because it can change the models used.

Environmental Variable
The environmental variable, MC5DATA, sets the default path that MC5 uses to find libraries and macros. This variable should be set to the path where the DATA directory resides. Multiple paths may be specified by placing a semicolon between paths. In Windows 3.X or Windows 95, this variable is set in the Autoexec.bat file by typing on a new line a statement such as:

SET MC5DATA=C:\MC5\DATA

In Windows NT 4.0, go to the Control Panel and double click on System. Click on the Environment tab. The MC5DATA variable would be set in the User Variables for Administrator area. The Variable and Value text fields would need to be filled in, and then click on the Set command button. The text fields would look similar to:

Variable   MC5DATA
Value C:\MC5\DATA;C:\CIRCUITS

Library Searching Hierarchy
With a schematic, models are searched for in a specific order. The order is as follows:

1) Searches in the schematic or text area.
2) Searches for the file specified in the FILE attribute (if the device has one).
3) Searches any libraries specified by a .LIB statement.
4) Searches the libraries specified in the Nom.lib file.

The first instance of the model found will be the one used.

Adding a Model Globally
The method for adding a model globally is to simply place the library file name that the model is contained in into the Nom.lib file. The Nom.lib file is a text file that contains multiple .LIB statements. Any library listed in this file is automatically accessed whenever an analysis is run from any directory as long as the environmental variable is pointing to the location of the Nom.lib file. The Nom.lib file is found in the DATA directory, and may be opened through the standard File-Open menu command. After opening this file, add in a new .LIB statement on a new line. For example, if the library file Myparts.lib contains the parts to be added and is present in the DATA directory with the Nom.lib file, a new line would be added as follows:

.lib "myparts.lib"

If the same library file is in a different directory, a path would also need to be included, such as:

.lib "C:\Library\myparts.lib"

The basic nomenclature for libraries is that binary libraries created from the Model program must have the extension .LBR, and text files containing .Model and .Subckt SPICE models should have any extension but .LBR and .CIR. The .LIB extension is preferable for text files.

Adding a Macro Globally
There is only one rule for adding a macro globally. The macro circuit must be present in a directory that is referred to by the environmental variable. It is easiest to keep the macro circuit in the DATA directory, but macros may also be stored in a separate directory if the environmental variable declares it. For example, if the macro circuits are to be stored in a subdirectory called MACROS, the environmental variable should be as follows:

SET MC5DATA = C:\MC5\DATA;C:\MC5\MACROS

It may not be desired for all models and macros to be defined as global. A user may want to simulate each project in its own subdirectory and have models and macros that are only used for that project. While they can edit the environmental variable and Nom.lib each time they start a new project, that can be tiresome and difficult to go back to a previous project.

Adding a Model Locally
The best way to add a model locally is to place a .LIB statement into the text or schematic area of the circuit being simulated that specifies the local library file name. If the library is stored in the same directory as the circuit file, the .LIB statement would be as follows:

.lib myparts.lib

otherwise a path would have to be specified also. Models may also be copied directly into the circuit itself. However, if you are simulating multiple circuits in a project, the .LIB method is better since editing the model would only require editing one file. Remember that a model in the text or schematic area takes precedence over one from a .LIB statement.

Adding a Macro Locally
There is no command needed for adding a macro locally. It only needs to be in the same directory as the circuit being simulated. This directory does need to be the active directory though. The way to view which directory is active is to invoke the Open File dialog box by clicking on Open under the File menu. The directory specified in this dialog box is the active directory. To change directories, simply open up a file from the desired directory. Opening up a file through the Recent Files list under the File menu does not change the active directory.

A path may be specified in the VALUE attribute of a macro. For example, when using the Amp macro, the VALUE attribute would typically appear similar to:

Amp(10)

However, to make sure that the circuit can always grab the correct macro no matter the active directory, the VALUE attribute may also be defined as:

C:\MC5\DATA\Amp(10)

MC5 would then search the DATA directory for the Amp macro circuit.
 
Return to the main Newsletter page