CERTI is written in C++
and its installation is enough if the federates are also writen in C++
. For federates written in Java, as Ptolemy federates, it is necessary to also use the jcerti
library. First you need to install CERTI, then install jcerti.
About jcerti
The current version of jcerti.jar (on Sept, 2020) is the code from the branch br_jcerti1516e, compliant with both DoD HLA 1.3 and with IEEE 1516-v2010 or 1516E (Evolved).
The file jcerti.jar is shipped with Ptolemy at $PTII/lib.
You can find here more information about jcerti.
Installing CERTI on Linux or Mac
You need g++, git and libxml2-dev. This script build-certi1516e.sh install CERTI on $HOME/pthla/hla1516e/certi-tools. It also install cmake, flex, and bison if you do not have it The source code is in $HOME/pthla/hla1516e/certi4-0.0.
You can find here how to run a CERTI demo.
Here a receipe for installing in $HOME/pthla
(as of 02/16/17, the last version was 3.5.1):
cd $HOME/pthla
tar xvfz CERTI-3.5.1-Source.tar.gz
mv CERTI-3.5.1-Source certi
mkdir $HOME/pthla/certi-tools
cd $HOME/pthla/certi
mkdir $HOME/pthla/certi/build-certi
cd $HOME/pthla/certi/build-certi
cmake -DCMAKE_INSTALL_PREFIX=$HOME/pthla/certi-tools ../
make
make install
- CERTI is now compiled and installed in the
$HOME/pthla/hla1516e/certi-tools
folder defined as $CERTI_HOME
folder. CERTI provides a script to set the environment (global variables, binaries, etc) to allow the correct launch of RTIG process, RTIA process and federates. To set the CERTI environment properly in a terminal run the command:
source $HOME/pthla/hla1516e/certi-tools/share/scripts/myCERTI_env.sh
or put the above command in your /.bash_profile
file (Mac) or /.bashrc
file (Linux).
Remark MacOS (from https://chess.eecs.berkeley.edu/ptexternal/wiki/Main/HLA): System Integrity Protection (SIP) was introduced in El Capitan in an effort to increase the security of the Mac OS. On a machine where SIP is Enabled (to check reboot, hold Command-R, run csrutil status. See How to modify system integrity protection in El Capitan.) it can have problems with the dynamic libraries.
Main CERTI Environment Variables (see also CERTI doc)
CERTI_HOME
: the directory where CERTI is installed, e.g. $HOME/pthla/hla1516e/certi-tools
. It is used by the RTIG in order to look for FOM (Federation Object Model) files.
CERTI_FOM_PATH
: provides the default directory where the FED files (HLA 1.3) and XML files (HLA 1516E) are. This variable is needed if the FED file is not in the directory where the RTIG is launched. The variable may contain a list of paths separated by ":".
CERTI_HOST
: provides the IP address of the machine that hosts the RTIG. As soon as it starts the RTIA will try to connect to the RTIG running on CERTI_HOST (or "localhost" if the variable is not defined or void).
When running
source $HOME/pthla/hla1516e/certi-tools/share/scripts/myCERTI_env.sh
The default values (when CERTI was installed as suggested above) are the following ones:
CERTI_HOME=$HOME/pthla/hla1516e/certi-tools
, CERTI_FOM_PATH=$CERTI_HOME/share/federations
and CERTI_HOST=localhost
.
When CERTI Environment Variables must be changed?
CERTI_HOST
: If the federation will run in your computer, but the RTIG will run in another computer named otherComputer
, you need to set (in your computer) CERTI_HOST
to the otherComputer
or to its IP number:
export CERTI_HOST=otherComputer
CERTI_FOM_PATH
: You can add the absolute-path (where the FED file is located) to CERTI_FOM_PATH
variable:
export CERTI_FOM_PATH="absolute-path:$CERTI_FOM_PATH"
Remarks:
- When all the federates of a federation are running in the same computer as the
rtig
(as in Figure 1), you must leave the default value CERTI_HOST=localhost
. You do not need to set this variable to the computer name or to the IP number (but you can if you want).
- Let be
host-rtig
the name of the computer where the rtig
run. When some (or all) federates run in other computer(s), as in Figure 2, then all these other computers must set CERTI_HOST=host-rtig
.
- For knowing the name of a computer, type the command line
hostname
in a terminal.
dupont$ hostname
aComputerName
It can happen that (FIXME because of the LAN, or firewall??) the name obtained by executing the command hostname
is not known. In this case, in all the computers running a federate (from a same federation) try to set CERTI_HOST
to the IP number of host-rtig
.
Where does the RTIG seek for the FED file or XML file?
As explained in CERTI doc CERTI seeks for a FED file in this order:
- In the directory where the RTIG is launched
- In the directories whose paths are provided by
CERTI_FOM_PATH
- In
$CERTI_HOME/share/federations
directory
- As the
$CERTI_HOME/share/federations
directory is the path by default in CERTI, the simplest way is always copy your .fed
files in this directory.
- If you cannot write in
$CERTI_HOME/share/federations
directory then add the path of the directory where the .fed file or .xml file is contained to CERTI_FOM_PATH
.
Remark: When using a federate writen in Java, the API jcerti
is needed.
Testing CERTI 1516E in one computer (localhost)
CERTI provides a C++ billard
demo for testing a HLA federation in $HOME/pthla/hla1516e/certi4-0.0/test/Billard/
folder. In some Linux
- Open 3 terminals. If you did not sourced
myCERTI_env.sh
in your ~/bash_profile
(~/.bashrc
on Linux), run in each terminal the command above
- Notice that after running
myCERTI_env.sh
, $CERTI_HOST=localhost
- Go to the first terminal and execute the middeware RTIG:
- Go to second terminal and call a billard federate named "1" (-n name) and HIT ENTER only once. A small white graphical interface representing a billard table pops out.
Remark: If the graphical interface does not appear, replace billard
by billard-nogui
in the commands below:
modern_billard -nTest1 -fTest
- Do not HIT ENTER yet when the following message appears:
CERTI Billard 4.0.0 (...) Press ENTER to start execution...
- Go to the third terminal and call a billard federate named "2" (-n name) and HIT ENTER.
modern_billard -nTest2 -fTest
- The following message appears:
CERTI Billard 4.0.0 (...) Synchronization...
- Go back to second terminal (where federate "1" was launched) and now press "ENTER".
If the demo works, the "billard table" shows the movement of two billard balls; In Terminal 3 you have several new messages including this one showing that an object instance of class Bille
named "1" was discovered:
Discovered object handle = 2, name = 1
And in Terminal 2, this message showing that an object instance of class Bille
named "2" was discovered:
Discovered object handle = 1, name = 2
There is also a Ptolemy billiard demo in $PTII/org/hlacerti/demo/Billard
.
Remark:
The rtig
can run for different lauchings of a same simulation. But if a federation is not ended properly (destroyed) then a new run can provoke an error. In this case, you need to kill the rtig
process, looking for his process number:
cardoso$ ps -ax | grep rtig
84699 ttys000 0:00.00 grep rtig
84695 ttys001 0:00.01 rtig
cardoso$ kill -9 84695
cardoso$ ps -ax | grep rtig
84727 ttys000 0:00.00 grep rtig
Testing CERTI 1516E in two computers
HLA standard targets distributed simulation, and so do CERTI, a HLA compliant tool.
- In each computer, run in a terminal the command line
ifconfig
for having the name of the computer and/or its IP address.
- Check if the two computers
C1
and C2
are connected to a same LAN. Let us call their IP address IP1
and IP2
, respectively. Notice that you can also use a ssh -X host-name
.
Scenario 1: Launch the rtig
in IP1
, and all C++ billard
federates in IP2
.
- Check if there is a firewall on port 60400 (PORT_TCP_RTIG) on each computer. The first command below is a succesfull test:
telnet host-name 60400
Trying ip-host-name...
Connected to host-name. Escape character is '^]'.
- This message indicates there is a firewall that must be removed:
telnet host-name 60400
Trying ip-host-name...
telnet: connect to address ip-host-name: Connection timed out
- If both computers succed to the test above, go to
C2
and set CERTI_HOST as C1
(where the rtig run):
- On
C2
: Open two terminal, and launch the two C++ billard
federates following the procedure above, except the first one (Launch RTIG in first terminal) since you already launched the rtig
on C1
.
If the simulation does not work, check the issue discussed here.
Scenario 2: Launching the rtig
and a federate in IP1
, and the other C++ billard
federates in IP2
.
- On
C1
: Open 2 terminals. If you did not sourced myCERTI_env.sh
in your ~/bash_profile
(~/.bashrc
on Linux), run in each terminal the command above
- Notice that after running
myCERTI_env.sh
, $CERTI_HOST=localhost
- Go to the first terminal and execute the middeware RTIG:
- Go to second terminal on
C1
and call a billard federate named "1" (-n name) and HIT ENTER only once. A small white graphical interface representing a billard table pops out.
Remark: If the interface does not appear, replace billard
by billard-nogui
in the commands below:
modern_billard -nTest1 -fTest
- Do not HIT ENTER yet when the following message appears:
CERTI Billard 4.0.0 (...) Press ENTER to start execution...
- On
C2
: open a terminal, set CERTI_HOST and call a billard federate named "2" (-n name) and HIT ENTER.
export CERTI_HOST=IP1
modern_billard -nTest2 -fTest
- The following message appears:
CERTI Billard 4.0.0 (...) Synchronization...
- Go back to the second terminal on
C1
(where federate "1" was launched) and now press "ENTER".
If the demo works, the "billard table" shows the movement of two billard balls; In C2
you have several new messages including this one showing that an object instance of class Bille
named "1" was discovered:
Discovered object handle = 2, name = 1
And in C1
, Terminal 2, this message showing that an object instance of class Bille
named "2" was discovered:
Discovered object handle = 1, name = 2
If the simulation does not work, check the issue discussed here.
Testing CERTI 1.3
The procedure for testing federates using HLA 1.3 is the same as in the tests above.
You need to replace in the commands
modern_billard -nTest1 -fTest
by
billard -n1 -fTest -FTest.fed -t10
and
modern_billard -nTest2 -fTest
by
billard -n2 -fTest -FTest.fed -t10
Recall that if billard does not work, you need to use billard-nogui.