Skip to content

maritime-web/NearMiss

Repository files navigation

NearMiss

Introduction

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.

How the prototype works

This prototype consists of several modules.

Flow

  1. gps-simulator is configured with a route (own vessel).

  2. ais-simulator is configured to read a file of AIS mesages (other vessels).

  3. pilot-plug-simulator reads from gps-simulator and ais-simulator and feeds the information to near-miss-engine.

  4. near-miss-engine checks for near-misses from received GPS and AIS information and writes vessel state records to the database.

  5. 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.

Architecture

NearMiss Architecture.
/----------\
|          |
|   AIS    +-o <-\   /-------------\          /-----------\          /----------\
| Simulator|     |   |             |          |cGRE       |          |          |
\----------/     \---|   Pilot Plug+---o <----| NearMiss  |--------->| NearMiss |
                     |   Simulator |          |  Engine   |          |    Web   |
/----------\     /---|             |          |           |---\   /->|          |
|          |     |   \-------------/          \-----------/   |   |  \----------/
|   GPS    +-o <-/                                            |   |
| Simulator|                                                  |   |
\----------/                                                  V   |
                                                           /----------\
                                                           |{s}       |
                                                           | NearMiss |
                                                           |    DB    |
                                                           |          |
                                                           \----------/


              -=------------------------------->
                   Direction of data flow

Building the Application

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.

Running the Application

The application can be executed in Docker containers or on the local machine (form command line or in a development tool).

Running the Application in Docker Containers

When running the application through Docker a mySql database is used (running in a separate Docker container).

Docker Compose

Use docker-compose through below given command lines to build, start and stop the application.

Building the Docker images
docker-compose build
Starting the Application
docker-compose up
Stopping the Application
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.

Running Individual Modules

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.

Running the Application locally

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:

  1. Start gps-simulator
    java -jar gps-simulator-0.0.1-SNAPSHOT.jar

  2. Start ais-simulator
    java -jar ais-simulator-0.0.1-SNAPSHOT.jar

  3. 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.

  4. 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

  5. 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/

  6. 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.

More information

Refer to documentation for each module for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published