Spectrum Software
spacer
Industrial Strength Simulation
select:

divider

 

 

divider

 

Batch Files

 

Micro-Cap 11 is designed to run primarily in an interactive mode, but it can also be run as a script or batch process from either the Program Manager command line or from Analysis menu / Run Script.

Either of two formats may be used.

MC11 [F1[.EXT]]...[FN[.EXT]]

MC11 [/S | /R] [/P] [/PC] [/PA] [@BATCH.BAT]

In the first format, F1, ...FN are the names of one or more circuit files to be loaded. The program loads the circuit files and awaits further commands.

In the second format, circuits can be simulated in batch mode by including the circuit name and the analysis type, /T(transient), /A(AC), or /D(DC) on a line in a text file. The syntax of the circuit line inside the batch file is:

cname [/DEF "x val"] [/NOF "fn"] [analysis] [/S | /R] [/P] [/PC] [/PA]

Command options for analysis
/T Run transient analysis on the circuit.
/A Run AC analysis on the circuit.
/D Run DC analysis on the circuit.
/HD Run Harmonic Distortion analysis on the circuit.
/ID Run Intermodulation Distortion analysis on the circuit.
/DYNAMIC_AC Run Dynamic AC analysis on the circuit.
/DYNAMIC_DC Run Dynamic DC analysis on the circuit.
/STABILITY Run Stability Analysis on the circuit.

Command options for Worst Case Analysis
BEGIN_COMMAND
cname /WC
/DCOP OR / T OR /AC OR /DC
/Output=expression
/RSS_LOW /Value=v1 /ErrorTol=e1
/RSS_HIGH /Value=v2 /ErrorTol=e2
/MCA_LOW /Value=v3 /ErrorTol=e3
/MCA_HIGH /Value=v4 /ErrorTol=e4
/EVA_LOW /Value=v5 /ErrorTol=e5
/EVA_HIGH /Value=v6 /ErrorTol=e6
END_COMMAND

This runs the requested worst case analysis on cname and prints the RSS, MCA, and EVA results to the file cname.owc, generating error messages if the specified values are not within the ErrorTol value.

Other commands
/S Save the analysis run to disk for later recall.
/R Retrieve the analysis run from disk and plot the waveforms specified in the Analysis Limits dialog box.
/PC Print the circuit diagram.
/PA Print the circuit analysis plot.
/P Print the circuit diagram and analysis plot.
/DEF "x val" Sets the variable x to val, for use within cname. cname must have a .DEFINE X... statement.
/NOF "fn" Provides a unique numeric output file name, fn, so that multiple runs of cname do not overwrite the standard numeric output file cname.*NO. fn is the desired file name without an extension. MC11 will add the appropriate extension (.TNO, .ANO, or .DNO) to fn.

The save, retrieve, and print commands may be applied globally for all circuits in the batch file by placing them on the Program Manager command line, or locally to a particular circuit file by placing them on a circuit line within the batch file.

Image commands
/IC Page="" Output=""
Creates an image file of the specified schematic page.
/IC Page="" Section="
" Output=""
Creates an image file of the specified schematic page in the specified macro section.
/IA Page="" Output=""
Creates an image file of the analysis plots in the specified analysis page.
/IP Window="" Output=""
Creates an image of the specified performance plot window.
/IF Window="" Output=""
Creates an image of the specified FFT plot window.
/I3 Window="" Output=""
Creates an image of the specified 3D plot window.
/IH Window="" Output=""
Creates an image of the specified histogram plot window.

The Output specifies the image file name that is to be created. The type of image file created is based upon the extension of the file name. The types of image files available are the same as those available in the Copy Entire Window to a Picture File under the Edit menu. The Window parameter uses the name of the performance plot, FFT plot, 3D plot, or histogram plot. This name is defined in the Title field within the Plot page of the Properties dialog box for each plot. The analysis/plot window image commands need to be used in conjunction with the appropriate command option for an analysis. For example:

