Interrupting a Simulation

Interrupt_Active The Interrupt element is triggered by an event, and responds by interrupting the simulation. The triggering event can be a discrete event signal or another type of event (e.g., a condition, such as X becoming greater than Y).

When the simulation is interrupted, you can display a user-defined message dialog with options for continuing or pausing (and subsequently aborting) the simulation and/or you can specify that the message is written to the run log.  You also specify how to treat the interrupted realization if the simulation is resumed (e.g., continue the realization, or keep current realization results and move to the next).

The Interrupt element has a number of potential uses:

   To alert you to error conditions that indicate a logical problem in a model. For example, if a certain variable should not go below 0 (if it does, it indicates a logic error in the model), you could use an Interrupt element to check for this condition.  This could be used, for example, to test for material balance in a model that was simulating movement of material (e.g., water).

   To help you debug a model that is crashing or showing unusual behavior.  For example, if a model crashes (or starts behaving unusually) when certain conditions are met or at a particular time in a simulation, you could use an Interrupt element to pause the simulation at that point so that you can browse the model and/or save the results up to that point in time.

   To terminate (skip to the end) of a simulation when a certain set of conditions are met.  For example, if you were carrying out a Monte Carlo simulation of a project, the project may actually complete at a different time each realization.  When the project completes, you could use an Interrupt element to skip to the end of the realization.

   To display status information to a user.  In some cases, you may simply want to display status information to a user who is running GoldSim interactively (e.g., using the GoldSim Player).  The message could, for example, prompt the user to pause the model, adjust some of the input parameters in a Dashboard, and then continue the simulation.

The dialog for an Interrupt element looks like this:

The topics below describe the use of the Interrupt element in detail.

The example file Interrupt.gsm in the General Examples/Events folder of your GoldSim directory (accessed by selecting File | Open Example... from the main menu) includes a simple example on the use of Interrupt elements.

Related Topics…

Learn more about: