Towards the Testing and Validation of Autonomous Ships: Design of a Variable Stability Ship Control System

: Maritime autonomous surface ships (MASSs) have received increased attention in both academic research and industrial applications in the global shipping and shipbuilding industry in recent years. According to its deﬁnition, a MASS can independently operate without human interaction. This brings the problem of how to test and evaluate the capabilities of the autonomous navigation control system developed for MASS. This paper proposes the novel concept of a variable stability ship and the design of its control system. A variable stability ship consists of a model-scaled ship, a model-following controller


Introduction
The rapid development of global trade in recent years has put higher requirements on energy saving, environmental protection, and the efficiency of existing transportation modes.According to [1], 80% of global trade is transported by sea each year.Ships deploy sensors and AI systems to improve safety, increase efficiency, reduce environmental impacts, and avoid collision avoidance [2].The International Maritime Organization (IMO) proposed the concept of a maritime autonomous surface ship (MASS) in 2017 and defines it as a ship that can operate independently of human interaction.A MASS could integrate perception, decision making, and control functions to implement autonomous navigation in complicated environments.With the advantages of high efficiency and autonomy, it has received increased attention in both academic research and industrial application in the global shipping and shipbuilding industry.
In 2018, the Maritime Safety Committee (MSC) in IMO completed a regulatory scoping exercise on MASS that was designed to assess existing IMO instruments to see how they might apply to ships with varying degrees of automation.In 2019, they approved Interim Guidelines for MASS trials to ensure that the trials of autonomous ships are "conducted safely, securely and with due regard for the protection of the environment."However, these guidelines are general without going further into details.The lack of specific standards and technical means for the trials and tests of MASS has restricted the progress of related products and practical applications.To promote autonomous navigation, functional testing and validation technologies on MASS are required.The development of testing and validation methods of MASS is still in the initial stage, and relevant research is scarce.A set of recommendations for the digital testing of autonomous navigation capabilities before actual sea trials is developed in [3], which takes into account the need for an accurate representation of the actual MASS vessel being built and verification of the autonomous navigation algorithm's capabilities to safety control the vessel in real-world scenarios.
The autonomous navigation system (ANS) is one of the key elements of a MASS.It is important to ensure its safe deployment and avoid causing accidents.This means a qualification process is necessary, for which the testing of the navigational system is required.Real-life testing alone is not feasible, as it is time and cost consuming; therefore, large-scale, systematic simulation-based testing is also needed.The authors in [4] propose the virtual-real interaction test scheme for the functional testing of MASS.A prototype of a test system developed for ANS is presented in [5]; the main components of the system include a scenario manager to generate dynamic test scenarios, an operating environment that defines the features of the test scenario, the digital twin of a ship to simulate its behavior, and a test evaluation system to assess how well the ANS performs on COLREGs safety rules and regulations.Collision avoidance is another important feature of a MASS.A scenario-based testing method is proposed in [6], in which an AI-based scenario search and production algorithm is used to create scenarios to validate the collision avoidance system.In [7], a navigation situation clustering model is developed to create test scenarios to assess the collision avoidance system of a MASS.It makes use of the automatic identification system data to extract the ship's trajectory and to cluster the data according to navigation situations to develop a collision avoidance test environment for MASS.A verification method is proposed in [8] to test safe trajectory planning algorithms implemented in the ANS, in which head-on, crossing, encounter situation, and sudden change of opponent ship scenarios are considered with no objective scenario design basis.In [9], a test platform for different control strategies for MASS is implemented based on a model-scaled ship.It can simulate the process of the control system autonomously, selecting an appropriate controller according to the ship's motion state and navigation scenarios.
Autonomous control is one of the key function of the MASS, and this functional test can be carried out by simulation calculations, physical model-based tests, real shipbased tests, and other hybrid methods.Simulation tests have the merits of low costs, high efficiency, and being risk-free, and are not restricted by environmental conditions.Nevertheless, it is difficult to guarantee the authenticity of testing scenarios due to the limitations on the accuracy of simulation model and computation capacity.Physical modelbased tests are more intuitive than simulations, as well as safer and lower cost compared with real ship-based tests.Therefore, they are commonly used in the analysis of ship performance, the development of new ship types, and the design of high-performance ships.In practice, most model-scaled ships are distorted models, which are not perfectly geometrically similar to their prototypes, which leads to differences in their dynamic responses.Meanwhile, building the physical models for all prototype ships is unrealistic, as it is both time consuming and increases costs.
Variable stability aircraft [10], also known as air flight simulation test aircraft, is a platform for testing the functional performance of new aircraft.It has the capability of changing the dynamic response of an aircraft in-flight without changing its physical properties, allowing adjustments of response characteristics and handling qualities [11].Variable stability aircraft have been used to design control systems for various flight situations, in which they can simulate the dynamic responses of different aircraft without changing their physical configurations.Inspired by variable stability aircraft, this paper extends this idea to the test of MASSs and proposes the concept of a variable stability ship.
A variable stability ship consists of a model-scaled ship, a model-following controller, and a hardware and software platform to implement its functions.The model-following controller is designed for the model-scaled ship to accomplish the control task, which is to ensure that the variable stability ship follows the states of different reference ships.In other words, the sailing states and trajectories of the variable stability ship and the reference ship need to be the same despite their dissimilarities in physical parameters and hydrodynamic characteristics.This enables the variable stability ship to have the capability to simulate the maneuverability and dynamic responses of reference ships.Therefore, the variable stability ship can be used to verify and evaluate the accuracy of different virtual ship models on a physical model-scaled ship, as well as evaluating the tested control strategies applied on different virtual ships in an actual environment.
The core function of a variable stability ship is accomplished by the design of the model-following controller, also referred to as the variable stability controller.The control task that a variable stability ship needs to complete can be considered a special type of formation control, whose purpose is to make its output follow the output of a reference ship that exhibits the desired characteristics.Sliding mode control (SMC) is based on variable structure systems composed of independent structures of different properties.It can adapt to system disturbances and model uncertainties [12], and has been successfully employed in the formation control of both autonomous surface and underwater vehicles due to its strong robustness and simplicity [12,13].To pursue faster convergence of tracking error, SMC with finite-time reachability was investigated [14,15].This paper combines finite-time control (FTC) with SMC to construct the variable stability controller to guarantee its fixed-time stability and adapt to parameter changes and disturbances.
This paper proposes the design of a variable stability ship control system for the testing and validation of MASSs, which involves the functional design and implementation of its hardware and software, and the construction of variable stability controller based on SMC and FTC.It can be used to test the performance of different control strategies on various ship types so as to reduce the R&D costs of physical model-based tests, as well as shorten the time spent in developing different physical models.Simulations are carried out to demonstrate the stability and quality of the variable stability controller, and to investigate its model-following performance to different reference ships.
The main contribution of this paper is twofold: • The novel concept of variable stability ship is proposed, which provides new solutions to the testing and validation of navigational control system of MASSs, especially in situations with limited experimental conditions.As far as the authors are aware, no similar published work exists for supporting the functional test problem of MASSs.

