# Research on Collision Warning Method for Ship-Bridge Based on Safety Potential Field
## 4 Vessel Warning for Bridge Area Based on Vessel Posture
### Ship State Prediction Based on Kalman Filtering  
The Kalman filter, based on the state-space model, can effectively estimate the state of dynamic systems [33]. By incorporating historical ship position data and navigation characteristics, and calculating changes at each time step, the Kalman filter can continuously predict ship positions and speeds over a period of time. This method helps to identify potential dangers in a timely manner and take appropriate measures to ensure the safety of navigation in bridge areas. The algorithm uses the minimum mean square error as the optimization criterion and mainly includes two stages--the prediction process and the state update--to achieve optimal estimation of the system's dynamic state. The system state equation and observation equation are shown as follows:  
\[\left\{ \begin{array}{l}X(k)=A\times X(k-1)+B\times i(k-1)+CW+w(k-1)\\ Z(k)=H\times X(k)+\psi(k)\end{array} \right. \tag{15}\]  
where \(C\) is the wind flow impact matrix and \(W\) is the wind flow impact vector; other specific parameters are described in the literature [34]. The prediction of ship trajectory and speed using Kalman filtering is undertaken in the following steps [34]:  
Figure 8: Schematic of the combination of state prediction and security potential field. Figure 7: Warning process based on safety potential field. Step 1: Establish the ship motion model and observation model. The transfer function is constructed through physical principles to form the ship motion process model and observation model expressed in state space. Step 2: Use the established motion process model and observation model to predict the ship's state and observation values at the next moment. The ship state quantities (position and speed) at the current moment are taken as inputs, the state at the next moment is estimated by the motion process model, and the observation values at the next moment are obtained by combining the observation model. Step 3: Correct the predicted values in step 2 based on the measured values of the ship state acquired by the sensors. The error between the measured value and the predicted value is calculated and the predicted value is corrected by Kalman gain \(K\), including the estimation of the speed. Step 4: Repeat steps 2 and 3 to obtain the ship state measurements at each moment by continuous iteration, thereby realising the prediction of the ship trajectory and speed. The computational formulae used in the above steps are as follows:  
\[\left\{ \begin{array}{l}\hat{\xi}_{k}^{-}=A\hat{x}_{k}+Bu_{k-1}\\ P_{K}^{-}=AP_{k-1}A^{T}+Q\\ K_{K}=P_{K}^{-}H^{T}(HP_{K}^{-}H^{T}+R)^{-1}\\ \hat{x}_{k}=\hat{x}_{k}^{-}+K_{k}(Z_{k}-H\hat{x}_{k}^{-})\\ P_{k}=(I-K_{k}H)P_{K}^{-}\end{array} \right. \tag{16}\]  
The specific values in equation are given in the literature [35]. The position of the ship in the geodetic coordinate system is represented by the latitude and longitude coordinates \((x(k),y(k))\). Assuming that the ship's speed and heading are known, the ship's latitude and longitude at the moment k can be obtained according to the following equation, based on the constant direction line sailing method, as follows [36]:  
\[\left\{ \begin{array}{l}x(k)=x(k-1)+V(k-1)T\cos(C(k-1))+W_{x}(k-1)\\ y(k)=y(k-1)+V(k-1)T\sec(x_{m}(k-1))\sin(C(k-1))+W_{y}(k-1)\end{array} \right. \tag{17}\]  
where \(x(k)\) denotes the longitude of the ship at moment k; \(V\) denotes the ship's speed to the ground, i.e., the ship's speed after considering the effects of wind and current; T denotes the time step of prediction; \(C\) denotes the ship's heading to the ground, i.e., the ship's heading after considering the effects of wind and current; \(y(k)\) denotes the ship's latitude at moment k; \(W_{x}(k-1)\) denotes the noise of the prediction process for the longitude; \(W_{y}(k-1)\) denotes the prediction process for the latitude noise, both of which are Gaussian white noise with mean value 0; \(X_{m}(k-1)\) denotes the average value of latitude at moment \(k-1\) and latitude at moment \(k\).