Research on Early Warning of Ship Danger Based on Composition Fuzzy Inference

Ship collision avoidance measures are important for reducing marine accidents caused by human factors and various natural environmental factors and can also prevent property loss and casualties. In recent years, various methods have been used to study collision avoidance, including ship domain models. This paper proposes a ship domain model based on fuzzy logic aimed at providing early warning of ship collision risk and a reasonable reference that can be used in combination with the International Regulation for Preventing Collisions at Sea (COLREGs). The composition fuzzy inference combining more than one fuzzy inference process is first used to introduce as many factors as possible related to ship collision risk for calculating the ship domain. In this way, the calculation of the ship domain size is more accurate, and a more accurate reference can be provided to sailors, which could save both time and labor by reducing errors. A fuzzy inference system based on if-then fuzzy rules was established in MATLAB and simulation experiments were conducted. The simulation results suggest that the proposed method is feasible and can help sailors make subjective decisions to effectively avoid the occurrence of collision accidents.


Introduction
In recent years, with advances in science and technology, maritime traffic has increased and brought many conveniences to human life. However, the increasing complexity of maritime traffic has gradually led to more safety problems. Frequent ship collisions cause serious economic losses and threaten the safety of passengers and crew members. Furthermore, worsening environmental pollution caused by ship collisions cannot be neglected. Despite a large body of research and methods devoted to reducing collisions at sea, ship collision accidents are inevitable. Thus, ship collision avoidance has become a research hotspot.
To minimize ship collisions, thereby increasing the safety of ships sailing at sea and reducing the associated losses, researchers in various countries have explored a range of methods for ship collision avoidance. According to the European Maritime Safety Agency's review [1] of maritime casualties in 2017, EU member states reported 3145 maritime accidents in 2016. More than half of these accidents were caused by ship collisions, and more than 60% of the collisions were caused by human error. Thus, reducing human errors during navigation at sea has become an important focus of research, with an emphasis on improving the navigator decision-making processes.
Algorithms such as the genetic algorithm, neural network, and distributed algorithm have been applied to ship collision avoidance problems. In addition, automatic radar plotting aid (ARPA) and automatic identification system (AIS) have been used to help make collision avoidance decisions. ARPA offers accurate information about the bearing and distance of nearby obstacles, while AIS provides important information about the ship's course, speed, and position. These data provide a powerful basis for effective ship collision avoidance. By far, many researchers have studied the ship domain in different waters with the help of AIS data. For example, Xiang et al. [2] proposed a calculation method for ships in restricted waters based on AIS data. Hansen M.G. et al. [3] used AIS data to study the ship domain in the bridge area and crossing waters and Zhang et al. [4] develop an effective big AIS data-driven approach to determine the probabilistic ship domain. Ding et al. [5] used AIS data to make statistics on the ship domain of different types of ships and ships of different sizes in open waters. Although research using AIS is now common, these systems can only be used as assistant tools to identify obstacles and offer additional navigation information. While these tools provide accurate and reliable information for navigators as the basis for decision-making, sailors cannot use this information to make navigation decisions.
Some algorithms have been used to aid ship navigation decision-making systems. For example, Li et al. [6] used an improved multiobjective algorithm to plan the collision avoidance trajectory of ships and to suggest safe navigation routes. In addition, Li et al. [7] studied ship collision avoidance using distributed algorithms for preventing multi-ship collisions at sea. Tsou and Hsueh [8] combined the ant colony algorithm with onboard AIS and geographic information system (GIS) systems for safe and economical collision avoidance route planning. The algorithms mentioned above, and others, can be used to plan the general ship collision avoidance route for multiple ships in the same water area, but the management of temporary accidents has not been well studied.
Previously, there have been researchers who used fuzzy logic to study navigation issues. Lee et al. [9] proposed a fuzzy logic ship autonomous navigation algorithm based on COLREGs criterion. The VFF (Virtual Force Field) method is improved and applied to the autonomous navigation of ships. However, the fuzzy inference system is mainly based on COLREGs, which lacks sufficient consideration of the interference caused by various factors in navigation. Grinyak et al. [10] proposed a fuzzy decision-making system about the motion's danger level that combines Mamdani and Sugeno fuzzy inference systems, but it mainly considered a model of the relative motion of two vessels and neglected the environmental factors. Namgung [11] proposed a fuzzy inference system that expressed appropriate collision risk index corresponding to level. It can measure the fuzzy risk index, but it cannot play a direct role in the sailor's decision warning. In this paper, composition fuzzy inference is carried out by comprehensively considering the ship's own factors and environmental factors when the ship is sailing at sea, giving the ship early collision warning and reminding the sailor to take measures to avoid collision.
When malfunction occurs or the ship fails to sail along an expected path or at an expected speed, the sailor's timely response is crucial. In the past, sailors' decisions were based on experience but with further research on the behavior of the navigating ships and intelligence science and technology, collision risk warnings can be achieved by other means. For instance, the ship domain model can be used to evaluate collision risk. Ship domains represent a defined area around the ship that other ships should not enter to ensure that the ship navigates safely through waters. Thus, the ship domain can be used as a standard safety measure and a reference parameter for evaluating collision risk, and it is also the basis for taking actions in ship collision avoidance.
The concept of ship domains was first proposed by Japanese scholar Fujii [12] as an elliptical domain proportional to the length of the ship. Goodwin [13], Davis [14], Coldwell [15], and others were inspired to establish other ship domain models' statistical observations. Vander Tak et al. [16] used the ship domain model to calculate the frequency of ship encounters for assessing maritime traffic hazards. Later, the ship domain concept was further extended. Pietrzykowski and Uriasz [17][18][19] introduced the notion of the fuzzy ship domain and defined ship domains in both open waters and restricted waters. Qu et al. [20] proposed three ship collision risk indicators based on the ship domain to quantitatively evaluate ship collision risk in a strait. Wang et al. [21] proposed a fuzzy quaternion ship domain model (FQSD) and used analytic expressions to describe models. Zhou et al. [22] introduced the dynamic fuzzy ship domain and established a ship domain model to determine collision risk between ships.
In this paper, the ship domain is used as the criterion for assessing collision risk. When other ships enter the ship domain, the situation becomes urgent and the ship must take action to avoid an imminent collision. Therefore, it is necessary to study the range and size of the ship domain. This paper proposes a fuzzy logic approach. The size of the ship domain is regarded as a fuzzy value that varies with the external environmental factors. A fuzzy control method is adopted to obtain a reasonable value of the ship domain by considering the dangerous inviolable area of each ship. Through fuzzification, fuzzy reasoning, and defuzzification, a reference for collision avoidance between ships is provided to effectively assist navigational decision-making.
In view of the fact that there are many factors that affect the ship domain, a single fuzzy inference may not be able to consider as many influencing factors as possible, which limits the number of factors. So, the factors considered in the study of ship collision warning were always limited in the past. Moreover, environmental factors such as navigation density and fairway visibility are always ignored. However, removing too many factors from the model can lead to excessive errors. The proposed composition fuzzy inference method combines the results of multiple fuzzy inferences and then performs fuzzy inference, retaining as many relevant factors as possible, which solves the problem of oversize errors caused by too many factors that need to be deleted in the past, thereby providing a more accurate estimate of the ship domain size, which can be used for more accurate and timely warning of collision danger to reduce the occurrence of collisions.
In addition, the previous research can only obtain the relationships between the ship domain and certain single factors. Here, the fuzzy logic method was used to not only obtain the changes in the ship domain with certain factors but also to simulate the influence of multiple factors on the size of the ship domain, which enables a more accurate description of the ship domain size. The proposed ship domain model could save both time and labor and enable the ship domain concept to be better applied in navigation systems.
The rest of the paper is organized as follows. Section 2 describes the ship domain and its influencing factors, various factors are selected to determine the shape of the ship domain, and less significant factors are removed. In Section 3, a fuzzy inference model of the ship domain is established considering five influencing factors including both own ship factors and environmental factors. In Section 4, the simulation platform and inference system are introduced and the simulation experiments and results compared with the traditional methods are presented. In Section 5, we summarize the advantages of the proposed method and the importance of early warning systems for preventing ship collisions.

