Вы находитесь на странице: 1из 2


I would like to make an additional server active whenever the current servers have a certain number of entities
waiting. In other words, there are multiple servers and if any server with capacity reaches a maximum input
buffer level, I want to open a new server.
Buffering, Decision Logic -- Processing
Key Concepts:
AssociatedStationLoad, Active Symbol, Add-On Process, Assign Step, Condition Based, Contents, Current Capacity,
Decide Step, InProcess, InputBuffer, Load, Monitor, NodeList, On Exited, Processing, Status Label

Assume that capacity can be added instantaneously with no set-up/transition time.
Technical Approach:
We want the maximum number of entities in a servers input buffer to be six. When a seventh entity arrives, a
new server should come on-line or be activated. There are monitors that watch all the Server Input Buffers and
when the seventh entity arrives, an event is fired that triggers a process to change the server capacities. When the
server has completed processing, capacity is reduced to zero again until it is needed in the future.

Details for Building the Model:

Simple System Setup:
Place a Source, 6 Servers in parallel, and a Sink in the Facility Window.
Name the Servers: a1 through a6.
Connect the Source to each Server and each Server to the Sink with Paths.
Setting Up the Selection Logic:
From within the Definitions window, create a Node List that contains the Input Nodes for all 6 Servers.
In the Output@Source1 node, change the Entity Destination Type property to Select From List and select
the Node list that was just created.
Set the Selection Goal to Smallest Value and use the default Selection Expression
Candidate.Node.AssociatedStationLoad. This expression will select the least congested possible
destination. Please refer to the documentation for more details on the AssociatedStationLoad function
and other related functions.
Set the Selection Condition property to Candidate.Server.CurrentCapacity > 0.
o This ensures that Entities do not get routed to a Server with a capacity of zero

Creating the Monitor Elements:

In the Definitions window, select the Elements panel and add 5 Monitor elements (we do not need to
monitor server a6).
Set up the properties of each Monitor Elements as follows:
o Monitor Type is CrossingStateChange
o State Variable Name is a1.InputBuffer.InProcess (or a2, a3,a4, a5)
o Threshold Value is 6
o Crossing Direction is Positive
This means that when the Input Buffer threshold value of 6 is crossed in the positive direction (going from
6-7) the Monitor will be triggered. (If the Crossing Direction would be Negative it would be triggered
when it went from 6-5, which is not what we want to have happen.)
Increasing Server Capacities:
From within the Processes window, create a new Process (Create Process ribbon button) and rename it
Place a single Assign step. Open the Repeating Property Editor in Assignments (More).

o For the first assignment, set the State Variable Name to a6.CurrentCapacity and the New Value
to (Input@a6.AssociatedStationLoad > 0 || ((a1.Capacity > 0) && (a2.Capacity > 0) &&
(a3.Capacity > 0) && (a4.Capacity > 0) && (a5.Capacity > 0)))
o Add another assignment: State Variable Name is a5.CurrentCapacity and New Value is
(Input@a5.AssociatedStationLoad > 0 || ((a1.Capacity > 0) && (a2.Capacity > 0) && (a3.Capacity
> 0) && (a4.Capacity > 0)))
o Similarly, add: State Variable Name a4.CurrentCapacity with New Value
(Input@a4.AssociatedStationLoad > 0 || ((a1.Capacity > 0) && (a2.Capacity > 0) && (a3.Capacity
> 0)))
o And finally: State Variable Name a3.CurrentCapacity and New Value
(Input@a3.AssociatedStationLoad > 0 || ((a1.Capacity > 0) && (a2.Capacity > 0)))

These expressions are checking 2 things: (1) If it is processing an Entity, an Entity is waiting to be
processed, or an Entity is routing to be processed, then let it remain operating OR (2) all the Servers
before that one are working. Because we used a logical expression it will return a 1 if true, and a 0 if false
which is what we want to set our Capacities to.

Note: It is important that these expressions are in this exact order - descending order. Otherwise, the
logic will not evaluate correctly.

Now that the Process has been created, we have to trigger it this is done back in the Monitor Element.
From the Definitions window, set the On Change Detected Process to UpdateServerCapacities for each
Monitor element. Therefore, once the Monitor is triggered (i.e. when the seventh Entity arrives) it will
fire this process, which checks all of the conditions and then sets the capacities accordingly.

Decreasing Capacities:
From within the Facility window, create a process in a3s Exited Add-On Process Trigger
From the Processes window, place a Decide step in this new process. Set Decide Type to ConditionBased
and Expression to Input@a3.AssociatedStationLoad == 0.
On the True segment, place an Assign step. Set the State Variable Name to a3.CurrentCapacity and leave
the New Value 0.0.
This process will check to see if there are any entities processing, waiting to be processed, and routing to
the server for processing. If there are not, then it assigns the Servers capacity to 0.
Repeat this for Servers a4, a5, and a6.