# A Real-Time Data Delivery for Mobile Sinks Group on Mobile Cyber-Physical Systems
## 2 The Proposed Mechanism
### Calculation of the Delivery Speed of a Mobile Sink Group  
In the spatiotemporal approach for the real-time communication, the delivery speed concept is applied. The delivery speed is maintained in order for all relay nodes to evenly distribute the real-time requirement of applications that have a dynamic topology and error-prone nodes. The selected next-hop node must have a relay speed that is faster than the required delivery speed to meet the requirement. The speed concept includes the spatial requirement and the temporal requirement for the data delivery. The temporal requirement can be given by the application, whereas the spatial requirement might be calculated with the Euclidean distance between the source node and the destination node, as we assume each sensor node could get its own coordinates from either GPS or any localization algorithms. However, in the mobile sink group, the end-to-end distance between a source node and each sink node could not be defined as the data delivery towards each sink node is based on flooding within the area.  
A source node defines the distance and calculates the delivery speed after getting the location information of a mobile sink group from sink location server [10; 11]. From the server, the source gets the center point \(P_{C}\) and the radius of movable area \(R_{C}\). \(P_{C}\) is the central coordinate calculated based on the position of all sinks in the group, and when a circle is drawn around \(P_{C}\), the radius of the circle that can contain all member sinks is \(R_{C}\). \(R_{C}\) could vary depending on the requirement of application.  
Equation (1) is a formula for calculating \(P_{C}\), and Equation (2) is a formula for obtaining \(R_{C}\).  
\[P_{C}(x,y)=\frac{1}{n(P)}\sum_{i=1}^{n(P)}P_{i},\quad P\ =\ \{(x,y)\mid(x,y)=\text{ coordinate of member sinks}\} \tag{1}\]  
\[R_{C}=MAX(D),\quad D\ =\ \{d\mid d=\text{distance between $P_{C}$ and member sinks}\} \tag{2}\]  
To define the distance and calculate the delivery speed, main forwarding and branch forwarding are applied. In the main forwarding, we follow the longest straight line of the area, passing the center point. Branching the longest straight line could reduce the total length of the grid structure and increase the probability of path merging.  
The total transmission distance for each sink is the summation of the main forwarding and the branching forwarding. The main forwarding operates on the straight line between a source (\(x_{s},y_{s}\)) and the center point (\(x_{c},y_{c}\)). The branching forwarding for each sink \(i\) (\(x_{si},y_{si}\)) could be defined by the distance between the sink and the straight line:  
\[\frac{|kx_{si}-y_{si}+y_{c}-kx_{c}|}{\sqrt{k^{2}+1}} \tag{3}\]  
where \(k=(y_{s}-y_{c})/(x_{s}-x_{c})\), \((x_{s}\
eq x_{c})\).  
In order to derive the delivery speed for every member in a mobile sink group, we consider the maximum (farthest) distance in the movable area. In the area, as the farthest point from the entry point might be located on the ring, we calculate the distance between two points on the ring. In Figure 2, we assume that the center point and the source node are on the coordinate (0,0) and (D,0), respectively. Each point on the circle can be represented with the angle \(\theta\): (Rcos \(\theta\), Rsin \(\theta\)). The distance to each point is presented as follows.  
\[f(\theta)=(D-Rcos\theta)+|Rsin\theta|. \tag{4}\]With a differential equation from the Equation (4), we can get the farthest points on the circle: \((\theta=3/4\pi\text{ or }5/4\pi)\) as \(f^{\prime}(3/4\pi)=f^{\prime}(5/4\pi)=0\) and \(f^{\prime\prime}(3/4\pi)<0,f^{\prime\prime}(5/4\pi)<0\). Therefore, the maximum distance is \((D+\sqrt{2}R)\). With the maximum distance, the source node makes the delivery speed which will be maintained during the data delivery.