•
As the most important function of the variable stability ship control system, a variable stability controller is designed combining FTC and SMC based on model-following principles.
The rest of the paper is organized as follows.The principles of the variable stability ship are described in Section 2. Section 3 introduces the design and implementation of the variable stability ship control system.In Section 4, the steps for constructing a variable stability controller based on sliding mode control are given.The simulation results are presented in Section 5. Conclusions and future work are given in Section 6.

Principles of Variable Stability Ship
To design the variable stability ship control system, several terms need to be clarified.This paper introduces relevant concepts and definitions as follows.
Definition 1 (variable stability).It means the ability of a system that can change its dynamic response without changing its physical properties and allows for adjustments of its response characteristics and maneuverability [10].
Definition 2 (variable stability ship).It refers to a ship that is capable of simulating the dynamic responses of a range of reference ships via a model-following control strategy.

Definition 3 (variable stability control).
It refers to the control strategy which ensures that the variable stability ship replicates the sailing states of a reference ship.
The principles of a variable stability ship (VSS) system are illustrated in Figure 1.Firstly, according to the content of the test, a human operator gives input to the test settings in the system to define the test scenario.Parameters of wind, current, waves, and system uncertainties are set to calculate environmental forces based on empirical equations.Then, the reference ship (RS) type is chosen, and its parameters and hydrodynamic coefficients are determined.Different control functions, including heading control, path following, and trajectory tracking, are included in the system.Depending on the control objective of the test, the control strategy to be tested is applied to the reference ship to complete its control task, and its output states of surge, sway, and yaw movements over time are recorded in the system.The control objective of the VSS is to follow the RS output states.Based on the models of RS and VSS, the error model for states tracking is built, upon which the model-following controller calculates the control commands and sends them to the model-scaled ship, which acts as the implemented VSS.In this way, the VSS simulates the reference ship's behavior under the tested control strategy in an actual environment so as to evaluate its control performance.Figure 3 shows the workflow of the variable stability control system.Firstly, the human tester selects the reference ship type, and inputs the scenario parameter.The RS and VSS states are initialized.The tested control strategy is applied to the virtual RS, and the RS states are updated in the VSS control system.Based on the current states of RS and VSS, the error model is constructed.The variable stability control module calculates the control commands for VSS to make it follow the RS states.The control commands are applied to the model-scaled ship so that it simulates RS behavior.Then the RS, variable stability model-scaled ship, and the virtual VSS states are updated in the system.By checking whether the termination criteria are satisfied, the human tester decides whether the procedure continues or finishes.The hardware of VSS includes its sensing system, shore-based monitoring system, model-scaled ship design, and VSS controller.A model-scaled ship is designed and built as the VSS prototype in an actual environment.The sensing system is implemented with a global navigation satellite system (GNSS) antenna, anemometer, camera, Lidar, long-range radio (LoRa), ultra-wideband (UWB), and inertial measurement unit (IMU).The shore-based monitoring system is designed to obtain a more accurate positioning of the model-scaled ship from the shore-end real-time kinematics (RTK).The VSS controller receives information regarding the RS and VSS from the sensing system and applies the control commands output from the variable stability control system to the model-scaled ship to simulate the behavior of RS.

