Looping with Model Builder

Model Builder

 

Objective:

Note: A background in VB and VBScript as well as a first experience with the Model Builder is required.

The Model Builder is a very powerful tool if you have a model and you want to conduct a sensitivity analysis. The following explanations show how you can run several simulations with the same model by looping and how to modify the parameters.

Step 1: Define the model parameters and the outputs you want to keep. You don't want to overwrite the outputs that you are studying. 

Make sure that your model is working. Decide which outputs you want to look at and what are your model parameters. Mark all of  them as a "model parameter" (Right click on the output and select define as model parameter). Create a folder where you want to store these outputs and, for each of them edit the properties of the output on the Model Builder and define the location and the name of the output. The other intermediary outputs have to be in the default folder and with a default name. The default folder is in Temp.                                   

Save your model and check in its properties that you have all the parameters you have defined.

Step 2: Exporting your model into a VBScript. The Model Builder can automatically convert your model into a VBScript.

The idea is that you can call your model with a VBScript and use this script to run your model with different sets of parameters and then loop. You want to export your model onto a VBScript. The model Builder can write it automatically for you. To do it, create a new model and grab your own model into it: you should end up with a rectangle (named after the name of your own model) and several bubbles corresponding to your parameters and your outputs.  

Go to file ,Export, To a VBScript and save the Script as AutomScript. Open it and look at it.

Step 3: Explanation of the script.

Step 4: Define an array and loop.

 

Back to Main Page