This is an old revision of the document!


PHP's gd library is missing or unable to create PNG images


LESSON 21: Dinamica EGO script language and console launcher



What will you learn?

Alternatively, you may want to save the model in EGO format in EGO programming language. You can open an edit EGO script language on a text editor, (e.g. NotePad++ or Context). But still it is much easier to use the graphical interface. For example, the Amazon logging model (Merry et al, 2009) developed in Dinamica EGO has more than one thousand script lines, even a skilled programmer would take longer writing the script than by using the graphical interface. Both script formats (EGOML/XML, EGO) are 100% compatible, so users can take back and forth a model from the graphical interface to the text editor without losing any information. Advanced modelers may use this well structured and tractable programming language.

Open again the model “simulate_deforestation_from_1997_2000_30years_ahead.xml”. To make the model more intelligible on the text editor, you first need to name some key variables and then add comments to parts of the model. Let’s do this. Select the Edit Functor tool and click on the Categorical Map “23267_1997.ers”.

Write in the alias field “initial_landscape”, click on Calc Distance Map and write the alias “distance_to_deforested”. Now save the model in EGO format.

Open in a text editor, the model “simulate_deforestation_from_1997_2000_30years_ahead.ego”. The EGO script is as follows:

Now that you have learned a bit about programming with EGO script language, another resource available in Dinamica EGO is the Console Launcher. Any model saved in Dinamica EGO, either EGOML/XML or EGO, can be run from the command prompt.

To facilitate running a model from the command prompt, we have developed a Console Launcher tool. Also, Console Launcher allows for queuing models and running them sequentially. Call the Console Launcher from the tools subfolder in the Start/Programs/Dinamica EGO shortcut. It will open the following interface.

Some parameters of Console Launcher are:

-Scheduler: how the model functors are going be sequenced

-Verifier: Type of script verification

-Log Level: Maximum level of log report

-Use Predefined seed: Check it to use a predefined seed to generate random numbers. Using a predefined seed forces Dinamica EGO to always generate the same output, even if the model is stochastic.

-Processors: number of processors/cores that model will use (Use 0 to automatically detect the number available)

-Run Model: Check it to run model completely, otherwise, Dinamica EGO will load all models and exit. Disable this flag to validate a large number of models.

You can save the Console Launcher configuration into a batch file too. This is useful in case you want to couple Dinamica EGO with other software.

TIP: another way to loosely couple other computer programs with Dinamica EGO is by means of functor Run External Process, available in the Control Tab. By using this functor, you will be able to make a call to an external program from within Dinamica, pass to this program intermediate results and feed its output back again into the Dinamica EGO model.



Congratulations, you have successfully completed this lesson! Now let’s move to the next lesson: LESSON 22: Heuristic calibration of models by using Genetic Algorithm