Simphony An Integrated Environment For C
Simphony An Integrated Environment For C
Simaan AbouRizk
Yasser Mohamed
1907
AbouRizk and Mohamed
1908
AbouRizk and Mohamed
available methods and properties in this class are shown in 3.2 Statistical
the following table.
This service provides support for collecting statistics on
Table 2: Sample Methods and Properties for Simulation both intrinsic and non-intrinsic types of data. Standard
Service statistics include average, standard deviation, minimum
Method/Property Description and maximum. Statistical collection is done in Simphony
AddEvent Declares a simulation event that through the concept of a “statistic”. A statistic must be
can be scheduled during declared on creating a new instance of an element before
simulation. any observation values are collected during simulation. To
AddFile Adds a simulation file. The file declare a new statistic, the developer can use the
can be declared as stack, queue or “AddStatistic” method as part of the “OnCreate” event
list. handler of the element. The following code shows example
ScheduleEvent Schedule an event for processing of possible use of the statistical services.
after certain simulation-time units.
Public Function Example_OnCreate(ob as
CloneEntity Creates a copy of an entity with CFCSim_ModelingElementInstance, x as Single, y
all the attributes of the original. as Single) as Boolean
RequestResource Requests a resource and implicitly ...
queues the requesting entity if the ob.AddStatistic “CycleTime”, “Truck Cycle
Time”,False,True
resource is not available. ...
End Function
The following example illustrates the use of the
“ScheduleEvent” method for scheduling a discrete event. Public Sub Example_OnSimulationProcessEvent(ob
As CFCSim_ModelingElementInstance, MyEvent As
The method requires three input parameters: 1) a reference String, Entity As CFCSim_Entity)
to the entity that will trigger the event, 2) the name of the ...
simulation event, and 3) the time period after which the Select Case MyEvent
event is scheduled starting from the current time. This Case “CollectStat”
Ob.stat(“CycleTime”).Collect SimTime-
method will mostly be used in the simulation event entity(“StartTime”)
handlers which are triggered on initializing a simulation ...
run (OnSimulationInitializeRun), or processing an event End Sub
(OnSimulationProcessEvent). The example utilize the
“ScheduleEvent” method in the “OnSimulationInitialize- The first part of the above code shows use of the
Run” event handler to kick off the simulation events. AddStatistic method in the OnCreate event handler. The
first parameter of the method is a unique string for identi-
Public Sub Example_OnSimulationInitializeRun(ob fying the statistic. The second is the description that will be
as CFCSim_ModelingElementInstance, RunNum as used by Simphony when displaying the results to the user.
Integer)
Dim Customer as CFCSim_Entity The third parameter is to define if the collected observation
Set Customer = ob.AddEntity should be treated as intrinsic (time of collection will be
Ob.ScheduleEvent Customer, “Customer_Arrive”, considered) or non-intrinsic. The last one is to define if
sampler.Expntl(10) Simphony should fully track the observations to produce a
End Sub
graph output for the statistic or not.
The above code first declares a variable of type The second part of the code shows the collecting of
CFCSim_Entity to hold on a reference to an entity repre- observation for the CycleTime statistic as part of an event
senting a customer. The second line utilizes the AddEntity in the OnSimulationProcessEvnet event handler. The
method to create a new entity, obtain a reference to it, and collection is done by defining the required statistic and
assign the reference to the declared variable. The Schedule- calling the collect method for it while passing the value of
Event method is then used to schedule the first event in the the observation to the collect method. In this case, the
simulation run which, in this case, represent a customer cycle time value is the difference between the current
arrival. The last parameter of the method is set through a simulation time (SimTime) and the time when the entity
call to another service in Simphony that enables sampling started its cycle which is held in an entity attribute called
random numbers from different types of distribution by “StartTime”.
defining the type and parameters of the required distribu- The following figure shows the output for a statistic
tion. The sampling in the above example is done from an that is fully tracked.
exponential distribution with a mean of 10.
1909
AbouRizk and Mohamed
3.4 Animation
1910
AbouRizk and Mohamed
The second part of the code is embedded in the event Table 3: Elements of the Common Template
handler responsible for processing the simulation events Element Description
(OnSimulationProcessEvent). When a “StartTravel” event Composite The composite element is used to build
is processed, the path is associated with an instance of the sub-models inside the main model. The
truck animation object and then the “StartPath” method is user can create other elements as
used to begin moving the object along the path at a given children inside a composite element and
simulation time. In the same way, when a “FinishTravel” link them to higher-level elements
event is reached, the “EndPath” method is used to end the through InPort and OutPort elements.
movement of the truck along the animation path. Conditional This element enables routing entities
The following figure shows part of the animation branching into two different branches based on a
screen for the previous example. condition associated with the element.
Probabilistic This element enables routing entities
Branching into a number of different branches
based on a probability associated with
each branch.
Resource These are a number of elements for
Handling managing resources in the model. They
Elements allow declaring resources and waiting
files, requesting, and releasing of the
declared resource. Multiple or single
resource requests in addition to
prioritized queuing are allowed.
Create This element creates new entities with
Figure 4: Animation of Truck Travel/Return Process Entities the number, start time and time intervals
specified by the user and transfer them
4 SIMPHONY TEMPLATES out through its output connection point.
Set Entity Assigns values for new or existing
The services provided by Simphony as a development Attributes attributes of entities passing through it.
environment allows for developing flexible and user-
Consolidate The consolidate element helps
friendly simulation tools in a relatively short time. These
managing the number of entities
services gives the developer full control over a wide range
flowing through it by either
of element behaviors. Although Simphony is intended for
consolidating or cloning them.
developing SPS tools, its capabilities enabled developing
Execute This element enables the execution of a
general-purpose tools with full functionality. Samples of
user written code during the simulation
the developed tools are introduced in the following
to perform any function that is not
sections to highlight some of the features that can be easily
supported by the elements in the
accomplished in a tool developed with Simphony.
template.
Statistics A number of elements that help
4.1 General Purpose Simulation Tools
Elements declaring and collecting statistics at key
points in the model.
Two templates were successfully developed in Simphony
that can be used for general-purpose modeling. The first Task This element represents a normal task
one is referred to as the “common” template. It provides that requires duration to perform.
basic constructs that can be used to model a system using Trace This element enables producing trace
process interaction concepts. The common template messages at selected points to check the
features most of the required functions for general purpose integrity of the model.
modeling that could be found in stand-alone general-
purpose simulation software. The use of this template The second general purpose template enables the user
requires the user to have background in simulation to build models based on the CYCLONE methodology. It
techniques. Many of the modeling elements in the template supports the standard CYCLONE elements (i.e. queue,
can be used in conjunction with elements from other normal, combi, generate/consolidate) in addition to ele-
templates to add certain behaviors to the model. ments for supporting hierarchical modeling and proba-
The template includes elements for handling hierarchi- bilistic branching. The hierarchical feature in the templates
cal modeling, entity creation and routing, resources, allows embedding CYCLONE models in other models
statistics, activities, and tracing. The following table briefly created by different templates.
describes the function of some elements in the template.
1911
AbouRizk and Mohamed
The following figure shows the icons of the modeling Building the dewatering model requires the following
elements in the two templates from which the user would information:
select to create a model.
• site coordinates,
• pump wells layouts
• excavation area dimensions and depth,
• original water table level, and
• aquifer properties (i.e. confined or unconfined
aquifers, layers, permeabilities)
1912
AbouRizk and Mohamed
Figure 7: Hierarchical Modeling and Integration Features in the Earth Moving Template
1913
AbouRizk and Mohamed
AUTHOR BIOGRAPHIES
ACKNOWLEDGMENTS
1914