SubModel

The SubModel object is the basis for the implementation of sub-models in JaamSim.  The components of SubModel are displayed in a Region that is created as part of the SubModel object.  A component is added to the SubModel by dragging and dropping it on top of its Region or by copying and pasting an existing object on top of the Region.

A component has both a local name with the context of its SubModel as well as a global name.  For example, a component with the local name Server1 within SubModelA has a global name of SubModelA.Server1.  The SubModel that contains a component is called the parent SubModel of the component.

The keyword 'sub' in an expression refers to the parent SubModel.  It is equivalent to entering 'this.parent'.

A SubModel can contain another SubModel as a component.  For example, if Server1 is component of SubModelA which in turn is a component of SubModelB, then the global name for Server1 is SubModelB.SubModelA.Server1.

A SubModel's Region can be displayed or hidden temporarily using the 'Show SubModels' button, or it can be displayed or hidden permanently using the 'Show Components' item in its context menu (right click).

A SubModel can receive entities as part of a process flow type model or it can operate independently.   A SubModel uses its SubModelStart and SubModelEnd components specify the entry and exit points for entities that arrive to and depart from the SubModel.  An entity arriving to a SubModel is directed automatically to its SubModelStart component.  An entity arriving to a SubModelEnd component is directed automatically back to the parent SubModel and from there to the object specified by its NextComponent input.  An entity can be sent directly to any other object by providing an input to the NextComponent input to the SubModelEnd object.  A SubModel that receives entities must have a single SubModelStart object as a component, but can have multiple SubModelEnd components.

When a SubModel is created, it automatically appears in the Model Builder under the 'Pre-built SubModels' heading and can be dragged and dropped in the same way as any other object in the Model Builder.  However, when a SubModel is dragged and dropped, a new type of object called a 'SubModelClone' is created.  This object behaves in the same way as a copy of the SubModel, but has the important additional property that it can be updated to be consistent with any changes that have been made to the original ('prototype') SubModel.  The update is performed automatically when a model is started or it can be performed manually by selecting 'Update Clones' from the context menu (right-click) for the original SubModel.

A SubModel object can also be copied in the same way as other objects.  The SubModel’s components and their inputs are copied along with the SubModel.  Inputs to SubModel components that reference the parent SubModel or another component of the SubModel are changed automatically to refer to the copied SubModel or SubModel component.  RandomSeed inputs to probability distributions are changed to the first unused integer value.  However, unlike a SubModelClone, a copied SubModel must be updated manually if the original SubModel is modified.

The KeywordList input provides a way to define new inputs for a SubModel.  Each of these inputs accepts an expression that returns a number with or without units.  An output with the same name as the input is created to return the present value for the input expression.  This feature allows a component of the SubModel to obtain all its inputs through its parent SubModel or from other components of the SubModel, thereby avoiding any references to objects outside of the SubModel.  The inputs and outputs created by the KeywordList input are retained by any SubModelClones that were created by dragging and dropping the SubModel.

SubModel Inputs

Keyword

Description

Key Inputs

 

Description

A free-form string describing the object.

NextComponent

The next object to which the processed entity is passed.

User-defined inputs

Inputs defined by the user through the KeywordList input.

Options

 

AttributeDefinitionList, CustomOutputList

See Section 6.2.

KeywordList

Defines new keywords for the sub-model and creates new outputs with the same names.  This allows the components of a sub-model to receive all their inputs from either the parent sub-model or from other components.

Graphics

 

Position, Alignment, Size, Orientation, Region, RelativeEntity, DisplayModel, Show, Movable, VisibleViews, DrawRange

See Section 11.1.

SubModel Outputs

Output Name

Description

Entity and DisplayEntity

 

Name, ObjectType, SimTime, Parent, Position, Size, Orientation, Alignment, GraphicalLength, ObserverList, NextList, PreviousList, EntityReferenceList

See Section 11.1.

StateEntity

 

State, WorkingState, WorkingTime, StateTimes, TotalTime

See Section 10.3.

LinkedComponent

 

obj, NumberAdded, NumberProcessed, NumberInProgress, ProcessingRate, ReleaseTime

See Section 16.

SubModel

 

User-defined outputs

Outputs defined by the user through the KeywordList input.

User-defined attributes and custom outputs

As defined by the AttributeDefinitionList and CustomOutputList inputs.