SubModel Example: Manipulation of Monte Carlo Statistics

A common use of SubModels is to manipulate Monte Carlo statistics.  That is, after carrying out a Monte Carlo simulation, you may want to carry out further calculations using the statistical outputs of the simulation.  For example, you may want to carry out a calculation that is some function of the mean and the 95th percentile of a particular output in a Monte Carlo simulation. 

Without the use of SubModels, the only way to accomplish this is by exporting results from a Monte Carlo simulation manually to another application (e.g., a spreadsheet or a separate GoldSim model).  With SubModels, this is easily accomplished within a single GoldSim model by inserting a SubModel (that is a Monte Carlo simulation) into an outer model (that is static and simply manipulates the statistical outputs of the inner model).

Example model MonteCarloStatistics.gsm in the General Examples/SubModel folder in your GoldSim directory (accessed by selecting File | Open Example... from the main menu) provides a simple illustration of such an application. In this model, the SubModel contains a single Stochastic.  The SubModel carries out a Monte Carlo simulation.  The outer model is a static deterministic simulation that contains a single Expression element.  The Expression is a function of statistics (the mean and 95th percentile) of the Stochastic within the SubModel.

Related Topics…