Contents
http://www.cs.uga.edu/~jam/jsim
JSIM is implemented in pure Java. It has been tested in both UNIX and NT environments. The following software is required for JSIM.
· JDK 1.3
· KOML (The Koala Object Markup Language)
http://www-sop.inria.fr/koala/XML/serialization/
· xerces_j (Apache's XML Parser for Java) and its XML tree viewer
http://xml.apache.org/dist/xerces-j/
The XML tree viewer that comes with the xerces_j samples jar file is used to display the XML-formatted query results. The XML parser is used by the KOML package to convert Java objects into and from XML data. It is also used in JSIM to establish a connection to the database via an XML configuration file, when creating the JSIM tables.
· Cloudscape
Cloudscape is an embedded object-relational database management system implemented in pure Java. It is needed only if you want to use the database features of JSIM.
3.1 Install all required software and download jsim.tar.gz to your home directory
3.2 Unzip jsim.tar.gz and extract all files from it
gunzip
jsim.tar.gz | tar -xvf –
3.3 Set up your environment variables and CLASSPATH by putting the following lines in your profile file, such as .cshrc. (You will need cloudscape.jar, RmiJdbc.jar, and client.jar only if you want to use the database. If you installed those jar files elsewhere, please adjust everything accordingly.)
setenv JSIM_HOME $HOME/JSIM
setenv CLASSPATH ./
setenv CLASSPATH
$JSIM_HOME/dep/koml.jar.$CLASSPATH
setenv CLASSPATH
$JSIM_HOME/dep/xerces.jar.$CLASSPATH
setenv CLASSPATH
$JSIM_HOME/dep/xercesSamples.jar.$CLASSPATH
setenv CLASSPATH
$JSIM_HOME/dep/client.jar.$CLASSPATH
setenv CLASSPATH
$JSIM_HOME/dep/cloudscape.jar.$CLASSPATH
setenv CLASSPATH
$JSIM_HOME/dep/RmiJdbc.jar.$CLASSPATH
setenv CLASSPATH $JSIM_HOME/
setenv CLASSPATH ..$CLASSPATH
Please also add the following to your search path.
$JAVA_HOME/bin.$JSIM_HOME/bin
cd $JSIM_HOME
make
Let us assume that you want to use the database feature of JSIM and you use Cloudscape as your database server. If you choose the RMI-JDBC framework, which is one of the client-server frameworks supported by Cloudscape, you must run the rmi server first. A default script for running the rmi database server is included in a file called "startCS.sh" in the JSIM/jsimdb directory. You need to configure the script according to your setting, change to the directory where you want your JSIM database to be created, and run the modified script.
When your database server is up and running, you can modify the configuration file called "create_jsimschema_config.xml" in the JSIM directory. Then type the following command to create the JSIM database schema:
java jsim.jquery.CreateJsimSchema
As a result, two tables will be created and a sql script file will be generated. The first table is a sequence table with only one integer field that will be initialized with a value of zero. This table stores the next scenarioID value for the SceanrioAgent. Whenever a request for a scenarioID is requested, the number in the table will be updated. The second table will be used to store the scenario objects. (We call each execution of a model or model federation a scenario. The simulation data generated from such a scenario is encapsulated in an object of type jsim.jquery.Store.) Now, you are ready to experiment with one of the sample models.
First, change to the directory, JSIM/examples/bank, and build the bank simulation:
cd
$JSIM_HOME/examples/bank
jmake.sh Bank
To run the model as a standalone application:
java Bank
To turn on the use of XML as the message format:
java -Djsim.use_xml=true
Bank
To dump the XML messages in files:
java -Djsim.use_xml=true
-Djsim.generate_xml_files=true Bank
To run the model as an applet:
make applet
To run the default model federation as an application:
make federate
To run the default model federation as an applet:
make fedApplet
The standalone model application and applet are straightforward to use. Below, we will briefly walk you through the model federation. Once the model federation is started, on the scenario window menu bar, click the "Action" menu to bring up a list of menu items. To run a simulation, select "Start Simulation". A dialog box will pop up to ask you for database connection information. If you do not want to store the simulation results into the database later on, just click "Cancel". Otherwise, you will have to enter the correct information and click "OK". Before the simulation is started, you will be asked to edit the properties of the model. Click "Apply" after editing. The snapshots in Figures 5-10 show the typical steps of running a simulation, displaying or storing simulation data, and querying the database.
Step 1: Launching scenario control window.

Step 2: Connecting to the JSIM database.

Step 3: Editing input model properties. note that each cell in the "Distribution" column is a list of distribution types currently supported by JSIM. You can click to select a type that interests you.

Step 4: Launching the simulation panel. Select "Start Simulation" under "JSIM Controls" to start the simulation. Select "Stop Simulation" after the simulation is done.

Step 5: Choosing a way to handle simulation results. If you choose "Display", you will see a panel displaying the simulation results, as captured in step 6. If you choose "Store", the input model properties, the properties of the agent that controls the simulation, and the simulation results will be stored in the database.

Step 6: Displaying simulation results. You can stop here, or you can perform some queries against the database.

Step 7: Querying the JSIM database. You get to this step by selecting the "Query Database" item under the "Action" menu. The query guide displays a query guide for the JSIM database. The "Status Watch" area will provide feedback to you whenever a command is issued. You can start with entering a query in the "SQL Query" area. Then click "Execute Query". If XML messaging is enabled, the query results will be returned in an XML tree viewer, as shown in Figure 12. Otherwise, the results will be displayed in the "Status Watch" area.

Step 8: Displaying the query results in an XML tree viewer.
cd $JSIM_HOME/examples/federation
run
The following figure shows a federation consisting of two federates. a BatchMeansAgent running a Bank model and a ReplicationAgent running a FoodCourt model.

Change to the directory where you want to place your new model and type jmod.sh. You can design a new model by selecting appropriate icons/nodes from the toolbar and then drag them to the canvas. You can add, delete, and reposition icons/nodes on the canvas. You can also draw line connections between them, edit the properties of each object at design time, and generate code for the model you have created. Note that to generate code you have to click the "Generate" button first and then click on the canvas. Otherwise no code will be generated. Along with the code, an HTML file for running the federate as an applet will also be generated. A make file can be generated by the command, jmake.sh <ModelName>.