SubModel Example: Dynamic
Optimization During a Simulation
Another common use of SubModels is to do a dynamic optimization during a simulation. Imagine a situation where you were simulating the operation of a facility over a period of one year. Every month, the operators make a decision based on the current state of the system. This decision is based on a simple optimization analysis using currently available data (i.e., at every month during the simulation). The optimization chooses the optimum values of a few control variables that the operators will use for the next month.
With SubModels, you could simulate this by inserting a SubModel A specialized element that allows you embed one complete GoldSim model within another GoldSim model. This facilitates, among other things, probabilistic optimization, explicit separation of uncertainty from variability, and manipulation of Monte Carlo statistics. (e.g., a static optimization) within an outer model (e.g., a dynamic simulation).
Example model DynamicOptimization.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 outer model is a dynamic deterministic simulation A simulation in which the input parameters are represented using single values (i.e., they are "determined" or assumed to be known with certainty)., and the SubModel is a static deterministic optimization. The objective function in the SubModel is a function of a parameter that is passed in from the outer model (and changes every timestep A discrete interval of time used in dynamic simulations.). Hence, every timestep, the SubModel carries out a new optimization and the results are used in the parent model for the next timestep.