Ship Domain
Fujii [12] defined ship domain as "The area around the previous ship most of the following ship's sailors avoid entering." The dimensions of the ship domain are related to factors such as ship speed, density, and tidal current. The first established ship domain model was oval shaped, as shown in Figure 1. Fujii assigned a specific numerical value to the ship domain size based on observations of maritime traffic, making it no longer an abstract concept, and demonstrated that the range of ship domain varies with the navigation conditions and waters. Later, other scholars introduced ship domains, which were mainly elliptical [2][3][4][5]. Therefore, in the present, an elliptical ship domain was selected.

Factors Affecting the Ship Domain
The ship domain depends on the sailor's maneuvering, however, the sailor's response is based on objective facts and also influenced by various factors. Therefore, the ship domain is affected by many subjective and objective uncertainties, including human, ship, environment, and management factors, and changes dynamically. The ship domain may also vary with its factors for different research purposes and different types of waters under different environmental conditions. The main factors are as follows: (1) Weather and hydrological effects. Generally, reduced visibility increases the size of the ship domain. The influence of various uncertain factors on the ship domain is complex, which makes it difficult to determine the relationships between ship domain and each factor. The influencing factors in the ship domain must, therefore, be analyzed and factors that have an obvious influence on the size of the ship domain should be selected, which can significantly reduce the complexity of studies of the ship domain.
At present, research on the ship domain is mostly aimed at open waters or restricted waters, and ship domains in diverse waters are suitable for different situations. In this study, we consider open waters. Management factors are not considered since they are not highly relevant in opens waters. Zhou's work [22] shows that the type of ship has little effect on the size of the ship domain, and its impact is mainly reflected in the speed of the vessel. Thus, the impact of ship type will not be considered in this study to simplify the ship domain model.
According to previous analyses with multiple sample data, among the many factors affecting the size of the ship domain, there is a clear trend in size, speed, and encounter angle of the ship. The size of the ship domain is also affected by navigation density and fairway visibility, whereas the sailor class and ship type have little effect on the size of the ship domain and no obvious rules have been defined. This paper considers three own ship factors, including ship length, ship speed, and encounter angle between two ships, and two environmental factors, including maritime navigation density and fairway visibility.

