Running MicroMODEL in Batch Mode

  1. Introduction
  2. Invoking a Batch Run
  3. Comment Lines in Batch Files
  4. TITLE: Set the Window Title
  5. WAIT: Wait a Specified Period
  6. SETITYPE: Select the Proper Module
  7. SETLABEL: Select the Current Label
  8. SETANS: Select the Current Answer Set
  9. SETTBLOK: Set the Title Block
  10. Running Programs
  11. CALL: Nest Command Files
  12. SET: Set a Batch Procedure Parameter
  13. EXPAND: Update a Template File
  14. EXPVAR: Update a Template File with Variable List
  15. Template Files
  16. POSTHP75: Plot to HP750C
  17. Sample Batch File

Introduction

MicroMODEL programs can be run in batch mode. Running the programs in batch mode allows the user to repeat complicated operations. Batch procedure files are also used to create sets of plots such as section plots or plan maps.

Under Windows-9x and Windows-NT, batch files have an extension of ".BAT". It is suggested that this convention be maintained in naming MicroMODEL batch control files, although any name can be used. For example, a batch file to run a set of north-south sections might be called "NS_SECT.BAT".

Running MicroMODEL in batch mode is fairly straightforward. There are just a few items that must be addressed when running MicroMODEL in this mode. First, only one MicroMODEL batch run, or one interactive session, can be running at any given time in a given user folder (directory). You may not run both a batch procedure and an interactive session at the same time.

Invoking a Batch Run

MicroMODEL batch procedures can either be invoked from the command line prompt, or they can be invoked from the "File" dropdown menu. Invoking a batch job from the File dropdown is easier. Simply choose "Run MicroMODEL in Batch Mode". Then, select the name of the batch command file to invoke, along with the name of the print file for this batch run. After your file selections have been made, click on "OK" and the batch job will begin.

A windows shortcut could created for a batch run. To get to the command line, use the MS-DOS prompt program. Once you are at the prompt, use the following command structure, assuming that the MAINMENU program is in your path. If it is not, then use the full path specification:

> MAINMENU batchfile outputfile     (MAINMENU.EXE is in current program path)
> C:/"Program Files"/MicroMODELV60/MAINMENU batchfile outputfile (MAINMENU.EXE not in path)

Where:
  batchfile = Name of batch procedure file
  outputfile = Name of batch log file
  (outputfile can be left blank and batch output defaults to MicroModelBatch.PRN)

Comment Lines in Batch Files

Comment lines can be inserted in the batch file by starting the line with either "!" or "#" (exclamation mark or pound sign). Any line beginning with these two tokens will be ignored by the batch processor, although it will echo to the batch log file. Blank lines can be inserted to improve readibility, if desired.

TITLE: Setting the Window Title

The batch processor runs in the form of a small window. The title of the window can be changed at any time using the TITLE command. For example, use the following syntax to set the Window title to "Big Batch":

TITLE Big Batch
Although most MicroMODEL programs run so quickly that the batch job runs for only a few seconds, it is possible that some more involved batch runs will take a significant amount of time. This feature allows you to set the window title that is shown on the minimized button at the bottom of your desktop. Once the batch job starts up, simply minimize the run window to get it out of your way and allow you to perform other tasks while the batch job is running.

WAIT: Wait a Specified Period

The WAIT command can be used to make the batch procedure wait a specified number of seconds before continuing with the next procedure. This feature is provided in case the user runs into timing problems where one procedure isn't completely finished before the next starts. With the release of V6.0 MicroMODEL, this should not be an issue. The number specified in a wait command is entered in units of 1/100th seconds. This command makes the procedure wait 5 seconds.

WAIT 500

SETITYPE: Select the Proper Module

