### Introduction

### Problem formulation

### 2.1 Route planning

### 2.2 Ship geometry and coordinate systems

*o*−

_{e}*x*), (2) Ship-fixed frame (

_{e}y_{e}z_{e}*o*−

_{s}*x*), and (3) Rudder-fixed frame (

_{s}y_{s}z_{s}*o*−

_{r}*x*).

_{r}y_{r}z_{r}### 2.3 Nonlinear state space model

*m*is the mass of body (unit:

*kg*)

*u*,

*v*,

*r*are the surge/sway/yaw velocities (units:

*m/s*,

*m/s*, and

*deg/s*, respectively)

*u̇*,

*v̇*,

*ṙ*are the surge/sway/yaw accelerations (units:

*m/s*

^{2},

*m/s*

^{2}, and

*deg/s*

^{2}, respectively)

*m*,

_{x}*m*are the added masses of

_{y}*x*axis direction and

*y*axis direction (unit:

*kg*)

*x*is the longitudinal coordinate of center of gravity of the ship (unit:

_{G}*m*)

*I*is the moment of inertia about the

_{ZG}*z*axis (unit:

*kg·m*

^{2})

*J*is the added moment of inertia about the

_{Z}*z*axis (unit:

*kg·m*

^{2})

*X*,

*Y*are the surge/sway resultant forces acting on the ship (unit:

*N*)

*N*is the yaw resultant moment acting on the ship (unit:

*N·m*)

*X*,

*Y*) and moment (

*N*) in Eq. (1) are decomposed into three components in the MMG model: the bare hull, rudder, and propeller. where the subscripts

*H*,

*R*,

*P*denote hull, rudder, and propeller, respectively.

*X*,

_{W}*Y*,

_{W}*N*mean the external forces and moment acting on the hull induced by waves. In this work, the nonlinear and linear MMG models were used for the validation study about the accuracy of the ship’s maneuvering performance. The hydrodynamic derivatives for the nonlinear maneuvering MMG model are expressed in Eq. (3), whereas the hydrodynamic derivatives for the linear MMG model are given in Eq. (4).

_{W}##### (3)

*X*,

_{u}*X*,

_{vv}*X*,

_{vr}*X*,

_{rr}*X*,

_{vvvv}*Y*,

_{v}*Y*,

_{r}*Y*,

_{vvv}*Y*,

_{vvr}*Y*,

_{vrr}*Y*,

_{rrr}*N*,

_{v}*N*,

_{r}*N*,

_{vvv}*N*,

_{vvr}*N*, and

_{vrr}*N*are called the hydrodynamic derivatives. For more details on the MMG model, reference can be made to Yasukawa, H., & Yoshimura, Y. (2015).

_{rrr}*x̄*) and manipulated inputs (

*ū*) vector as follows (Sandeepkumar et al, 2022):

##### (5)

*x̄*= [

*u v r x y ψ*]

*is the state vector,*

^{T}*ū*= [

*n δ*]

*is the manipulated input vector.*

^{T}*x*and

*y*are the x and y position expressed with respect to the earth-fixed coordinate (unit: m),

*ψ*is the ship's heading angle (unit: degree),

*n*is the propeller rotational speed (unit: RPS),

*δ*is the rudder angle (unit: degree).

### 2.4 Nonlinear MPC

*t*∈ [0,

*T*] (where

_{P}*T*is the horizon length), should be defined for the problem of optimal route planning, representing the time from the start to the end of the route planning. When the system dynamics are given in continuous time as reported in Eq. (3), a finite-horizon optimal route planning problem can be formulated as follows (Rawlings et al, 2017):

_{P}##### (7)

*x*(

_{f}*t*) and

*y*(

_{f}*t*) are the final position in the earth-fixed coordinate at a given time. As an equality constraint,

### Results (Case study)

*x*

_{0}and then performs intermediate computations that result in a new point

*x*

_{1}. It then repeats the process in order to obtain successive approximations

*x*

_{2},

*x*

_{3}, ⋯ of the local minimum. It should be highlighted that the number of iterations in the optimization computation depends on the solver's stopping criteria consisting of Step tolerance and Function tolerance. Step tolerance is a lower bound on the size of a step, indicating the norm of (

*x*−

_{i}*x*

_{i}_{+ 1}), whereas Function tolerance is a lower bound on the change in the objective value during a step (|

*f*(

*x*) −

_{i}*f*(

*x*

_{i}_{+ 1})|). For the route planning optimization in this work, the iterations end if |

*x*−

_{i}*x*

_{i}_{+ 1}| < Step tolerance and |

*f*(

*x*) −

_{i}*f*(

*x*

_{i}_{+ 1})| < Function tolerance.

*x̄*) and manipulated (

*ū*) variables.

### Conclusions and discussion

*x̄*) and manipulated (

*ū*) variables satisfy equality and inequality conditions. In this regard, it can be argued that the effectiveness of the MPC controller adopted in this study is demonstrated by presenting that the optimal ship route was successfully generated with the satisfaction of the nonlinear dynamics of the ship and all the constraints for the state and manipulated variables.