Web-based Simulation
description
Transcript of Web-based Simulation
Web-based SimulationWeb-based Simulation
Course: 60-520Course: 60-520Instructor: Dr. A.K. AggarwalInstructor: Dr. A.K. Aggarwal
By Sheng BaiBy Sheng Bai
AgendaAgenda
• IntroductionIntroduction
• Client-basedClient-based
• Server-basedServer-based
• DistributedDistributed
• SummarySummary
• ReferenceReference
What’s SimulationWhat’s Simulation
• Building a softwareBuilding a software
• Based on an algorithmic logicBased on an algorithmic logic
• Simulate some phenomenonSimulate some phenomenon
• With some purposeWith some purpose– Observing systemsObserving systems– Finding analytical solutionsFinding analytical solutions– Predicting system behaviorsPredicting system behaviors
Types of simulationTypes of simulation
• Stochastic or deterministicStochastic or deterministic
• Continuous or discreteContinuous or discrete
• Local or distributedLocal or distributed
Web-based SimulationWeb-based Simulation
• A driver of software technologiesA driver of software technologies
• A rapidly emerging areaA rapidly emerging area– WEBSIM;WEBSIM;– Winter Simulation Conference Sessions;Winter Simulation Conference Sessions;– WSC Modeling Methodology Track;WSC Modeling Methodology Track;
• Java Java
ClassificationClassification
• Client-basedClient-based
• Server-basedServer-based
• DistributedDistributed
Client-based Client-based
• Browser & Server StructureBrowser & Server Structure
• Download logic to client sideDownload logic to client side
• Running and analyzing on client’s Running and analyzing on client’s sideside
• No communications during the No communications during the simulationsimulation
• Implementation: simjavaImplementation: simjava
simjavasimjava
• A discrete event simulation package A discrete event simulation package
• A Java port of a C++ library, HASE+A Java port of a C++ library, HASE++ +
• HASE++ is based on Jade’s SIM++HASE++ is based on Jade’s SIM++
• A collection of A collection of entities: Sim_entityentities: Sim_entity
• Entities are Entities are connected by connected by ports: Sim_portports: Sim_port
• Communication via Communication via using event using event objects: Sim_eventobjects: Sim_event
• Central controller: Central controller: Sim_systemSim_system
Process Process
Sim_system
.initialize()
Source
Sim_entity
Sink
Sim_entity
Sim
_syste
m.a
dd
()
Sim
_syste
m.a
dd()
Sim_system.link_ports ("Sender", "out", "Receiver", "in");
Sim_system.run()
out in
Sim_port
Sim_port
Animation Animation
• Package: simanim;Package: simanim;
• Class: Anim_applet;Class: Anim_applet;
• Method: Anim_applet.anim_init();Method: Anim_applet.anim_init();
• Driven by trace output of simulationDriven by trace output of simulation– S tracesS traces– P tracesP traces
DemonstrationDemonstration
Analyzing simulation Analyzing simulation resultsresults
• Package: simdiagPackage: simdiag• Java Beans:Java Beans:
– TimingDiagramTimingDiagram– TraceSaverTraceSaver– TraceLoaderTraceLoader– GraphDiagramGraphDiagram
TimingDiagramTimingDiagram
• Stat timing window in anim_init()Stat timing window in anim_init()• Attach to a trace saverAttach to a trace saver• A TraceEventObjectA TraceEventObject
– Trace lineTrace line– A command:A command:
•TRACE; LAYOUT; RUN; PAUSE; STOP; DISPLAYTRACE; LAYOUT; RUN; PAUSE; STOP; DISPLAY
Example trace FileExample trace File
$types $types State IDLE BUSY SEND RECV State IDLE BUSY SEND RECV
$bars $bars p[0] State p[0] State p[1] State p[1] State
$events $events u:p[0] at 1.234: P IDLE u:p[0] at 1.234: P IDLE u:p[1] at 4.567: P BUSY u:p[1] at 4.567: P BUSY ......
TimingDiagramTimingDiagram
GraphDiagramGraphDiagram
GraphDiagramGraphDiagram
Problems Problems
• Take time to downloadTake time to download
• Unsteady performanceUnsteady performance
• Can’t run sophisticate simulationsCan’t run sophisticate simulations
Server sideServer side
• RMI (Remote Method Invocation)RMI (Remote Method Invocation)– Distributed simjavaDistributed simjava
• EJB (Enterprise JavaBeans)EJB (Enterprise JavaBeans)– JSIMJSIM
RMI ArchitectureRMI Architecture
User Machine
Web Browser
Server
RMI Runtime
Process Process
Sim_system
Source Sink
Client Applet
Sim_systemRI
Sim
_syste
m.a
dd()
Sim
_syste
m.a
dd()
Sim_system.link_ports ("Sender", "out", "Receiver", "in")
java.rmi.Remote
implements Sim_systemRI
EJBsEJBs
• Independence form messaging Independence form messaging middleware, transaction support, middleware, transaction support, naming & directory services…naming & directory services…
• Delegates difficult tasks to EJB serverDelegates difficult tasks to EJB server
• Simplify application developmentSimplify application development
Client-Server InteractionClient-Server Interaction
JSIM ArchitectureJSIM Architecture
Simulation processSimulation process
Distributed systemDistributed system
• EJB solution has all the tradition EJB solution has all the tradition weakness weakness
• ReuseReuse
• CollaborateCollaborate
Standardization Standardization
• High Level Architecture (DoD)High Level Architecture (DoD)• Components based ArchitectureComponents based Architecture• Runtime infrastructure (RTI)Runtime infrastructure (RTI)
– Federation managementFederation management– Declaration managementDeclaration management– Object managementObject management– Ownership managementOwnership management– Time managementTime management– Data distribution managementData distribution management
Solution: Jini & XML + JSIMSolution: Jini & XML + JSIM
• Jini: a universal network-computing Jini: a universal network-computing modelmodel
• XML: a universal format for data XML: a universal format for data exchangeexchange
JiniJini
• Java dynamic networkingJava dynamic networking
• Distributed, highly adaptive to changeDistributed, highly adaptive to change
• Open softwareOpen software
• Originally created by Sun Originally created by Sun MicrosystemsMicrosystems
• Contributed to Jini Community in 1999Contributed to Jini Community in 1999
Jini ArchitectureJini Architecture
InfrastructureInfrastructure ProgrammingProgramming
ModelModelServicesServices
BaseBase
JavaJavaJava VMJava VM Java APIsJava APIs JNDIJNDI
RMIRMI Java BeansJava Beans Enterprise Enterprise BeansBeans
Java SecurityJava Security …… JTSJTS
JavaJava
++
JiniJini
Discovery/Join Discovery/Join Leasing Leasing Printing Printing
Distributed Distributed Security Security
TransactionsTransactions Transaction Transaction Manager Manager
Lookup Lookup Events Events JavaSpaces JavaSpaces Service Service
InfrastructureInfrastructure
• Distributed securityDistributed security– Integrated into RMI, Integrated into RMI, – extends to world of distributed systemsextends to world of distributed systems
• Discovery/Join protocolDiscovery/Join protocol– Allows services to discover, advertiseAllows services to discover, advertise
• Lookup serviceLookup service– A repository of servicesA repository of services
Programming ModelProgramming Model
• Leasing interface Leasing interface – Allocating and Freeing resources Allocating and Freeing resources
• Event and notification interfaceEvent and notification interface– Enabling Event-based communication Enabling Event-based communication
• Transaction interfaceTransaction interface– Ensuring properly coordination of state Ensuring properly coordination of state
changes.changes.
ServicesServices
• Builds on top of InfrastructureBuilds on top of Infrastructure
• Has an interface defining its Has an interface defining its operationsoperations
• Both user and program orientedBoth user and program oriented
• Examples:Examples:– A printing serviceA printing service– A JavaSpaces serviceA JavaSpaces service– A transaction managerA transaction manager
1. Discovery1. Discovery
2. Join2. Join
3. Lookup3. Lookup
Process4: InvokeProcess4: Invoke
XMLXML
• Self-descriptive, text-based, universalSelf-descriptive, text-based, universal
• Two ways to access XML documentsTwo ways to access XML documents– Element level: standard APIsElement level: standard APIs
•Simple APIs for XML (SAX): efficientSimple APIs for XML (SAX): efficient
•Document Object Model (DOM): flexibleDocument Object Model (DOM): flexible
– Object level: programmatic manipulationObject level: programmatic manipulation• Java XML Data Binding project (Sun)Java XML Data Binding project (Sun)
•Dynamic XML (Object Space)Dynamic XML (Object Space)
JSIM Federated Simulation with JSIM Federated Simulation with Jini and XMLJini and XML
SummarySummary
• Three typesThree types
• A young disciplineA young discipline
• Reuse of existing simulation modelsReuse of existing simulation models
• Federated is the most promising oneFederated is the most promising one
ReferenceReference• [1] Xeuqin Huang and John A. Miller, "Building a Web-Based [1] Xeuqin Huang and John A. Miller, "Building a Web-Based
Federated Simulation System with Jini and XML," Proceedings of the Federated Simulation System with Jini and XML," Proceedings of the 34th Annual Simulation Symposium (ANSS'01), Seattle, Washington, 34th Annual Simulation Symposium (ANSS'01), Seattle, Washington, United States, April 2001United States, April 2001
• [2] Z.Y. Du, “LBSim: A Simulation System for Dynamic Load-[2] Z.Y. Du, “LBSim: A Simulation System for Dynamic Load-Balancing Algorithms for Distributed Systems”, Technical Report in Balancing Algorithms for Distributed Systems”, Technical Report in University of Windsor, Canada, 2004.University of Windsor, Canada, 2004.
• [3][3] John A. Miller, Andrew F. Seila and Xuewei Xiang, "The JSIM John A. Miller, Andrew F. Seila and Xuewei Xiang, "The JSIM Web-Based Simulation Environment," Future Generation Computer Web-Based Simulation Environment," Future Generation Computer Systems (FGCS), Special Issue on Web-Based Modeling and Systems (FGCS), Special Issue on Web-Based Modeling and Simulation, Vol. 17, No. 2 (October 2000) pp. 119-133. Elsevier Simulation, Vol. 17, No. 2 (October 2000) pp. 119-133. Elsevier North-Holland.North-Holland.
• [4] Ernest H. Page, Robert L. Moose Jr. and Sean P. Griffn, “Web-[4] Ernest H. Page, Robert L. Moose Jr. and Sean P. Griffn, “Web-based simulation in simjava using remote method invocation”, based simulation in simjava using remote method invocation”, Proceedings of the 29th conference on Winter simulation Atlanta, Proceedings of the 29th conference on Winter simulation Atlanta, Georgia, United States, 1997Georgia, United States, 1997
• [5][5] Fred Howell and Ross McNab "simjava: a discrete event Fred Howell and Ross McNab "simjava: a discrete event simulation package for Java with applications in computer systems simulation package for Java with applications in computer systems modelling", in proc. First International Conference on Web-based modelling", in proc. First International Conference on Web-based Modelling and Simulation, San Diego CA, Society for Computer Modelling and Simulation, San Diego CA, Society for Computer Simulation, Jan 1998.Simulation, Jan 1998.
Questions?Questions?