Problem:
I would like to keep track of what Server an entity visited so that this information can be used later in the model. I
would like to keep a reference to an object on my entity.
Categories:
Decision Logic – Paths, Decision Logic – Processing, Entity Characteristics
Key Concepts:
Active Symbol, Object Reference State, Location.Parent, Selection Weight
Assumptions:
If an Entity is processed at Server1, it must route to Server5 for processing after it finishes at Server4. If an Entity is
processed at Server2, it must route to Server6 for processing after it finishes at Server4.
Technical Approach:
An Object Reference State is created on the ModelEntity object, which will be used to hold a reference to which
Server the entity visited first (either Server1 or Server2). The Selection Weight properties on the paths the leave
Output@Server4 will contain expressions that will route the entity to correct Server, either Server5 or Server6,
depending on which Server it visited at the beginning of the model. The logic in these expressions checks the value
of the Object Reference State on each entity to determine if it was processed at Server1 or Server2.
Details for Building the Model:
Simple System Setup
Place a Source (Source1) and Sink (Sink1) at the left and right sides, respectively, of the Facility window.
Place two Server2 in parallel after the Source and name them Server1 and Server2. Connect Source1 to
each new Server with Paths.
Place two Servers, in series, next. Name them Server3 and Server4. Connect them together with Paths
and connect both Server1 and Server2 to Server3 with a Path.
Place two additional Servers, in parallel, after Server4. Name them Server5 and Server6. Connect Server4
to each new Server with a Path and connect Server5 and Server6 to the Sink with Paths.
Place a ModelEntity object from the Project Library, into the Facility window. Select the entity in the
Facility window and click on ‘Add Additional Symbol’ icon in the Ribbon. Change the color of the second
symbol to Red. First, ensure that he second symbol is displayed by selecting the entity in the Facility
window and checking the Active Symbol icon in the Ribbon. If (2 of 2) is displayed, you are viewing the
second symbol. Click on the Color drop down in the Ribbon, find Red, and then click back onto the Entity
object to change its color. (if you are viewing 1 of 2, or the first symbol, simply select the second symbol
from the Active Symbol drop down)
Creating the Object Reference State on the ModelEntity
Click onto ModelEntity in the Navigation window in the upper right side of the interface. Once
ModelEntity is selected, you are now viewing the object definition for this object. Go to the Definitions
window of the ModelEntity object.
Go to the States Panel by selecting States on the left panel.
Click on the Object Reference icon in the ribbon to create a new Object Reference State. Rename this
new state, FirstServer.
Adding Logic to the Model
Back in the main Model, click on Server1 and expand the State Assignments property category. Add a new
assignment in the On Entering property. Click Add to create a new Assignment once the Repeating
Property Editor window is open. Set the State Variable Name to ‘ModelEntity.FirstServer’. Set the New
Value property to ‘ModelEntity.Location.Parent’.
o The function ModelEntity.Location.Parent will return a reference to the object where the entity
is current located (it’s ParentObject) and at this moment, the ParentObject is Server1, so it will
assign a reference of Server1 to the new state named FirstServer on each entity that passed
through.
Click on Server2 and add the exact same assignment to this Server. (Exact same State Variable Name and
same expression for New Value). However, before you exit the Repeat Group editor, add a second
Assigment. Set the State Variable Name to ‘ModelEntity.Picture’ and the New Value to ‘1’.
o This will change the color of all entities leaving Server2 to Red. This will help with visually
confirming that these entities will be routed to Server6.
Select the Path that leads from Server4 to Server5. Set the Selection Weight property to
‘ModelEntity.FirstServer == Server1’. This tells Simio that only entities that have their FirstServer state set
to ‘Server1’ will be able to take this Path.
Similarly, select the Path that leads from Server4 to Server6. Set the Selection Weight property to
‘ModelEntity.FirstServer == Server2’. This tells Simio that only entities that have their FirstServer state set
to ‘Server2’ will be able to take this Path.