DMA NearMiss is an application prototype used to detect near-miss situations with other vessels seen from own vessel’s point of view.
Using own vessels GPS data and received AIS messages from other vessels the near-miss situations are detected and saved to db. From db the near-miss situations are accessible through a web service.
This prototype consists of several modules.
-
gps-simulator is configured with a route (own vessel).
-
ais-simulator is configured to read a file of AIS mesages (other vessels).
-
pilot-plug-simulator reads from gps-simulator and ais-simulator and feeds the information to near-miss-engine.
-
near-miss-engine checks for near-misses from received GPS and AIS information and writes vessel state records to the database.
-
near-miss-web exposes a Web service REST API for client applications to retrieve vessel state records from the database.
There has been made a experimental user interface in the Baltic Web application.
/----------\ | | | AIS +-o <-\ /-------------\ /-----------\ /----------\ | Simulator| | | | |cGRE | | | \----------/ \---| Pilot Plug+---o <----| NearMiss |--------->| NearMiss | | Simulator | | Engine | | Web | /----------\ /---| | | |---\ /->| | | | | \-------------/ \-----------/ | | \----------/ | GPS +-o <-/ | | | Simulator| | | \----------/ V | /----------\ |{s} | | NearMiss | | DB | | | \----------/ -=-------------------------------> Direction of data flow
This application depends on AisLib. This module should be cloned from GitHub and build prior to building the NearMiss application prototype.
Find AisLib here: https://github.com/dma-ais/AisLib
Then clone and build using mvn clean install
Then build the NearMiss prototype using:
mvn clean install
This can be done from the application root folder or from within the individual module folders.
The modules using db will use the in memory H2 database during unit testing, like when running:
mvn test
Spring default profile (application.properties) will be used when running the tests.
The application can be executed in Docker containers or on the local machine (form command line or in a development tool).
When running the application through Docker a mySql database is used (running in a separate Docker container).
Use docker-compose through below given command lines to build, start and stop the application.
docker-compose build
docker-compose up
docker-compose down
The docker profile (application-docker.properties) will be used when running Docker. When running under Docker MySql will be used as database.
If the application is to be started through individual Docker commands then refer to the docker-compose.yml file for dependencies between the individual modules of the application.
When the application is running locally a in memory H2 database is used in server mode (TCP).
To run the full application locally do following:
-
Start gps-simulator
java -jar gps-simulator-0.0.1-SNAPSHOT.jar
-
Start ais-simulator
java -jar ais-simulator-0.0.1-SNAPSHOT.jar
-
Start pilot-plug-simulator using parameters
java -jar pilot-plug-simulator-0.0.1-SNAPSHOT.jar --port=9000 --connectTo=localhost:9898 --connectTo=loalhost:9897
Refer to pilot-plug-simulator in the sub project. -
Start near-miss-db using the h2tcp profile starting the h2 mem db in tcp mode.
java -jar near-miss-db-0.0.1-SNAPSHOT-exec.jar --spring.profiles.active=h2tcp --spring.config.location=../src/main/resources
-
Start near-miss-engine using h2tcp profile.
java -jar near-miss-engine-0.0.1-SNAPSHOT.jar --spring.profiles.active=h2tcp --spring.config.location=../src/main/resources/
-
Start near-miss-web using h2tcp profile.
java -jar near-miss-web-0.0.1-SNAPSHOT.jar --spring.profiles.active=h2tcp --spring.config.location=../src/main/resources
The dev profile (application-dev.properties) will be used when running locally.
Refer to documentation for each module for more information.