The ITYPE corresponds to the different modules that are part of MicroMODEL. The ITYPE is set in batch mode via the SETITYPE program. You must change MicroMODEL to the appropriate ITYPE for the program that you are running, or else an error will occur. ITYPE for each module is as follows:


     ITYPE     MODULE

       1 = Data Input (Samples)
       2 = Surface Modeling
       3 = Rock Modeling
       4 = Compositing
       5 = Grade Modeling
       6 = Pit Design
       7 = File Manager
       8 = Grade Thickness
       9 = Special Tools(*)
      10 = Digitizing Interface(*)

      (*)For these modules, the value of ITYPE is ignored.

To set ITYPE within a batch file, use the following command and syntax:

SETITYPE n

Where: n = ITYPE (1 through 10)
           or, n can also be the following text: DATA, SURFACE, ROCK,
                                                 COMPOSITE, GRADE, PIT, FILE, GT.

SETLABEL: Select the Current Label

Many MicroMODEL programs use the current Sample, Composite, or Grade label for input. The SETLABEL command allows the user to set the current label for Sample, Composite, and Grade. Set the labels as follows:

SETLABEL type number

Where:
  type = s,c,g,S,C,G for Sample, Composite, Grade
  number = label number

Examples:

  SETLABEL s 3    (Set Sample label to 3)
  SETLABEL G 4    (Set Grade label to 4)

SETANS: Select the Current Answer Set

MicroMODEL programs use answersets with multiple responses. A batch command is available for setting the response for any answer file. In order to set the response number, you must know what the name of the answer file is for the program you will be running in batch mode. Refer to Documentation Volume II, File Organization Tables, to find the appropriate answer file name.

To set the response number for an answer file, use the following command and syntax:


SETANS Filename n
  Where:
     Filename = Name of Answser File (e.g., CELL.ANS)
     n = Response Number (Answer Set Number)

SETTBLOK: Set the Title Block

The title block that is drawn with all plot output can be set with two commands. First, the current title block answerset can be set by using the SETANS tool on answerfile TITBLOCK.ANS. Next, a template file can be used to override individual responses in the title block file, in conjunction with program SETTBLOK. The example below shows how these two commands can be used:

SETANS TITBLOCK.ANS 2
SETTBLOK TBLOCK.TPL

Running Programs

The main purpose of the batch procedures is to run MicroMODEL programs. For example, drillhole cross sections are created using a program called SECT. Refer to Section 13 for a full description of the programs. All MicroMODEL programs can be run in batch mode, but only a subset can be run using template files. The following is a current list of programs that can be run in batch mode with optional template files.

    CELL
    CELLEX
    CFREQDA
    CFREQGR
    CMPPLT
    CONRES
    CONSCT
    CONT
    DIGPLT
    DXF2PCNT
    MANIP
    MOD3
    MOD3P
    MONEY
    MRGPLT
    OPDMTX
    SECT
    SETTBLOK
    SORT3
    SORT3P
    SORT3X
    STATSDA
    STATSGR
    VARIG
    XSANG
    XSECT

To run one of these programs from the batch procedure, simply enter the name of the program beginning of the line, followed by an optional template file name.

Example:
  CELL CELL.TPL
  Runs the Plot Plan View Values with CELL.TPL template file override.

To run any other MicroMODEL program from the batch procedure, simply enter the name of the program at the beginning of the line.

Example:
  DXF2PCNT
  Runs the DXF to POLY.CNT conversion program.

CALL: Nest Command Files

Probably one of the most powerful features of the batch control system is the ability to Nest command files. Command files can be nested up to four levels deep. That is, the original command file entered as part of the command line can call another command file, which can in turn call another, which can in turn call another.

A nested command file is invoked using the CALL command. Syntax is as follows:

CALL cfile
   Where:
      cfile = name of another file containing batch commands

Example:

CALL Command2.BAT

Once the last command of a nested command procedure file has been processed, control returns to the original command procedure file containing the CALL command. What makes this feature so powerful is that a given command procedure can be called multiple times from another command procedure file.