Factors Affecting the Ship Domain
The ship domain depends on the sailor's maneuvering, however, the sailor's response is based on objective facts and also influenced by various factors. Therefore, the ship domain is affected by many subjective and objective uncertainties, including human, ship, environment, and management factors, and changes dynamically. The ship domain may also vary with its factors for different research purposes and different types of waters under different environmental conditions. The main factors are as follows: (1) Weather and hydrological effects. Generally, reduced visibility increases the size of the ship domain.
(2) Ship size. The larger the ship, the larger the ship domain. The influence of various uncertain factors on the ship domain is complex, which makes it difficult to determine the relationships between ship domain and each factor. The influencing factors in the ship domain must, therefore, be analyzed and factors that have an obvious influence on the size of the ship domain should be selected, which can significantly reduce the complexity of studies of the ship domain.
At present, research on the ship domain is mostly aimed at open waters or restricted waters, and ship domains in diverse waters are suitable for different situations. In this study, we consider open waters. Management factors are not considered since they are not highly relevant in opens waters. Zhou's work [22] shows that the type of ship has little effect on the size of the ship domain, and its impact is mainly reflected in the speed of the vessel. Thus, the impact of ship type will not be considered in this study to simplify the ship domain model.
According to previous analyses with multiple sample data, among the many factors affecting the size of the ship domain, there is a clear trend in size, speed, and encounter angle of the ship. The size of the ship domain is also affected by navigation density and fairway visibility, whereas the sailor class and ship type have little effect on the size of the ship domain and no obvious rules have been defined. This paper considers three own ship factors, including ship length, ship speed, and encounter angle between two ships, and two environmental factors, including maritime navigation density and fairway visibility.

Composition Fuzzy Inference Based on Ship Domain
Herein, the influence of various factors on the size of the ship domain are determined. The shape of the ship domain is not discussed. The ship domain was assumed to be an ellipse. Since the position of the ship inside the domain is different in every study, only the size of the ship domain is assessed. The lengths of the major and the minor axes of the ellipse can determine its area. The situation is similar when these lengths are used for fuzzy control. However, the major axis length could better predict collision risk and was therefore selected as the output variable, indicating the impact of each factor on the size of the ship domain.
In this paper, five factors influencing the ship domain are considered: ship length, ship speed, encounter angle between the two ships, navigation density, and fairway visibility. The excessive number of factors make single fuzzy reasoning impossible because the formulation of excessive fuzzy rules is extremely complicated and may produce large errors. Therefore, the composition fuzzy reasoning method is adopted.

Composition Fuzzy Inference Based on Ship Domain
Herein, the influence of various factors on the size of the ship domain are determined. The shape of the ship domain is not discussed. The ship domain was assumed to be an ellipse. Since the position of the ship inside the domain is different in every study, only the size of the ship domain is assessed. The lengths of the major and the minor axes of the ellipse can determine its area. The situation is similar when these lengths are used for fuzzy control. However, the major axis length could better predict collision risk and was therefore selected as the output variable, indicating the impact of each factor on the size of the ship domain.
In this paper, five factors influencing the ship domain are considered: ship length, ship speed, encounter angle between the two ships, navigation density, and fairway visibility. The excessive number of factors make single fuzzy reasoning impossible because the formulation of excessive fuzzy rules is extremely complicated and may produce large errors. Therefore, the composition fuzzy reasoning method is adopted.

Fuzzy Control
Fuzzy control is the process that performs fuzzy inference on input variables to transform the fuzzy output values into crisp output values using the following steps: (1) Select the input and output variables that reflect the working mechanism of the system and determine the range of input and output variables and the fuzzy set of linguistic variables; (2) Create the membership function (FMF) for each set of inputs and outputs; (3) Formulate the if-then fuzzy rules to construct the relationship between the output fuzzy set and the input fuzzy sets, and select the fuzzy reasoning model; (4) Perform fuzzy reasoning on the fuzzy input variables combined with the fuzzy rules and defuzzification of the output. Fuzzification converts the precise input value into a fuzzy value and defuzzification converts the fuzzy value after fuzzy inference into a crisp value using the following formulas, respectively:

Fuzzy Control
Fuzzy control is the process that performs fuzzy inference on input variables to transform the fuzzy output values into crisp output values using the following steps: (1) Select the input and output variables that reflect the working mechanism of the system and determine the range of input and output variables and the fuzzy set of linguistic variables; (2) Create the membership function (FMF) for each set of inputs and outputs; (3) Formulate the if-then fuzzy rules to construct the relationship between the output fuzzy set and the input fuzzy sets, and select the fuzzy reasoning model; (4) Perform fuzzy reasoning on the fuzzy input variables combined with the fuzzy rules and defuzzification of the output. Fuzzification converts the precise input value into a fuzzy value and defuzzification converts the fuzzy value after fuzzy inference into a crisp value using the following formulas, respectively: where x 0 is the crisp input value, x is the fuzzy set, f z represents the fuzzification operator; z is the fuzzy value of the control output, z 0 is the clarity value of the control output, and d f represents the defuzzification operator. To consider the influence of different factors on the ship domain model, three critical factors are selected as the input linguistic variables, i.e., the ship's own size, the ship speed, and the encounter angle between the two ships. The major axis length of the elliptical ship domain is the output variable. Fuzzy control is performed to obtain a crisp output quantity of the size of the ship domain. A block diagram of the fuzzy control process of the ship domain model is shown in Figure 3. where 0 x is the crisp input value, x is the fuzzy set, fz represents the fuzzification operator; z is the fuzzy value of the control output, 0 z is the clarity value of the control output, and df represents the defuzzification operator. To consider the influence of different factors on the ship domain model, three critical factors are selected as the input linguistic variables, i.e., the ship's own size, the ship speed, and the encounter angle between the two ships. The major axis length of the elliptical ship domain is the output variable. Fuzzy control is performed to obtain a crisp output quantity of the size of the ship domain. A block diagram of the fuzzy control process of the ship domain model is shown in Figure 3.

Fuzzy Linguistic Variables and Fuzzy Sets
Fuzzy linguistic variables are fuzzy sets expressed in fuzzy language, simply referred to as linguistic variables, and can be divided into input linguistic variables and output linguistic variables. Each fuzzy linguistic variable has multiple fuzzy linguistic terms whose names usually have certain meanings, such as very small (VS), small (S), medium small (MS), medium (M), medium big (MB), big (B), very big (VB), etc.
The ship's own size, ship speed, and encounter angle between the two ships are selected as the input linguistic variables. The size of the ship domain is the quantity of fuzzy control selected as the output linguistic variable.
Each linguistic variable is composed of a set of fuzzy linguistic values, which constitutes a fuzzy set. For each linguistic variable, each fuzzy set of values has the same range.
The size of the ship itself can be represented by the length and breadth of the vessel. In this paper, "ship length" (L) is regarded as an input linguistic variable, which is divided into three fuzzy For the "encounter angle between the two ships" (E), the influence of the encounter angle on the size of the ship domain is more complex, therefore, more fuzzy linguistic terms must be selected, but it is also more precise. The input linguistic variable "encounter angle" is divided into seven fuzzy linguistic terms: very small (VS), small (S), medium small (MS), medium (M), medium big (MB), big

Fuzzy Linguistic Variables and Fuzzy Sets
Fuzzy linguistic variables are fuzzy sets expressed in fuzzy language, simply referred to as linguistic variables, and can be divided into input linguistic variables and output linguistic variables. Each fuzzy linguistic variable has multiple fuzzy linguistic terms whose names usually have certain meanings, such as very small (VS), small (S), medium small (MS), medium (M), medium big (MB), big (B), very big (VB), etc.
The ship's own size, ship speed, and encounter angle between the two ships are selected as the input linguistic variables. The size of the ship domain is the quantity of fuzzy control selected as the output linguistic variable.
Each linguistic variable is composed of a set of fuzzy linguistic values, which constitutes a fuzzy set. For each linguistic variable, each fuzzy set of values has the same range.
The size of the ship itself can be represented by the length and breadth of the vessel. In this paper, "ship length" (L) is regarded as an input linguistic variable, which is divided into three fuzzy linguistic terms: small (S), medium (M), and big (B). That is to say, the values of the fuzzy set of the input linguistic variable "ship length" are {S, M, B}. By referring to the relevant data of ship size, the range of ship length is [30,400] and the unit of ship length is in meters (m). Similarly, after investigating typical ship speeds, the range of input linguistic variable "ship speed" (V) is [0,30] in kn. The values of the fuzzy set "ship speed" are also {S, M, B}, again representing small (S), medium (M), and big (B).
For the "encounter angle between the two ships" (E), the influence of the encounter angle on the size of the ship domain is more complex, therefore, more fuzzy linguistic terms must be selected, but it is also more precise. The input linguistic variable "encounter angle" is divided into seven fuzzy

Fuzzy Membership Functions
A linguistic variable has multiple linguistic terms and each linguistic term corresponds to a membership function. In the MATLAB Fuzzy Logic Toolbox, there are Gaussian, triangular, trapezoidal, bell-shaped, sigmoidal, л-type, and Z-type membership functions. Here, the triangular and trapezoidal membership functions are selected to describe the linguistic variables, with a, b, c, and d as the parameters, and the formulas are as follows, respectively: The parameters in the formulas are affected by the range of each linguistic value of the linguistic variable. Figure 4 shows the membership functions of three input linguistic variables and one output linguistic variable. The input linguistic variable "ship speed" (V) selects only the triangular membership function, while the input linguistic variables "ship length" (L) "encounter angle between the two ships" (E), and the output linguistic variable "ship domain size" (D1) not only selects the triangular membership function but also uses the trapezoidal membership function. The Fuzzy Logic Toolbox in MATLAB was used to draw the membership functions, which not only reflects the membership function of the input and output linguistic variables but also clearly shows the linguistic term and range of input and output linguistic variables, as well as the relationship among each linguistic term of each linguistic variable.

Fuzzy Inference
The fuzzy inference system applies fuzzy logic to map a given input to the output. In fuzzy inference systems, fuzzy rules can describe human experience and knowledge in the form of fuzzy language. A set of fuzzy logic inference systems is composed of many fuzzy inference rules. The number of fuzzy rules is the Cartesian product of the fuzzy linguistic variables and membership sets.
In the present study, there are three input linguistic variables. The input linguistic variable "ship length" has three membership sets, S, M, and B, "ship speed" also has three membership sets, S, M, and B, and "encounter angle" has seven membership sets, VS, S, MS, M, MB, B, and VB. Therefore, the number of fuzzy rules is 63. The fuzzy rules are presented in Table 1. The Mamdani model is the most commonly used fuzzy inference method and is adopted in the present study.

Fuzzy Inference
The fuzzy inference system applies fuzzy logic to map a given input to the output. In fuzzy inference systems, fuzzy rules can describe human experience and knowledge in the form of fuzzy language. A set of fuzzy logic inference systems is composed of many fuzzy inference rules. The number of fuzzy rules is the Cartesian product of the fuzzy linguistic variables and membership sets.
In the present study, there are three input linguistic variables. The input linguistic variable "ship length" has three membership sets, S, M, and B, "ship speed" also has three membership sets, S, M, and B, and "encounter angle" has seven membership sets, VS, S, MS, M, MB, B, and VB. Therefore, the number of fuzzy rules is 63. The fuzzy rules are presented in Table 1. The Mamdani model is the most commonly used fuzzy inference method and is adopted in the present study.

Fuzzy Control Process
The influence of environmental factors on the fuzzy ship domain affected are also considered. Two factors, navigation density and fairway visibility, are selected as input linguistic variables and the long axis length of the elliptical ship domain is taken as an output linguistic variable. Fuzzy reasoning can be performed to obtain the ship domain size. A block diagram of the fuzzy control process for the ship domain model is shown in Figure 5.

Fuzzy Control Process
The influence of environmental factors on the fuzzy ship domain affected are also considered. Two factors, navigation density and fairway visibility, are selected as input linguistic variables and the long axis length of the elliptical ship domain is taken as an output linguistic variable. Fuzzy reasoning can be performed to obtain the ship domain size. A block diagram of the fuzzy control process for the ship domain model is shown in Figure 5.

Fuzzy Linguistic Variables and Fuzzy Sets
In this paper, "navigation density" N is divided into five fuzzy linguistic terms: small (S),

Fuzzy Membership Functions
The triangular membership function and trapezoidal membership function are again selected to describe the linguistic variables, as shown in Figure 6.

Fuzzy Linguistic Variables and Fuzzy Sets
In this paper, "navigation density" N is divided into five fuzzy linguistic terms: small (S), medium small (

Fuzzy Membership Functions
The triangular membership function and trapezoidal membership function are again selected to describe the linguistic variables, as shown in Figure 6.

Fuzzy Control Process
The influence of environmental factors on the fuzzy ship domain affected are also considered. Two factors, navigation density and fairway visibility, are selected as input linguistic variables and the long axis length of the elliptical ship domain is taken as an output linguistic variable. Fuzzy reasoning can be performed to obtain the ship domain size. A block diagram of the fuzzy control process for the ship domain model is shown in Figure 5.

Fuzzy Linguistic Variables and Fuzzy Sets
In this paper, "navigation density" N is divided into five fuzzy linguistic terms: small (S),

Fuzzy Membership Functions
The triangular membership function and trapezoidal membership function are again selected to describe the linguistic variables, as shown in Figure 6.

Fuzzy Inference
The fuzzy rules of navigation density, fairway visibility and ship domain size are shown in Tab 2, and the Mamdani fuzzy reasoning method is adopted.

Fuzzy Control Process
The fuzzy ship domain is affected by both the ship's own factors and environmental facto Using the composition inference method, ship domain size affected by the ship's own factors (D and ship domain size affected by environmental factors (D2) can be obtained and are taken as t input linguistic variables. The long axis size of the oval ship domain is taken as the output linguis variable, expressed as D. In other words, under composition fuzzy inference, the size of ship doma is affected by both ship's own factors and environmental factors. A block diagram of the fuzzy cont process for the ship domain model is presented in Figure 7.

Fuzzy Inference
The fuzzy rules of navigation density, fairway visibility and ship domain size are shown in Table 2, and the Mamdani fuzzy reasoning method is adopted.

Fuzzy Inference
The fuzzy rules of navigation density, fairway visibility and ship domain size are shown in Table  2, and the Mamdani fuzzy reasoning method is adopted.

Fuzzy Control Process
The fuzzy ship domain is affected by both the ship's own factors and environmental factors. Using the composition inference method, ship domain size affected by the ship's own factors (D1) and ship domain size affected by environmental factors (D2) can be obtained and are taken as the input linguistic variables. The long axis size of the oval ship domain is taken as the output linguistic variable, expressed as D. In other words, under composition fuzzy inference, the size of ship domain is affected by both ship's own factors and environmental factors. A block diagram of the fuzzy control process for the ship domain model is presented in Figure 7.

Fuzzy Linguistic Variables and Fuzzy Sets
Both the input linguistic variable and the output linguistic variable are the ship domain size; "ship domain size affected by the ship's own factors" D1 and "ship domain size affected by environmental factors" D2 are the input linguistic variables; and "the ship domain size affected by comprehensive factors" D, which is influenced simultaneously by both the ship's own factors and environmental factors, is the output linguistic variable. Since

Fuzzy Membership Functions
The membership function is shown in Figure 8.

Fuzzy Linguistic Variables and Fuzzy Sets
Both the input linguistic variable and the output linguistic variable are the ship domain size; "ship domain size affected by the ship's own factors" D1 and "ship domain size affected by environmental factors" D2 are the input linguistic variables; and "the ship domain size affected by comprehensive factors" D, which is influenced simultaneously by both the ship's own factors and environmental factors, is the output linguistic variable. Since

Fuzzy Membership Functions
The membership function is shown in Figure 8.

Fuzzy Inference
The fuzzy rules are presented in Table 3. The Mamdani fuzzy reasoning method is adopted.

Fuzzy Inference
The fuzzy rules are presented in Table 3. The Mamdani fuzzy reasoning method is adopted. Table 3. Fuzzy rules (D).

Results
The MATLAB Fuzzy Logic Toolbox was used to construct and then simulate the fuzzy inference system, then the relationships between the size of the ship domain and influencing factors, including ship length (L), ship speed (V), encounter angle (E), navigation density (N), and fairway visibility (K) were obtained, as shown in Figure 9.

Results
The MATLAB Fuzzy Logic Toolbox was used to construct and then simulate the fuzzy inference system, then the relationships between the size of the ship domain and influencing factors, including ship length (L), ship speed (V), encounter angle (E), navigation density (N), and fairway visibility (K) were obtained, as shown in Figure 9.
The ship domain shows a trend of gradually increasing with the increase in size and speed of the ship, but gradually decreases with increasing encounter angle. Simultaneously, the size of the ship domain gradually decreases with increasing navigation density and fairway visibility, i.e., the smaller the navigation density, the lower the visibility and the larger the ship domain size. However, the ship domain does not have a linear relationship with these single factors. Thus, it can be seen, the influence result of each factor on ship domain obtained by fuzzy inference is similar to other studies [22]. The ship domain shows a trend of gradually increasing with the increase in size and speed of the ship, but gradually decreases with increasing encounter angle. Simultaneously, the size of the ship domain gradually decreases with increasing navigation density and fairway visibility, i.e., the smaller the navigation density, the lower the visibility and the larger the ship domain size. However, the ship domain does not have a linear relationship with these single factors. Thus, it can be seen, the influence result of each factor on ship domain obtained by fuzzy inference is similar to other studies [22].
The comprehensive influence of various two-factor combinations on the size of the ship domain were also simulated, as shown in Figure 10. The surface diagrams illustrate the trends of each set of influencing factors on the size of the ship domain as well as the specific size of the ship domain when concrete values of the two factors are input into the MATLAB simulation platform. The MATLAB Fuzzy Logic Toolbox was used for simulations and the specific size of the ship domain was obtained by determining the input. The results of the fuzzy simulations are shown in Figure 11. When specific values are assigned as inputs, i.e., the values of ship length (L), ship speed (V), encounter angle (E), navigation density (N), and fairway visibility (K) are determined, the size of the ship domain can be obtained. This article makes the simulation when two ships are in the headon situation as an example, when the "ship length" L = 215 m, the "ship speed" V = 15 kn, the "encounter angle" E = 5, "navigation density" N = 420, and "fairway visibility" K = 10 km, and "the major axis length of the elliptical ship domain" D = 2990 m. If the ship does not encounter any other ships at this time, appropriate actions should be taken according to the length of the semimajor axis and the International Regulation for Preventing Collisions at Sea (COLREGs). The MATLAB Fuzzy Logic Toolbox was used for simulations and the specific size of the ship domain was obtained by determining the input. The results of the fuzzy simulations are shown in Figure 11. When specific values are assigned as inputs, i.e., the values of ship length (L), ship speed (V), encounter angle (E), navigation density (N), and fairway visibility (K) are determined, the size of the ship domain can be obtained. This article makes the simulation when two ships are in the head-on situation as an example, when the "ship length" L = 215 m, the "ship speed" V = 15 kn, the "encounter angle" E = 5, "navigation density" N = 420, and "fairway visibility" K = 10 km, and "the major axis length of the elliptical ship domain" D = 2990 m. If the ship does not encounter any other ships at this time, appropriate actions should be taken according to the length of the semimajor axis and the International Regulation for Preventing Collisions at Sea (COLREGs). The MATLAB Fuzzy Logic Toolbox was used for simulations and the specific size of the ship domain was obtained by determining the input. The results of the fuzzy simulations are shown in Figure 11. When specific values are assigned as inputs, i.e., the values of ship length (L), ship speed (V), encounter angle (E), navigation density (N), and fairway visibility (K) are determined, the size of the ship domain can be obtained. This article makes the simulation when two ships are in the headon situation as an example, when the "ship length" L = 215 m, the "ship speed" V = 15 kn, the "encounter angle" E = 5, "navigation density" N = 420, and "fairway visibility" K = 10 km, and "the major axis length of the elliptical ship domain" D = 2990 m. If the ship does not encounter any other ships at this time, appropriate actions should be taken according to the length of the semimajor axis and the International Regulation for Preventing Collisions at Sea (COLREGs).   Figure 12 shows the ship domain of the own vessel and the encounter situation between the own vessel and a target vessel sailing in one direction. Taking the major axis of the ellipse as the diameter and the center of the ship as the center of the ship domain, a circle tangent to the ellipse was drawn. From Figure 12, it can be easily observed that when the "encounter angle" E = 5, the two ships are in the head-on situation, the own vessel receives a collision risk warning when the target vessel is 1495 m away and collision avoidance actions according to COLREGs should be taken to avoid an urgent situation. In other encounter situations, it is also possible to simulate the value of a ship domain, when other ships reach this distance and receive a collision risk warning, the sailor must consider whether or not to take action immediately. There is also a collision risk between the two ships at this time, therefore, the sailor should be on the lookout and be prepared to take measures at any time to avoid a collision. Thus, the length of the major axis of the ship domain can determine the collision risk, which can provide an early warning to help sailors in the subjective decision-making process to avoid collisions.
In the past, most ship domain models have been too complex since many factors affect the ship domain. Researchers have previously chosen to ignore certain factors while retaining more important factors based on experiential knowledge. For most situations, own ship factors such as ship length, (c)  Figure 12 shows the ship domain of the own vessel and the encounter situation between the own vessel and a target vessel sailing in one direction. Taking the major axis of the ellipse as the diameter and the center of the ship as the center of the ship domain, a circle tangent to the ellipse was drawn. From Figure 12, it can be easily observed that when the "encounter angle" E = 5, the two ships are in the head-on situation, the own vessel receives a collision risk warning when the target vessel is 1495 m away and collision avoidance actions according to COLREGs should be taken to avoid an urgent situation.  Figure 12 shows the ship domain of the own vessel and the encounter situation between the own vessel and a target vessel sailing in one direction. Taking the major axis of the ellipse as the diameter and the center of the ship as the center of the ship domain, a circle tangent to the ellipse was drawn. From Figure 12, it can be easily observed that when the "encounter angle" E = 5, the two ships are in the head-on situation, the own vessel receives a collision risk warning when the target vessel is 1495 m away and collision avoidance actions according to COLREGs should be taken to avoid an urgent situation. In other encounter situations, it is also possible to simulate the value of a ship domain, when other ships reach this distance and receive a collision risk warning, the sailor must consider whether or not to take action immediately. There is also a collision risk between the two ships at this time, therefore, the sailor should be on the lookout and be prepared to take measures at any time to avoid a collision. Thus, the length of the major axis of the ship domain can determine the collision risk, which can provide an early warning to help sailors in the subjective decision-making process to avoid collisions.
In the past, most ship domain models have been too complex since many factors affect the ship domain. Researchers have previously chosen to ignore certain factors while retaining more important factors based on experiential knowledge. For most situations, own ship factors such as ship length, (c) In other encounter situations, it is also possible to simulate the value of a ship domain, when other ships reach this distance and receive a collision risk warning, the sailor must consider whether or not to take action immediately. There is also a collision risk between the two ships at this time, therefore, the sailor should be on the lookout and be prepared to take measures at any time to avoid a collision. Thus, the length of the major axis of the ship domain can determine the collision risk, which can provide an early warning to help sailors in the subjective decision-making process to avoid collisions.
In the past, most ship domain models have been too complex since many factors affect the ship domain. Researchers have previously chosen to ignore certain factors while retaining more important factors based on experiential knowledge. For most situations, own ship factors such as ship length, ship speed, and encounter angle have an important influence on the size of the ship domain owing to the limitations of the single simulation method. Environmental factors are often viewed as less important and abandoned due to limitations on the number of factors required. Nevertheless, environmental factors have some influence on the ship domain. Although wind and wave have little influence, factors such as fairway visibility and navigation density have a greater impact on the size of the ship domain. Therefore, the influence of certain environmental factors on the ship domain cannot be ignored. Taking these factors into account undoubtedly reduces experimental errors in determining the size of the ship domain, which makes the ship domain a more valuable warning signal. For example, when only the ship's own factors were considered in the present study, the ship domain size was D1 = 3190 m. In this case, the ship would receive the danger warning at 1595 m, instead of 1495 m, and take unnecessary measures to avoid collision. Premature preventive measures waste time, manpower, and material resources. Fuzzy reasoning can be used to synthesize various factors and produce more accurate simulation results, leading to fewer errors, which can save both time and unnecessary labor.
The traditional early warning methods of ship collision mainly rely on the ship's Collision Risk Index (CRI) to complete. It refers to the possibility of collisions between ships. Generally, when CRI = 0, it means that the ship is far away from the target ship and there is no danger of collision; when CRI = 1, it means that no matter what collision avoidance actions are taken, a collision will occur between the two ships. Most studies took CRI = 0.5 as the basis of whether to take action when establishing a ship collision avoidance decision model. If CRI > 0.5, then collision avoidance action is required. If CRI < 0.5, there is no danger of collision, just lookout.
The calculation of CRI usually depends on the distance of closest point approach (DCPA) and the time of closest point approach (TCPA). Many researchers have adopted different methods to calculate CRI by input DCPA and TCPA. Some of them adopted fuzzy inference methods [23] and some adopted fuzzy comprehensive evaluation [24]. The calculation of TCPA and DCPA is the first thing to do. The calculation process is shown as follows. Figure 13 is a diagram of ship relative motion parameters.
where v τ is the relative speed of the target ship, ϕ τ is the angle of the relative speed of the target ship, R t is distance between two ships, α t is the true position of the target ship relative to own ship. The calculation formulas are as follows.
ship speed, and encounter angle have an important influence on the size of the ship domain owing to the limitations of the single simulation method. Environmental factors are often viewed as less important and abandoned due to limitations on the number of factors required. Nevertheless, environmental factors have some influence on the ship domain. Although wind and wave have little influence, factors such as fairway visibility and navigation density have a greater impact on the size of the ship domain. Therefore, the influence of certain environmental factors on the ship domain cannot be ignored. Taking these factors into account undoubtedly reduces experimental errors in determining the size of the ship domain, which makes the ship domain a more valuable warning signal. For example, when only the ship's own factors were considered in the present study, the ship domain size was D1 = 3190 m. In this case, the ship would receive the danger warning at 1595 m, instead of 1495 m, and take unnecessary measures to avoid collision. Premature preventive measures waste time, manpower, and material resources. Fuzzy reasoning can be used to synthesize various factors and produce more accurate simulation results, leading to fewer errors, which can save both time and unnecessary labor. The traditional early warning methods of ship collision mainly rely on the ship's Collision Risk Index (CRI) to complete. It refers to the possibility of collisions between ships. Generally, when CRI = 0, it means that the ship is far away from the target ship and there is no danger of collision; when CRI = 1, it means that no matter what collision avoidance actions are taken, a collision will occur between the two ships. Most studies took CRI = 0.5 as the basis of whether to take action when establishing a ship collision avoidance decision model. If CRI > 0.5, then collision avoidance action is required. If CRI < 0.5, there is no danger of collision, just lookout.
The calculation of CRI usually depends on the distance of closest point approach (DCPA) and the time of closest point approach (TCPA). Many researchers have adopted different methods to calculate CRI by input DCPA and TCPA. Some of them adopted fuzzy inference methods [23] and some adopted fuzzy comprehensive evaluation [24]. The calculation of TCPA and DCPA is the first thing to do. The calculation process is shown as follows. Figure 13 is a diagram of ship relative motion parameters.
( ) where v τ is the relative speed of the target ship, τ ϕ is the angle of the relative speed of the target ship, t R is distance between two ships, t α is the true position of the target ship relative to own ship. The calculation formulas are as follows.  The specific solution process will not be introduced in detail, but the calculation of the relative speed and the relative course between the two ships requires the speed and course of the own ship and the target ship. This means that adopting this method to judge the collision risk index should obtain not only the speed and course of the own ship, but also that of the target ship.
As can be seen from the article and the simulation results, when the composition fuzzy inference based on the ship domain is adopted, only the ship's and environmental information at a certain moment need to be obtained, and there is no need to judge the status of the target ships, even static obstacles. As long as there are obstacles within the danger warning range during sailing, it will receive the collision warning and need to take avoidance actions. This makes the judgment of collision risk simpler and faster, and can also solve the limitation of judging only dynamic obstacles when judging the collision risk based on the CRI.
When judging the collision risk adopting the traditional method, the result obtained is the CRI of the target ship relative to own ship at a certain moment and position, and it can only be known whether it is necessary to take action at this time. However, the collision risk distance of the ship at a certain moment is obtained by the composition fuzzy inference. The method is more intuitive, more applicable, and has a certain predictability, which can give the sailor more reaction time.
At the same time, the data provided by the AIS system required by the traditional method does not contain environmental factors, and to a certain extent the impact of environmental factors on ship collisions is ignored. The composition fuzzy inference method has smaller errors.
The comparison table between composition fuzzy inference and traditional methods is shown in Table 4.

Conclusions
In this paper, the ship domain was regarded as the safe domain for avoiding collisions between vessels. To establish the model, the ship domain was represented as a fixed ellipse and certain factors affecting the ship domain were considered. Not only the ship's own factors that have a greater impact on the ship domain are selected but also the environmental factors that have relatively small impact on the ship domain are added. Then, composition fuzzy inference of the selected factors was used to determine collision risk according to the range of the ship domain. The simulation results provide a reference for implementing collision avoidance actions in different ship encounter situations, which can improve the subjective decision-making of sailors and reduce the probability of collision. Compared with traditional methods of studying ship collision danger warning, the research process of collision danger of composition fuzzy inference is simpler and faster, the result is more intuitive, more applicable, and with fewer errors and has a certain predictability, which can remind the sailor to make preparations in advance.

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