"cpswt-core"
for CPSWTThe cpswt-core project contains all software needed to run Java-based federates in CPSWT.
Table of Contents
- Project
"cpswt-core"
for CPSWT
- Constituent Modules
- cpswt-core/root
- cpswt-core/base-events
- cpswt-core/coa
- cpswt-core/config
- cpswt-core/federate-base
- cpswt-core/federation-manager
- cpswt-core/utils
- CPSWT Software Installation and Instructions to Build and Publish cpswt-core Modules on Ubuntu 20.04 LTS (Focal Fossa)
- General Software Installation
- Software for Java-based Federates
- Summary of Environment Variable Definitions and Modifications Needed for CPSWT
cpswt-core
contains the core modules for the implementation of the Cyber-Physical Systems Wind Tunnel (CPSWT).
In particular, it contains modules to allows Java-based federates to participate in federations,
the federation manager module which is responsible for coordinating federation execution, and a
module for COA management.
The modules used for CPSWT functionality are as follows. Any modules not listed are under development or are not currently being used.
This module contains the Java base classes for Java classes that implement HLA interaction and object classes in CPSWT. These Java base classes, InteractionRoot and ObjectRoot, actually contain all of the functionality needed to implement any HLA interaction or object class in Java. Importantly, they allow Java-based federates to use dynamic messaging: this enables the federates to manipulate any HLA interaction or object class instance using only the InteractionRoot or ObjectRoot Java base classes, respectively. That is, an HLA interaction or object instance can be manipulated without an explicit corresponding Java class.
The modules contains HLA interaction and object classes that are “built-in” to CPSWT. These classes are derived from InteractionRoot and ObjectRoot.
Class List (indentation shows inheritance):
HLA Interactions:
InteractionRoot
C2WInteractionRoot
ActionBase
EmbeddedMessaging
FederateJoinInteraction
FederateResignInteraction
OutcomeBase
SimLog
VeryLowPrio
LowPrio
MediumPrio
HighPrio
SimulationControl
SimPause
SimResume
SimEnd
HLA Objects:
ObjectRoot
FederateObject
This module contains the Java classes necessary to implement Courses of Action (COA), i.e. complex behavior that is designed into a federation via its federation model.
This module contains Java classes that determine the contents of federate configuration files, as well as read them.
This module contain Java classes that implement behavior that all federates must have. Among them are:
This module contains the Java classes that implement the FederationManager, which:
This module contains various utility classes used by the other modules.
Table of Contents
The following CPSWT installation instructions were performed on a VirtualBox VM with 128 GB Disk and 12GB RAM.
Currently, only Ubuntu 20.04 LTS (Focal Fossa) is supported.
There are several text boxes in the instructions below that contain commands that you need to execute at the shell command-line.
To copy any of these commands, hover over the textbox and a small “copy” button will appear at the right of the textbox (two rounded rectangles, one on top of the other). Press this button, and the command will be copied to your clipboard.
Then, to paste the command in your shell, select your shell window and press SHIFT-CTRL-V.
This sections contains instructions for the installation of 3rd-party software that is needed to run CPSWT federations.
sudo apt update
sudo apt upgrade -y
The following packages must be installed:
They can be installed with the following command:
apt install -y apt-transport-https bison build-essential ca-certificates clang cmake curl doxygen flex gcc gdb gettext git gradle graphviz libboost1.71-all-dev libcppunit-dev libeigen3-dev libffmpeg-ocaml-dev libfox-1.6-dev libgdal-dev libgl2ps-dev libgtest-dev libjsoncpp-dev libosgearth-dev libproj-dev libqt5opengl5-dev libwebkit2gtk-4.0-37 libxerces-c-dev libxml2-dev lld make maven mongodb mpi-default-dev openjdk-8-jdk openjdk-17-jdk openscenegraph-plugin-osgearth perl python2 python3 python3-dev python3-pip python-is-python3 qt5-qmake qtbase5-dev qtbase5-dev-tools qtchooser software-properties-common swig wget xterm zlib1g-dev
The following python packages (for python3) must also be installed:
They can be installed with the following command:
sudo python3 -m pip install --system --upgrade jinja2 matplotlib numpy pandas posix_ipc python-dateutil scipy seaborn webgme-bindings
Set java-17-openjdk-amd64
to be the default java used by your system by executing the following command:
sudo update-java-alternatives -s java-1.17.0-openjdk-amd64
Ignore any errors output by the above command.
There will be several modifications to your .bashrc
file in these instructions. The first is set your JAVA_HOME
to the directory of your
Java
installation.
Granted the openjdk-17-jdk
package was installed in step 1, the following command should be appended to your .bashrc
file in your home directory:
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
To see a list of all environment variables that need to be defined or modified in your .bashrc
file,
see Summary of Environment Variable Definitions and Modifications Needed for CPSWT at the end of this document.
Whenever command is added in your .bashrc
file, it will only have an effect when you spawn and use a new shell, and this effect is needed immediately.
So, whenever a command is added to your .bashrc
in these instructions either:
Type the command directly into your current shell, in this case
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64.
As these instructions are being written, a compressed tarball to install Portico version 2.1.0 can be downloaded by typing the following URL into your Google Chrome web brower.
https://master.dl.sourceforge.net/project/portico/Portico/portico-2.1.0/portico-2.1.0-linux64.tar.gz?viasf=1
However, if this link does not work, you should be able to download the Portico version 2.1.0 as follows:
portico-2.1.0-linux64.tar.gz
at the right side of the resulting page, under Linux 64-bit
and May 6th
portico-2.1.0-linux64.tar.gz
portico-2.1.0-linux64.tar.gz
should be downloaded into your Downloads
directory under your home directory.portico-2.1.0-linux64.tar.gz
tarball into your home directory:
cd
tar xf <YOUR-HOME-DIRECTORY>/Downloads/portico-2.1.0-linux64.tar.gz
Append the following command to your .bashrc
file:
export RTI_HOME="<YOUR-HOME-DIRECTORY>/portico-2.1.0"
After doing this remember to either kill your current shell and spawn a new one or type this command into your current shell.
To see a list of all environment variables that need to be defined or modified in your .bashrc
file,
see Summary of Environment Variable Definitions and Modifications Needed for CPSWT
As these instructions are being written, a compressed tarball to install Apache Archiva version 2.2.5 can be downloaded by typing the following URL into your Google Chrome web brower.
https://archive.apache.org/dist/archiva/2.2.5/binaries/apache-archiva-2.2.5-bin.tar.gz
However, if this link does not work, you should be able to download the Apache Archiva version 2.2.5 as follows:
Introduction
menu item at the top of the resulting pageDownloads
Previous Versions
section of the resulting page, click on Apache Archiva Archives
2.2.5/
binaries/
apache-archiva-2.2.5-bin.tar.gz
apache-archiva-2.2.5-bin.tar.gz
should be downloaded into your Downloads
directory under your home directory.apache-archiva-2.2.5-bin.tar.gz
tarball into your /opt
directory:
root
using the following command:
sudo su -
/opt
directory:
cd /opt
apache-archiva-2.2.5-bin.tar.gz
tarball:
tar xf <YOUR-HOME-DIRECTORY>/Downloads/apache-archiva-2.2.5-bin.tar.gz
root
USER ID YET – GO TO THE NEXT STEP BELOWStart the Archiva server and set up Archiva to execute on boot:
/etc/systemd/system/archiva.service
using your favorite editor by executing the editor from the command-line, i.e. as root.
It should not exist yet, and so should be created when you edit it.Place the following text in this file:
[Unit]
Description=Archiva Server
Documentation=https://archiva.apache.org/docs/2.2.5/
After=network.target
[Service]
Type=forking
PIDFile=/opt/apache-archiva-2.2.5/logs/archiva.pid
WorkingDirectory=/opt/apache-archiva-2.2.5
ExecStart=bash -ic "export PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin:$PATH ; exec /opt/apache-archiva-2.2.5/bin/archiva start"
ExecStop=/opt/apache-archiva-2.2.5/bin/archiva stop
[Install]
WantedBy=multi-user.target
- Save the file and exit the editor
- Type the following two commands at the root shell prompt:
systemctl enable archiva systemctl start archiva
- Exit out of the
root
userid:exit
- The Archiva server should now be started and will start automatically on boot.
NOTE
Archiva can take several seconds to start up. If your browser reports that it cannot load the page, or the page is taking a long time to load, wait 60 seconds (ample time) and try again.
Create Admin User
admin
<whatever you think is appropriate>
adminpass123
adminpass123
<your email address>
<check the box>
<LEAVE BOX UNCHECKED>
<LEAVE BOX UNCHECKED>
Save
buttonIt is important that you use admin
and adminpass123
as your Archiva administrator username and password, respectively,
as they are used in other parts of these instructions.
The following instructions show how to install, build and publish software needed to use Java-based federates in CPSWT.
Gradle is the build tool the CPSWT project uses to build, test, and publish its software to the installed Archiva repository on your system.
For Gradle to work properly in this capacity, the following steps must be performed:
.gradle
directory under your home directory, if it doesn’t already exist, by executing the following commands:
cd
mkdir .gradle
Edit the
archivaUser=admin
archivaPassword=adminpass123
archivaHostId=localhost
archivaPort=8080
version=0.8.0-SNAPSHOT
org.gradle.console=plain
omnetppHome=/opt/omnetpp-5.6.2
IMPORTANT: to execute gradle to build/test/publish software, we will be using the gradle wrapper
executable, which will reside in the directories
where we perform the building/testing/publishing.
DO NOT EXECUTE the following two commands below – they’re only there to show how to set up the gradle wrapper
gradle wrapper
executable, change to the given directory (this happens in a few places below) and execute the
following command in your shell:
gradle wrapper --gradle-version=8.0
./gradlew <options> [arguments]
To build CPSWT Packages and publish them to Archiva, we first need to clone the git repositories where they reside. To do this, it is best to create a directory under your home directory where all needed CPSWT git repositories will be cloned (there 3 total needed for these instructions).
It is recommended that you call this directory cpswt
. To create it, enter the following commands:
cd
mkdir cpswt
This directory will be referred to as <CPSWT-HOME>
for the remainder of these instructions.
IMPORTANT: <CPSWT-HOME>
is an absolute path , not a relative path. For instance, if
you made <CPSWT-HOME>
the cpswt directory under <YOUR-HOME-DIRECTORY>
, then <CPSWT-HOME>
represents “<YOUR-HOME-DIRECTORY>/cpswt
”.
cd <CPSWT-HOME>
git clone git@github.com:SimIntToolkit/cpswt-core.git
<CPSWT-HOME>/cpswt-core/cpswt-core
directory (you read that right – cpswt-core appears twice):
cd <CPSWT-HOME>/cpswt-core/cpswt-core
gradle wrapper --gradle-version=8.0
./gradlew :utils:publish
./gradlew :root:publish
./gradlew :base-events:publish
./gradlew :config:publish
./gradlew :federate-base:publish
./gradlew :coa:publish
./gradlew :federation-manager:publish
./gradlew :fedmanager-host:publish
To test if the Java packages have been published to Archiva, do the following:
http://localhost:8080
using your Google Chrome browserBrowse
in the upper left-hand corner under Artifacts
Browse Repository
in the top-middle-left of the page, click on the small down-arrow on the right side of a small textbox.Archive Managed Snapshot Repository
org.cpswt
, which should be a short ways down the page from Browse Repository
mentioned above.A list should appear that contains all of the packages you published above using ./gradlew
(in alphabetical order):
This concludes the setup for CPSWT for the HelloWorldJava example!
The following lines must be added to the end of the .bashrc
file in your home directory.
They define or modify important environment variables needed for CPSWT.
Make the following substitutions in the values for these environment variables:
<YOUR-HOME-DIRECTORY>
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
export RTI_HOME="<YOUR-HOME-DIRECTORY>/portico-2.1.0"