This section is designed to highlight one or two features per issue that may be overlooked because they
are not made visually obvious with a toolbar button.
Setting Define Parameters and Numeric Output File Names within Batch Files
The batch file capability in Micro-Cap is a useful method for running multiple circuit analyses with a single command.
The batch file contains a list of circuits that Micro-Cap will run one after the other. In most cases, this will be a
list of different circuits that will be simulated. However, it can be quite useful to vary one or more parameters within
a single circuit file, and run a batch file that simulates each of the variations. A parameter can be varied in a circuit
file through the use of the /DEF switch in the batch file whose syntax is:
/DEF "x value"
The above switch sets the variable x in the circuit to the value specified. The x variable must be set in the corresponding
circuit with a define statement. Since the default numeric output file that is created when a circuit is run uses the circuit
name itself, the numeric output file will be overwritten each time the same circuit is run within the batch file. In order to
use the numeric output file from each variation of the circuit, the /NOF switch would need to be used to rename the numeric
output file and prevent it from being overwritten. The syntax for the /NOF switch is:
/NOF "fn"
where fn is the numeric output file name without an extension. Micro-Cap will add the appropriate extension (.TNO, .ANO, or
.DNO) depending on the simulation type that was specified.
A batch file can be created with any text editor. The file would need to be in standard ASCII text format. As an example for
how to use the DEF and NOF switches, the following three lines were entered in a text file called TEST.BAT.
Prlc8 /T /DEF "Rtest 50" /NOF "Prlc8a"
Prlc8 /T /DEF "Rtest 100" /NOF "Prlc8b"
Prlc8 /T /DEF "Rtest 150" /NOF "Prlc8c"
The first line is read in. The circuit PRLC8.CIR is loaded. The Rtest define variable is set to 50, and a transient analysis
(due to the /T switch) is run. The numeric output from the simulation is stored in a file called PRLC8A.TNO. The analysis is
exited and the circuit file is closed. The second and third lines are processed in the same manner. For the second line, the
Rtest variable is set to 100, and the numeric output is stored in the file PRLC8B.CIR. For the third line, the Rtest variable
is set to 150, and the numeric output is stored in the file PRLC8C.CIR.
When the batch file is finished, there will be three numeric output files available that each contain the simulation data from
one variation of the circuit file.
A batch file can be launched within Micro-Cap through the command line. At a command line, enter the following command:
c:\mc9\mc9 @Test.bat
to run the Test.bat file in MC9. In this case, the Test.bat is located in the same directory as the MC9.EXE file.
|