A MBSE Application to Controllers of Autonomous Underwater Vehicles Based on Model-Driven Architecture Concepts

: In this paper, a hybrid realization model is proposed for the controllers of autonomous underwater vehicles (AUVs). This model is based on the model-based systems engineering (MBSE) methodology, in combination with the model-driven architecture (MDA), the real-time uniﬁed modeling language (UML) / systems modeling language (SysML), the extended / unscented Kalman ﬁlter (EKF / UKF) algorithms, and hybrid automata, and it can be reused for designing controllers of various AUV types. The dynamic model and control structure of AUVs were combined with the specialization of MDA concepts as follows. The computation-independent model (CIM) was speciﬁed by the use-case model combined with the EKF / UKF algorithms and hybrid automata to intensively gather the control requirements. Then, the platform-independent model (PIM) was specialized using the real-time UML / SysML to design the capsule collaboration of control and its connections. The detailed PIM was subsequently converted into the platform-speciﬁc model (PSM) using open-source platforms to promptly realize the AUV controller. On the basis of the proposed hybrid model, a planar trajectory-tracking controller, which allows a miniature torpedo-shaped AUV to autonomously track the desired planar trajectory, was implemented and evaluated, and shown to have good feasibility.

Controller design for AUVs has been a challenge because controllers are closely linked to AUV dynamics in complex underwater environments [9][10][11]. The AUV controller can consist of discrete models, continuous models, and their interaction in a hybrid dynamic system (HDS), as modeled by hybrid automata (HA) [12][13][14][15]. Traditional control methods have often been used for implementing complex systems to make them more effective for their controllers [16][17][18]. They have also been used for building AUV controllers. Some traditional control techniques applied for AUV applications are described below. Table 1. Society of Naval Architects and Marine Engineers (SNAME) notations for underwater vehicles (data from [64]).

Degree of Freedom Motions Force and Moment Linear and Angular Velocity
Position and Euler Angles Yaw N r ψ According to the guidance, navigation, and control of underwater vehicles [9,[73][74][75][76][77], the kinematic model in the inertial frame and the dynamic model in the main frame of AUVs can be written as Equations (1) and (2), respectively. , and D(ν) denote inertia, Coriolis, and damping, respectively, while g(η) is a vector of gravity and buoyancy forces. On the right-hand side of Equation (2), τ(v,u) is the vector of resultant forces and moments acting on the AUV, and u represents the control inputs. A model of state-space discreteness can be used to model the control evolution of an AUV that is used to estimate the states of an AUV by using the EKF or UKF [78][79][80][81][82] methodologies; the motion of the control system can be described as shown in Equation (3).
x k = f k−1 (x k−1 , u k−1 ) + w k−1 y k = h k (x k ) + v k 4 of 20 where x = η ν , x k is the state variable vector at the k-th instant of x, u k and y k are the system's inputs and outputs, respectively, and h k , w k , and v k are the measurement function, additive process, and measurement noise, respectively.

General Control Architecture for an AUV
The physical architecture of an AUV consists of the following subsystems: the guidance subsystem; the navigation subsystem; and the control subsystem. These subsystems have their own tasks, yet they must also cooperate to permit the vehicle to complete its mission. Figure 1 shows a block definition diagram in SysML that depicts the interactions of the subsystems.

General Control Architecture for an AUV
The physical architecture of an AUV consists of the following subsystems: the guidance subsystem; the navigation subsystem; and the control subsystem. These subsystems have their own tasks, yet they must also cooperate to permit the vehicle to complete its mission. Figure 1 shows a block definition diagram in SysML that depicts the interactions of the subsystems. According to the above AUV dynamic and control architecture, and the definition of an HDS described in [13][14][15], AUV controllers can, thus, be considered HDSs whose dynamic behaviors can be modeled by HA [12] and implemented by line-of-sight (LOS) navigability, as described in [83][84][85][86][87].

CIM for an AUV Controller
On the basis of the dynamics and control frame of AUVs described in Section 2, the main use case model of AUV controllers is shown in Figure 2. Figure 3a,b describes a case study of pathtracking scenarios, where the state machine of the "Track a desired trajectory" use case is shown using the sequence and state diagrams of real-time UML/SysML conventions.
The system/human actors and use cases of the AUV controller are defined as follows: -MDS is the measurement display system actor, which includes the guidance subsystem and navigation subsystem. -MES is the marine environment system actor, which represents the marine environmental noises. -Maintainer is a human actor who has authority to check the physical AUV components and configure system parameters AUV for running AUV tasks. -"Track a desired trajectory" is a use case study for tracking the target of a predefined path. -"Ensure safety" is a use case for ensuring system safety. -"Configure control parameters of the AUV" is a use case for configuring and updating system parameters. -"Maintain the physical components" is a use case for servicing the whole physical system. According to the above AUV dynamic and control architecture, and the definition of an HDS described in [13][14][15], AUV controllers can, thus, be considered HDSs whose dynamic behaviors can be modeled by HA [12] and implemented by line-of-sight (LOS) navigability, as described in [83][84][85][86][87].

CIM for an AUV Controller
On the basis of the dynamics and control frame of AUVs described in Section 2, the main use case model of AUV controllers is shown in Figure 2. Figure 3a,b describes a case study of path-tracking scenarios, where the state machine of the "Track a desired trajectory" use case is shown using the sequence and state diagrams of real-time UML/SysML conventions.
The system/human actors and use cases of the AUV controller are defined as follows: -MDS is the measurement display system actor, which includes the guidance subsystem and navigation subsystem. -MES is the marine environment system actor, which represents the marine environmental noises. -Maintainer is a human actor who has authority to check the physical AUV components and configure system parameters AUV for running AUV tasks. -"Track a desired trajectory" is a use case study for tracking the target of a predefined path. -"Ensure safety" is a use case for ensuring system safety. -"Configure control parameters of the AUV" is a use case for configuring and updating system parameters.  In this work, an implemented functional block diagram ( Figure 4) is proposed for the kinematic and dynamic models of an AUV, described in Equations (1) and (2), to obtain the internal continuous evolutions for the controller, where Ωdi, = 1, are desired rotational speeds, which are applied to the n actuators of the AUV, and ΣT and τφ,θ,Ψ are the overall output forces and moments acting on the actuators of the AUV.   In this work, an implemented functional block diagram ( Figure 4) is proposed for the kinematic and dynamic models of an AUV, described in Equations (1) and (2), to obtain the internal continuous evolutions for the controller, where Ωdi, = 1, are desired rotational speeds, which are applied to the n actuators of the AUV, and ΣT and τφ,θ,Ψ are the overall output forces and moments acting on the actuators of the AUV. In this work, an implemented functional block diagram ( Figure 4) is proposed for the kinematic and dynamic models of an AUV, described in Equations (1) and (2), to obtain the internal continuous evolutions for the controller, where Ω di , i = 1, n are desired rotational speeds, which are applied to the n actuators of the AUV, and ΣT and τ φ,θ,Ψ are the overall output forces and moments acting on the actuators of the AUV. Appl. Sci. 2020, 10, x FOR PEER REVIEW 6 of 21 As previously assessed, the IB expansion combined with the control Lyapunov function (CLF) can be used in many AUV control applications. This was also applied to the functional blocks of deep control, position control, and attitude control (Figure 4), which participate in the continuous evolutions. PID regulators were also used for the functional block of motor control. This study did not focus on the decomposition of these control techniques for an AUV because they were developed in many AUV applications [23][24][25][26]34,35,[88][89][90].
In addition, the discrete state-space models in Equation (3), in combination with the EKF or UKF [78][79][80][81][82] implementations, allowed the estimation of the states of the developed AUV, as introduced in Section 4.
Furthermore, hybrid automata (HA), presented by Henzinger, Kopke, Puri, and Varaiya [12], provide a mathematical model for digital computer systems that interact with an analog environment in real time. In the CIM, HA are established as shown in Equation (4).
where Q is a set of running cases of the AUV, qo ∈ Q is the starting situation, X is the continuous state-space of continuous elements, xco ∈ X is the initial value,  is a set of external events, A is a set of transitions between running cases corresponding to events σ ∈ , Inv is an application tool, which is used to check xc ∈ inv(q), and F is the continuous global model issued from the kinematic and dynamic models in Equations (1) and (2).

PIM for an AUV Controller
The PIM's goal is to implement real-time capsule collaboration, which allows capturing, in detail, the design model for control. From the above-identified CIM, the five primary control capsules were specialized to implement the HA for an AUV controller: the discrete part's capsule, the continuous part's capsule, the external interface's capsule, the internal interface's capsule, and the instantaneous global continuous behavior (IGCB)'s capsule. Figures 5 and 6 indicate the real-time capsule collaboration for an AUV controller using real-time UML cooperation and class diagrams. As previously assessed, the IB expansion combined with the control Lyapunov function (CLF) can be used in many AUV control applications. This was also applied to the functional blocks of deep control, position control, and attitude control (Figure 4), which participate in the continuous evolutions. PID regulators were also used for the functional block of motor control. This study did not focus on the decomposition of these control techniques for an AUV because they were developed in many AUV applications [23][24][25][26]34,35,[88][89][90].
In addition, the discrete state-space models in Equation (3), in combination with the EKF or UKF [78][79][80][81][82] implementations, allowed the estimation of the states of the developed AUV, as introduced in Section 4.
Furthermore, hybrid automata (HA), presented by Henzinger, Kopke, Puri, and Varaiya [12], provide a mathematical model for digital computer systems that interact with an analog environment in real time. In the CIM, HA are established as shown in Equation (4).
where Q is a set of running cases of the AUV, q o ∈ Q is the starting situation, X is the continuous state-space of continuous elements, x co ∈ X is the initial value, Σ is a set of external events, A is a set of transitions between running cases corresponding to events σ ∈ Σ, Inv is an application tool, which is used to check x c ∈ inv(q), and F is the continuous global model issued from the kinematic and dynamic models in Equations (1) and (2).

PIM for an AUV Controller
The PIM's goal is to implement real-time capsule collaboration, which allows capturing, in detail, the design model for control. From the above-identified CIM, the five primary control capsules were specialized to implement the HA for an AUV controller: the discrete part's capsule, the continuous part's capsule, the external interface's capsule, the internal interface's capsule, and the instantaneous global continuous behavior (IGCB)'s capsule. Figures 5 and 6 indicate the real-time capsule collaboration for an AUV controller using real-time UML cooperation and class diagrams. Appl. Sci. 2020, 10, x FOR PEER REVIEW 7 of 21 Figure 5. Collaboration diagram of real-time capsules for an AUV controller (data from [63]).
Here, the discrete part's capsule consists of situations Q and transitions A in HA of the AUV controller; the continuous part's capsule contains the continuous state-space X; the IGCB's capsule implements concrete global continuous behaviors as f∈F, where f is directly derived from Equation (3) and the implemented functional block diagram ( Figure 4) can be implemented in f for the estimation of AUV states; the external interface's capsule is an intermediary, which receives/sends events/signals between the AUV controller and the MES/MDS; the internal interface's capsule permits the Inv tool to generate internal events in the HA evolution. The detailed specification of this capsule collaboration can be found in the author's previous report [63].  Here, the discrete part's capsule consists of situations Q and transitions A in HA of the AUV controller; the continuous part's capsule contains the continuous state-space X; the IGCB's capsule implements concrete global continuous behaviors as f ∈F, where f is directly derived from Equation (3) and the implemented functional block diagram ( Figure 4) can be implemented in f for the estimation of AUV states; the external interface's capsule is an intermediary, which receives/sends events/signals between the AUV controller and the MES/MDS; the internal interface's capsule permits the Inv tool to generate internal events in the HA evolution. The detailed specification of this capsule collaboration can be found in the author's previous report [63].
Here, the discrete part's capsule consists of situations Q and transitions A in HA of the AUV controller; the continuous part's capsule contains the continuous state-space X; the IGCB's capsule implements concrete global continuous behaviors as f∈F, where f is directly derived from Equation (3) and the implemented functional block diagram (Figure 4) can be implemented in f for the estimation of AUV states; the external interface's capsule is an intermediary, which receives/sends events/signals between the AUV controller and the MES/MDS; the internal interface's capsule permits the Inv tool to generate internal events in the HA evolution. The detailed specification of this capsule collaboration can be found in the author's previous report [63].  Reusability is essential in the operator of controllers for different AUV applications because it reduces manufacturing time and equipment costs. Moreover, this can allow the capsule collaboration of a developed AUV to be customized and reused in a new control application for many types of AUVs, as shown in Table 2.

Continuous part
The ports and protocols of this capsule are not changed.
It is specialized by adding or removing down continuous elements.
Discrete capsule This is not changed. None.

External interface
The state machine, ports, and protocols of this capsule are not changed.
It is specialized by adding/removing inputs/outputs events issued from the outside.

Internal interface
The state machine and ports of this capsule are not changed.
It is specialized by adding/removing Inv in/from the new IGCB.
The real-time capsule collaborations shown in Figures 5 and 6 are not changed for new control applications of AUVs.

PSM for an AUV Controller
In the construction of the AUV controller, the above-designed PIM was converted into the PSM using IBM Rational Software Architect Real Time, IBM Rational Rose Real Time [91], or Papyrus for Real Time (Papyrus-RT) [92]. These tools are effectively used to develop complex real-time and embedded systems and software applications. They act as implementations of real-time UML/SysML for C++, Java, Ada, and runtime system supports.
Hence, the PIM could be converted into the PSM using different implementation development environments (IDEs) to ultimately realize a controller with suitable microcontrollers. The MDA's features also support model transformation. This transformation model could be rapidly applied through round-trip engineering. The transformation rules, which can be used to convert the PIM into PSM and vice versa through round-trip engineering of the intermediate codes of an object-oriented programming language, were presented in the authors' previous report [1]. Furthermore, the above-defined HA could be automatically implemented using the state pattern described in [93,94]. According to this pattern, the HA's structure implementation to display the meaningful programming usefulness of the control program of an AUV is shown in Figure 7. An example of HA implementation based on the state pattern was performed and compiled using Arduino's IDE [95] to fit into ATMEGA32-U2 and STM32 Cortex-M4 microcontrollers for an AUV controller, as shown in Appendix A.

Physical Application Configurations
Following the above-proposed model, a planar trajectory-tracking controller, which allowed a low-cost AUV possessing a torpedo shape to reach and follow a predetermined trajectory on the free surface, was deployed. This case study represents one element of our long-term research project funded by the Vietnam National Foundation for Science and Technology Development (NAFOSTED) under grant number 107.03-2019.302. The torpedo-shaped AUV's main operating parameters are summarized in Table 3.

Control Implementation and Test Results
According to the functional block diagram for performance describing the continuous evolution of the AUV controller, the environmental disturbance caused by a wave was only considered as sea state code 1 [96], i.e., slight ripples on the free surface.

Physical Application Configurations
Following the above-proposed model, a planar trajectory-tracking controller, which allowed a low-cost AUV possessing a torpedo shape to reach and follow a predetermined trajectory on the free surface, was deployed. This case study represents one element of our long-term research project funded by the Vietnam National Foundation for Science and Technology Development (NAFOSTED) under grant number 107.03-2019.302. The torpedo-shaped AUV's main operating parameters are summarized in Table 3.

Control Implementation and Test Results
According to the functional block diagram for performance describing the continuous evolution of the AUV controller, the environmental disturbance caused by a wave was only considered as sea state code 1 [96], i.e., slight ripples on the free surface.
The state-space models shown in Equation (3) were implemented to calculate the current states of the AUV using the installed sensors, e.g., the inertial measurement unit (IMU) MPU6000 [97] and the global positioning system (GPS) Ublox Neo 6M [98]. The state estimations in both cases were based on the EKF (Algorithm 1) and the UKF (Algorithm 2). In Algorithms 1 and 2,. denotes an estimation, P is the state covariance, and Q and R represent the covariance matrices of the process and measurement noise, respectively. The state was estimated starting from the following initial conditions:x 0|0 = x 0 and P 0|0 = 0 12×12 . Algorithm 1. Navigation filter based on the extended Kalman filter (EKF).

Function EKF algorithm
Step EKF predict x k|k =x k|k−1 + L k e k ; P k|k = P k|k−1 − L k S k L T k−1 ; end Algorithm 2. Navigation filter based on the unscented Kalman filter (UKF).

Function UKF algorithm
Step UKF predict Step UKF update Data:x k|k−1 , P k|k−1 , h k (.) Result:x k|k , P k|k ŷ k|k−1 , S k , P xy k = UT x k|k−1 , P k|k−1 , h k−1 (.) ; S k = R k + S k ; L k = P xy k S −1 k ; e k = y k −ŷ k|k−1 ; x k|k =x k|k−1 + L k e k ; P k|k = P k|k−1 − L k S k L T k ; end We used the OpenModelica tool [99], which is an open-source simulation environment, to perform the simulation of an AUV controller. OpenModelica is an object-oriented modeling environment of Modelica [100] and C/C++ for hybrid systems. A case study in which the MDS was assumed to address an event in the transferring state to the AUV controller with a desired course angle of 020 • and average speed of 1.5 m/s is shown in Figure 8. Here, the average transient durations, which correspond to the cases using EKF and UKF, were 6.8 and 6.2 s for the AUV's stabilized course. We used the OpenModelica tool [99], which is an open-source simulation environment, to perform the simulation of an AUV controller. OpenModelica is an object-oriented modeling environment of Modelica [100] and C/C++ for hybrid systems. A case study in which the MDS was assumed to address an event in the transferring state to the AUV controller with a desired course angle of 020° and average speed of 1.5 m/s is shown in Figure 8. Here, the average transient durations, which correspond to the cases using EKF and UKF, were 6.8 and 6.2 s for the AUV's stabilized course. The ATMEGA32-U2 and STM32 Cortex-M4 microcontrollers [95] were installed on the mainboard. The AUV installation for trial trips is shown in Figure 9. The test scenarios were based on different desired courses, for various desired shape-based paths and average velocities. Some of the main planar course-tracking test results are shown in Table 4. Figures 10a,b and 11a,b respectively show that the AUV reached and followed the desired rectangle-and triangle-shaped trajectories. The ATMEGA32-U2 and STM32 Cortex-M4 microcontrollers [95] were installed on the mainboard. The AUV installation for trial trips is shown in Figure 9. The test scenarios were based on different desired courses, for various desired shape-based paths and average velocities. Some of the main planar course-tracking test results are shown in Table 4. Figure 10a,b and Figure 11a,b respectively show that the AUV reached and followed the desired rectangle-and triangle-shaped trajectories.
Appl. Sci. 2020, 10, x FOR PEER REVIEW 12 of 21    * This test scenario corresponds to the simulation case shown in Figure 8.
On the basis of comparison with the test results obtained in the literature [1,63], this current AUV controller was superior in terms of the stabilized interval and trajectory error, which decreased by about 0.7 s and 0.90 m, respectively. The UKF enabled more accurate estimations. Although operations in UKF such as the unscented transform (UT), i.e., the UT function in Algorithm 2, may appear more complex than those for the EKF, the assessments of actual computational complexity and optimizations for the application of various Kalman filter extensions were studied intensively by Zhang, et al. [101] and Raitoharju and Piché [102].   An assessment of the above-described AUV application using MBSE methodology combined with MDA components is described in Table 5. Table 5. Assessment of the torpedo-shaped AUV control application of model-based systems engineering (MBSE) methodology combined with the model-driven architecture (MDA). CIM, computation-independent model; PIM, platform-independent model; PSM, platform-specific model; IDE, implementation development environments; OMG, Object Management Group; XML, extensible markup language; MOF, Meta Object Facility; UML, unified modeling language; SysML, systems modeling language.

Proposed Models
Advantages Disadvantages

CIM
This model focuses on a global model of top level, which can combine discrete models and continuous models.
An implemented functional block diagram must be supplemented in the CIM to depict internal continuous behaviors for the control system developed.

PIM
The PIM-PSM separation and its model transformation allow the designed control elements to be customizable and reusable for various kinds of AUVs.
This can influence the performance effort of projects.

PSM
The control capsules can be transformed into various PSM IDEs (e.g., Java, Net, or Ada IDEs).Arduino microcontrollers are used to deploy the real-time and embedded control system using open-source solutions.
Within the OMG, the XML Metadata Interchange (XMI) specification [103] supports the exchange of model data when using an MOF-based language such as real-time UML/SysML. However, development engineers may need training to develop the required skills in different IDEs.

Conclusions and Future Work
This paper introduced an application of MBSE methodology to intensively deploy controllers for AUVs whose dynamics can be considered an HDS. This application model is based on the MBSE methodology, combined with MDA concepts, real-time UML/SysML, EKF/UKF algorithms, and HA to systematically realize the controller. The dynamic models and control structure of AUV were first used for control combined with MDA components such as the CIM, PIM, and PSM. In the CIM, the use case model was defined with continuous behaviors, EKF/UKF algorithms, and HA to closely control the requirements. The PIM was established to establish the design model by constructing a real-time capsule pattern. This pattern can be customized and reused in new AUV control applications ( Table 2). The PIM designed was then converted into the PSM through round-trip engineering of the intermediate C++ codes to form an AUV controller with suitable microcontrollers. On the basis of the proposed model, a planar trajectory-tracking controller of a miniature torpedo-shaped AUV running on the free surface was implemented and evaluated using the ATMEGA U2 and STM32-Cortex-M4 microcontrollers. Lastly, the advantages and disadvantages of the MBSE/MDA approach were discussed with respect to this AUV control application (Table 5).
In this case study, the above-described MBSE methodology, combined with MDA concepts, was only applied to simple test scenarios for a miniature torpedo-shaped AUV running on the free surface.
We are yet to fine-tune parameters with respect to the process and measurement noise and the evolutionary optimization for noise parameters for this application. Thus, these important further developments are scheduled for the future. Firstly, the EKF/UKF-based navigation filters will be simulated online within a complete AUV combined with depth control and a suitable environment. Then, the new controller will be implemented on the AUV and tested online through fast frequency disturbances. The performances of the different Kalman filter extensions in terms of accuracy will be carefully investigated in different scenarios. In further MBSE/MDA studies, we will also follow our application strategy to specify, in detail, the patterns of model transformations using the different MDA transformation types, and we will compare them to cases using OPM, such as those described in [54,55].

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

Appendix A
An example of HA implementation based on the state pattern ( Figure 7) and C++ codes is shown as Figure A1.