You are on page 1of 2

Problem:

I would like to create my own, custom List State that will produce time persistent statistics on each value that is
assigned to the state.
Categories:
Buffering, Custom Statistics, Discrete States
Key Concepts:
Before Exiting, Buffer Capacity, List State, Math.If, On Entering, State Assignments, Status Pie, StringList

Approach:
We set up a system that has two servers in series (Server1 & Server2), which are in parallel with two other servers
(Server3 & Server4) in series. We would like statistics on when either Server1 or Server2 are busy and statistics on
when either Server3 or Server4 is busy. In other words, wed like to know when the top line of servers is busy and
when the bottom line of servers is busy. By creating a custom ListState for Line1 (which includes Server1 &
Server2) and a custom ListState for Line2 (which includes Server3 & Server4), we will get statistics such as the
average amount of time spent in the Busy state and the number of occurrences that each Line was in the Busy
state.
Simple System Setup:
Place a Source and a Sink object in the Facility window.
In between these two objects, place 4 Server objects. Set the Input Buffer Capacity and the Output Buffer
Capacity to 0 for all 4 servers so that we do not have any buffering in the system. Server1 and Server2
are in series so therefore connect the Source to Server1 with a Path, connect Server1 to Server2 with a
Connector and connect Server2 to the Sink with a Path.
Server3 and Server4 are in series so therefore connect the Source to Server3 with a Path, connect Server3
to Server4 with a Connector and connect Server4 to the Sink with a Path.
Create the two List States:
From the Definitions window, go to the States panel. Create new List State by clicking on List in the
States ribbon. Name this new state Line1ListState. Create another new ListState and name is
Line2ListState.
Leave the States Panel and go to the Lists panel (found on the left side of the interface). Create a new
String List by clicking on String in the ribbon menu. Name this new List Line1. Enter the word Idle
into the first row of the List and the word Busy into the second row of the List.
Create another String List by clicking on String in the ribbon menu. Name this new List, Line2. Enter
the word Idle into the first row of the List and the word Busy into the second row of the List.
Go back to the States panel where you created the List States and select Line1ListState. In the properties
window of this State, set the String List Name property to Line1 and set the Initial State Value property
to Idle.
Select Line2ListState. In the properties window of this State, set the String List Name property to Line2
and set the Initial State Value property to Idle.
Assign Values to List States:
Go back to the Facility window where well assign values to our new List States. Select the first Server in
the top series (Server1) and expand the State Assignments property category in the properties window.
Click on the ellipse (the button) in the On Entering property and when the On Entering Repeating
Property Editor window appears, click Add. Set the State Variable Name to Line1ListState and the New
Value to 1. Assigning a value of 1 to this List State is equivalent to setting it to the list value of Busy (the
List is 0-indexed so Idle =0 and Busy = 1).
Click on the second Server in the top series (Server2) and expand the State Assignments property category
in the properties window. Click on the ellipse (the button) in the On Exiting property and when the On
Entering Repeating Property Editor window appears, click Add. Set the State Variable Name to
Line1ListState and the New Value to Math.If(Server1.Processing.Contents>0, 1, 0). This Math.If
statement says that if there is an entity being processed at Server1, then keep the value of the
Line1ListState at 1. If not, then set it to 0, which is Idle.
Select the first Server in the bottom series (Server3) and expand the State Assignments property category
in the properties window. Click on the ellipse (the button) in the On Entering property and when the
On Entering Repeating Property Editor window appears, click Add. Set the State Variable Name to
Line2ListState and the New Value to 1.
Click on the second Server in the bottom series (Server4) and expand the State Assignments property
category in the properties window. Click on the ellipse (the button) in the On Exiting property and
when the On Entering Repeating Property Editor window appears, click Add. Set the State Variable Name
to Line2ListState and the New Value to Math.If(Server2.Processing.Contents>0, 1, 0). This Math.If
statement says that if there is an entity being processed at Server2, then keep the value of the
Line2ListState at 1. If not, then set it to 0, which is Idle.
Place two Status Pie charts from the Animation ribbon into the Facility window. Set the Data Type
property of the Status Pie to List State and the List State property to Line1ListState (and Line2ListState
for the second chart).
Embellishments:
Consider adding additional values to each List and then assigning the appropriate index into the ListState to see
that a ListState can contain more than just the two values (0 and 1) that this SimBit demonstrated.
Discussion:
The statistics for these new ListStates are displayed in the Results window after the run is complete. For each
ListState, there are statistics for Average Time, Total Time, Percent Time and Number of Occurences for each State
Value (i.e. Busy, Idle in our example).
Most of the Simio Standard Library objects contain a built in ListState, called ResourceState, which is automatically
updated with values such as Busy, Idle, OffShift, etc.
There are functions available for a ListState, such as MyListState.AverageTime(stateValue),
MyListState.TotalTime(stateValue), MyListState.PercentTime(stateValue),
MyListState.NumberOccurences(stateValue),

You might also like