Software for spatially-explicit simulation of forest dynamics

Message Passing

The SORTIE-ND software exists in two parts: the core model and the graphical user interface (GUI). These two pieces are each standalone and communicate with each other through rudimentary message passing.

When the user starts to put together a simulation, they use the GUI to create a parameter file. When the user tells the GUI to start a run with the parameter file, the GUI launches the core model as a process in a separate thread. This can be thought of as the software equivalent to the user launching the core model through the command line. The parameter file is passed as an argument to the core model.

As the core model runs, it outputs simple progress messages to the standard output stream (stdout), or writes errors to the standard error stream (stderr). Because the GUI launched the core model as a process, it can capture these streams and report their contents to the user. Anything in stdout is written to a location on the GUI window for messages; anything in stderr is treated as evidence of a fatal error and displayed in a message window to the user.

The GUI also has to be able to tell the model to pause or quit. The GUI can always kill the model process programmatically, but it could not be restarted and this would not allow the model to perform its memory cleanup. So if the user requests a pause or a quit while the model is running, the GUI writes a small text file to a certain location. Periodically, the model checks for the existence of this file; if it is present, it reads its contents and performs the correct action.

15-Feb-2005 01:58 PM