Diffamp /t /ic Page="Page1" Output="cir.gif" /ia Page="Main" Output="tran.jpg"

would export the schematic in the page named Page1 to a GIF file called cir.gif. It would then run transient analysis, and export the analysis plots in the analysis page Main to a JPEG file called tran. jpg. Note that when the image commands are used on a line, there should only be a single analysis command option specified. If you want to run multiple analyses on a circuit while saving the image files, each analysis should have its own batch line.

In the second format, MC11 must be invoked with the name of the batch file preceded by the character '@'. For example, consider a text file called TEST.BAT containing these lines:

PRLC /A /T
SENSOR.CKT /A /IA Page="Main" Output="Sense.jpg"
LOGIC /DEF "DELAY 1E-7" /NOF "DELAYA" /T
LOGIC /DEF "DELAY 2E-7" /NOF "DELAYB" /T
If MC11 is invoked with the command line, MC11 @TEST.BAT, it will:

1. Load the PRLC.CIR circuit and run an AC and transient analysis.
2. Load the SENSOR.CKT circuit and run an AC analysis. Create a JPEG file called Sense.jpg that contains an image of the analysis plots in the analysis page called Main.
3. Load the LOGIC.CIR circuit with the variable DELAY set to 1E-7, then run transient analysis. Save the numeric output in the file DELAYA.TNO.
4. Load the LOGIC.CIR circuit with the variable DELAY set to 2E-7, then run transient analysis. Save the numeric output in the file DELAYB.TNO.

As an alternative you can load the batch file from within MC11 and then select the Run Script option from the Analysis menu.
During these analyses, the expressions specified in the circuit file would be plotted during the run and be visible on the screen, but the results would not be saved to disk.

Note that the default circuit file name extension is .CIR.

By appending an '/S' to the command line, all of the analyses specified in the batch file will be run and the results saved to disk for later recall. By appending an '/R' to the command line the analyses are bypassed and the results merely recalled and plotted.

By appending a '/P' to the command line, all of the analyses specified in the batch file will be run and the circuit and analysis plot printed.

In the batch file, a line can get lengthy if multiple commands are implemented. The batch file can use the keywords BEGIN_COMMAND and END_COMMAND to make a line easier to read. All of the text within these keywords will be considered to be just a single command line. For example, you can modify the above batch file this way:

PRLC /A /T
SENSOR.CKT /A /IA Page="Main" Output="Sense.jpg"
BEGIN_COMMAND
LOGIC /DEF "DELAY 1E-7"
/NOF "DELAYA"
/T
END_COMMAND
LOGIC /DEF "DELAY 2E-7" /NOF "DELAYB" /T

and the results would be the same as described before.

Here is an example that loads a circuit called batch1.cir, runs AC analysis and saves images of the circuit, the analysis plot, two performance plots and a 3D plot.

BEGIN_COMMAND

;Run AC analysis
batch1.cir /a
;Save the Schematic Page Main as batch1.jpg
/ic Page="Main" Output="batch1.jpg"
;Save the AC analysis Page a as batch1_ac.jpg
/ia Page="a" Output="batch1_ac.jpg"
;Save the Peak performance plot as batch1_acpf1.jpg
/ip Window="Peak_Y(RE(v(OUT)),1,1) vs Temperature" Output="batch1_acpf1.jpg"
;Save the Valley performance plot as batch1_acpf2.jpg
/ip Window="Valley_Y(IM(v(OUT)),1,1) vs Temperature" Output="batch1_acpf2.jpg"
;Save the 3D plot as batch1_ac_3d.jpg. Only one 3d Plot so no need to specify the Window
/i3 Output="batch1_ac_3d.jpg"

END_COMMAND

Here is the set of images the batch1.bat file produced.
Batch File images

Each of the five images is saved in the DATA folder where they may be used individually or as a part of a schematic like this one (batch1_pics.cir) whose only function is to display a collection of plots. Alternatively they might be part of a report detailing simulation results.

 
Download Winter 2014 Circuit Files
Return to the main Newsletter page