A ’batch’ file contains native DOS commands in a programming structure. When executed each of the DOS commands in the batch file is executed sequentially. Since, most MIKE Zero and MIKE SHE programs can be executed in this way, a properly constructed batch file allows you to run multiple models sequentially when you are not at the computer, such as over night.
Basically, to run MIKE SHE in batch mode, you must
1. Setup the different models with different names using the Setup Editor
2. Create a .BAT file containing the DOS commands to run the models
3. Run the .BAT file and analyse the results using the standard MIKE Zero analysis tools (e.g. the Results Viewer)
Setup the different models
Your original model can be saved to a new name and the necessary changes made in the new set up. We highly recommended that you create and set up the different models in the MIKE SHE Setup Editor. In principle, you could edit the .SHE file, which is a text file containing all of the information on the model set up, but the file is typically very large and confusing, and the format of this file must be preserved exactly.
Create the batch file
To create a batch file, you must create a text file with the extension .BAT. Then add the DOS commands in the order that you would like them executed. But, before you can run the MIKE SHE executables, you must add the MIKE SHE installation directory to your PATH variable. The default installation directory depends on your operating system. For example, for Windows 7 (64-bit) the default directory is:
C:\Program Files(x86)\DHI\2017\bin\x64
The path for the actual installation directory is saved in an environment variable called DHI_MIKE_2017, so the DOS command to add the default path to the PATH variable can be written as:
Set PATH=%PATH%;%DHI_MIKE_2017%
To run MIKE SHE from the batch file you must add the following two DOS command lines after the PATH statement above:
MSHE_PreProcessor MyModel.she
MSHE_watermovement MyModel.she
The above two lines will run both the preprocessor and the water movement engine separately. If you want to run them together, then you can replace the two lines with
MSHE_Simulation MyModel.she
The examples above will run silently. That is, no progress information will be displayed. If you want to display progress information, then you should use the MzLaunch utility. Using
MzLaunch.exe MyModel.she -e MSHE_Simulation
will leave the MzLaunch utility open when the simulation finishes, whereas
MzLaunch.exe MyModel.she -e MSHE_Simulation -exit
will close the MzLaunch utility when the simulation finishes.
Analyse the Results
The MSHE_watermovement.exe program automatically generates all of the output asked for in the Setup Editor. Thus, to look at your output, you only need to open the model at look at your results in the normal way.
If you want to run the water balance program, which is described in the Using the Water Balance Tool chapter, you can add the following lines to you batch file:
MSHE_Wbl_Ex.exe //apv My_WB_areas.WBL
MSHE_Wbl_Post.exe //apv My_WB_areas.WBL 1
MSHE_Wbl_Post.exe //apv My_WB_areas.WBL 2
In the above, the first command runs the Extraction phase of the water balance utility, while the subsequent commands run the Post-processing items in the water balance file. The number after the water balance file name indicates which Post-processing item to run. Post-processing steps cannot be executed before an Extraction step but only one Extraction step needs to be run for a each water balance utility file.