# Patent

## Title
Wireless communication system for calculating time of flight

## Abstract

The invention discloses a wireless communication system for calculating time of flight. The system transmits and receives a plurality of packets every a plurality of delay times. Thereafter, the wireless communication system calculates a plurality of reference times according to the delay times and processing times and then averages the reference times to obtain the time of flight. Thereby, the time of flight can be calculated more accurately.

## Background
BACKGROUND OF THE INVENTION
1. Field of the Invention
The invention relates to a wireless communication system, and more particularly relates to a wireless communication system for calculating time of flight (TOF).
2. Description of the Prior Art
Recently, the development of the wireless communication positioning has been growing rapidly, and the wireless communication positioning has been widely applied to many applications. For example, the positioning can be applied to the navigation system, the information management of where users locate, the mobile emergency positioning (e.g. related positioning rules of E-911 legislation for phones in America), the logistics management, and the car dispatch.
Time of arrival (TOA) and time difference of arrival (TDOA) are wireless positioning algorithms relative to time, and they can be applied to different kinds of wireless communication positioning, such as the global positioning system (GPS), the cell phone positioning, the ultra wide band (UWB), the ultrasonic positioning, and the like.
Time of flight plays a key role of TOA and TDOA and has a great effect on the accuracy of the positioning. A general method for calculating time of flight does not takes account of the influence of the hardware structure, the interference in the wireless communication environment, and the load of the hardware system, such that the calculated result will not be accurate.
Therefore, a scope of the invention is to provide a wireless communication system for accurately calculating time of flight to solve the aforesaid problems.
SUMMARY OF THE INVENTION
A scope of the invention is to provide a wireless communication system for calculating time of flight.
According to a preferred embodiment, the wireless communication system of the invention comprises a first communication module and a second communication module. The first communication module spends a first processing time transmitting and receiving each packet. And, the second communication module spends a second processing time transmitting and receiving each packet.
In this embodiment, the first communication module transmits a first pilot to the second communication module. After transmitting the first pilot, the first communication module sequentially transmits N first packets each with a first delay time, wherein N is a natural number larger than 1.
After receiving the first pilot, the second communication module sequentially receives the N first packets each with a second delay time. Afterward, the second communication module transmits the second pilot to the first communication module. After transmitting the second pilot, the second communication module sequentially transmits N second packets each with a third delay time. Each of N first packets is respectively corresponds to one of the N second packets.
After receiving the second pilot, the first communication module sequentially receives the N second packets each with a fourth delay time. Afterward, according to N first processing times, N second processing times, N first delay times, N second delay times, N third delay times, and N fourth delay times corresponding to the N first packets and the N second packets, the first communication module calculates N reference times and averages the N reference times to obtain a time of flight (TOF).
Therefore, the wireless communication system of the invention sequentially receives and transmits multiple packets every multiple delay times. According to the delay times and the processing times, the wireless communication system of the invention calculates multiple reference times and then averages the reference times to obtain the TOF. Accordingly, it can be more accurately to calculate the TOF.
The advantage and spirit of the invention may be understood by the following recitations together with the appended drawings.



BRIEF DESCRIPTION OF THE APPENDED DRAWINGS
FIG. 1 is a functional block diagram illustrating the wireless communication system according to a preferred embodiment of the invention.
FIG. 2A and FIG. 2B are schematic diagrams illustrating the packet transmission of the wireless communication system in FIG. 1.
FIG. 3 is a schematic diagram illustrating the packet transmission according to another preferred embodiment of the invention.



DETAILED DESCRIPTION OF THE INVENTION
Please refer to FIG. 1. FIG. 1 is a functional block diagram illustrating the wireless communication system 1 according to a preferred embodiment of the invention. As shown in FIG. 1, the wireless communication system 1 comprises a first communication module 10 and a second communication module 12. The first communication module 10 comprises a first baseband circuit 100, a first radio frequency circuit 102, and a first antenna 104. The second communication module 12 comprises a second baseband circuit 120, a second radio frequency circuit 122, and a second antenna 124. In this embodiment, the time of the first communication module 10 is asynchronous with the time of the second communication module 12.
The first communication module 10 spends a first processing time transmitting and receiving each packet. The first processing time comprises a first transmitting time, a first receiving time, and a first influence time, wherein the first communication module 10 spends the first transmitting time transmitting each packet; the first communication module 10 spends the first receiving time receiving each packet; and the first communication module 10 spends the first influence time on wireless environment and system load. The second communication module 12 spends a second processing time transmitting and receiving each packet. The second processing time comprises a second transmitting time, a second receiving time, and a second influence time, wherein the second communication module 12 spends the second transmitting time transmitting each packet; the second communication module 12 spends the second receiving time receiving each packet; and the second communication module 12 spends the second influence time on the wireless environment and the system load. The first processing time and the second processing time are described in the following equation 1 and equation 2:

A(Process)=TxA(Process)+RxA(Process)+ΦxA; and  Equation 1:

B(Process)=TxB(Process)+RxB(Process)+ΦxB.  Equation 2:

In the equation 1 and equation 2, A(Process) represents the first processing time, TxA(Process) represents the first transmitting time, RxA(Process) represents the first receiving time, ΦxA represents the first influence time, B(Process) represents the second processing time, TxB(Process) represents the second transmitting time, RxB(Process) represents the second receiving time, and ΦxB represents the second influence time.
Please refer to FIG. 2A and FIG. 2B. FIG. 2A and FIG. 2B are schematic diagrams illustrating the packet transmission of the wireless communication system 1 in FIG. 1. In this embodiment, as shown in FIG. 2A, the first communication module 10 transmits the first pilot PLa to the second communication module 12. After transmitting the first pilot PLa, the first communication module 10 sequentially transmits three first packets Pa1-Pa3 each with a first delay time Tta1-Tta3. After receiving the first pilot PLa, the second communication module 12 sequentially receives the first packets Pa1-Pa3 each with a second delay time Trb1-Trb3. Afterward, as shown in FIG. 2B, the second communication module 12 transmits the second pilot PLb to the first communication module 10. After transmitting the second pilot PLb, the second communication module 12, sequentially transmits three second packets Pb1-Pb3 each with a second delay time Ttb1-Ttb3. After receiving the second pilot PLb, the first communication module 10 sequentially receives the second packets Pb1-Pb3 each with a fourth delay time Tra1-Tra3. It should be noticed that each first packet Pa1-Pa3 respectively corresponds to one of the second packets Pb1-Pb3.
According to the first processing times A(Process), the second processing times B(Process), the first delay times Tta1-Tta3, the second delay times Trb1-Trb3, the third delay times Ttb1-Ttb3, and the fourth delay times Tra1-Tra3 corresponding to the first packets Pa1-Pa3 and the second packets Pb1-Pb3, the first communication module 10 calculates three reference times and then averages the three reference times to obtain a time of flight (TOF). It should be noticed that the number of the first and second packets can be adjusted according to practical applications.
The reference time can be calculated by the following equation 3:




  
    
      
        {
        
          
            
              
                
                  
                    
                      TxA_
                      ⁢
                      1
                    
                    +
                    
                      2
                      ⁢
                      Δ
                      ⁢
                      
                        
                      
                      ⁢
                      T_
                      ⁢
                      1
                    
                    +
                    
                      
                        A
                        ⁡
                        
                          (
                          Process
                          )
                        
                      
                      ⁢
                      _
                      ⁢
                      1
                    
                    +
                    
                      
                        B
                        ⁡
                        
                          (
                          Process
                          )
                        
                      
                      ⁢
                      _
                      ⁢
                      1
                    
                  
                  =
                  
                    RxA_
                    ⁢
                    1
                  
                
              
            
            
              
                
                  
                    
                      TxA_
                      ⁢
                      2
                    
                    +
                    
                      2
                      ⁢
                      Δ
                      ⁢
                      
                        
                      
                      ⁢
                      T_
                      ⁢
                      2
                    
                    +
                    
                      
                        A
                        ⁡
                        
                          (
                          Process
                          )
                        
                      
                      ⁢
                      _
                      ⁢
                      2
                    
                    +
                    
                      
                        B
                        ⁡
                        
                          (
                          Process
                          )
                        
                      
                      ⁢
                      _
                      ⁢
                      2
                    
                  
                  =
                  
                    RxA_
                    ⁢
                    2
                  
                
              
            
            
              
                
                  
                    
                      TxA_
                      ⁢
                      3
                    
                    +
                    
                      2
                      ⁢
                      Δ
                      ⁢
                      
                        
                      
                      ⁢
                      T_
                      ⁢
                      3
                    
                    +
                    
                      
                        A
                        ⁡
                        
                          (
                          Process
                          )
                        
                      
                      ⁢
                      _
                      ⁢
                      3
                    
                    +
                    
                      
                        B
                        ⁡
                        
                          (
                          Process
                          )
                        
                      
                      ⁢
                      _
                      ⁢
                      3
                    
                  
                  =
                  
                    RxA_
                    ⁢
                    3
                  
                
              
            
          
          .
        
      
    
    
      
        Equation
        ⁢
        
          
        
        ⁢
        3
      
    
  




In the equation 3, TxA_1-TxA_3 respectively represents the first time point when the first communication module 10 transmits the first packet Pa1-Pa3, RxA_1-RxA_3 respectively represents the second time point when the first communication 10 receives the second packet Pb1-Pb3, and ΔT_1-ΔT_3 represents the reference time.
In this embodiment, the relation of the first delay time, the second delay time, and the second influence time is listed in the following equation 4:

Trb−Tta=RxB(Process)−TxA(Process)+ΦxB.  Equation 4:

In the equation 4, Tta represents the first delay time, and Trb represents the second delay time.
Similarly, the relation of the third delay time, the fourth delay time, and the first influence time is listed in the following equation 5:

Tra−Ttb=RxA(Process)−TxB(Process)+ΦxA.  Equation 5:

In the equation 5, Ttb represents the third delay time, and Tra represents the fourth delay time.
In this embodiment, assuming that the first delay time Tta is equal to the third delay time Ttb, the equation 6 could be obtained by subtracting the equation 5 from the equation 4 first and substituting with the equation 1 and the equation 2 later, listed as follows:

Trb−Tra=B(Process)−A(Process).  Equation 6:

The equation 6 is substituted into the equation 3, so as to obtain the following equation 7:




  
    
      
        {
        
          
            
              
                
                  
                    
                      TxA_
                      ⁢
                      1
                    
                    +
                    
                      2
                      ⁢
                      ΔT_
                      ⁢
                      1
                    
                    +
                    
                      2
                      ⁢
                      
                        B
                        ⁡
                        
                          (
                          Process
                          )
                        
                      
                      ⁢
                      _
                      ⁢
                      1
                    
                    +
                    
                      Tra_
                      ⁢
                      1
                    
                    -
                    
                      Trb_
                      ⁢
                      1
                    
                  
                  =
                  
                    RxA_
                    ⁢
                    1
                  
                
              
            
            
              
                
                  
                    
                      TxA_
                      ⁢
                      2
                    
                    +
                    
                      2
                      ⁢
                      ΔT_
                      ⁢
                      2
                    
                    +
                    
                      2
                      ⁢
                      
                        B
                        ⁡
                        
                          (
                          Process
                          )
                        
                      
                      ⁢
                      _
                      ⁢
                      2
                    
                    +
                    
                      Tra_
                      ⁢
                      2
                    
                    -
                    
                      Trb_
                      ⁢
                      2
                    
                  
                  =
                  
                    RxA_
                    ⁢
                    2
                  
                
              
            
            
              
                
                  
                    
                      TxA_
                      ⁢
                      3
                    
                    +
                    
                      2
                      ⁢
                      ΔT_
                      ⁢
                      3
                    
                    +
                    
                      2
                      ⁢
                      
                        B
                        ⁡
                        
                          (
                          Process
                          )
                        
                      
                      ⁢
                      _
                      ⁢
                      3
                    
                    +
                    
                      Tra_
                      ⁢
                      3
                    
                    -
                    
                      Trb_
                      ⁢
                      3
                    
                  
                  =
                  
                    RxA_
                    ⁢
                    3
                  
                
              
            
          
          ⁢
          
            
          
          .
        
      
    
    
      
        Equation
        ⁢
        
          
        
        ⁢
        7
      
    
  




In this embodiment, the second processing time B(Process) is estimated by a time difference between a time point after the second communication module 12 receives the first packet Pa1-Pa3 and a time point before the second communication module 12 transmits the corresponding second packet Pb1-Pb3. In such a way, the equation 7 is further transformed into the following equation 8:




  
    
      
        {
        
          
            
              
                
                  
                    
                      TxA_
                      ⁢
                      1
                    
                    +
                    
                      2
                      ⁢
                      Δ
                      ⁢
                      
                        
                      
                      ⁢
                      T_
                      ⁢
                      1
                    
                    +
                    
                      2
                      ⁢
                      β_
                      ⁢
                      1
                    
                    +
                    
                      Tra_
                      ⁢
                      1
                    
                    -
                    
                      Trb_
                      ⁢
                      1
                    
                  
                  =
                  
                    RxA_
                    ⁢
                    1
                  
                
              
            
            
              
                
                  
                    
                      TxA_
                      ⁢
                      2
                    
                    +
                    
                      2
                      ⁢
                      Δ
                      ⁢
                      
                        
                      
                      ⁢
                      T_
                      ⁢
                      2
                    
                    +
                    
                      2
                      ⁢
                      β_
                      ⁢
                      2
                    
                    +
                    
                      Tra_
                      ⁢
                      2
                    
                    -
                    
                      Trb_
                      ⁢
                      2
                    
                  
                  =
                  
                    RxA_
                    ⁢
                    2
                  
                
              
            
            
              
                
                  
                    
                      TxA_
                      ⁢
                      3
                    
                    +
                    
                      2
                      ⁢
                      Δ
                      ⁢
                      
                        
                      
                      ⁢
                      T_
                      ⁢
                      3
                    
                    +
                    
                      2
                      ⁢
                      β_
                      ⁢
                      3
                    
                    +
                    
                      Tra_
                      ⁢
                      3
                    
                    -
                    
                      Trb_
                      ⁢
                      3
                    
                  
                  =
                  
                    RxA_
                    ⁢
                    3
                  
                
              
            
          
          .
        
      
    
    
      
        Equation
        ⁢
        
          
        
        ⁢
        8
      
    
  




In the equation 8, β_1-β_3 represents the estimated time difference.
Afterward, substituting the first time point TxA_1-TxA_3 generated while the first communication module 10 transmits the first packet Pa1-Pa3, the second time point RxA_1-RxA_3 generated while the first communication module 10 receives the second packets Pb1-Pb3, the second delay time Trb_1-Trb_3, the fourth delay time Tra_1-Tra_3, and the estimated time difference β_1-β_3 into the equation 8, such that the reference time ΔT_1-ΔT_3 is obtained. Further, average the reference times ΔT_1-ΔT_3 to obtain the time of flight.
Because the invention takes account of the influence of the hardware structure, the disturbance in the wireless environment, and the load of the hardware system, the calculated time of flight will be more accurate than the prior art.
Please refer to FIG. 3. FIG. 3 is a schematic diagram illustrating the packet transmission according to another preferred embodiment of the invention. In this embodiment, the time of the first communication module 10 of the wireless communication system 1 is synchronous with the time of the second communication module 12.
The first communication module 10 spends a third processing time transmitting each packet. The third processing time comprises a transmitting time for transmitting each packet. The second communication module 12 spends a fourth processing time receiving each packet. The fourth processing time comprises a receiving time for receiving each packet, and an influence time on the wireless environment and the system load.
As shown in FIG. 3, the first communication module 10 sequentially transmits three packets P1-P3 each with a fifth delay time Tta′1-Tta′3. The second communication module 12 sequentially receives packets P1-P3 each with a sixth delay time Trb′1-Trb′3. According to the third processing time, the fourth processing time, the fifth delay time Tta′1-Tta′3, and the sixth delay time Trb′1-Trb′3 corresponding to the packets P1-P3, the first communication module 10 calculates three reference times and then averages the reference times to obtain a time of flight. It should be noticed that the number of packets can be adjusted according to practical applications.
The reference time is calculated by the following equation 9:




  
    
      
        
          

        
        ⁢
        
          {
          
            
              
                
                  
                    
                      
                        TxA
                        ′
                      
                      ⁢
                      _
                      ⁢
                      1
                    
                    +
                    
                      Δ
                      ⁢
                      
                        
                      
                      ⁢
                      
                        T
                        ′
                      
                      ⁢
                      _
                      ⁢
                      1
                    
                    +
                    
                      
                        
                          TxA
                          ⁡
                          
                            (
                            Process
                            )
                          
                        
                        ′
                      
                      ⁢
                      _
                      ⁢
                      1
                    
                    +
                    
                      
                        
                          RxB
                          ⁡
                          
                            (
                            Process
                            )
                          
                        
                        ′
                      
                      ⁢
                      _
                      ⁢
                      1
                    
                  
                  =
                  
                    
                      RxB
                      ′
                    
                    ⁢
                    _
                    ⁢
                    1
                  
                
              
            
            
              
                
                  
                    
                      
                        TxA
                        ′
                      
                      ⁢
                      _
                      ⁢
                      2
                    
                    +
                    
                      Δ
                      ⁢
                      
                        
                      
                      ⁢
                      
                        T
                        ′
                      
                      ⁢
                      _
                      ⁢
                      2
                    
                    +
                    
                      
                        
                          TxA
                          ⁡
                          
                            (
                            Process
                            )
                          
                        
                        ′
                      
                      ⁢
                      _
                      ⁢
                      2
                    
                    +
                    
                      
                        
                          RxB
                          ⁡
                          
                            (
                            Process
                            )
                          
                        
                        ′
                      
                      ⁢
                      _
                      ⁢
                      2
                    
                  
                  =
                  
                    
                      RxB
                      ′
                    
                    ⁢
                    _
                    ⁢
                    2
                  
                
              
            
            
              
                
                  
                    
                      
                        TxA
                        ′
                      
                      ⁢
                      _
                      ⁢
                      3
                    
                    +
                    
                      Δ
                      ⁢
                      
                        
                      
                      ⁢
                      
                        T
                        ′
                      
                      ⁢
                      _
                      ⁢
                      3
                    
                    +
                    
                      
                        
                          TxA
                          ⁡
                          
                            (
                            Process
                            )
                          
                        
                        ′
                      
                      ⁢
                      _
                      ⁢
                      3
                    
                    +
                    
                      
                        
                          RxB
                          ⁡
                          
                            (
                            Process
                            )
                          
                        
                        ′
                      
                      ⁢
                      _
                      ⁢
                      3
                    
                  
                  =
                  
                    
                      RxB
                      ′
                    
                    ⁢
                    _
                    ⁢
                    3.
                  
                
              
            
          
        
      
    
    
      
        Equation
        ⁢
        
          
        
        ⁢
        9
      
    
  




In the equation 9, TxA′_-TXA′_3 respectively represents the first time point when the first communication module 10 transmits the packet P1-P3, RxB′_1-RxB′_3 respectively represents the second time point when the second communication module 12 receives the packet P1-P3, ΔT′_1-ΔT′_3 represents the reference time, TxA(Process)′_1-TxA(Process)′_3 represents the transmitting time corresponding to the packet P1-P3, and RxB(Process)′_1-RxB(Process)′_3 represents the receiving time corresponding to the packet P1-P3.
In this embodiment, the relation of the fifth delay time, the six delay time, and the influence time is listed in the following equation 10:

Trb′−Tta′=RxB(Process)′−TxA(Process)′+ΦxB.′  Equation 10:

In the equation 10, Tta′ represents the fifth delay time, Trb′ represents the sixth delay time, and ΦxB′ represents the influence time.
The equation 10 is substituted into the equation 9, and the equation 11 is then obtained as follows:




  
    
      
        {
        
          
            
              
                
                  
                    
                      
                        TxA
                        ′
                      
                      ⁢
                      _
                      ⁢
                      1
                    
                    +
                    
                      Δ
                      ⁢
                      
                        
                      
                      ⁢
                      
                        T
                        ′
                      
                      ⁢
                      _
                      ⁢
                      1
                    
                    +
                    
                      2
                      ⁢
                      
                        
                          TxA
                          ⁡
                          
                            (
                            Process
                            )
                          
                        
                        ′
                      
                      ⁢
                      _
                      ⁢
                      1
                    
                    +
                    
                      (
                      
                        
                          
                            Trb
                            ′
                          
                          ⁢
                          _
                          ⁢
                          1
                        
                        -
                        
                          
                            Tta
                            ′
                          
                          ⁢
                          _
                          ⁢
                          1
                        
                      
                      )
                    
                    -
                    
                      Φ
                      ⁢
                      
                        
                      
                      ⁢
                      
                        xB
                        ′
                      
                      ⁢
                      _
                      ⁢
                      1
                    
                  
                  =
                  
                    
                      RxB
                      ′
                    
                    ⁢
                    _
                    ⁢
                    1
                  
                
              
            
            
              
                
                  
                    
                      
                        TxA
                        ′
                      
                      ⁢
                      _
                      ⁢
                      2
                    
                    +
                    
                      Δ
                      ⁢
                      
                        
                      
                      ⁢
                      
                        T
                        ′
                      
                      ⁢
                      _
                      ⁢
                      2
                    
                    +
                    
                      2
                      ⁢
                      
                        
                          TxA
                          ⁡
                          
                            (
                            Process
                            )
                          
                        
                        ′
                      
                      ⁢
                      _
                      ⁢
                      2
                    
                    +
                    
                      (
                      
                        
                          
                            Trb
                            ′
                          
                          ⁢
                          _
                          ⁢
                          2
                        
                        -
                        
                          
                            Tta
                            ′
                          
                          ⁢
                          _
                          ⁢
                          2
                        
                      
                      )
                    
                    -
                    
                      Φ
                      ⁢
                      
                        
                      
                      ⁢
                      
                        xB
                        ′
                      
                      ⁢
                      _
                      ⁢
                      2
                    
                  
                  =
                  
                    
                      RxB
                      ′
                    
                    ⁢
                    _
                    ⁢
                    2
                  
                
              
            
            
              
                
                  
                    
                      
                        TxA
                        ′
                      
                      ⁢
                      _
                      ⁢
                      3
                    
                    +
                    
                      Δ
                      ⁢
                      
                        
                      
                      ⁢
                      
                        T
                        ′
                      
                      ⁢
                      _
                      ⁢
                      3
                    
                    +
                    
                      2
                      ⁢
                      
                        
                          TxA
                          ⁡
                          
                            (
                            Process
                            )
                          
                        
                        ′
                      
                      ⁢
                      _
                      ⁢
                      3
                    
                    +
                    
                      (
                      
                        
                          
                            Trb
                            ′
                          
                          ⁢
                          _
                          ⁢
                          3
                        
                        -
                        
                          
                            Tta
                            ′
                          
                          ⁢
                          _
                          ⁢
                          3
                        
                      
                      )
                    
                    -
                    
                      Φ
                      ⁢
                      
                        
                      
                      ⁢
                      
                        xB
                        ′
                      
                      ⁢
                      _
                      ⁢
                      3
                    
                  
                  =
                  
                    
                      RxB
                      ′
                    
                    ⁢
                    _
                    ⁢
                    3
                  
                
              
            
          
          .
        
      
    
    
      
        Equation
        ⁢
        
          
        
        ⁢
        11
      
    
  




When the transmitting time TxA(Process)′_1-TxA(Process)′_3 and the influence time ΦxB′_1-ΦxB′_3 are equal to zero, the equation 11 is further transformed into the following equation 12:




  
    
      
        {
        
          
            
              
                
                  
                    
                      
                        TxA
                        ′
                      
                      ⁢
                      _
                      ⁢
                      1
                    
                    +
                    
                      Δ
                      ⁢
                      
                        
                      
                      ⁢
                      
                        T
                        ′
                      
                      ⁢
                      _
                      ⁢
                      1
                    
                    +
                    
                      (
                      
                        
                          
                            Trb
                            ′
                          
                          ⁢
                          _
                          ⁢
                          1
                        
                        -
                        
                          
                            Tta
                            ′
                          
                          ⁢
                          _
                          ⁢
                          1
                        
                      
                      )
                    
                  
                  =
                  
                    
                      RxB
                      ′
                    
                    ⁢
                    _
                    ⁢
                    1
                  
                
              
            
            
              
                
                  
                    
                      
                        TxA
                        ′
                      
                      ⁢
                      _
                      ⁢
                      2
                    
                    +
                    
                      Δ
                      ⁢
                      
                        
                      
                      ⁢
                      
                        T
                        ′
                      
                      ⁢
                      _
                      ⁢
                      2
                    
                    +
                    
                      (
                      
                        
                          
                            Trb
                            ′
                          
                          ⁢
                          _
                          ⁢
                          2
                        
                        -
                        
                          
                            Tta
                            ′
                          
                          ⁢
                          _
                          ⁢
                          2
                        
                      
                      )
                    
                  
                  =
                  
                    
                      RxB
                      ′
                    
                    ⁢
                    _
                    ⁢
                    2
                  
                
              
            
            
              
                
                  
                    
                      
                        TxA
                        ′
                      
                      ⁢
                      _
                      ⁢
                      3
                    
                    +
                    
                      Δ
                      ⁢
                      
                        
                      
                      ⁢
                      
                        T
                        ′
                      
                      ⁢
                      _
                      ⁢
                      3
                    
                    +
                    
                      (
                      
                        
                          
                            Trb
                            ′
                          
                          ⁢
                          _
                          ⁢
                          3
                        
                        -
                        
                          
                            Tta
                            ′
                          
                          ⁢
                          _
                          ⁢
                          3
                        
                      
                      )
                    
                  
                  =
                  
                    
                      RxB
                      ′
                    
                    ⁢
                    _
                    ⁢
                    3
                  
                
              
            
          
          .
        
      
    
    
      
        Equation
        ⁢
        
          
        
        ⁢
        12
      
    
  




Afterward, substitute the first time point TxA′_-TXA′_3 generated while the first communication module 10 transmits the packet P1-P3, the second time point RxB′_1-RxB′_3 generated while the second communication module 12 receives the packet P1-P3, the fifth delay time Tta′_1-Tta′_3, and the sixth delay time Trb′_1-Trb′_3 into the equation 11, such that the reference time ΔT′_1-ΔT′_3 is obtained. Finally, the reference times ΔT′_1-ΔT′_3 are averaged to obtain the time of flight.
Compared to the prior art, the wireless communication system of the invention sequentially receives and transmits multiple packets with multiple delay times. According to the delay times and the processing times, the wireless communication system of the invention calculates multiple reference times and then averages the reference times to obtain the TOF. Alternatively, because the invention takes account of the influence of the hardware structure, the disturbance in the wireless environment, and the load of the hardware system, the calculated time of flight will be more accurate than the prior art. Additionally, no matter whether the time of the first communication module is, synchronous with the time of the second communication module, the invention can be applied to both.
With the example and explanations above, the features and spirits of the invention will be hopefully well described. Those skilled in the art will readily observe that numerous modifications and alterations of the device may be made while retaining the teaching of the invention. Accordingly, the above disclosure should be construed as limited only by the metes and bounds of the appended claims.

## Claims

1. A wireless communication system, comprising:
a first communication module, after transmitting a first pilot, sequentially transmitting N first packets each with a first delay time, and after receiving a second pilot, sequentially receiving N second packets each with a fourth delay time, each of the N first packets respectively corresponding to one of the N second packets, N being a natural number larger than 1, the first communication module spending a first processing time transmitting and receiving each packet; and
a second communication module, after receiving the first pilot, sequentially receiving the N first packets each with a second delay time, and after transmitting the second pilot, sequentially transmitting the N second packets each with a third delay time, the second communication module spending a second processing time transmitting and receiving each packet;
wherein, according to the N first processing times, the N second processing times, the N first delay times, the N second delay times, the N third delay times, and the N fourth delay times corresponding to the N first packets and the N second packets, the first communication module calculates N reference times and averages the N reference times to obtain a time of flight (TOF);
wherein the first processing time comprises a first transmitting time, a first receiving time, and a first influence time; the first communication module spends the first transmitting time transmitting each packet, spends the first receiving time receiving each packet, and spends the first influence time on a wireless environment and a system load; the first processing time is shown as follows: A(Process)=T×A (Process)+R×A(Process)+Φ×A; wherein A(Process) represents the first processing time, T×A(Process) represents the first transmitting time, R×A(Process) represents the first receiving time, and Φ×A represents the first influence time;
wherein the second processing time comprises a second transmitting time, a second receiving time, and a second influence time; the second communication module spends the second transmitting time transmitting each packet, spends the second receiving time receiving each packet, and spends the second influence time on the wireless environment and the system load; the second processing time is shown as follows:
B(Process)=T×B(Process)+R×B(Process)+Φ×B; wherein B(Process) represents the second processing time, T×B(Process) represents the second transmitting time, R×B(Process) represents the second receiving time, and Φ×B represents the second influence time;
wherein the N reference times are calculated according to the following N first equations:





  {
  
    
      
        
          
            
              
                TxA_
                ⁢
                1
              
              +
              
                2
                ⁢
                ΔT_
                ⁢
                1
              
              +
              
                
                  A
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _
                ⁢
                1
              
              +
              
                
                  B
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _
                ⁢
                1
              
            
            =
            
              RxA_
              ⁢
              1
            
          
        
      
      
        
          
            
              
                TxA_
                ⁢
                2
              
              +
              
                2
                ⁢
                ΔT_
                ⁢
                2
              
              +
              
                
                  A
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _
                ⁢
                2
              
              +
              
                
                  B
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _
                ⁢
                2
              
            
            =
            
              RxA_
              ⁢
              2
            
          
        
      
      
        
          M
        
      
      
        
          
            
              TxA_N
              +
              
                2
                ⁢
                ΔT_N
              
              +
              
                
                  A
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _N
              
              +
              
                
                  B
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _N
              
            
            =
            RxA_N
          
        
      
    
    ;
  



wherein T×A N represents a first time point when the first communication module transmits the Nth first packet, R×A N represents a second time point when the first communication module receives the Nth second packet, T N represents the Nth reference time, A (Process) N represents the first processing time corresponding to the Nth first packets, and B (Process) N represents the second processing time corresponding to the Nth second packets.

2. The wireless communication system of claim 1, wherein the relation of the first delay time, the second delay time, and the second influence time is listed below: Trb-Tta=R×B(Process)−T×A(Process)+Φ×B; wherein Tta represents the first delay time, and Trb represents the second delay time.

3. The wireless communication system of claim 2, wherein the relation of the third delay time, the fourth delay time, and the first influence time is listed below: Tra-Ttb=R×A(Process)−T×B(Process)+Φ×A; wherein Ttb represents the third delay time, and Tra represents the fourth delay time.

4. The wireless communication system of claim 3, wherein when the first delay time is equal to the third delay time, the equation is obtained as follows: Trb-Tra=B(Process)−A(Process).

5. The wireless communication system of claim 4, wherein the N first equations are transformed into the following N second equations:




  {
  
    
      
        
          
            
              
                TxA_
                ⁢
                1
              
              +
              
                2
                ⁢
                ΔT_
                ⁢
                1
              
              +
              
                2
                ⁢
                
                  B
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _
                ⁢
                1
              
              +
              
                Tra_
                ⁢
                1
              
              -
              
                Trb_
                ⁢
                1
              
            
            =
            
              RxA_
              ⁢
              1
            
          
        
      
      
        
          
            
              
                TxA_
                ⁢
                2
              
              +
              
                2
                ⁢
                ΔT_
                ⁢
                2
              
              +
              
                2
                ⁢
                
                  B
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _
                ⁢
                2
              
              +
              
                Tra_
                ⁢
                2
              
              -
              
                Trb_
                ⁢
                2
              
            
            =
            
              RxA_
              ⁢
              2
            
          
        
      
      
        
          M
        
      
      
        
          
            
              TxA_N
              +
              
                2
                ⁢
                ΔT_N
              
              +
              
                2
                ⁢
                
                  B
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _N
              
              +
              Tra_N
              -
              Trb_N
            
            =
            RxA_N
          
        
      
    
    .
  



wherein Tra_N represents the fourth delay time corresponding to the Nth second packet, and Trb N represents the second delay time corresponding to the Nth first packet.

6. The wireless communication system of claim 5, wherein the second processing time is estimated by a time difference between a time point after the second communication module receives the first packet and a time point before the second communication module transmits the corresponding second packet, such that the N second equations are further transformed into N third equations:




  {
  
    
      
        
          
            
              
                TxA_
                ⁢
                1
              
              +
              
                2
                ⁢
                ΔT_
                ⁢
                1
              
              +
              
                2
                ⁢
                β_
                ⁢
                1
              
              +
              
                Tra_
                ⁢
                1
              
              -
              
                Trb_
                ⁢
                1
              
            
            =
            
              RxA_
              ⁢
              1
            
          
        
      
      
        
          
            
              
                TxA_
                ⁢
                2
              
              +
              
                2
                ⁢
                ΔT_
                ⁢
                2
              
              +
              
                2
                ⁢
                β_
                ⁢
                2
              
              +
              
                Tra_
                ⁢
                2
              
              -
              
                Trb_
                ⁢
                2
              
            
            =
            
              RxA_
              ⁢
              2
            
          
        
      
      
        
          M
        
      
      
        
          
            
              TxA_N
              +
              
                2
                ⁢
                ΔT_N
              
              +
              
                2
                ⁢
                β_N
              
              +
              Tra_N
              -
              Trb_N
            
            =
            RxA_N
          
        
      
    
    ⁣

7. A wireless communication system, comprising:
a first communication module, sequentially transmitting N packets each with a first delay time, N being a natural number larger than 1, the first communication module spending a first processing time transmitting and receiving each packet; and
a second communication module, sequentially receiving the N packets each with a second delay time, the second communication module spending a second processing time transmitting and receiving each packet;
wherein, according to the N first processing times, the N second processing times, the N first delay times, and the N second delay times corresponding to the N packets, the first communication module calculates N reference times and averages the N reference times to obtain a time of flight (TOF);
wherein the first processing time comprises a first transmitting time, the first communication module spends the first transmitting time transmitting each packet;
wherein the second processing time comprises a receiving time and an influence time, the second communication module spends the receiving time receiving each packet, and spends the influence time on the wireless environment and the system load;
wherein the N reference times are calculated according to the following N first equations:





  {
  
    
      
        
          
            
              
                TxA_
                ⁢
                1
              
              +
              
                ΔT_
                ⁢
                1
              
              +
              
                
                  TxA
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _
                ⁢
                1
              
              +
              
                
                  RxB
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _
                ⁢
                1
              
            
            =
            
              RxB_
              ⁢
              1
            
          
        
      
      
        
          
            
              
                TxA_
                ⁢
                2
              
              +
              
                ΔT_
                ⁢
                2
              
              +
              
                
                  TxA
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _
                ⁢
                2
              
              +
              
                
                  RxB
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _
                ⁢
                2
              
            
            =
            
              RxB_
              ⁢
              2
            
          
        
      
      
        
          M
        
      
      
        
          
            
              TxA_N
              +
              ΔT_N
              +
              
                
                  TxA
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _N
              
              +
              
                
                  RxB
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _N
              
            
            =
            RxB_N
          
        
      
    
    ;
  



wherein T×A_N represents a first time point when the first communication module transmits the Nth packet, R×B N represents a second time point when the second communication module receives the Nth packet, T_N represents the Nth reference time, T×A (Process)_N represents the transmitting time corresponding to the Nth packet, and R×B (Process)_N represents the receiving time corresponding to the Nth packet.

8. The wireless communication system of claim 7, wherein the relation of the first delay time, the second delay time, and the influence time is listed below: Trb-Tta=R×B (Process)−T×A (Process) +Φ×B; wherein Tta represents the first delay time, and Trb represents the second delay time, T×A (Process) represents the transmitting time, R×B(Process) represents the receiving time, and Φ×B represents the influence time.

9. The wireless communication system of claim 8, wherein the N first equations are transformed into the following N second equations:




  {
  
    
      
        
          
            
              
                TxA_
                ⁢
                1
              
              +
              
                Δ
                ⁢
                
                  
                
                ⁢
                T_
                ⁢
                1
              
              +
              
                2
                ⁢
                
                  TxA
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _
                ⁢
                1
              
              +
              
                (
                
                  
                    Trb_
                    ⁢
                    1
                  
                  -
                  
                    Tta_
                    ⁢
                    1
                  
                
                )
              
              -
              
                Φ
                ⁢
                
                  
                
                ⁢
                xB_
                ⁢
                1
              
            
            =
            
              RxB_
              ⁢
              1
            
          
        
      
      
        
          
            
              
                TxA_
                ⁢
                2
              
              +
              
                Δ
                ⁢
                
                  
                
                ⁢
                T_
                ⁢
                2
              
              +
              
                2
                ⁢
                
                  TxA
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _
                ⁢
                2
              
              +
              
                (
                
                  
                    Trb_
                    ⁢
                    2
                  
                  -
                  
                    Tta_
                    ⁢
                    2
                  
                
                )
              
              -
              
                Φ
                ⁢
                
                  
                
                ⁢
                xB_
                ⁢
                2
              
            
            =
            
              RxB_
              ⁢
              2
            
          
        
      
      
        
          M
        
      
      
        
          
            
              TxA_N
              +
              
                Δ
                ⁢
                
                  
                
                ⁢
                T_N
              
              +
              
                2
                ⁢
                
                  TxA
                  ⁡
                  
                    (
                    Process
                    )
                  
                
                ⁢
                _N
              
              +
              
                (
                
                  Trb_N
                  -
                  Tta_N
                
                )
              
              -
              
                Φ
                ⁢
                
                  
                
                ⁢
                xB_N
              
            
            =
            RxB_N
          
        
      
    
    ⁢
    
      
    
    .
  



wherein Tta N represents the first delay time corresponding to the Nth packet, Trb_N represents the second delay time corresponding to the Nth packet, and Φ×B _N represents the influence time corresponding to the Nth packet .

10. The wireless communication system of claim 9, wherein when the transmitting time and the influence time are equal to zero, the N second equations is further transformed to the following N third equations:




  {
  
    
      
        
          
            
              
                TxA_
                ⁢
                1
              
              +
              
                ΔT_
                ⁢
                1
              
              +
              
                (
                
                  
                    Trb_
                    ⁢
                    1
                  
                  -
                  
                    Tta_
                    ⁢
                    1
                  
                
                )
              
            
            =
            
              RxB_
              ⁢
              1
            
          
        
      
      
        
          
            
              
                TxA_
                ⁢
                2
              
              +
              
                ΔT_
                ⁢
                2
              
              +
              
                (
                
                  
                    Trb_
                    ⁢
                    2
                  
                  -
                  
                    Tta_
                    ⁢
                    2
                  
                
                )
              
            
            =
            
              RxB_
              ⁢
              2
            
          
        
      
      
        
          M
        
      
      
        
          
            
              TxA_N
              +
              ΔT_N
              +
              
                (
                
                  Trb_N
                  -
                  Tta_N
                
                )
              
            
            =
            RxB_N
          
        
      
    
    .