The JSIM web-based simulation environment

15
Future Generation Computer Systems 17 (2000) 119–133 The JSIM web-based simulation environment John A. Miller * , Andrew F. Seila, Xuewei Xiang Computer Science Department, 415 GSRC, University of Georgia, 219 Hardman Hall, Athens, GA 30602-7404, USA Abstract In its ideal form, web-based simulation should allow simulation models as well as simulation results to be as readily distributable and composable as today’s web documents. The rapid advances in web technology, most notably Java, are helping to make this a possibility. Support for executable web content, universal portability, component technology, and standard high-level packages for accessing databases and producing graphical user interfaces are important enablers of web-based simulation. Component-based software can be used to develop highly modular simulation environments supporting high reusability of software components. Because of the potentially large scope of web-based simulation, greater demands are placed on simulation environments. They should support rapid visual model development, access to local and remote databases, techniques for executing models or federations of models in a variety of ways, and embedding of simulation within larger systems. The use of component technology in the JSIM web-based simulation environment allows simulation models to be treated as components that can be dynamically assembled to build model federations. It also allows simulation inputs and outputs to be dynamically linked to database systems, making storage of simulation results easy and flexible. © 2000 Elsevier Science B.V. All rights reserved. Keywords: Web-based simulation; Simulation environments; Component software; Java; Java beans 1. Introduction Web-based simulation is an important new direc- tion for simulation research and development. In its ideal form, web-based simulation should allow sim- ulation models as well as simulation results to be as readily distributable and composable as today’s web documents. Clearly, this is easier said than done. It is easy to hyperlink documents even if authored by dif- ferent people. Hyperlinking simulation models is not so easy. Easier than hyperlinking models is making models widely and easily accessible over the web. Executable content (e.g., Java applets) facilitates this type of client side execution. Expensive or long- running simulations can still be executed on powerful * Corresponding author. Tel.: +1-706-542-3440.. E-mail address: [email protected] (J.A. Miller). servers. This can be done by having a thin client run- ning on a browser communicate with a server where the models run as, e.g., Java servlets or applications. Because of the larger scope and scale of web-based simulation, provision for appropriate simulation envi- ronments takes on a higher level of importance. With the potential of having models executing all over the world producing simulation results, it would be waste- ful not to store these results. Java database connectiv- ity (JDBC) makes it easy to store simulation results in an organized fashion in relational or object-relational databases. Although JDBC takes care of low level database connectivity issues, many higher level is- sues remain. Java also facilitates the construction of friendly graphical user interfaces (GUIs) to present results from databases. Consequently, users need not know detailed formatting specifications in order to ac- cess simulation results stored in databases all over the 0167-739X/00/$ – see front matter © 2000 Elsevier Science B.V. All rights reserved. PII:S0167-739X(99)00108-9

Transcript of The JSIM web-based simulation environment

Page 1: The JSIM web-based simulation environment

Future Generation Computer Systems 17 (2000) 119–133

The JSIM web-based simulation environment

John A. Miller∗, Andrew F. Seila, Xuewei XiangComputer Science Department, 415 GSRC, University of Georgia, 219 Hardman Hall, Athens, GA 30602-7404, USA

Abstract

In its ideal form, web-based simulation should allow simulation models as well as simulation results to be as readilydistributable and composable as today’s web documents. The rapid advances in web technology, most notably Java, arehelping to make this a possibility. Support for executable web content, universal portability, component technology, andstandard high-level packages for accessing databases and producing graphical user interfaces are important enablers ofweb-based simulation. Component-based software can be used to develop highly modular simulation environments supportinghigh reusability of software components. Because of the potentially large scope of web-based simulation, greater demandsare placed on simulation environments. They should support rapid visual model development, access to local and remotedatabases, techniques for executing models or federations of models in a variety of ways, and embedding of simulation withinlarger systems. The use of component technology in the JSIM web-based simulation environment allows simulation models tobe treated as components that can be dynamically assembled to build model federations. It also allows simulation inputs andoutputs to be dynamically linked to database systems, making storage of simulation results easy and flexible. © 2000 ElsevierScience B.V. All rights reserved.

Keywords:Web-based simulation; Simulation environments; Component software; Java; Java beans

1. Introduction

Web-based simulation is an important new direc-tion for simulation research and development. In itsideal form, web-based simulation should allow sim-ulation models as well as simulation results to be asreadily distributable and composable as today’s webdocuments. Clearly, this is easier said than done. It iseasy to hyperlink documents even if authored by dif-ferent people. Hyperlinking simulation models is notso easy. Easier than hyperlinking models is makingmodels widely and easily accessible over the web.Executable content (e.g., Java applets) facilitates thistype of client side execution. Expensive or long-running simulations can still be executed on powerful

∗ Corresponding author. Tel.:+1-706-542-3440..E-mail address:[email protected] (J.A. Miller).

servers. This can be done by having a thin client run-ning on a browser communicate with a server wherethe models run as, e.g., Java servlets or applications.

Because of the larger scope and scale of web-basedsimulation, provision for appropriate simulation envi-ronments takes on a higher level of importance. Withthe potential of having models executing all over theworld producing simulation results, it would be waste-ful not to store these results. Java database connectiv-ity (JDBC) makes it easy to store simulation results inan organized fashion in relational or object-relationaldatabases. Although JDBC takes care of low leveldatabase connectivity issues, many higher level is-sues remain. Java also facilitates the construction offriendly graphical user interfaces (GUIs) to presentresults from databases. Consequently, users need notknow detailed formatting specifications in order to ac-cess simulation results stored in databases all over the

0167-739X/00/$ – see front matter © 2000 Elsevier Science B.V. All rights reserved.PII: S0167-739X(99)00108-9

Page 2: The JSIM web-based simulation environment

120 J.A. Miller et al. / Future Generation Computer Systems 17 (2000) 119–133

web. For rapid model development, the environmentshould provide visual tools for designing simulationmodels.

Just as a web document may be hyperlinked to sev-eral other web documents, models may be linked to-gether to form a model federation. A loosely coupledapproach to hyperlinking simulation models into a fed-eration is suggested in this work. Using componentbased software, in this case Java beans, one model isable to inject entities into another model. Using theforthcoming Enterprise Java beans, these two modelsmay be located anywhere on the web.

