Exporting SubModels

In some cases, you may want to run a SubModel as a standalone model.  This is useful, for example, if you want to debug, test, and/or refine it separate from the parent model. Although you can't run the SubModel directly from within a parent model, you can export it, run it separately, and then import it back into the parent model.  You may also choose to export a SubModel so that you can subsequently import it into a different model.

You can export a SubModel by pressing the Export as .GSM… button in the SubModel dialog. When you do so, you will be prompted for a file name (and location) for the saved file.

When exporting a SubModel, several points should be noted:

   All of the options (specified in the parent model's Options dialog) are exported with the new model.

   All user-defined units and array label sets specified in the parent model are exported with the new model.

   If you export a SubModel, any Resource Types and Stores in the SubModel will become available in the new model.

In addition, the input and output interfaces are exported to the stand-alone model.  The output interface is not accessible in the stand-alone model, but the input interface is accessible, and can be edited.  In particular, the input interface is accessible via the Globals tab in the stand-alone model's Simulation Settings dialog:

In the example shown above, Parameter1 and Parameter2 in the SubModel were referencing outputs X and Y in the parent model.  Once the SubModel was exported, of course, it no longer had access to X and Y "outside" of the model (since there is no "outside" to a stand-alone model). Hence if you tried to run the stand-alone model an error would be displayed. 

In order to run the stand-alone model, the Definitions for the Globals would need to be changed to values.  Note, however, that the original exported Definitions are saved with the file separately.  Therefore, if you subsequently import the stand-alone model into another model (as a SubModel), the original input (and output) interface that was exported will be automatically recreated.

   Note: You can only export a SubModel that has values or conditions on the input interface.  If the input interface contains Time Series Definitions, Lookup Table Definitions or Distribution Definitions, you will not be able to export the model (as these could not be represented as values on the Globals tab.

If the exported SubModel's input interface included externally defined Run Properties (e.g., such as Simulation Duration), these interface items will appear in the Globals list.  However, they will not be used by the stand-alone model, and cannot be edited.  They can, however, be deleted.

Related Topics…

Learn more about: