README

Brahms Distributed Virtual Machine

9/29/2009
Copyright (c) 1998-2009 NASA Ames Research Center. All Rights Reserved.

Table of Contents:

I. Installation Notes
II. Running a Distributed Brahms Model
III. Trouble Shooting
IV. Contacting the Brahms development team for Technical Support

I. Installation Notes

Brahms Agent Environment version 1.3.2 includes the server components necessary to run the distributed virtual machine now referred to as the Brahms Hosting Environment. The Brahms Hosting Environment now uses the Brahms Collaborative Infrastructure (CI) for its transport, directory, data distribution, and management services. The HostingEnvironment script has the environment variables setup such that it can be run in distributed mode. Multiple Hosting Environments in a distributed environment will require their own set of configuration files to configure the CI services such as transport, directory, and data distribution. This is discussed in more detail later in this document.

To be able to run the Brahms Hosting Environment the machine on which the components are installed must have a (wireless) network card installed and to run in a distributed setup across multiple machines IP multicasting must be enabled to allow the different Brahms Hosting Environments to discover one another.

II. Running a Distributed Brahms Model

Brahms models can only be run distributed in a 'real-time' mode. There is currently no support to run a Brahms simulation distributed. It is also not possible to run a model distributed using the Composer.

To run a Brahms model distributed a number of steps need to be followed:

1. Create the distributed models.

2. Create a HostingEnvironment script for each distributed model.

3. Setup the HostingEnvironment configuration files to configure the hosting environment and its transport, directory, and data distribution services.

4. Run the models.

1. Create the distributed models

To distribute a model over different machines in different Brahms virtual machines you need to compile a complete model as you normally would for Brahms models. This will generate a <model>.bcc file. Copy this bcc file X number of times where X is the number of machines the model will run on. Each BCC file is the model loaded in one specific virtual machine on one computer system. Open each of these BCC files and change the Model name to a unique name between the three models by modifying the value for the name attribute for the MODEL element and remove all those agents and objects that will not be running in that specific machine by removing the line with the agent/object reference. Serialized objects (instance of SerializableObject), areas, and conceptual objects are not distributed so you should not remove any of those references! For example if you created a model 'MyModel.b' located in the directory \Brahms\MyModel\src, you will after compiling it have a file MyModel.bcc. If you want to distribute this model over three machines you will need to copy this file three times and name each file:

To make distribution simpler zip the three model files up using a zip tool or the Java jar tool and give the archive the extension .bar. Suppose you put the three model files in: C:\Brahms\MyModel\models. Then run the commands:

    cd \Brahms\MyModel\models
    jar cvf mymodels.bar *
    cd ..
    mkdir lib
    copy models\mymodels.bar lib

2. Create a HostingEnvironment script for each distributed model.

For each model create a HostingEnvironment script. Use the HostingEnvironment script located in Brahms/AgentEnvironment/bin as a template. For the three example models we would create a bin directory and have three scripts.

    \Brahms\MyModel\MyModel1HE.bat
    \Brahms\MyModel\MyModel2HE.bat
    \Brahms\MyModel\MyModel3HE.bat

The contents of each file (shown MyModel1HE.bat) would look something like:

@ECHO OFF
SET BRAHMS_ROOT=C:\Program Files\Brahms\AgentEnvironment
SET MYMODEL_ROOT=C:\Brahms\MyModel
SET MYMODEL_CONFIG=%MYMODEL_ROOT%\config\m1
SET MYMODEL_DEPLOY=%MYMODEL_ROOT%\deploy\m1

REM Java Setup
SET JAVA_MEMORY=-Xincgc -Xmx512m -Xss1024k -Xms32m
SET BOOTCP=-Xbootclasspath/p:"%BRAHMS_ROOT%\lib\jacorb\jacorb.jar;%BRAHMS_ROOT%\lib\jacorb\logkit-1.2.jar;%BRAHMS_ROOT%\lib\jacorb\avalon-framework-4.1.5.jar"
SET CP=-cp ".;%MYMODEL_CONFIG%;%MYMODEL_DEPLOY%;%MYMODEL_ROOT%\deploy;%BRAHMS_ROOT%\config;%BRAHMS_ROOT%\deploy;%BRAHMS_ROOT%\Agents"
SET EXT_JAR_DIRS=-Djava.ext.dirs="%BRAHMS_ROOT%\jre\lib\ext;%BRAHMS_ROOT%\lib;%BRAHMS_ROOT%\lib\ci;%BRAHMS_ROOT%\lib\jidesoft;%BRAHMS_ROOT%\lib\mysql;%BRAHMS_ROOT%\lib\jacorb;%MYMODEL_DEPLOY%;%MYMODEL_ROOT%\deploy;%BRAHMS_ROOT%\deploy;%BRAHMS_ROOT%\Agents"
SET JAVA_LIB_PATH=-Djava.library.path="%MYMODEL_DEPLOY%;%MYMODEL_ROOT%\deploy;%BRAHMS_ROOT%\deploy;%BRAHMS_ROOT%\Agents"
SET ORB=-Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton
SET JAVA_PROPERTIES=%JAVA_MEMORY% %BOOTCP% %CP% %JAVA_LIB_PATH% %EXT_JAR_DIRS% %ORB%
title MyModel1
"%BRAHMS_ROOT%\jre\bin\java.exe" %JAVA_PROPERTIES% gov.nasa.arc.brahms.ahe.HostingEnvironment HostingEnvironment

pause

Replace m1 with m2 and m3 respectively for the MyModel2HE.bat and MyModel3HE.bat files.

3. Setup the HostingEnvironment configuration files to configure the hosting environment and its transport, directory, and data distribution services.

The configuration files will specify exactly for each hosting environment what is loaded and how the services are configured. In the script we specified which configuration directory and deployment directories are to be included in the classpath for the hosting environment. This is used by the hosting environment to find the relevant configuration files.

Create the configuration directory for each model:

    cd \Brahms\MyModel\
    mkdir config
    cd config
    mkdir m1
    mkdir m2
    mkdir m3

In each model's configuration directory (m1, m2, m3) copy the contents of the folder: \Brahms\AgentEnvironment\config\templates. There is no need to copy the ProcessManager*.* files or the pmasp directory and its contents. All you need is the HostingEnvironment*.* and heasp directory and its contents.

For each copied file remove the word 'Template' from the filename. Each model's directory should now have as contents:

    \Brahms\MyModel\config\m1\HostingEnvironment.cihx
    \Brahms\MyModel\config\m1\HostingEnvironmentLogger.cfg
    \Brahms\MyModel\config\m1\heasp\ASP.ciaspx
    \Brahms\MyModel\config\m1\heasp\DataDistributionService.citx
    \Brahms\MyModel\config\m1\heasp\DirectoryService.cidx
    \Brahms\MyModel\config\m1\heasp\TranslationService.cilx
    \Brahms\MyModel\config\m1\heasp\TransportService.cicx

In the HostingEnvironment, DataDistributionService, and DirectoryService specify unique names in the CREDENTIALS element for the SIMPLENAME, QUALIFIEDNAME, and DIRECTORYNAME elements.

    <SIMPLENAME>MyModel1HE</SIMPLENAME>
    <QUALIFIEDNAME>gov.nasa.MyModel1HE</QUALIFIEDNAME>
    <DIRECTORYNAME>brahms/directory/hostingenvironment/MyModel1HE</DIRECTORYNAME>

This is required to ensure no name conflicts exist between hosting environment and each one of the services.

In each HostingEnvironment.cihx file modify the following properties (in this case for MyModel1):

ci.ahe.deploydir C:/Brahms/MyModel/deploy/m1
model MyModel1
mode drt
library_path C:/Brahms/MyModel/lib;C:/Program Files/Brahms/AgentEnvironment/Models/lib

The deploydir is used to locate any Java external agent implementations, external activity implementations, and agent configuration files. The model property specifies the fully qualified name of the model file to load. The mode property must be drt to indicate that the hosting environment is to be started in distributed real-time mode. The library path specifies where the model file and the agents/objects in the model can be found.

In each TransportService.cicx file change the host properties to the hostname of the machine on which the model will be run or specify the ip address of that machine. Set the port to an available port number or specify 0 or remove the port property altogether to have the transport service choose the first available port.

In each DataDistributionService.citx file make sure to assign an available port number for the tcp.port and udp.port properties or choose 0 or remove the port number to have the data distribution service choose the first available port. For the multicast address and port make sure that the same address and port number is used in all DataDistributionService.citx files. This is essential to allow the the directory services from the hosting environments to discover one another and to synchronize eachother's entries. If the addresses/ports are not identical the agents/actors will not be able to find one another in the models.

Open each HostingEnvironmentLogger.cfg file and specify a unique filename for the log4j.appender.F.File property. This is where each hosting environment will log its output.

4. Run the models.

Now start each model by starting the appropriate Hosting Environment. So with the above three models run 

    cd \Brahms\MyModel\bin
    MyModel1HE.bat
    MyModel2HE.bat
    MyModel3HE.bat

Note that starting the hosting environments can take some time. References to remote agents need to be resolved which can sometimes take some time if the remote agent has not yet registered. 

You can stop each hosting environment by either pressing the Stop button on the little control panel that appears for each hosting environment or by pressing Ctrl-C in the command window of each hosting environment. This will properly deregister all the agents and objects from the directory service and properly shut down all the services.

III. Trouble Shooting

If there are problems starting any of the hosting environments you will need to verify a number of settings:

  1. Verify that each hosting environment, directory service and data distribution service is assigned a unique name in its Credentials in each of their configuration files.
  2. Verify the host name and port properties and their values in the configuration files to ensure there are no conflicts.
  3. Make sure that IP multicasting is enabled on your machine.
  4. Make sure that your network allows for IP multicasting (configure the router and firewalls to permit multicasting).
  5. Verify that the proper configuration directories are specified in the Hosting Environment scripts.

IV. Contacting the Brahms project team for Technical Support 

In case you have problems with the installation or questions and problems with the use of the Brahms Composer, Agent Viewer, Compiler or Virtual Machine you can reach Technical Support at: 

E-mail: support@agentisolutions.com
www: http://www.agentisolutions.com/support/support.htm

Thank you for trying the Brahms Agent Environment. We hope you find it useful in your modeling and agent development efforts.

Sincerely,

The Brahms Development Team