MarineSystemsSim.jl

MarineSystemsSim.jl is a small, Fossen-inspired library for 3-DOF surface vessel models in Julia. The goals are:

  • a clean 3-DOF surge–sway–yaw model in standard Fossen form,
  • high performance (StaticArrays, cached mass matrix and inverse),
  • easy integration with DifferentialEquations.jl and automatic differentiation.

What the package provides

Parameter types

Kinematics and frames

Core dynamics and interface

Fossen-style helpers

See:

A tiny taste of the API

Here is a minimal sketch of how the pieces fit together. For a full runnable example (including an ODE solver), see Getting started.

using MarineSystemsSim
using StaticArrays

# 1. Rigid body
rb = RigidBody3DOF(m, Iz, xG)

# 2. Hydrodynamics (Fossen-style derivatives)
hydro = hydroparams_fossen3dof(
    Xudot, Yvdot, Yrdot, Nrdot,   # added mass
    Xu,    Yv,    Yr,    Nv,  Nr, # linear damping
    Xuu,   Yvv,   Nrr;            # quadratic damping
    Xv = Xv, Xr = Xr, Yu = Yu, Nu = Nu,
)

# 3. Bundle parameters and build cached model
params = VesselParams3DOF(rb, hydro)
model  = Vessel3DOF(params)  # cached M, M⁻¹ and D_lin

# 4. Evaluate state derivative once
X = @SVector [x, y, ψ, u, v, r]   # 6×1 state: [η; ν]
τ = @SVector [τx, τy, τψ]         # 3×1 generalised forces

Xdot = vessel_dynamics(X, model, τ)

This is the same structure you use inside an ODE right-hand side; the Getting started page shows the full workflow with OrdinaryDiffEq.jl and concrete numbers.