Viewing and Editing a Submodel

You double-click a submodel block to view its contents in a separate submodel window. Figure 7.9 shows a model with one submodel block and the submodel window open.

Figure 7.9: A Submodel Block and the Submodel Window


The Submodel window opens with the Instance option selected in the Submodel window combo box. The Instance option in the submodel window enables you to view (but not edit) the contents of a particular submodel instance. The Instance option is especially useful for viewing the animation of a submodel instance as the model runs, and it alleviates the need to open a separate window for each submodel instance. If you have a submodel window open and you double-click on another submodel block that is linked to the same submodel that is already open, then both instances are viewed in the same submodel window. Clicking the up and down arrows adjacent to the Instance option changes the submodel instance being viewed. The label that is associated with each submodel instance is displayed.
Note: The submodel instance number reflects the order in which the submodel instances were opened. If you close a submodel instance and then open it again, it could have a different instance number.

You open the Definition view in a Submodel window by clicking the down arrow adjacent to the Instance option and selecting Definition. Figure 7.10 shows a Submodel window in Definition mode. The Definition option in the submodel window enables you to edit the contents of a submodel. When you edit a submodel and save the changes, all instances of the submodel in the current model and in any other model reflect the changes. You can drag blocks into the submodel, connect blocks, delete blocks, and perform any other modeling action that you would perform in the regular Model window. You can drag blocks into a Submodel window from the template palette in the SAS Simulation Studio window. Alternatively, the Definition view in a Submodel window has a template palette that appears when you place the mouse over the template image An M/M/1 Queueing Model . This template behaves in the same way as the template in the SAS Simulation Studio window. When you move the mouse away from the An M/M/1 Queueing Model icon, the Submodel window template disappears.

Note: In the Submodel window, new blocks can be dropped only within the submodel border, and this border might be smaller initially than the size of the Submodel window. In Definition mode, you can expand the border of the submodel by clicking anywhere in the submodel background and then dragging one of the submodel border corners to the desired size.

Note: If a submodel contains any blocks that use a random stream (such as the Numeric Source block), then every instance of that submodel uses the same random streams. If you want each submodel to use different random streams, then you could design your submodel so that the blocks that use a random stream are external to the submodel. Then any random values are input to the submodel through a tunnel. You also might consider using a compound block instead of a submodel block because each instance of a compound block in a particular model automatically contains different streams.

To save an edited submodel block, right-click on the submodel and select Save. When you close the Submodel window, you will also be prompted to save any changes. The default filename extension for a saved submodel block is .cblk. When the edited submodel definition is saved, all instances of that submodel in the currently opened simulation model automatically refresh to reflect the new, updated definition. Furthermore, all instances of the submodel that are in other models (either in the same project or in different projects) are also updated.

Figure 7.10: A Submodel Window in Definition Mode