trafficgen.marine_system_simulator¶
The Marine Systems Simulator (MSS) is a Matlab and Simulink library for marine systems publicly available at https://github.com/cybergalactic/MSS.
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.
Functions
|
Compute lon lon (rad), lat lat (rad) and height h (m) for the NED coordinates (xn,yn,zn). |
|
Compute (north, east) for a flat Earth coordinate system from lon lon (rad) and lat lat (rad). |
|
Return the "smallest signed angle" (SSA) or the smallest difference between two angles. |
- 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] ¶
Compute lon lon (rad), lat 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 lon lon (rad), lat 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 lat and lon
- Parameters:
x_n (float) – Ship position, north [m]
y_n (float) – Ship position, east [m]
lat_0 (float) – Flat earth coordinate located at (lon_0, lat_0)
lon_0 (float) – Flat earth coordinate located at (lon_0, lat_0)
z_n (float) – Ship position, down [m], default is 0.0
h_ref (float) – Flat earth coordinate with reference h_ref in meters above the surface of the ellipsoid, default is 0.0
- Returns:
lat (float) – Ship position in lat [rad]
lon (float) – Ship position in lon [rad]
h (float) – Ship height in meters above the surface of the ellipsoid [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] ¶
Compute (north, east) for a flat Earth coordinate system from lon lon (rad) and lat 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 lon lon (rad) and lat 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 lat and lon
- Parameters:
lat (float) – Ship position in lat [rad]
lon (float) – Ship position in lon [rad]
lat_0 (float) – Flat earth coordinate located at (lon_0, lat_0)
lon_0 (float) – Flat earth coordinate located at (lon_0, lat_0)
h (float) – Ship height in meters above the surface of the ellipsoid, default is 0.0
h_ref (float) – Flat earth coordinate with reference h_ref in meters above the surface of the ellipsoid
- Returns:
x_n (float) – Ship position, north [m]
y_n (float) – Ship position, east [m]
z_n (float) – Ship position, down [m]
- trafficgen.marine_system_simulator.ssa(angle: float) float ¶
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
- Parameters:
angle (float) – Angle given in radius
- Returns:
smallest_angle – “smallest signed angle” or the smallest difference between two angles
- Return type:
float