trafficgen.marine_system_simulator module
The Marine Systems Simulator (MSS) is a Matlab and Simulink library for marine systems.
It includes models for ships, underwater vehicles, unmanned surface vehicles, and floating structures. The library also contains guidance, navigation, and control (GNC) blocks for real-time simulation. The algorithms are described in:
T. I. Fossen (2021). Handbook of Marine Craft Hydrodynamics and Motion Control. 2nd. Edition, Wiley. ISBN-13: 978-1119575054
Parts of the library have been re-implemented in Python and are found below.
- trafficgen.marine_system_simulator.flat2llh(x_n: float, y_n: float, lat_0: float, lon_0: float, z_n: float = 0.0, height_ref: float = 0.0) Tuple[float, float, float] [source]
Compute longitude lon (rad), latitude lat (rad) and height h (m) for the NED coordinates (xn,yn,zn).
Method taken from the MSS (Marine System Simulator) toolbox which is a Matlab/Simulink library for marine systems.
The method computes longitude lon (rad), latitude lat (rad) and height h (m) for the NED coordinates (xn,yn,zn) using a flat Earth coordinate system defined by the WGS-84 ellipsoid. The flat Earth coordinate origin is located at (lon_0, lat_0) with reference height h_ref in meters above the surface of the ellipsoid. Both height and h_ref are positive upwards, while zn is positive downwards (NED). Author: Thor I. Fossen Date: 20 July 2018 Revisions: 2023-02-04 updates the formulas for latitude and longitude
- Params:
xn: Ship position, north [m]
yn: Ship position, east [m]
zn=0.0: Ship position, down [m]
lat_0, lon_0: Flat earth coordinate located at (lon_0, lat_0)
h_ref=0.0: Flat earth coordinate with reference h_ref in meters above the surface of the ellipsoid
- Returns:
* lat (Latitude [rad])
* lon (Longitude [rad])
* h (Height [m])
- trafficgen.marine_system_simulator.llh2flat(lat: float, lon: float, lat_0: float, lon_0: float, height: float = 0.0, height_ref: float = 0.0) Tuple[float, float, float] [source]
Compute (north, east) for a flat Earth coordinate system from longitude lon (rad) and latitude lat (rad).
Method taken from the MSS (Marine System Simulator) toolbox which is a Matlab/Simulink library for marine systems.
The method computes (north, east) for a flat Earth coordinate system from longitude lon (rad) and latitude lat (rad) of the WGS-84 elipsoid. The flat Earth coordinate origin is located at (lon_0, lat_0). Author: Thor I. Fossen Date: 20 July 2018 Revisions: 2023-02-04 updates the formulas for latitude and longitude
- Params:
lat: Ship position in latitude [rad]
lon: Ship position in longitude [rad]
h=0.0: Ship height in meters above the surface of the ellipsoid
lat_0, lon_0: Flat earth coordinate located at (lon_0, lat_0)
h_ref=0.0: Flat earth coordinate with reference h_ref in meters above the surface of the ellipsoid
- Returns:
* x_n (Ship position, north [m])
* y_n (Ship position, east [m])
* z_n (Ship position, down [m])
- trafficgen.marine_system_simulator.ssa(angle: float) float [source]
Return the “smallest signed angle” (SSA) or the smallest difference between two angles.
Method taken from the MSS (Marine System Simulator) toolbox which is a Matlab/Simulink library for marine systems.
Examples
angle = ssa(angle) maps an angle in rad to the interval [-pi pi)
Author: Thor I. Fossen Date: 2018-09-21
- Param:
angle: angle given in radius
- Returns:
* smallest_angle
- Return type:
“smallest signed angle” or the smallest difference between two angles