This article is part of the GoldSim Style Guide. For an introduction, please start here.
The goal for your model should be to use no more memory than what is needed to portray results of your model and understand what it is doing. You might need to save more results temporarily while debugging but that should not be considered the ultimate state of your model. This means you need to save result elements only used for debugging and building the model in a separate place (as mentioned in the “Model Organization” section earlier) so you can easily remove them and disable the results later on.
A rule of thumb for a model is to start building the model assuming no outputs need to be saved. Only turn on outputs that you need as you continue building the model. With this approach, you minimize saving results that aren’t needed. The opposite approach is to start out by saving everything by default then deciding at the end to disable what is not needed, which ends up taking more time and causing unnecessary bloat.
The memory used to view and run a model is a function of the following model properties:
- Number of (and type of) elements
- Number and size of arrays
- Amount of text in element notes and text boxes
- Amount of data stored in time series and lookup tables
- Graphical components
- Number of update time points for saving results
- Number of unscheduled updates occurring
- Number of realizations and scenarios
- Number of external elements, their DLL code, and the data
The memory used is an important aspect of your model because it will affect the size of your model file, which needs to be shared with others. If the size of the model file and results continues to grow as you build the model and you don’t take any measures to restrict the size, it’s possible that you approach the limits of your operating system. To avoid this, we recommend that you take memory reducing measures while building the model and also take some time before publishing your model to disable saving results for outputs that are not needed while the model is in production mode.
Disable Final Values and Time History Results
The check boxes at the bottom of an element’s property dialog control whether outputs will be saved for the element.
You can set this save setting globally by right-clicking in the top level graphics pane and going to the Information tab. In there, you will see two buttons that will disable all final values and time histories. This is an easy to way to start fresh with an existing model then walk through and only enable what is needed.
Time Step Settings
Start by assuming a larger time intervals for saving results and only reduce the interval when it becomes necessary to see more time points. You can find this interval setting in the model’s simulation settings dialog.
Delete Unused Elements
It is often helpful to walk through the model before going into production to make sure you don’t have any loose ends where elements are not being used anymore. This happens when you are building the model and change how elements are linked to each other during further iterations of model changes. Before deleting an element, make sure there are no dependencies remaining. To do this, first inspect the output port. If you see a “dot” inside the port, it means other elements are referencing it. Deleting this element would cause the model to be in an error state, unable to run.
There are more subtle dependencies that you need to be aware of:
- Result references
- Links to Dashboard controls
To check for these types of dependencies, right-click on the element and check for referencing results and/or Dashboard controls. If you see either of these two items in the context menu of the element, it means there are dependencies that will be destroyed when you delete the element. You should first resolve these by linking the results and/or Dashboard controls to the correct element before deleting.
Delete Unused Array Label Sets
During the construction of a model, you might create array label sets and stop using them later on, causing an accumulation of unused array label sets in your model. Walk through all the labels and click the Delete Set… button to remove any unused sets.