Title: WebSim
1WebSim
- Introduction to Multi-user Web simulators
- By
- Murteza Salemi
- Jørgen Bjones
-
- Under supervision of
- Prof. Jose J. Gonzalez
2Contents
- What are WebSims?
- Demonstration of a multi-user simulator
- How to make a WebSim?
- Tools needed to make a WebSim
- Focus on multi-user simulators
- Showing the Java structure for the multi-user
simulator Beer Game
3What is WebSim?
- WebSim is a Java Applet allowing one or more
players to access a simulation model through a
web browser.
Server
Client
4Why use a WebSim?
- Publish a simulation model on the web
- Distribute models via an Intranet or the Internet
- Many players can participate on the same model at
the same time
5WebSim
- Examples of WebSim applications
(http//www.powersim.no)
6The Beer Game
- Classic simulation developed at Massachusetts
Institute of Technologys Sloan School of
Management in the 1960s. http//web.mit.edu/afs/at
hena.mit.edu/org/s/sloan/www/ - Simulation model used to illustrate delays in
supply chain management
7Beer Game Demonstration
- Ladies and Gentlemen fasten your seat belts
because here comes the
Beer Game Simulator
8 How WebSim structure is built?
Server
Client
WebServer
JBuilder, Visual J
Java Applet
Web Browser
Metro Server
Powersim Exporter
Powersim Constructor
Model
9How to make a WebSim?
- Following tools must be used
- Java programming tool (JBuilder)
10Powersim Constructor
- An example of a simulating model built with
Powersim Constructor tool.
11Powersim Metro Server
- Windows Socket based server, which allows client
applications to access a running simulation
across a network. - Capable of running both single- and multi-user
simulations.
Port nr. which the server and the client
communicate over
Clients IP address
12Some essential parts of Metro Server
The model Beer.sim
Session
Sessions label
Sessions identifier
Slot
Slots label
Slots Identifier
13Due to security restrictions in Java, Metro
Server has to run on the same computer as the web
server where the WebSim is published. The WebSim
front-end lies embedded in a web page on the
server, and the model that is to be used, lies in
the folder where Metro Server expects to find it
the Model Folder. The connection between the
WebSim and the Metro Server is done automatically
by the front-end, and there is therefore no other
actions that need to be done in order to set up
the WebSim. The Metro Server can be set up in
different ways. By default, the server listens to
communication port 7777, but if that port is used
by another service, another port can be assigned.
It may also be useful to test a new version of
Metro Server by setting the new version to listen
to a different "test" port.
14 The System Administrator can examine the current
status of the server. This allows him to monitor
how many sessions are active, how many simulation
streams are in use, etc. The System Administrator
can also examine various historical data about
the serving of WebSims, through the Event
Log. Metro Server provides a window for managing
sessions. Each session can be examined, showing
how many clients are connected, when the last
activity happened, how long the simulation model
has been run, etc. Sessions can also be
controlled by the system administrator. For
example, the system administrator may want to
delete a session that has had no activity for a
few hours.
15Finally, Metro Server provides a window to manage
connections. Each connection can be examined,
showing the IP address of the connected client,
and the average transfer time between the Metro
Server and the client. System administrators can
often diagnose problems by examining individual
connections in more detail.
16Metro Server gives the following possibilities
- Concurrent simulations
- Simulators with levels of difficulty
- Simulators with different user roles
17Concurrent simulations
Running the same simulation model
Several instances
18Simulators with levels of difficulty
Advanced
Intermediate
Beginner
19Simulators with different user roles
Sales Manager
Human Resources
Production Manager
20Multi-user simulations
Users
21Distributed simulations
22Web Server
- The web server holds the applet.
- The Metro Server must run at the same computer as
the web server where the WebSim is published.
Personal WebServer
23Powersim Exporter
- A tool to bind together the model and the Metro
Server
Metro Server
Exporter
Model
24Powersim Exporter
- Model Variables
- a model can have a lot of variables
- Public Variables
- but you want the user to see or manipulate some
of them - Slot Collection
- and possibly let different users access the
simulation in different ways (through different
slots)
25Powersim Exporter
Slot Collection. One slot is an entry point to
the model and each role in the model has its own
slot
A lot of model variables
A selection is made public
26Powersim Exporter
- Defines properties of public variables
- Read only
- Read/write
- Units
- Range
- etc
27Powersim Exporter
- Slot Collection
- Contains all slots that are available to the
model - A slot is an entry point to the model and each
role in the model has its own slot - Each slot contains information about what
variables each player should have access to
28Powersim Exporter
- Slot Collection options
- Destroy when any player leaves
- Destroy when all players leave
- Destroy manually
29Powersim Exporter
- Slot
- A slot is an entry point to the model
- Each slot allows to play one role in the model
- Metro Server allows many roles to play different
games simultaneous
30Powersim Exporter
- Each slot has the following option field
- Optional
- Optional Rejoinable
- Optional Initially
- Optional Initially Rejoinable
- Required
- Required Rejoinable
31Powersim Exporter
- Optional
- The slot must be joined initially
- It can be left at any time
- The simulation can continue without it
32Powersim Exporter
- Optional Rejoinable
- The slot can be joined and left at any time
- The simulation will be able to continue
33Powersim Exporter
- Optional Initially
- The slot may or may not be joined
- If a slot is left, the simulation will stop
- If a slot is not joined it gets blocked during
simulation
34Powersim Exporter
- Optional Initially Rejoinable
- The slot may or may not be joined
- If a slot is left, the simulation will freeze
until the slot is joined again - If a slot is not joined it gets blocked during
simulation
35Powersim Exporter
- Required
- The slot must be joined
- If a slot is left, the simulation will stop
36Powersim Exporter
- Required Rejoinable
- The slot must be joined
- If it is left, the simulation will freeze until
the slot it is rejoined by a player
37WebSim an extended Java applet
- A Java programming tool (e.g. JBuilder) is used
to program - the Java GUI using Java AWT an/or JavaBeans
- and more GUI using objects from Powersim Metro
Java API - and communication between the GUI and the Metro
Server (i.e. the simulation model) - and optionally communication between the players
using functions in the API package
38Java Applet
- The Java Metro API packages
- Contains classes to create a WebSim
- Creating the GUI
- Communication to the Metro Server
- Event handling
39Object
Component
Container
Panel
Window
Frame
Applet
PsWizardClientPanel
GameFrame
WizardFrame
BeerApplet
wizClient1
wizClient2
wizClient3
wizClient4
40BeerApplet
WizardFrame
Connect to Metro Server
Initializes the wizards
Back to BeerApplet to show the wizards
41 Back to BeerApplet to show the wizards
wizClient1
wizClient2
wizClient3
wizClient4
GameFrame
GameFrame
42GameFrame
Join Game Constructor
New Game Constructor
Showing the main Window
Showing the main Window
43GameFrame
PsJoinListener
PsMessageListener
PsAdvanceListener
PsLeaveListener
44Thank you for your attention.
45WebSim Structure
Client
WebServer
JBuilder
Java Applet
Web Browser
Metro Server
Powersim Constructor
Exporter
Model
46Beer Game package that holds most of the beer
game classes
Creating an instance of WizardFrame
47Here we connect to Metro server
Failure in the connection is detected here
A dialogbox shown to the user informing him
about the failure
48Initializing the Wizards
49The wizards is shown to the user here
50Slot Label
51(No Transcript)
52Session Label
The role that the player will play
53(No Transcript)
54(No Transcript)
55New session is created
The session gets the chosen slot (role)
The slot is joined here
Asks the simulation to start
56The constructor gets the exiting session
Asks the simulation to play
The chosen slot is joined
57Catches the event
Handles the event after its kind
58Gets the userId who wants to join the game
Gets the slot (role) that the user wants to join
59The main window is initialized when the
simulation advances
60Catches the userId that wants to leave the game