Hardware Implementation
Figure 4 illustrates the hardware implementation of the variable stability control system.The testing control strategy is applied to the virtual RS model to run simulations.The RS states are updated in the simulation, and the VSS states obtained from the sensing system installed on the model-scaled ship are sent to the variable stability controller.The controller determines the control forces and moments required for the VSS to follow the RS states.Then these control inputs are transformed into propeller speed and rudder angle commands and are sent to the model-scaled ship via TCP/IP communication.In other words, the variable stability controller is implemented in a shore-end laptop and communicates with the ship-end data acquisition board PLC.The PLC controls the motor, and the driver compares the error between the feedback motor signal from the encoder with the PLC command and performs closed-loop control of the motor.In this way, the motor drives the propeller and rudder to execute control commands.Figure 5 shows the composition of the shore-based monitoring system.It is equipped with a communication unit including routers, a POE signal switch, a server, a differential base station, and a laptop used to remotely control the model-scaled ship.The ship-end system communicates with the shore-side monitoring workstation via the Modbus protocol.The model-scaled ship is a 64 TEU twin-propeller and twin-rudder container model ship, and the scale ratio with the prototype is 1:18.It is installed with sensors, batteries, signal amplifier, control cabinet, motors, and drivers.The shore-end laptop inputs RS information and the testing control strategy and sends control commands to the shore-end system.The model-scaled ship information regarding its position, velocity and course is collected from the shore-end system and uploaded to the data acquisition board in the control cabinet.The ship-end system receives and executes control commands.

Software Design
This paper designs the interface based on the Python language and PyQt5 framework.The whole software control platform runs on a microcomputer configured with Core i7-10750 CPU, 2.6 GHz with 16 GB RAM, and is designed in Python language.The VSS control interface is shown in Figure 6.It of six main functions, including a control panel, switch control, map display, ship parameters display, and monitoring of VSS and RS states.
The control panel provides the RS/VSS selection, the testing control type (free running, heading control, and path following), target heading angle and reference path points, as well as the testing control strategies (PID and sliding mode control).Before the test procedure starts, the RS and VSS need to be initialized, which means RS and VSS types, the applied control strategies and the corresponding control parameters need to be determined.The information of RS and VSS is shown in the ship parameters display part, and their information during tests is given in the state display part and monitoring part.When the test procedure initiates, the start button is clicked, the ship end hardware equipment is powered on and waits for the shore-end control command.The shore-end system receives the status information of the ship-end equipment and performs related control operations.The PC controller calculates the control command and sends it to the ship-end PLC through Modbus protocol, and the PLC drives the actuator to complete the ship control.The whole control program is divided into multiple threads, one main thread circulates to calculate the control command, and two sub-threads realize data receiving and sending, respectively.

Variable Stability Controller Design
This section introduces the ship model and the controller design steps to implement variable stability control.

Mathematical Model of the Ship
Figure 7 shows the ship coordinate system used in this paper: the space-fixed coordinate system O 0 − x 0 y 0 z 0 and the moving ship-fixed coordinate system o − xyz, where o is taken on the midship of the ship, with x, y and z axes that point towards the ship's bow, towards the starboard and vertically downwards, respectively.Heading angle ψ is defined as the angle between the x 0 and x axes, variable δ represents the rudder angle, and r represents the yaw rate.Variables u and v denote the surge and sway velocity in the x and y directions, respectively.As the multiple degrees of freedom (DOF) model need more control inputs, the surface ship can be simplified to 3 DOFs.According to [17], it can be described as where η = [x, y, ψ] indicates the position vector (x, y) and heading angle ψ of the ship in the earth-fixed coordinate, and v = [u, v, r] indicates the velocity vectors (u, v) and yaw rate r in the body-fixed coordinate.τ = [τ u , τ v , τ r ] denotes the control inputs, which are the surge, sway forces and yaw moments.J(ψ) is a simplified rotation matrix between earth-fixed and body-fixed coordinates, which can be expressed as It has the property of J (ψ)J(ψ) = I, J(ψ) = J(ψ)Λ(r), and that J (ψ)Λ(r)J(ψ) = Matrices M, C(v), and D(v) represent the ship inertia coefficients, the Coriolis and centripetal matrix, and the damping matrix, separately.To simplify the dynamics of the ship, these matrices can be determined according to the surge-decoupled system: It is noted that m represents ship mass, and I z represents the moment of inertia around the z-axis.
Parameters X u, Y ṙ and N ṙ are the hydrodynamic coefficients.
Matrix C(v) can be simplified as and D(v) is determined by (4)

Controller Design Based on SMC-FTC
The main function of the VSS control system is to simulate the dynamic response of another ship with a variable stability control strategy.It is essentially a model-following problem that is similar to formation control and trajectory tracking control.It can be seen as a formation control problem, in which the leadership and the followership track the same trajectory, or a trajectory tracking problem, in which the variable stability ship follows the states of a reference ship instead of its trajectory.
To construct the VSS controller, auxiliary variables x = J(ψ)v and h(x) are introduced to reformulate model (1) as follows: ( Consequently, The variable stability control objective is to ensure that the position vectors of both RS and VSS stay the same.The position error η e between VSS and RS can be expressed as in which η V and η R represent the position vectors of VSS and RS, respectively.The derivatives of the error model are obtained as This paper designs the VSS controller based on sliding mode control.Based on the error model ( 8), the sliding surface is defined: ) in which s e (•) is a function of errors of position and motion vectors defined as integral sliding mode term, 0 , and that sig The time derivative of ( 9) is obtained: Therefore, to make Ṡ0 = 0, the control forces of VSS are determined: in which λ 0 > 0, λ 1 > 0, λ 2 > 0; p and q are odd integers that satisfy 0 < p < q.
Lemma 1.If there exists a system that satisfies ẏ = −αy 2−plq − βy p/q , y(0) = y 0 (13) in which y represents the system state, y 0 represents the initial system state, α > 0, β > 0, and p and q are two positive odd numbers.When p < q is satisfied, the system can converge to stability in a finite time, and the upper bound on the convergence time T has the following properties: Lemma 2. Consider a second-order system described by ẋ1 = x 2 , ẋ2 = g(x 1 , x 2 ), where x 1 and x 2 are the state variables and the control input is g(x 1 , x 2 ).If the control input is chosen as g(x 1 , x 2 ) = −ρ 1 Sgn(x 1 ) − ρ 2 Sgn(x 2 ) (ρ 1 > ρ 2 > 0), the unique equilibrium point x 1 = x 2 = 0 is globally finite-time stable.For the proof of Lemmas 1 and 2, we refer the readers to [18] for further details.
The proof of finite-time convergence and the stability of the controller ( 12)) is given as follows.
Proof.Define the Lyapunov function: The time derivative is presented: 1+p/q 2 (19) According to Lemma 1, the system under (12) converges to stability with time: where p−q 2q and m 1 = p + q, n 1 = 2q, and m 1 < n 1 is satisfied.
Moreover, when the control law ( 12) reaches the sliding surface with time T 1 , conditions S(t) ≡ 0 and Ṡ (t) ≡ 0 hold.According to Lemma 2, it can be proved that the system has finite time stability.

Simulation Results
This section presents the simulation results of the proposed VSS control strategy, and the implementation results on a model-scaled ship.

Simulation Settings
To verify the effectiveness of the VSS controller proposed, simulations are carried out, in which the model-scaled ship simulates the behavior of two reference ships, including a marine engineering ship [19] and a double-ended ferry [20], which are referred to as Ship A and Ship B, respectively.The parameters of the VSS and RSs are given in Appendix Table A1.The VSS is a 1:18 scale replica of a 64TEU container ship.It is noted that as the RS and VSS vary in size, the scaling factors are considered in simulations.A basic PID control law is applied to the RS such that it follows the reference paths.Then the designed SMC-FTC controller is applied to the VSS such that it follows the RS states.

Performance Evaluation
Figures 8 and 9 give the simulated results of the VSS following the states of reference Ship A and Ship B. It can be seen that VSS is able to track the 3-DOF states of reference ships.The position errors concerning x, y and ψ between VSS and RSs over time are also given.It shows that while the VSS and RSs start from different initial states, the VSS can successfully follow the position states of the RSs.When the VSS follows reference Ship A, the position errors e x , e y and e ψ converge and stabilize after 40 s, 60 s and 200 s, respectively.When the VSS follows reference Ship B, position errors e x , e y and e ψ converge and stabilize after 30 s, 30 s and 120 s, respectively.Figures 10 and 11 give the control forces and moments of the VSS and reference ships.It is noted that the reference ships follow randomly selected paths with fixed surge forces τ u and relative small yaw moments τ r .The control forces and moments are transformed into rudder angle and propeller speed commands via thrust allocation algorithms and sent to the VSS.

Future Prospects of Variable Stability Ship
The proposed design of the variable stability ship and its control system can be used in the testing and validation of MASS in several directions.Firstly, the proposed VSS integrates physical and simulation tests, in which the model-scaled ship can simulate the dynamic responses of the virtual RS under different testing control strategies.In other words, the testing control strategies developed for MASS are applied to different virtual RSs, and the simulated RSs states are duplicated on the physical VSS in the real environment, which makes the control performance more visible.In this way, the developed MASS control strategy can be tested on various types of ships, using only one physical modelscaled ship.This provides solutions for situations in which full-scale physical tests are unable to be carried out.
Meanwhile, the variable stability ship itself is a physical model, which can be used to validate and adjust the developed virtual ship models in the simulation test systems.According to its principle, the VSS should replicate the RS motion states in an actual environment with a designed VSS controller.If deviations exist between the virtual RS states and the actual VSS states, it may be caused by model uncertainties of the RS model.By measuring these states' differences, the virtual RS model can be adjusted.

Conclusions and Future Work
To test the performance of the navigational control system developed for autonomous ships, this paper proposes the concept of a variable stability ship and gives the functional requirements, hardware implementation and software design of its control system.The variable stability controller is constructed based on finite-time sliding mode control following the model-following control principle.Preliminary results are given to show its effectiveness and potential in future applications.
For future work, this research will be extended in several directions.Firstly, experimental tests will be carried out, in which the VSS controller is implemented on a utilized model-scaled ship to simulate the dynamic responses of different virtual ships.This will further validate the practicability of the proposed method.Secondly, the VSS controller proposed in this paper did not explicitly consider external disturbances and model certainties.This will be studied in our future work by adding state observers and introducing robust strategies.In addition, various testing control strategies will be applied to the RS to generate different reference states; it is worth investigating how the VSS performs when following the RS states under different control tasks.Moreover, the proposed VSS controller relies on completely known and accurate ship dynamics, while in practice, the deviations between the given ship mathematical model and true ship dynamics always exist.This will affect the performance of the VSS controller.Therefore, model-free or learning-based control strategies can be introduced to further improve the VSS control performance.
Data Availability Statement: Data available on request due to restrictions eg privacy or ethical.

Conflicts of Interest:
The authors declare no conflict of interest.

Figure 1 .
Figure 1.The principles of a variable stability ship simulation system.

Figure 2
Figure2gives the functional design of the variable stability control system.The software design of VSS consists of five main functions, including reference ship selection, control test, variable stability control, virtual model simulation, and information display and storage:• Reference ship selection.The simulated ship type selection system is used to input information about the simulated ship parameters and to select the control algorithm to be verified.

Figure 2 .
Figure 2. Functional design of variable stability control system.

Figure 3 .
Figure 3. Workflow of variable stability control system.

Figure 4 .
Figure 4.The hardware implementation of variable stability control system.

Figure 5 .
Figure 5.The shore-based monitoring of model-scaled ship.

Figure 6 .
Figure 6.The interface of variable stability control system.

Figure 8 .
Figure 8. Trajectories of VSS and reference Ship A.

Figure 9 .
Figure 9. Trajectories of VSS and reference Ship B.

Figure 10 .
Figure 10.Control inputs of VSS and reference Ship A.

Figure 11 .
Figure 11.Control inputs of VSS and reference Ship B.

Table A1 .
Applied parameters for simulations of VSS and RSs.