This chapter examines several issues pertainingto simulation environments for web-based simula-tion. These issues are illustrated by examining thefunctional modules in the JSIM web-based simu-lation environment [11,13,17]. The current versionhas evolved to incorporate the newest approach tosoftware development, component-based technology.If component-based technology succeeds, the longhoped for gains in software development productivitymay finally be realized. Complex software systemswill be built by assembling components, minimizingthe amount of low-level coding required. Systemsbuilt with components should be more extensible andoften able to run in distributed and heterogeneousenvironments. Typically, component-based softwarewill also run on the web (e.g., Java beans and ActiveX). JSIM, built using Java and Java beans, can pro-vide many of the advantages of web-based simulation[5,7].

In the rest of this chapter, a perspective on researchand development in web-based simulation is given.A discussion of the importance of software compo-nent technology is also presented. To illustrate theseissues, some parts of the JSIM web-based simulationenvironment are examined in detail. JSIM consistsof three layered groups of Java packages. The firstgroup, JSIM foundation packages, has little to dowith web-based simulation, but is necessary for anysimulation system. Its constituent packages are brieflydescribed for completeness. The second group, JSIMengine packages, are more relevant since simulationmodels can be manifest as Java beans for distributionor assembly into model federations. The third group,JSIM environment packages, facilitates the creationof simulation models, the connection to databases, thecontrolled execution of models or model federations,

and query driven simulation. This third group will beexamined in greater detail.

2. Web-based simulation

After starting in 1996 [2,5,17], research and de-velopment work on web-based simulation has ex-ploded. Users on the web are familiar with clickingon hyperlinks to find useful information or run smallweb-enabled applications (e.g., applets). It is onlynatural that the same could be done for simulationmodels. While this can be done, e.g., by using Javaapplets, this is only the beginning step along newdimensions of research and development for the sim-ulation community. At least three dimensions can beexplored: (1) Models are being enriched by linkingthem to web documents and multimedia (e.g., text todescribe the model and images to connect the modelswith reality) [6]. (2) Simulations can be developedby assembling model elements from multiple sites onthe web. They can even be developed by teams atgeographically remote sites. Full exploitation of thisrequires not only the use of software component tech-nology but also collaborative development tools anddesigners, model repositories, and mechanisms fordata interchange and interoperability. (3) Simulationmodels can now be executed on the web in a variety ofways. The list below considers increasingly complexways in which models can be executed on the web.• Web-based execution. The simplest way to allow

simulation models to be executed over the web isto include executable content within web pages.This allows a user to download and run a simula-tion model from anywhere in the world. Typically,this done with a Java applet. Java provides “univer-sal portability” allowing downloaded applets to runanywhere. There are three techniques to ensure thatall the necessary files are available for execution:(i) install a simulation system at each site, (ii) ad-just linking (CLASSPATH) information to includethe download site, or (iii) form each model into aself-contained archive file (jar file).

• Thin-to-thick clients. Although executable content(e.g., Java applets) provides the most commonapproach for model execution in web-based simula-tion, it represents one extreme point on the dimen-sion of client thickness (i.e., Java applets are thickor heavyweight clients). This is particularly useful

Page 3: The JSIM web-based simulation environment

J.A. Miller et al. / Future Generation Computer Systems 17 (2000) 119–133 121

if simulation and animation capabilities are tightlycoupled. One could make the client thinner byhaving the animation run on the client and the sim-ulation run on the server (e.g., as a Java servlet). Ifanimation is not used, the client can be made verythin by simply providing a mechanism for users todefine inputs and view output results. In this case,almost all of the computation is performed on theserver.

• Distributed execution. So far, the discussion hasaddressed the ability to execute models at appro-priate locations on the web (i.e., anywhere, butat one particular place). The ever-growing aggre-gate computational capacity of the web argues formore. The execution of models can be distributedin four ways: (i) a user may simultaneously executemultiple models or scenarios, (ii) multiple replica-tions of a model under a particular scenario maybe simultaneously executed, (iii) loosely coupledcomponents of a model federation may be executedsimultaneously, or (iv) techniques from parallelsimulation may be applied to partition and executea model in parallel. (In JSIM, theqdsAgencyprovides the first, while the second and third areprovided by JSIM’srunAgency . For discussionsof the final option see [3,18].)

• Execution of dynamic model federations. Becauseof the enormous scope of the web, the concept ofan individual simulation model is too small a scale.Although large and sophisticated models may bebuilt hierarchically, the standard laws of causalityapply resulting in the need for global time and syn-chronization. One approach to allow a large numberof models to interact in a loosely coupled fashionis to link models through less frequent externalevents which are not synchronized with internalevents. This is easy to do using Java beans compo-nent technology. If models are implemented as Javabeans, they can be easily linked using a Java visualdevelopment tool. These tools allow this linkage tobe done dynamically. Models do not need to be re-coded or recompiled to be included in a federation.A model federation may be assembled graphicallyand immediately executed. A developer can quicklyassemble a model federation by browsing one ormore model repositories to extract existing models.The elemental models making up the federationcould be drawn from sites all over the world.

• Embedded execution. Frequently, simulation usersare not principally interested in running simulationmodels. Rather simulation models assist them inmaking decisions. In addition, simulations may beuseful in tuning automated or semi-automated sys-tems. In such cases, it may be useful to have thesimulations simply run behind the scenes. One typeof embedding to be discussed later is query drivensimulation (QDS) [16]. In this case, simulation isembedded in an information system. Another ex-ample is embedding simulation within workflowtechnology for the purpose of design improvementand operational tuning [15]. Although embeddedsimulation is generally useful, a web-based andcomponent-based approach makes it easier to as-semble and modify the overall system.

• Agent-based execution. As is apparent from theprevious discussion, the execution environmentfor web-based simulation may be anywhere fromstraightforward to enormously complex. If it is notstraightforward, then users (e.g., simulation analystsor business decision makers) require help to executethe models. Rather than having a fixed way to exe-cute models, it would be better to have a dialog withthe user to determine what she/he wants to be done.Once this is known, resources should be enlisted toaccomplish what the user wants. Agent technologyfacilitates flexible solutions to such complex prob-lems. One agent may interact with the user, andthen based upon profiles of other specialized agents,take a contract with them to perform the work. Theagents collaborate to solve the overall problem.

2.1. Component-based simulation environments

Although web-based simulation is useful and viablewithout software component technology, utilization ofcomponents increases the potential of web-based sim-ulation.

During the 1990s, simulation software has uti-lized the advantages of object-oriented programming(OOP). The next step in software development is com-ponent software. Component software begins whereOOP left off and adds capabilities to maximize soft-ware reuse and facilitate rapid development throughassembling components rather than traditional cod-ing. Graphical/visual design tools are typically usedin this assembly process.

Page 4: The JSIM web-based simulation environment

122 J.A. Miller et al. / Future Generation Computer Systems 17 (2000) 119–133

Component-based software development systemsmay support some or all of the following capabilities:• Object-oriented programming. Under OOP, soft-

ware is developed as objects consisting of attributes(data members) and methods (member functions).The advantages of encapsulation, inheritance andpolymorphism have been well documented.

• Persistence. Mechanisms are provided to save andrestore the state of executing objects with little orno programming. Traditionally, these operations re-quired a substantial amount of custom coding.

• Introspection. By following certain coding conven-tions (design patterns) and by providing supplemen-tary classes, different software components can bemade to interact without any custom coding. Forexample, one class may inquire about properties,methods or events of other classes. Properties areappearance or behavioral attributes that are exposed(e.g., by get/set methods) to other classes or visualtools.

• Distribution. Although not a requirement, it is use-ful to be able to have components work togethereven if they are not executing on the same machine.This is facilitated by providing high-level mecha-nisms for distributed object-to-object communica-tion typically through remote method calls or re-mote handling of events.

• Platform independence. While “Write-Once, RunAnywhere” is not a requirement, it certainly sim-plifies the developer’s job. If this is fully supported,any object can be downloaded to any machine andexecuted without recoding or even recompiling.At present, web-enabled software components may

be developed with either Active X or Java beans.Java beans have the advantages of platform indepen-dence and a simpler programming environment (fullobject-orientation, automatic garbage collection, safeuse of memory and a straightforward approach to mul-tithreading).

Java and Java beans technology provide an excel-lent foundation for web-based simulation. Java’s onlyclear disadvantage, its speed compared to compiledlanguages like C++, is becoming less of an issue asjust-in-time (JIT) and native-code compilers arebecoming available.

Much of the current research in web-based simula-tion involves the development of simulation systemsand environments implemented in Java:

• JSIM [11,13,17],• SimKit [2],• SimJava [10,18],• Silk [8], and• JUST [19].

3. Overview of JSIM

JSIM consists of three layered groups of packages:foundation packages, engine packages and environ-ment packages (see Fig. 1). Each of these layers isbriefly described below.1. Three Foundation packages. This bottom layer con-

sists of thequeue , statistic and variatepackages. These packages are generally useful insimulation as well as in other related applicationdomains.• The queue package is rooted by theQueue

class which is defined as an abstract base class,from which FIFO Queue, LIFO Queue, Priori-tyQueueandTemporalQueueare derived. Splaytrees are used to implement priority and tempo-ral queues, and simple lists are used to imple-ment the FIFO and LIFO queues. Priority andtemporal queues may be used for lines orderedby priority as well as to implement Future EventLists (FELs) and time advance mechanisms.

Fig. 1. Layers of packages.

Page 5: The JSIM web-based simulation environment

J.A. Miller et al. / Future Generation Computer Systems 17 (2000) 119–133 123

• The statistic package contains classes tocollect statistical information. TheStatisticclassis an abstract base class and contains methodsto analyze statistical data and aid in outputtingsimulation results. TheSampleStatandTimeStatclasses extend the baseStatisticclass.Sample-Statis used for collecting sample statistical data(via its tally method), while theTimeStatclassis used to gather time-persistent statistics (viaits accumulatemethod). TheStatisticclass hasthe ability to calculate minimums, maximums,means, variances, standard deviations, root meansquares and confidence interval half widths. Thepackage also contains aBatchStatisticclass de-rived from SampleStatwhich is used to collectbatch statistics. Finally, histograms can be pro-duced using theHistogramclass.

• Thevariate package provides a wide varietyof random variates. TheVariate class is a baseclass from which all other variates are extended.The Variate class uses JSIM’s own linear con-gruential generator calledLCGRandom, but thiscan be changed very easily to use Java’sRan-domclass by modifying the code of theVariateclass. It is also a simple matter to install yetanother random number generator. JSIM hasimplementations of 14 continuous random vari-ate generators and eight discrete random variategenerators. The discrete random variates avail-able in JSIM’svariate package areBernoulli,Binomial, DiscreteProb, Geometric, HyperGeo-metric, NegativeBinomial, Poisson,and Randi.The continuous random variates available areBeta, Cauchy, ChiSquare, Erlang, Exponential,F Distribution, Gamma, HyperExponential,LogNormal, Normal, StudentT, Triangular, Uni-form, andWeibull. The algorithms for these ran-dom variate generators may be found in [9,20].

2. Two Engine packages.This middle layer supportsthe two most popular simulation world views orparadigms. Theevent package supports the con-struction of event-scheduling type models, whilethe process package supports the constructionof process-interaction type models.• The event package can be used to build

event-scheduling simulation models. Theevent package is composed of the classesEvent, Entity andScheduler. TheEventclass is

used to code event routines, e.g., what happensat an arrival event. TheEntity class is used tomaintain information about entities (e.g., cus-tomers) in the simulation. Finally, theSchedulerclass is used to schedule future events by puttingthem into the FEL.

• The process package provides classes thatare used to create simulation models followingthe process-interaction paradigm. A simulationmodel may be encapsulated as a Java bean. Suchbean objects contain severalDynamic Nodes.Currently, Server, Facility, Signal, Sourceand Sink are provided as types ofDynamicNodes. These nodes are connected with edgeswhich Transportentities (SimObjects) betweenthe nodes. AModel object is used to controlthe simulation by starting all of theSourcesas well as stopping the simulation. If anima-tion is to be performed, the model creates aModelCanvasobject in which it displays theanimation.

3. Four Environment packages. This top layer pro-vides a flexible environment for web-based simu-lation.• Thejmodel package provides a visual designer

for the process package. The designer’s ren-dering of the model may be animated when thesimulation is run.

• The jquery package consists of general pur-pose code enabling models to access databases.It consists of beans to access databases utilizingJDBC.

• The runAgency package controls the execu-tion of one or more models. The beans in thispackage spare users many details of executingmodels or model federations.

• The qdsAgency package provides a conve-nient means for accessing/generating simulationdata (i.e., for query driven simulation [16]). Thispackage allows simulation inputs and outputsto be stored in databases and simulation modelsto be launched as a part of query processing,thus providing a simple and unified view ofsimulation results whether they exist or not.

The last two packages are referred to as agenciessince they include Java beans capable of collabo-rating in order to make decisions (i.e., they includeagents).

Page 6: The JSIM web-based simulation environment

124 J.A. Miller et al. / Future Generation Computer Systems 17 (2000) 119–133

4. Process-oriented simulation and animation inJSIM

Process-oriented simulations typically are imple-mented by representing the life cycle of a simulationentity as a thread or coroutine. Since Java has built-insupport for threads, such implementations are simpli-fied. Threads modify the simulation state, carry out ac-tions over time, and wait for resources. The advance-ment of time as well as the control of execution (whichthread(s) gets to execute) is done most straightfor-wardly by using (i) a clock keeping track of simulated(or virtual) time and (ii) a FEL to determine the orderof thread activations. In the JSIM implementation, atmost three threads will be active simultaneously (thevirtual scheduler thread, the animation display thread,and the current simulation thread). Simulation threadsmay be a simulation entity (e.g., an ER patient), anentity source or a signal. Since only one simulationthread can be active at a time, race conditions as wellas complex synchronization code can be avoided. Thevirtual scheduler loops until the FEL is empty, pullingthe next thread activation off the FEL. Since the vir-tual scheduler runs at the lowest priority, the activatedthread will take control until it finishes. In addition,the animation display thread wakes up every so manymilliseconds, reads the state of the simulation to dis-play it graphically. This thread operates relatively in-dependently and in particular never modifies the sim-ulation state. Indeed, the animation could be placedin a separate package or bean without too much of anadverse effect on performance.

Animation may be turned off to maximize thespeed of the simulation. If animation is used, virtualtime simulation is still too fast for humans to followthe animation in detail. Consequently, the simula-tion/animation may be incrementally slowed down tothe speed most desirable to the user. This is done byplacing aThread.sleep method in the main loopof the virtual scheduler. This Java method will producea real time sleep of a given number of milliseconds.

It is also possible to use the built-in meth-ods provided by Java (e.g.,Thread.start andThread.sleep ) to control the activation of threadsas opposed to using the FEL. JSIM provides thisoption by using Java’s built-in (real time) clockSystem.currentTimeMillis . Using this ap-proach, several simulation threads may be active

simultaneously. Unfortunately, complex synchroniza-tion code must be added to eliminate race condition(such as entities disappearing for no reason). Conver-sion between a virtual time and real time simulationcan be done quite easily as they are unified by theClock class which includes a method to toggle be-tween these alternatives.

JSIM’s VirtualSchedulerclass as well as Java’sThread class provide the foundation for process-oriented simulations. JSIM builds several classes ontop of these, facilitating concise coding of simulationmodels as well as automatic code generation. JSIMprocess-oriented models may be viewed as directedgraphs (digraphs) with nodes connected by edges andentities flowing through the graph. We discuss JSIMmodels from this point of view in the subsequentsubsections.

4.1. SimObject class

A simulation model based on the process-interactionparadigm needs to define the entities and their lifecycle within the simulation model. An instance of theSimObjectclass represents a single simulation entityor process. The simulation model builder should ex-tendSimObjectto create useful simulation entity types(e.g., customer or patient). Precisely, the simulationmodel builder needs to specify the functioning or lifecycle of the simulation entity as required by the model.SimObjectextends theThreadclass provided by Java.Hence, every entity in a JSIM process-interactionmodel is a separate thread. ASimObject’s logic (be-havior during its lifetime) is defined by the modelbuilder by coding itsrun method.

4.2. DynamicNode class and its subclasses

DynamicNodeis an abstract class that encapsulatesthe features common to the classes that appear asnodes in a JSIM model, currently,Server, Facility, Sig-nal Sourceand Sink. Every such node collects twodifferent types of statistics, namely duration/time dataand occupancy/usage data. Suitable labels are createdusing the node’s name for display purposes.• Server class. A Serveracts as a service provider. It

initially creates a certain number of service units asdefined by the model builder, thus providing serversto SimObjects requesting service.SimObjects

Page 7: The JSIM web-based simulation environment

J.A. Miller et al. / Future Generation Computer Systems 17 (2000) 119–133 125

obtain service byrequesting a server and thenusing the server. If all the service units are busy,the client entity will be lost. Service may be pre-empted by invoking thepreempt method. Eachserver also maintains statistics regarding the usageof its service units and its clients’ service times.

• Facility class. A Facility is derived fromServersince it is most similar to this class. It encapsulates aQueueas a private data member. Simulation entities(SimObjects) obtain service by requesting a facilityusing therequestmethod. If the facility is not busy,the simulation entity acquires a server anduses it.However, if the facility is busy, the simulation en-tity is enqueued in the facility’sQueue. When thesimulation entity finishes its work, it releases theserver. ThequeueLengthmethod returns the lengthof the queue within the facility.

• Signal class. A Signalaffects the behavior of serversby alternatively increasing or decreasing the num-ber of service units. For example, a Signal may beused as a traffic light in a simulation of an inter-section of streets. When the signal turns on/green,servers/facilities (representing traffic lanes) in itscontrol list will have a service unit added (using theServerexpandmethod) so that traffic can flow. Con-versely, when the signal turns off/red, a service unitwill be removed (using the Servercontractmethod)to stop the traffic flow.

• Source class. A Sourceis a generator or creator ofentities (SimObjects). It createsSimObjects depend-ing on defined parameters such as inter-arrival timeor the number of entities to create. ASourcemustbe created for each entity type. Therun methodimplements the lifetime of theSourceclass. It hasbeen implemented to create an entity periodicallyaccording to the inter-arrival time distribution.

• Sink class. A Sinkis, conceptually, the opposite of aSourcein that a sink phases out or destroysSimOb-jects created by a source.SimObjects go to a sinkwhen they complete their lifetimes.SimObjects areeliminated at sinks using thecapturemethod.

4.3. Transport class

Objects from theTransportclass form the edges ofthe simulation model graph, with each connecting twonodes. Simulation entities orSimObjects travel alongtransports while moving from one node to another. A

transport has a default constant speed which may bechanged using theadjustSpeedmethod. Afterjoining atransport, an entity moves along the transport using themovemethod. Themovemethod returns false when theend of the transport is reached. Transports have beenimplemented as quad curves so that the model buildercan flexibly specify the edge connecting two nodes.Quad curves are part of the Java 2D API and specifya curve as a quadratic function ofx andy coordinates.

4.4. Model class

The Model class is derived from (extends)Frame,allowing multiple models to be run simultaneously,each in a separate window frame. It also implementsthe Runnableinterface and itsrun method starts offall Sourceobjects. Then, until the simulation is over,it periodically wakes up to repaint the animation can-vas. When the simulation is over, it displays statisticalsummary results.

4.5. Animation

In Java, animations are relatively easy to create sinceJava provides high-level graphics/GUI packages andAPIs (e.g., awt, swing, 2D API and 3D API). JSIMdesigns can be animated by reusing much of the codeused for the visual designer. Animation brings thedesign diagram to life. For JSIM, models consist ofentities flowing through graphs (or networks). Eachnode and edge has fixed coordinates determined by theJMODEL visual designer. (Alternatively, coordinatescan be given in hand-coded constructor calls.) As en-tities flow, their coordinates are repeatedly updated.The Model class has adisplayThreadthat wakes upperiodically to repaint all the nodes, edges and enti-ties. Smooth motion is obtained by updating the coor-dinates of entities sufficiently often. AModel objectinitially creates an off-screen graphics buffer of thesame size as its actual on-screen graphics buffer. Itthen paints this off-screen graphics buffer. After this,it paints the off-screen buffer onto the screen by copy-ing it onto the on-screen graphics buffer. This tech-nique, referred to asdouble buffering, is a good wayto reduce flicker in animation. Animation is a use-ful tool in checking the correctness of a model. Thesimulation model builder can track the movements ofsimulation entities through the model. It is also useful

Page 8: The JSIM web-based simulation environment

126 J.A. Miller et al. / Future Generation Computer Systems 17 (2000) 119–133

for clients as well as model builders, since it is ofteneasiest to understand the simulation model by lookingat animations. Currently, JSIM uses Java’s 2D API todraw/paint shapes onto the screen.

5. The JSIM simulation environment

As previously discussed, an environment to supportweb-based simulation has greater demands on it be-cause of the potentially huge scale and scope. In addi-tion, web users are not inclined to work with systemsthat are not easy to use. To deal with this situation, theJSIM simulation environment currently consists of thefour packages: thejmodel , jquery , runAgencyandqdsAgency packages.

5.1. Thejmodel package

JSIM provides a visual model designer imple-mented using the Javaswing package. It is aGUI-based model builder that supplies simulationistswith more direct intuitive means to build a model.It allows users to position a simulation object on amodel-builder canvas by selecting a button from thetool-bar and then clicking on a location on the canvasto place the object (e.g., server node). Although JSIMis designed to allow models to be rapidly hand codedutilizing JSIM’s extensive class library, the easiestway to create a model is to use JSIM’s visual designer,JMODEL. JMODEL provides several buttons to con-trol the construction of a model on a canvas. The con-trol buttons currently provided are shown in Table 1.

Models are built visually by clicking on a buttonto set the designer mode. Then, when the mouse is

Table 1JMODEL’s control buttons

Server Provides service to entities arriving at the nodeFacility Inherits from server and adds a queue to hold

waiting entitiesSignal Alters the number of service units in a server(s)Source Produces entities with random inter-arrival timesSink Consumes entities and records statistics about themTransport Connects two nodes (from, to) togetherMove Relocates nodes to new positions in the canvas

(edges follow)Delete Deletes nodes or edges by clicking on themUpdate Views/changes the properties of selected nodesGenerate Emits Java code implementing the designed model

clicked, an action will be performed at its locationin the drawing canvas. For example, if in “Facility”mode, a new facility will be drawn at the location (seeFig. 2). To connect two nodes with a transport, enter“Transport” mode and then click on the two nodes.This will cause a straight line to be drawn. To producea curve, click on a point outside the nodes to serve asa control point.

The code in thejmodel package was created to beeasily extensible. Each node in the graph is a polygonso that adding new shapes to represent new types ofnodes is easy. Similarly, each edge in the graph is aquad curve allowing flexible pathways between nodes.

5.2. Thejquery package

The jquery package contains classes and beansmaking it easy for other components to access re-lational (e.g., Mini SQL) and object-relational (e.g.,Oracle 8) databases. JSIM can be linked to a vari-ety of database management systems because of itsreliance on Java database connectivity (JDBC). Typi-cally, this is as easy as changing the connection spec-ification (e.g., to change the connection specificationfrom Mini SQL to Oracle, simply change the url asshown below).

url =′′jdbc:msql://orion.cs.uga.

edu:1888/jsim ′′;url =′′jdbc:oracle:thin://orion.cs.

uga.edu:1521 ′′;In the worst case, the JDBC driver may need to bechanged, but this only effects a few lines of code sincethe JDBC API is the same in any case.

A couple of important beans in this package are thefollowing.• DbQuery bean. TheDbQuery bean responds to

events that embed SQL queries. Using JDBC itsends a query to the designated database and placesthe results in an AbstractTableModel allowing theresults to be readily sent back to the requester ordisplayed.

• DbUpdate bean. TheDbUpdate bean similarlyresponds to events that embed SQL updates. Itmay be used by model beans in order to store theirresults in databases. This makes it easy to run

Page 9: The JSIM web-based simulation environment

J.A.

Mille

re

ta

l./Fu

ture

Ge

ne

ratio

nC

om

pu

ter

Syste

ms

17

(20

00

)1

19

–1

33

127

Page 10: The JSIM web-based simulation environment

128 J.A. Miller et al. / Future Generation Computer Systems 17 (2000) 119–133

models with or without a database, or switchdatabases since the association between the beansis established dynamically.

5.3. TherunAgency package

In JSIM, models may be formed as Java beans sothat model federations may be dynamically formedout of simpler models and immediately executed. Inaddition, models may be dynamically associated withbeans from the environment. Model beans may beeither atomic or composite, and may be assembled intomodel federations.

5.3.1. Atomic/composite modelsThe simplest type of model is an atomic model.

An atomic model is built as a connected digraph witha single source and a single sink. The source is theproducer of entities (e.g., customers) that flow throughthe graph to be consumed by the sink. All other nodesmust have both incoming and outgoing edges.

A composite model consists of two or more modelssharing a common environment and display frame.Since general models may have multiple sources,different types of entities can be created (e.g.,McDonald’s customers and Wendy’s customers).These flows may be independent (no shared nodes),competing (shared nodes), or interacting (one playingclient role and other playing server role). Allowingdigraphs with multiple sources and sinks introducescomplex issues of well-formedness.

Composite models may be formed by combiningtwo or more simpler existing models. This is done byloading the two models into thejmodel designer andallowing the user to link them as appropriate. Newcode is then generated for this composite model. Notethat synthesizing a new composite model is less dy-namic than assembling a new model federation. Thisis because elements are more tightly coupled in a com-posite model (e.g., they share a common FEL).

A simple illustration of a composite model is theFoodCourtexample. It contains twoSources, threeFa-cilities and twoSinks forming two digraphs. The topdigraph represents a fast food establishment in whichmultiple clerks are fed by individual queues (as is doneat McDonald’s), while the bottom digraph representsan establishment in which the multiple clerks are fedby a single queue (as is done at Wendy’s). A screen-

shot of the animation of this model is shown in Fig. 3.This is a classic comparison of a G/G/2 queue versustwo G/G/1 queues.

5.3.2. Assembling models into a model federationModels can be assembled to form a model feder-

ation without requiring any traditional programming.Each model may be represented by an icon and imple-mented as a Java bean. A designer can select from ex-isting models to dynamically build a model federation.Individual models in the federation are linked via Javabean events. When an entity in one model reaches asink, an external event can be triggered which will behandled in another model. Handling the external eventwill cause an entity to be created by a source in thatmodel. Effectively, one model is able to interact withanother model (by injecting an entity). (Currently, weassume that entity injection occurs “now” in the tar-get model with appropriate method synchronization toprevent race conditions. If a time,t, is given for en-tity injection, it is possiblet could be in the past forthe target model, so techniques for parallel simulationwould be needed.)

Such interactions require that sinks in one modelbe linked to sources in another model. This linkageis not designed or coded in, but rather establisheddynamically using the facilities of visual develop-ment tools like the BeanBox in the Beans Devel-opment Kit (BDK), Java Studio or Visual Cafe,etc.

Consider the following situation (theFoodAnd-Health model federation) as one to connect the twomodels. Some of the customers leaving theFoodCourtfind that they are feeling ill, so with probabilitytrig-gerProb they choose to go to a hospital emergencyroom (ER). Patients enter the ER and wait to see theTriage Nurse, who will decide whether the patientwill see the Physician’s Assistant or one of the ERDoctors. Before this step, the patient must registerwith the Admit Clerk. A screenshot of this model isshown in Fig. 2. TheSignal is used to periodicallychange the number of ER Doctors on duty.

TheFoodCourtandERmodels can be easily assem-bled into a model federation. For example, using theBDK bean box one would carry out the followingsteps:1. Select theFoodCourtmodel/bean from the tool box

and drag-and-drop it into the bean box.

Page 11: The JSIM web-based simulation environment

J.A. Miller et al. / Future Generation Computer Systems 17 (2000) 119–133 129

Fig. 3. Screenshot of FoodCourt animation.

2. Adjust any of the properties using the BDK prop-erty editor.

3. Do the same with the ER model/bean.4. Edit theFoodCourt’s events and connect itsEnti-

tyEvents to the ER by clicking on the ER’s iconin the bean box. This will enable theFoodCourtmodel to feed the ER model.

5. Select the appropriate method from the event targetdialog box which pops up.The selected method will be executed when these

events occur. The events will be constructed andbroadcast when an entity is captured by aSink in theFoodCourtbean. This will cause theSourcein the ERbean to create and start (i.e., inject) a new entity. Ba-sically, Sink.capturecalls Model.triggerEntityEventwhich constructs and broadcasts anEntityEventto alltargets (specified or linked dynamically and graphi-cally using the BeanBox). The adaptor class (which isautomatically generated at event linkage time) listensfor any EntityEvents. When it hears one, it will callER.injectEntity(also established at linkage time). This

method then callsSource.startEntitywhich injects anew entity into the ER in response to this externalstimulus. These injected entities are in addition to anythat theSourcewould normally (internally) produce.

When the model federation is executed, each modelis animated in a separate frame. The models mayrun independently, but will typically interact throughexternal events created by one model being handledby another. The animation of a very complex modelis hard to watch in its totality and make any senseof it. With multi-frame animation, one can easilyfocus in on parts of the simulation by bringing therelevant window frames into the foreground of thescreen.

A JSIM model federation is run (executed) by beansfrom the runAgency. The principal agents controllingthe execution are described below.• ModelAgent beans. AModelAgent is respon-

sible for executing a JSIM model. It will start up themodel for a certain amount of time/work. The modelwill report back the results of this run/batch. The

Page 12: The JSIM web-based simulation environment

130 J.A. Miller et al. / Future Generation Computer Systems 17 (2000) 119–133

model agent will then, based on the selected outputmethodology [1,4,9], either terminate or continuethe execution (more runs or batchs) of the model.The JSIM approach is very modular and flexibleallowing new model agents to be added at anytime so long as they follow the rules of the game.Currently, two types of model agents have beenimplemented — one implementing the method ofindependent replications and the other implement-ing the method of batch means.

• ScenarioAgent beans. The overall control of theexecution of a model federation is the responsibil-ity of the ScenarioAgent . After collaboratingwith other agents to choose an approach to execut-ing the model federation, the scenario agent will in-form the model agents to use an appropriate outputanalysis methodology (e.g., method of independentreplication, method of batch means) as well as ap-propriate goals (e.g., confidence levels and relativeprecisions).

Fig. 4. Beans in theqdsAgency .

An example of the execution framework forFoodAndHealth model federation is shown in Fig. 4.It depicts the arrangement of theFoodCourtand ERbeans as well as their relationships in the bean box.

5.4. TheqdsAgency package

Simulation can be embedded in other systems inseveral ways. One such approach, referred to as querydriven simulation (QDS), is based on the tenet thatsimulation analysts as well as naive users should seea system based upon QDS as a sophisticated informa-tion system, one that uniformly enables the retrieval orgeneration of information about the behavior of sys-tems under study [12,14,16]. This means that the usermust be provided with an easy to use environmentwhere she/he may trigger complex actions by enteringa simple query, e.g., on a form.

Simulation is often a computationally intensive andcostly exercise. Hence, it only makes sense that simu-

Page 13: The JSIM web-based simulation environment

J.A. Miller et al. / Future Generation Computer Systems 17 (2000) 119–133 131

lation results be stored for future use. Database man-agement systems provide efficient techniques for thestorage, manipulation and retrieval of large amountsof data. Consequently, a QDS system should usedatabases to store simulation results as well as sim-ulation models. In addition, other information usefulfor decision making would be stored and associatedwith the simulation data.

When a user queries a simulation system based onQDS, the system first tries to locate the required infor-mation in the database since it might have been storedas the result of an earlier model execution. If the re-quired data is present, it is simply retrieved and pre-sented to the user. If it is not present, the QDS systeminstantiates the relevant model (or models), executesit (or them) and shows the results of the execution tothe user.

Fig. 5. Beans in theqdsAgency .

The principal agent that facilitates a user’s in-teraction with the QDS system is theQdsAgentbean. It is assisted by theModelBrowser andResultBrowser beans. A typical session involv-ing an user and the QDS system can be explained asfollows (see Fig. 5).1. Start theQdsAgent .2. Browse or query the available models or model fed-

erations. This work is done by theModelBrowserat the request of theQdsAgent .

3. Once the user selects a model or model federa-tion of interest, theQdsAgent allows the userto browse the corresponding simulation resultsusing the ResultBrowser . Alternatively, theuser may define a scenario of interest for themodel or model federation. This is facilitatedby the QdsAgent obtaining the list of model

Page 14: The JSIM web-based simulation environment

132 J.A. Miller et al. / Future Generation Computer Systems 17 (2000) 119–133

parameters from the database (including defaultvalues).

4. After parameter specification, theQdsAgentchecks the database to see if information ex-ists regarding the prior execution of the selectedmodel or model federation with the given pa-rameter values. If the simulation results exist, theQdsAgent retrieves them from the database viathe ResultBrowser . If not, the QdsAgentcollaborates with aScenarioAgent to executea model or model federation with the given param-eters. Execution will cause the results to be storedin a database. The results can now be shown usingtheResultBrowser .

6. Conclusions

The JSIM web-based simulation environmentprovides the following advantages over conventionalsimulation environments:• JSIM supports the distribution of both simulation

results and simulation models, since they can beaccessed over the web. This provides the potentialto make simulation analysis much more widelyavailable.

• JSIM supports universal portability in that modelscan be run essentially anywhere. The use of theJava language along with its comprehensive classlibraries make this possible. The use of JDBCmakes it easy to switch between several databasemanagement systems.

• JSIM supports the dynamic assembly of modelfederations. By utilizing component-based tech-nology, in this case Java beans, the environment isbuilt up from reusable software components thatcan be dynamically assembled using visual devel-opment tools. Model beans can be linked to formmodel federations and may be linked to environ-ment beans to control their execution and save theirresults in databases.

• JSIM provides simple and uniform access to sim-ulation results based on the notion of query drivensimulation. The users simply ask for informationand it is up to the system to figure out how toget it, e.g., by accessing databases and/or runningsimulation models.

Besides JSIM’s use as a research testbed forweb-based simulation, it can also be used to teachsimulation (it has been used in the CS 421/621simulation course at the University of Georgia). Inaddition, it has been coded in a very modular andstraightforward way so that it can be readily extendedby others. JSIM is freely available for downloadat http://orion.cs.uga.edu:5080/ ∼jam/jsim.

Future releases of JSIM will exploit the capabilitiesof new Java APIs in order to enrich the visual appear-ance, the distributed capabilities and the interoperabil-ity of the system.• Java 3DThis API will allow models to have incre-

ased visual richness. At the same time, we will intro-duce additional types of nodes as well as conditionalbranching between nodes. The visual designer cur-rently only supports probabilistic branching.

• Enterprise Java beans (EJB). This API will allowinteracting models to be run on multiple machinesjust as easily as they are now run on a single ma-chine. Furthermore, complete JSIM simulation en-vironments will be run as distributed systems onheterogeneous platforms. In addition to EJB, remotemethod invocation (RMI), Java IDL (CORBA) andServlet technology will be explored.

• XML for data interchange. The eXtensible MarkupLanguage (XML) promises to not only become thenew improved HTML, but will likely become thestandard for data interchange between a variety ofsystems, tools and applications, thus simplifying in-teroperability. As one example, JSIM now uses Javaio serialization to savejmodel designs. This bi-nary data may either be stored in files or databases(e.g., as binary large objects (BLOBs)). Utilizingwork in currently ongoing projects to serialize Javaobjects as XML documents, JSIM objects can be di-rectly stored in object-oriented or object-relationaldatabases without any custom coding.

References

[1] J. Banks, J. Carson, B. Nelson, Discrete-Event SystemSimulation, 2nd ed., Prentice-Hall, Upper Saddle River, NJ,1996.

[2] A. Buss, K. Stork, Discrete Event Simulation and World-WideWeb Using Java, in: Proceedings of the 1996 WinterSimulation Conference, Coronado, CA, 1996, pp. 780–785.

Page 15: The JSIM web-based simulation environment

J.A. Miller et al. / Future Generation Computer Systems 17 (2000) 119–133 133

[3] A. Ferscha, M. Richter, Java based cooperative distributedsimulation, in: Proceedings of the 1997 Winter SimulationConference, Atlanta, GA, 1997, pp. 381–388.

[4] G. Fishman, S. Yarberry, An implementation of the batchmeans method, INFORMS J. Comput. 9 (3) (1997) 296–310.

[5] P. Fishwick, Web-based simulation: some personalobservations, in: Proceedings of the 1996 Winter SimulationConference, Coronado, CA, 1996.

[6] P. Fishwick, An architectural design for digital objects, in:Proceedings of the 1998 Winter Simulation Conference,Washington, DC, 1998, pp. 359–365.

[7] P. Fishwick (Ed.), Proceedings of the 1998 InternationalConference on Web-based Simulation and Modeling,Society for Computer Simulation, San Diego, CA, 1998(http://www.cise.ufl.edu/ fishwick/webconf/full).

[8] K. Healy, R. Kilgore, Silk: a Java-based process simulationlanguage, in: Proceedings of the 1997 Winter SimulationConference, Atlanta, GA, 1997, pp. 475–482.

[9] A. Law, W. Kelton, Simulation Modeling and Analysis,McGraw-Hill, New York, NY, 1982.

[10] R. McNab, F. Howell, Using Java for discrete eventsimulation, in: Proceedings of the 12th UK Computerand Telecommunications Performance Engineering Workshop(UKPEW), University of Edinburgh, 1996, pp. 219–228.

[11] J. Miller, Y. Ge, J. Tao, Component-based simulationenvironments: JSIM as a case study using Java beans, in:Proceedings of the 1998 Winter Simulation Conference,Washington, DC, 1998, pp. 373–381.

[12] J. Miller, K. Kochut, W. Potter, E. Ucar, A. Keskin,Query-driven simulation using Active KDL: a functionalobject-oriented database system, Int. J. Comput. Simulation1 (1) (1991) 1–30.

[13] J. Miller, R. Nair, Z. Zhang, H. Zhao, JSIM: a Java-basedsimulation and animation environment, in: Proceedings ofthe 30th Annual Simulation Symposium, Atlanta, GA, 1997,pp. 31–42.

[14] J. Miller, W. Potter, K. Kochut, O. Weyrich, Modelinstantiation for query driven simulation in Active KDL,in: Proceedings of the 23rd Annual Simulation Symposium,Nashville, TN, 1990, pp. 15–32.

[15] J. Miller, A. Sheth, K. Kochut, X. Wang, A. Murugan,Simulation modeling within workflow technology, in:Proceedings of the 1995 Winter Simulation Conference,Arlington, VA, 1995.

[16] J. Miller, O. Weyrich, Query driven simulation usingSIMODULA, in: Proceedings of the 22nd Annual SimulationSymposium, Tampa, FL, 1989, pp. 167–181.

[17] R. Nair, J. Miller, Z. Zhang, A Java-based query drivensimulation environment, in: Proceedings of the 1996 WinterSimulation Conference, Coronado, CA, 1996, pp. 786–793.

[18] E. Page, R. Moose, S. Griffin, Web-based simulation inSimJava using remote method invocation, in: Proceedings ofthe 1997 Winter Simulation Conference, Atlanta, GA, 1997,pp. 468–474.

[19] M. Pidd, R. Cassel, Three phase simulation in Java, in:Proceedings of the 1998 Winter Simulation Conference,Washington, DC, 1998, pp. 367–371.

[20] A. Pritsker, Introduction to Simulation with SLAM II, 3rded., Wiley, New York, NY, 1986.

John A. Miller is an Associate Profes-sor and the Graduate Coordinator in theDepartment of Computer Science at theUniversity of Georgia. His research inter-ests include database systems, simulationand workflow as well as parallel and dis-tributed systems. Dr. Miller received theB.S. degree in Applied Mathematics fromNorthwestern University in 1980, and theM.S. and Ph.D. in Information and Com-

puter Science from the Georgia Institute of Technology in 1982 and1986, respectively. During his undergraduate education, he workedas a programmer at the Princeton Plasma Physics Laboratory. Dr.Miller is the author of over 60 technical papers in the areas ofdatabase, simulation and workflow. He has been active in the orga-nizational structures of research conferences in all these three areas.He has served in positions from Track Coordinator to PublicationsChair to General Chair of the following conferences: Annual Simu-lation Symposium (ANSS), Winter Simulation Conference (WSC),Workshop on Research Issues in Data Engineering (RIDE), NSFWorkshop on Workflow and Process Automation in InformationSystems, and Conference on Industrial and Engineering Applica-tions of Artificial Intelligence and Expert Systems (IEA/AIE). Heis an Associate Editor for ACM Transactions on Modeling andComputer Simulation and has been a Guest Editor for the Interna-tional Journal in Computer Simulation as well as IEEE Potentials.

Andrew F. Seila is an Associate Profes-sor in the Department of MIS in the TerryCollege of Business at the University ofGeorgia, Athens, GA. He received his B.S.in Physics and Ph.D. in Operations Re-search and Systems Analysis, both fromthe University of North Carolina at ChapelHill. Prior to joining the faculty of theUniversity of Georgia, he was a Mem-ber of Technical Staff at the Bell Labora-

torites in Holmdel, NJ. His research interests include all areas ofsimulation modeling and analysis, especially output analysis andsimulation-based decision support. He is co-author of a forthcom-ing textbook on simulation to be published by Duxbury Press. Hispapers have appeared in numerous journals and he has been ac-tively involved in the Winter Simulation Conference since 1977,having served as Session Organizer and Chair for many years andas Associate Program Chair for the 1993 conference and ProgramChair for the 1994 conference.

Xuewei Xiang is a member of the technical staff at the SprintApplied Technology Center located in Atlanta, Georgia. He re-ceived his M.S. in Computer Science in 1999 from the Universityof Georgia. His research interests include simulation, Web-basedinformation systems, and component based software development.