Interrupting a
Simulation
The Interrupt element An efvent element that is triggered by an event, and responds by interrupting the simulation. is triggered by an event, and responds by interrupting the simulation.
The triggering event can be a discrete event signal A discrete signal indicating that something (e.g., an accident, an earthquake, a bank deposit) has occurred. 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 Text that is stored with a GoldSim model once it has been run. It contains basic information regarding the simulation, and any warning or error messages that were generated.. You also specify how to treat the interrupted realization A single model run within a Monte Carlo simulation. It represents one possible path the system could follow through time. 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 A method for propagating (translating) uncertainties in model inputs into uncertainties in model results. 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 A program that allows you to "play" or "read" an existing GoldSim model without having to license the GoldSim software. The GoldSim Player is available as a free download from the GoldSim website.). The message could, for example, prompt the user to pause the model, adjust some of the input parameters in a Dashboard A special GoldSim element that allows you to build custom interfaces or "control panels" for your models., and then continue the simulation.
The properties dialog for an Interrupt element looks like this:
The
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.