SET 1 5500.0
CALL RUNSECT.BAT
SET 1 6000.0
CALL RUNSECT.BAT
SET 1 6500.0
CALL RUNSECT.BAT

Where:
   RUNSECT.BAT is a command procedure file that generates a section at %1 North

SET: Set a Batch Procedure Parameter

The batch handler allows the user to set the values of up to twenty different command line parameters. The parameters are numbered 1 through 20. To set a command line parameter, use the set command:

SET varnum varval
  Where:
     varnum = parameter to set (1-20)
     varval = value of parameter.  Can be numeric or text.

Examples:

SET 1 "Section 3500 East"
SET 2 2350.0

Using Batch Variables

Once batch parameter variables have been set, their values can be accessed from within any command line in the batch control file. They can also be utilized via the EXPAND command. The representation for a batch parameter variable is:

%p
  Where:
     p = parameter number (1-20)

Example:

SET 1 2550.0
ECHO Pt1E = %1 > SECT.TPL

The SET command sets the value of parameter 1 to 2550.0
The ECHO command redirects text into file SECT.TPL
In this case, the first line of SECT.TPL will contain:

Pt1E = 2550.0

EXPAND: Update a Template File

The EXPAND command can be used to take an entire template file that contains batch parameters, and output a new copy of the template file which contains the interpreted values of the parameters. The example shown below should give the user an idea of how to use this command:


Listing of template file CELL.TPL

! Template file for CELL
    Ic1 = %1  ! Starting Column
    Ic2 = %2  ! Ending Column
    Ir1 = %3  ! Starting Row
    Ir2 = %4  ! Ending Row

This Command Sequence sets the values of the four parameters, and
does the value replacement using file CELL.TPL as input and file
CELL.TMP as output:

SET 1 25
SET 2 50
SET 3 35
SET 4 70
EXPAND CELL.TPL  CELL.TMP


Listing of output file CELL.TMP

! Template file for CELL
    Ic1 = 25  ! Starting Column
    Ic2 = 50  ! Ending Column
    Ir1 = 35  ! Starting Row
    Ir2 = 70  ! Ending Row

EXPVAR: Update a Template File With Variable list.

The EXPVAR command is similar to the EXPAND command, except that the variable replacement is controlled by a list of tokens following the input and output file names, rather than by the global "SET" variables.


Listing of template file CELL.TPL

! Template file for CELL
    Ic1 = %1  ! Starting Column
    Ic2 = %2  ! Ending Column
    Ir1 = %3  ! Starting Row
    Ir2 = %4  ! Ending Row

This Command Sequence sets the values of the four parameters, and
does the value replacement using file CELL.TPL as input and file
CELL.TMP as output:

EXPVAR CELL.TPL  CELL.TMP 25 50 35 70


Listing of output file CELL.TMP

! Template file for CELL
    Ic1 = 25  ! Starting Column
    Ic2 = 50  ! Ending Column
    Ir1 = 35  ! Starting Row
    Ir2 = 70  ! Ending Row

Template Files

For all of the MicroMODEL programs that are likely to be run in batch mode, there is a powerful feature that can be used to override some of the responses contained in the answer file. Template files (extension=TPL) allow the user to enter, via simple text input, new values to use in the MicroMODEL run. For example, this command:

SORT3P SORT3P.TPL

runs SORT3P procedure using whatever the current answer selection is in file SORT3P.ANS, but overrides that with the input values stored in SORT3P.TPL.

You will find the template files in the MicroMODEL program directory, with the extension "TPL." You may alter any of the variables listed in these files. Only enter the ones you wish to alter in the TPL file, though. For example, below is a listing of the "default" template file for drillhole section plotting, SECT.TPL:

! Batch Input Template File for Program SECT
! [Variable] [=] [!Description: Data Type : Lower Limit : Upper Limit]
           Pt1e =            !Left Hand Easting of Section | Real   :None:None                                                                                
           Pt1n =            !Left Hand Northing of Section | Real   :None:None                                                                               
           Pt2e =            !Right Hand Easting of Section | Real   :None:None                                                                               
           Pt2n =            !Right Hand Northing of Section | Real   :None:None                                                                              
            Tol =            !Section Tolerance +/- | Real   :0.:None                                                                                         
           Zbot =            !Bottom Elevation of Section | Real   :None:None                                                                                 
           Ztop =            !Top Elevation of Section | Real   :None:None                                                                                    
        Penelev =            !Pen Number for Elevation Lines | Integer:0:99                                                                                   
        Pentopo =            !Pen Number for Topography Surface | Integer:0:99                                                                                
        Ansname =            !Answer set name | String :None:None                                                                                             
        DhAtBot =            !0=do not plot name at bottom; 1=plot | Integer:0:1                                                                              

Generally, for running a set of sections, the only variables that need to change are the endpoint coordinates. Here is an example template file with these values entered in the appropriate spot. Note that the other variables have been deleted from the file:

! Batch Input Template File for Program SECT
! [Variable] [=] [!Description: Data Type : Lower Limit : Upper Limit]
           Pt1e = 1000.0     !Left Hand Easting of Section
           Pt1n = 2000.0     !Left Hand Northing of Section
           Pt2e = 5000.0     !Right Hand Easting of Section
           Pt2n = 2000.0     !Right Hand Northing of Section

You may add comment lines anywhere within the template file, by placing an exclamation point (!) at the beginning of the line.

POSTHP75: Plot to HP750C

The HP750C plotting program can be accessed in batch mode by using the POSTHP75 command. Command switches are used to control input file, output file, and scale:

HP 750C Plotter Driver 
 Batch Useage is as follows: 
 POSTHP75 FN=Filename OF=Fileout P1 P2 P3 P4
 Parameters (P1...P4) can be any of the following
    U = Unscaled
    R = Rotated
    N = Not Rotated
    [Number] = Fixed Scale
    Example: POSTHP75 FN=SECT OF=SECT.750 R 1000 
    Plot SECT rotated at 1000 scale to SECT.750
 

Sample Batch File

The example below is a full batch command file for doing a section plot with MicroMODEL. This batch file is meant to be called by another batch file, which would contain the section endpoints and section letter designation for a number of sections. The calling batch file is listed next.


!*** Set the title block.  First, set the answerset to response #2
!     Then, use program SETTBLOK with Template file TBLOCK.TPL,
!     which is create with the one-line echo command.
SETANS TITBLOCK.ANS 2
!
echo DrawTitl(1) = "SECTION 5" >TBLOCK.TPL
!
SETTBLOK TBLOCK.TPL
!
!*** Plot Section from compositing module (ITYPE=4)
!
SETITYPE 4
! Set the section northings and eastings
SET 1 1000.0
SET 2 2000.0
SET 3 2000.0
SET 4 2000.0
SET 5 A
!
!*** Create temporary template file for section program, "SECT.TPL"
!    The first redirect, using single greater than symbol, starts
!    a new file.  The subsequent redirects, using double greater
!    than symbols, append to the file.
!
ECHO Pt1E = %1 > SECT.TPL
ECHO Pt1N = %2 >> SECT.TPL
ECHO Pt2E = %3 >> SECT.TPL
ECHO Pt2N = %4 >> SECT.TPL
!
!*** Set the section answerset to the first response
!
SETANS SECT.ANS 1
!
!*** Now, run the section program and use the template file override,
!    using the template file just created (SECT.TPL)
!
SECT SECT.TPL
!
!*** Run the plotting program for HP-750C output.  The current answer
!    set sends output to file HP750C.OUT
!
POSTHP75 FN=SECT
!
!
!*** Copy the output to various files, using parameter #5 (section name)
!
COPY HP750C.OUT S_%5.750
COPY SECT.PLT S_%5.PLT
COPY SECT.SCL S_%5.SCL
COPY MMPLOT.DXF S_%5.DXF