Skip to content

Commit

Permalink
deploy: 3720027
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaasRostock committed Nov 23, 2023
0 parents commit d0519cd
Show file tree
Hide file tree
Showing 84 changed files with 12,699 additions and 0 deletions.
Empty file added .nojekyll
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: fe6e78131ef79695ff429e53298be037
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
API Reference
=============

This page contains auto-generated API reference documentation [#f1]_.

.. toctree::
:titlesonly:

/api/trafficgen/index

.. [#f1] Created with `sphinx-autoapi <https://github.com/readthedocs/sphinx-autoapi>`_
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
:py:mod:`trafficgen.check_land_crossing`
========================================

.. py:module:: trafficgen.check_land_crossing
.. autoapi-nested-parse::

This module finds if the generated path is crossing land.



Module Contents
---------------


Functions
~~~~~~~~~

.. autoapisummary::

trafficgen.check_land_crossing.path_crosses_land



.. py:function:: path_crosses_land(position_1, speed, course, lat_lon_0, time_interval=50)
Find if path is crossing land.

Params:
position_1: Ship position in (north, east) [m].
speed: Ship speed [knots].
course: Ship course [degree].
lat_lon_0: Reference point, latitudinal [degree] and longitudinal [degree].
time_interval: The time interval the vessel should travel without crossing land [minutes]

:returns: True if parts of the path crosses land.
:rtype: is_on_land


Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
:py:mod:`trafficgen.cli`
========================

.. py:module:: trafficgen.cli
.. autoapi-nested-parse::

CLI for trafficgen package.



Module Contents
---------------


Functions
~~~~~~~~~

.. autoapisummary::

trafficgen.cli.main
trafficgen.cli.gen_situation



Attributes
~~~~~~~~~~

.. autoapisummary::

trafficgen.cli.logger
trafficgen.cli.default_data_path
trafficgen.cli.sit_folder
trafficgen.cli.own_ship_file
trafficgen.cli.target_ship_folder
trafficgen.cli.settings_file
trafficgen.cli.output_folder


.. py:data:: logger
.. py:data:: default_data_path
.. py:data:: sit_folder
.. py:data:: own_ship_file
.. py:data:: target_ship_folder
.. py:data:: settings_file
.. py:data:: output_folder
.. py:function:: main(args=None)
.. py:function:: gen_situation(situations, own_ship, targets, settings, visualize, col, row, visualize_situation, output)
Console script for trafficgen. Example:

trafficgen gen-situation -s ./data/example_situations_input
-o ./data/test_output_1


Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
:py:mod:`trafficgen.encounter`
==============================

.. py:module:: trafficgen.encounter
.. autoapi-nested-parse::

This module generates encounters consisting of one own ship and one to many target ships.
The generated encounters may be of type head-on, overtaking give-way and stand-on and
crossing give-way and stand-on.



Module Contents
---------------


Functions
~~~~~~~~~

.. autoapisummary::

trafficgen.encounter.generate_encounter
trafficgen.encounter.check_encounter_evolvement
trafficgen.encounter.calculate_min_vector_length_target_ship
trafficgen.encounter.find_start_position_target_ship
trafficgen.encounter.assign_future_position_to_target_ship
trafficgen.encounter.determine_colreg
trafficgen.encounter.calculate_relative_bearing
trafficgen.encounter.calculate_ship_course
trafficgen.encounter.assign_vector_time
trafficgen.encounter.assign_speed_to_target_ship
trafficgen.encounter.assign_beta
trafficgen.encounter.update_position_data_target_ship
trafficgen.encounter.update_position_data_own_ship
trafficgen.encounter.decide_target_ship



.. py:function:: generate_encounter(desired_encounter_type, own_ship, target_ships, target_ship_id, beta_default, relative_speed_default, vector_time_default, settings)
Generates an encounter.

Params:
* desired_encounter_type: Desired encounter to be generated
* own_ship: Dict, information about own ship that will encounter a target ship
* target_ships: List of target ships that may be used in an encounter
* target_ship_id: ID which should be used on target ship
* beta_default: User defined beta. If not set, this is None.
* relative_speed_default: User defined relative speed between own ship and
target ship. If not set, this is None.
* vector_time_default: User defined vector time. If not set, this is None.
* settings: Encounter settings

:returns: target ship information, such as initial position, speed and course
encounter_found: 0=encounter not found, 1=encounter found
:rtype: target_ship


.. py:function:: check_encounter_evolvement(own_ship, own_ship_position_future, target_ship, target_ship_position_future, desired_encounter_type, settings)
Checks encounter evolvement. The generated encounter should be the same type of
encounter (head-on, crossing, give-way) also some time before the encounter is started.

Params:
* own_ship: Own ship information such as initial position, speed and course
* target_ship: Target ship information such as initial position, speed and course
* desired_encounter_type: Desired type of encounter to be generated
* settings: Encounter settings

:returns:

* returns 0 if encounter not ok, 1 if encounter ok


.. py:function:: calculate_min_vector_length_target_ship(own_ship_position, own_ship_course, target_ship_position_future, desired_beta)
Calculates minimum vector length (target ship speed x vector). This will
ensure that ship speed is high enough to find proper situation.

Params:
* own_ship_position: Own ship initial position, speed and course
* own_ship_course: Own ship initial course
* target_ship_position_future: Target ship future position
* desired_beta: Desired relative bearing between

Returns: min_vector_length: Minimum vector length (target ship speed x vector)


.. py:function:: find_start_position_target_ship(own_ship_position, own_ship_course, target_ship_position_future, target_ship_vector_length, desired_beta, desired_encounter_type, settings)
Find start position of target ship using desired beta and vector length.

Params:
* own_ship_position: Own ship initial position, speed and course
* own_ship_course: Own ship initial course
* target_ship_position_future: Target ship future position
* target_ship_vector_length: vector length (target ship speed x vector)
* desired_beta: Desired bearing between own ship and target ship seen from own ship
* desired_encounter_type: Desired type of encounter to be generated
* settings: Encounter settings

:returns: Dict, initial position of target ship {north, east} [m]
* start_position_found: 0=position not found, 1=position found
:rtype: * start_position_target_ship


.. py:function:: assign_future_position_to_target_ship(own_ship_position_future, max_meeting_distance)
Randomly assign future position of target ship. If drawing a circle with radius
max_meeting_distance around future position of own ship, future position of
target ship shall be somewhere inside this circle.

Params:
* own_ship_position_future: Dict, own ship position at a given time in the
future, {north, east}
* max_meeting_distance: Maximum distance between own ship and target ship at
a given time in the future [nm]

:returns: Dict, future position of target ship {north, east} [m]
:rtype: future_position_target_ship


.. py:function:: determine_colreg(alpha, beta, theta13_criteria, theta14_criteria, theta15_criteria, theta15)
Determines the colreg type based on alpha, relative bearing between target ship and own
ship seen from target ship, and beta, relative bearing between own ship and target ship
seen from own ship.

Params:
* alpha: relative bearing between target ship and own ship seen from target ship
* beta: relative bearing between own ship and target ship seen from own ship
* theta13_criteria: Tolerance for "coming up with" relative bearing
* theta14_criteria: Tolerance for "reciprocal or nearly reciprocal courses",
"when in any doubt... assume... [head-on]"
* theta15_criteria: Crossing aspect limit, used for classifying a crossing encounter
* theta15: 22.5 deg aft of the beam, used for classifying a crossing and an overtaking
encounter

:returns:

* encounter classification


.. py:function:: calculate_relative_bearing(position_own_ship, heading_own_ship, position_target_ship, heading_target_ship)
Calculates relative bearing between own ship and target ship, both seen from
own ship and seen from target ship.

Params:
* position_own_ship: Dict, own ship position {north, east} [m]
* heading_own_ship: Own ship course [deg]
* position_target_ship: Dict, own ship position {north, east} [m]
* heading_target_ship: Target ship course [deg]

:returns: relative bearing between target ship and own ship seen from target ship [deg]
* beta: relative bearing between own ship and target ship seen from own ship [deg]
:rtype: * alpha


.. py:function:: calculate_ship_course(waypoint_0, waypoint_1)
Calculates ship course between two waypoints

Params:
* waypoint_0: Dict, waypoint {north, east} [m]
* waypoint_1: Dict, waypoint {north, east} [m]

:returns: Ship course [deg]
:rtype: course


.. py:function:: assign_vector_time(setting_vector_time)
Randomly (uniform) assigns vector time

Params:
* setting_vector_time: Minimum and maximum value for vector time

:returns: Vector time [min]
:rtype: vector_time


.. py:function:: assign_speed_to_target_ship(encounter_type, own_ship_speed, min_target_ship_speed, relative_speed_setting)
Randomly (uniform) assigns speed to target ship depending on type of encounter

Params:
* encounter_type: Type of encounter
* own_ship_speed: Own ship speed [knot]
* min_target_ship_speed: Minimum target ship speed [knot]
* relative_speed_setting: Relative speed setting dependent on encounter [-]

:returns: Target ship speed [knot]
:rtype: speed_target_ship


.. py:function:: assign_beta(encounter_type, settings)
Randomly (uniform) assigns relative bearing beta between own ship
and target ship depending on type of encounter

Params:
* encounter_type: Type of encounter
* settings: Encounter settings

:returns: Relative bearing between own ship and target ship seen from own ship [deg]


.. py:function:: update_position_data_target_ship(ship, lat_lon_0)
Updating position data of the target ship to also include latitude and longitude
position of the target ship

Params:
* ship: Target ship data
* lat_lon_0: Reference point, latitudinal [degree] and longitudinal [degree]

:returns: Updated target ship data
:rtype: ship


.. py:function:: update_position_data_own_ship(ship, lat_lon_0, delta_time)
Updating position data of the target ship to also include latitude and longitude
position of the target ship

Params:
* ship: Own ship data
* lat_lon_0: Reference point, latitudinal [degree] and longitudinal [degree]
* delta_time: Delta time from now to the time new position is being calculated [minutes]

:returns: Updated own ship data
:rtype: ship


.. py:function:: decide_target_ship(target_ships)
Randomly picks a target ship from a dict of target ships

Params:
* target_ships: dict of target ships

:returns: The target ship, info of type, size etc.


Loading

0 comments on commit d0519cd

Please sign in to comment.