<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Penrose Wang on Medium]]></title>
        <description><![CDATA[Stories by Penrose Wang on Medium]]></description>
        <link>https://medium.com/@penrosewang?source=rss-dacbcc3b0b1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*EJMgAOnQAN4VFaUd</url>
            <title>Stories by Penrose Wang on Medium</title>
            <link>https://medium.com/@penrosewang?source=rss-dacbcc3b0b1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 17:39:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@penrosewang/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Introduction to GNSS III: GNSS Algorithms and Development]]></title>
            <link>https://medium.com/@penrosewang/introduction-to-gnss-iii-gnss-algorithms-and-development-e5bff4d53eec?source=rss-dacbcc3b0b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5bff4d53eec</guid>
            <category><![CDATA[beidou]]></category>
            <category><![CDATA[gps]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[gnss]]></category>
            <category><![CDATA[navigation]]></category>
            <dc:creator><![CDATA[Penrose Wang]]></dc:creator>
            <pubDate>Sat, 17 Oct 2020 20:05:06 GMT</pubDate>
            <atom:updated>2020-10-17T20:05:06.536Z</atom:updated>
            <content:encoded><![CDATA[<p>This is the third and final story for the GNSS introduction series. The <a href="https://medium.com/@penrosewang/introduction-to-gnss-some-basics-2dc8cb716589">first story</a> introduces some basic principles of GPS positioning, and the <a href="https://medium.com/@penrosewang/introduction-to-gnss-ii-gps-signal-processing-dd9eae0bdade">second one</a> introduces GPS signal processing. In this story, we will focus on some important GNSS algorithms and some introductions to the Beidou system.</p><p>Similar to before, let’s start with an interesting story.</p><h3>Start with a Story</h3><h4>The secret behind Scallops’ “Great Escapes” in Zhangzi (Roe) Island</h4><p>Located in Changehai County, nestled in the Yellow Sea just off the Northeast coast of China, there lies a tiny island called Zhangzi (meaning roe deer in English). This island is ominated by the Zhangzidao Group which manages over 70,000 hectares of the Yellow Sea and provides a full-service operation of shellfish. However, it got public attention over the years because of blatantly staged “scallops escape”, “scallops starved”, “scallop seedings degradation”, and other absurd drama related to performance and financial fraud.</p><p>The market has questioned its financial data since 2014. Below is a summary of reply letters from Zhangzidao Group to Shenzhen Stock Exchange explaining the massive loss of scallops.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/23ec3f4f5adf2267b184e0b99905d15c/href">https://medium.com/media/23ec3f4f5adf2267b184e0b99905d15c/href</a></iframe><p>Zhangzi Island has been claimed by uncontrollable natural risks that hurt the net profit, explaining the serious distortion of the financial report. However, the seabed inventory and the mining situation cannot be easily verified.</p><p>The China Securities Regulatory Commission (CSRC) launched a case against Zhangzidao Group after a number of scallops “great escape” incidents. In the course of the investigation, the CSRC solved the problem of no daily record of the capture areas from Zhangzidao Group’s side with the help of satellite positioning data. The CSRC restored navigation trajectories of 27 fishing vessels in the last two years and found out that the actual fishing area was strongly inconsistent with the fishing plan announced by Zhangzidao Group Finance in 2017. The truth finally got exposed.</p><p>To ensure the fishing vessels can avoid each other under severe weather conditions, their positions and status are monitored and recorded by the mounted satellite navigation terminals which support Beidou Navigation Satellite System. Beidou system is independently built and able to provide civil positioning data within 10 meters of accuracy. It is the most accurate data that can be accessed under that condition to restore the operating status of fishing vessels.</p><p>Beidou Navigation Satellite System has been developed for 20 years since the first Beidou-I satellite was launched in 2000. So, what is the development of Beidou from generation I to III? Is Beidou superior or inferior to GPS? Are we currently using Beidou in GNSS receivers (such as cellphones)? And since the Beidou satellite network has been completed, is there any remaining work to be done?</p><p>Before answering the questions, let’s go through some takeaways from previous articles and learn a few important GNSS algorithms. For those without much patience, please directly go to the last segment —<em> Beidou Overview and Development</em>.</p><h3>Previous Takeaways</h3><h4>Takeaways from Article I</h4><ul><li>The principle idea behind GPS localization is simple — trilateration.</li><li>As GNSS receiver’s clock error and 3D positions are unknown, a minimum of four satellites is needed to determine user’s location.</li><li>Pseudorange, calculated based on time delay, is the distance from the satellite to user including clock offset and observation errors.</li><li>Some major observations errors include atmospheric error, multipath, and random error.</li></ul><h4>Takeaways from Article II</h4><ul><li>GPS signal consists of the carrier wave, pseudorandom noise (PRN) code, and navigation message.</li><li>A GNSS receiver (referred to as user afterward) will generate a local signal matching with the received signal by signal acquisition and tracking.</li><li>During signal tracking, user will obtain the value of the carrier phase, doppler drift, and code phase throughout the time.</li></ul><h4>Pseudorange Equation:</h4><p><em>R</em> = <em>c</em>[<em>T₂</em> - <em>T₁</em>]<br> =<em>c</em>[(<em>tᵣ </em>+ <em>dtᵣ</em>) - (<em>tˢ </em>+ <em>dtˢ</em>)]<br> =<em>c</em>(<em>tᵣ </em>- <em>tˢ</em>) + <em>c</em>(<em>dtᵣ</em> - <em>dtˢ</em>)<br> =<em>ρᵣˢ</em> + <em>c</em>(<em>dtᵣ</em> - <em>dtˢ</em>) + <em>ε</em></p><p>where</p><ul><li><em>T₂</em>, <em>tᵣ</em>, <em>dtᵣ</em> stand for signal reception time, user’s true time and user clock bias,</li><li><em>T₁</em>, <em>tˢ</em>, <em>dtˢ</em> stand for transmission time, satellite’s true time and clock bias,<br> <em>ρᵣˢ </em>stands for distance between satellite and user,</li><li><em>c</em>(<em>dtᵣ</em> - <em>dtˢ</em>) stands for user’s clock offset w.r.t. satellite (measured in distance), and</li><li><em>ε</em> stands for observation errors (e.g., multipath, atmospheric delay, and random error).</li></ul><h4>Position, Velocity, and Time (PVT) and GNSS Observations</h4><p>Previously we introduced how to use pseudorange observations to calculate position by trilateration (<a href="https://medium.com/@penrosewang/introduction-to-gnss-some-basics-2dc8cb716589">story I</a>) and decode navigation message from GPS signal (<a href="https://medium.com/@penrosewang/introduction-to-gnss-ii-gps-signal-processing-dd9eae0bdade">story II</a>). The only missing part is how to obtain pseudorange observation given navigation message and GPS signal, i.e., how to obtain <em>T₂</em> and <em>T₁</em> for calculating pseudorange?</p><p>Signal reception time <em>T₂</em> is read from user’s clock and will not be introduced in this article. Signal transmission time <em>T₁</em> is obtained through GPS navigation message, which will be our main focus. We will take GPS L1 C/A signal as an example.</p><h4>Navigation Message and GPS Time</h4><p>GPS L1 C/A navigation messages are sent by frames. Each frame contains 5 subframes, lasting for 30 seconds, and each subframe contains 300 bits, lasting for 6 seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2cPD5EuQ9DnYChz_OTiDrw.png" /><figcaption>GPS navigation message is segmented by frames, and each frame contains 5 subframes.</figcaption></figure><p>GPS uses another time system called GPS time instead of UTC (Y:M:D:h:m:s). It’s consisted of two parts:</p><ul><li>GPS week number: number of weeks passed since Jan. 5, 1980, its value ranges from 0 to 1023.</li><li>Time of week (TOW): how many seconds passed since the beginning of the week, its value ranges from 0 to 604799.</li></ul><p>Notice that GPS week number would overflow if above 1023. (Yes, it’s coded as 10 bits in GPS navigation message.) And time of week can be directly calculated by the subframe count passed in each week. Thus, GPS time obtained from navigation message is only accurate to the level of 6 seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZWHBiNHbJArHcpqxRvSo3g.png" /><figcaption>Subframe count minus one and multiplied by 6 is the time of week.</figcaption></figure><p>Of course, this is far from useful. The accuracy for reception time needs to be better than 1 us, since an error of 1 us leads to 300 m error in pseudorange observation after multiplied by the speed of light.</p><h4>Synchronization</h4><p>After signal tracking and decoding, user can know when each bit, subframe, and frame start and end in the received signal using prior knowledge, this process is called synchronization.</p><p>After synchronization, the user would know how many bits have been transmitted in the subframe at the current time. One bit lasts for 20 ms, thus using this info, user could measure transmission time to an accuracy of milliseconds, but still not good enough.</p><p>Notice that one bit contains 20 C/A codes, and each C/A code has 1023 chips, so the duration of one C/A code chip is about 1 us. It’s intuitive to use this information to fine-tune signal transmission time.</p><p>During signal tracking, the user knows the code phase of the receiving signal at any time, accurate to a decimal place of code chips. So, the problem solved.</p><h4>Ranging Code</h4><p>In this way, suppose at signal reception time <em>T₁</em>, the subframe count is <em>n</em>, the bit count is <em>b</em>, and <em>c</em> C/A code period has passed inside the bit, and the current code phase is <em>CP</em>, the signal transmission time is</p><p><em>T₂</em> = 6<em>n</em> + 0.02<em>b</em> + 0.001 × (<em>c</em> + <em>CP</em>/1023) (sec),</p><p>where <em>n</em>, <em>b</em>, <em>c</em> are integers, and <em>CP</em> is accurate to the decimal place.</p><p>PRN code phase is being used for measuring signal transmission time and derives pseudorange observation, thus both C/A code and P code are also called <strong>ranging code</strong>.</p><p>Notice that P code chip frequency is 10 times of C/A code, which means one P code phase represents one-tenth of the C/A code phase. Thus, signal transmission time calculated from P code will be 10 times more accurate than C/A code. That is why P code signal leads to better positioning service and is used by the military.</p><h4>Position, Velocity, and Time (PVT)</h4><p>With pseudorange observations, user can solve position and clock offset through least square estimation. Hence, we know the “P” and “T” in PVT.</p><p>However, Pseudorange observation contains no information about the movement of the user, thus other observations need to be introduced for obtaining the user’s velocity.</p><p>Let’s recall the Doppler effect. If an observer is moving relative to the wave source, the observed frequency of the wave will be different from when it was transmitted from the source, the difference is called the Doppler shift. The <strong>Doppler observation</strong> of each satellite can be obtained from the tracking loop, and the value is usually equal to the Doppler shift.</p><p>According to the Doppler effect:</p><p><em>s</em> = <em>λ</em>Δ<em>f</em>,</p><p>where <em>λ</em> is the wavelength of the transmitting signal (GPS signal frequency), Δ<em>f</em> is the Doppler shift, <em>s</em> is the radial speed of the source (GPS satellite) and receiver (the user), calculated by</p><p><em>s </em>= <em>e</em>(<em>vˢ </em>- <em>vᵣ</em>),</p><p>where <em>vˢ</em> is the speed of the satellite and <em>vᵣ</em> speed of the user, <em>e</em> is the unit vector representing the direction of the satellite and user.</p><p>Similar to pseudorange observation, we have three unknown variables of user’s velocity <em>vᵣ </em>(in ℝ³), and one other unknown of user’s clock drift (derivative of clock offset). So a minimum of four Doppler shift observations is needed.</p><h4>GNSS Basic Observations</h4><p>With pseudorange and Doppler observations, the user is able to have a PVT solution. However, there is another type of GNSS observation called<strong> carrier phase</strong>.</p><p>Like Pseudorange, which is calculated using the phase of ranging coded, the carrier phase is the distance calculated based on the time delay obtained from the phase of carrier wave. Signal tracking loop will keep counting how many periods have passed since the time it locks the carrier wave phase.</p><p>Compared with ranging code, the carrier wave has a much higher frequency. Using the same logic that P code leads to better accuracy than C/A code, carrier phase will lead to much better accuracy when measuring signal reception time. Under some circumstances, the positioning error using carrier phase observations could be within one wavelength, which is about 20 cm.</p><h3>Differential GPS and Assisted-GPS</h3><h4>Selective Availability</h4><p>During the 1990s, GPS quality was degraded by the United States government in a program called “Selective Availability” (SA), so the positioning accuracy of unauthorized uses can only achieve around 100 meters.</p><p>Selective availability will introduce an unknown bias to each satellite’s clock, so the signal transmitting time will be slightly different compared with true time. Thus, all pseudorange observations will be biased and the calculated position will be wrong.</p><p>When enabling SA, the pseudorange can be written as</p><p><em>Rₓ</em>=<em>ρᵣˢ </em>+ <em>c</em>(<em>dtᵣ </em>- <em>dtˢ</em>) + <em>εᵣˢ</em> + <em>eₓˢ</em></p><p>where <em>eₓˢ</em> is the error introduced by SA for each satellite. So, there will always be more unknowns than observations. With <em>n</em> satellites, the unknowns will be <em>n </em>+ 4, consisting of <em>n</em> SA error and user’s 3D position and clock offset. Obviously, it’s unsolvable.</p><p>Is there any way to eliminate the SA errors? Notice that the satellite is transmitting its signal to all users, so the SA errors are the same for each user in a given area. Based on this idea, differential GPS came out.</p><h4>Differential GPS (DGPS)</h4><p>Suppose there is a GPS base station (represented as <em>o</em>) whose position is already known, then its pseudorange observation <em>Rₒˢ</em> can be written as</p><p><em>Rₒˢ</em> = <em>ρₒˢ</em> + <em>c</em>(<em>dtₒ</em> - <em>dtˢ</em>) + <em>εₒˢ</em> + <em>eₓˢ,</em></p><p>where <em>ρₒˢ</em> is the physical distance between satellite and base station, <em>dtₒ</em> - <em>dtˢ</em> is the clock offset, <em>εₒˢ </em>is measurement error including random error, atmospheric error, and multipath of base station, and <em>eₓˢ</em> is SA error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*nQEhRtYfAmZoH8Y5SLFdiQ.png" /><figcaption>Diagram for differential GPS</figcaption></figure><p>Compare with the user’s pseudorange observation.<br> <em>Rᵣˢ </em>= <em>ρᵣˢ </em>+ <em>c</em>(<em>dtᵣ </em>- <em>dtˢ</em>) + <em>εᵣˢ </em>+ <em>eₓˢ</em><br>Notice that SA error <em>eₓˢ</em> is the same in the two equations.</p><p>Make a difference between the two equations we have</p><p><em>Rₒˢ </em>-<em> Rᵣˢ </em>=<em> </em>(<em>ρₒˢ </em>-<em> ρᵣˢ </em>) +<em> c</em>(<em>dtₒ </em>-<em> dtᵣ</em>)<em> + εₒˢ </em>-<em> εᵣˢ.</em></p><p>SA errors will be eliminated and, same as before, there are four unknowns and equations are solvable.</p><ul><li><em>ρₒˢ</em> - <em>ρᵣˢ</em> contains three unknowns which are the user’s 3D position (positions of the satellite and base station are known).</li><li><em>dtₒ</em> - <em>dtᵣ</em> can be treated as one unknown as it’s the same for all satellites.</li></ul><p>This is how Differential GPS (DGPS) overcomes SA by using differenced pseudorange observation for solving the user’s position.</p><p>DGPS also helps to eliminate atmospheric error, which could be a major contribution to pseudorange error. When the base station is nearby (less than 200 km with user), the atmospheric error can be regarded as the same and will cancel out in term <em>εₒˢ </em>-<em> εᵣˢ</em>.</p><p><strong>The accuracy of the standard GPS solution is about 10 meters, and with DGPS the accuracy is around 1 meter.</strong></p><p>The distance between the base station and the user matters. If the base station is too far away, the atmosphere environment may be different, so atmospheric error won’t be eliminated.</p><p>If the base station is near enough (less than 20 km with the user), using carrier phase observations can provide up to centimeter-level accuracy. This procedure is called real-time-kinematic (RTK).</p><p>One imperfection of DGPS is that the fixed base station cannot be deployed on the sea or in the sky, so the base station network is called ground-based augmentation system. There exist other systems such as satellite-based augmentation system (SBAS) to apply an atmospheric correction for aerial and maritime users.</p><h4>Assisted GPS (A-GPS)</h4><p>Assisted GPS is extensively used with GPS-capable cellular phones, which is a system that significantly reduces the startup time. Startup time is defined as the time required for a user to acquire satellite signals and calculate the first position solution.</p><p>As introduced in the previous article, signal acquisition is time-consuming. Almanac and ephemeris data in navigation messages will speed up the process by reducing the acquisition search space.</p><p>Almanac contains inaccurate position overtime for all satellites. It is transmitted repeatedly for over 12.5 minutes. All satellites will broadcast the same almanac data which is considered valid for up to 180 days for the GPS system.</p><p>Ephemeris contains the satellite’s detailed orbital information. Each satellite broadcasts its ephemeris data every 30 seconds and is valid for up to 4 hours for GPS.</p><p>If the user doesn’t have almanac or ephemeris data, typically it will wait to collect the data before giving any position solution. This period of time is the main contribution of startup time.</p><p>Based on the situation whether the user has almanac or ephemeris when it starts, the startup mode can be classified as three types:<br>• Cold (no almanac or ephemeris): startup time around 15 minutes<br>• Warm (with almanac, no ephemeris): startup time around 45 seconds<br>• Hot (with almanac and ephemeris): startup time less than 10 seconds</p><p>Assisted GPS improves the startup performance by sending almanac and ephemeris data to the user through cellular data, so the user would always have a hot start without receiving the data from GPS navigation messages. That’s why one will get an accurate position through the mobile right away when opening navigation apps.</p><h3>Beidou Overview and Development</h3><h4>Generations of Beidou</h4><p>Beidou-1 consisted of only four satellites and ceases to work after 2012. It’s an experimental regional navigation system that only covered a limited area around the greater China.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*3mPf8YA1LIFsZlZXFNkjEg.png" /><figcaption>Coverage of Beidou-I</figcaption></figure><p>Beidou-I used active (meaning users will transmit signals) positioning which is different from the method introduced in the articles. In active positioning, the user needs bidirectional communication with satellites for positioning service. This method has some drawbacks:</p><ul><li>Limited users (since the system needs to assign limited IDs to users to recognize them);</li><li>Low accuracy (about 100 m) and low solution frequency (takes about 1 s to get a solution);</li><li>The receiver is bulky and easily exposed (since users need to transmit high power signals to communicate with satellites);</li><li>It had no ability for measuring velocity.</li></ul><p>Beidou-II &amp; III use passive (meaning users only receive signals) positioning and work similarly to GPS. Beidou-II provides a regional navigation service for Asia-Pacific users and consists of 16 satellites. Beidou-III provides global service and consists of 35 satellites.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*n5afk6jLbXzwuM1s1I5Qng.png" /><figcaption>Coverage of Beidou-II</figcaption></figure><h4>Beidou &amp; GPS Comparison</h4><p>Compared with GPS, Beidou has some unique features:</p><ul><li>Beidou-II &amp; III has SMS capability, which could help in emergency situations where cellular data is unavailable.</li><li>Beidou-III is currently the only GNSS with inter-satellite link ability, which helps improve accuracy and eliminate the need for global ground control segments.</li></ul><p>Another advantage of Beidou is that it has more satellites in total and will have more visible satellites especially in the Asia-Pacific area, which would lead to better accuracy.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e2511801a101b848e02a2a4f20017d1/href">https://medium.com/media/1e2511801a101b848e02a2a4f20017d1/href</a></iframe><p>The accuracy and stability of the atom clock are essential to the accuracy of pseudorange observation, and thus are two of the deciding factors of positioning accuracy.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/91340fe5935f0a9ed13171ec09826a4e/href">https://medium.com/media/91340fe5935f0a9ed13171ec09826a4e/href</a></iframe><h4>Beidou Status and Future</h4><p>More than 70 % of smartphones in China already support BeiDou navigation service.</p><ul><li>Apple iPhone 12</li><li>Huawei P40, Mate 30</li><li>One plus 8</li><li>Xiaomi Mi 10, Redmi Note 9</li><li>Google Pixel 5</li><li>Samsung Galaxy S20, M51 …</li></ul><p>Currently, in civil GNSS receiver, GPS and Beidou are not competitors, but cooperators to some extent. Most chips support multiple GNSS such as GPS, Beidou, GLONASS, Galileo, and even QZSS, in order to have more GNSS observations to achieve better accuracy.</p><p>Continuous development of ground-based augmentation systems such as QianXun has substantially enhanced Beidou service accuracy and reliability.</p><p>Next-generation of Beidou is on the way! Based on Beidou-III, Beidou-IV aims to further improve PVT, SBAS, SMS, international rescue, PPP, and ISL before 2035.</p><h3>Takeaways and Concluding Remarks</h3><ul><li>GNSS has PVT ability, solving users’ position, velocity, and time.</li><li>Basic GNSS observations include pseudorange, Doppler, and carrier phase.</li><li>A ground-based augmentation system uses differential GPS technique to enhance positioning performance and may lead to cm accuracy.</li><li>Assisted GPS is commonly used in mobiles to reduce GNSS startup time.</li></ul><p>The three stories cover some important basics of the GNSS system, including trilateration, GPS signal processing, and common GNSS algorithms. The intention of the series is not only for popular science (have to admit it’s difficult to understand without knowledge of digital signal processing) but also a sum up of what I learned during study and work.</p><p>Hope all readers could benefit from the series and have their own takeaways. And congratulate again on the completion of Beidou-III constellation deployment!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5bff4d53eec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to GNSS II: GPS Signal Processing]]></title>
            <link>https://medium.com/voice-tech-podcast/introduction-to-gnss-ii-gps-signal-processing-dd9eae0bdade?source=rss-dacbcc3b0b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd9eae0bdade</guid>
            <category><![CDATA[signal-processing]]></category>
            <category><![CDATA[gps]]></category>
            <category><![CDATA[gnss]]></category>
            <category><![CDATA[gps-tracking-system]]></category>
            <dc:creator><![CDATA[Penrose Wang]]></dc:creator>
            <pubDate>Thu, 10 Sep 2020 07:05:33 GMT</pubDate>
            <atom:updated>2020-09-10T07:05:33.732Z</atom:updated>
            <content:encoded><![CDATA[<p>This is my second story for GNSS introduction.</p><p>My <a href="https://medium.com/@penrosewang/introduction-to-gnss-some-basics-2dc8cb716589">first story</a> introduced some basic principles of GPS positioning, today I will focus on GPS signal structure and introduce how to extract the information needed for positioning from GPS signal.</p><h3><strong>Start with Sides</strong></h3><p>Before serving the main dish, let’s first see how GPS became a game-changer in the Gulf War, which is believed to be the first high-tech war in history. Before the Gulf War, fixed landmarks are used as references for localization and navigation. Under bad weather conditions (e.g., nighttime or fog) or difficult terrain conditions (e.g., desert), landmarks will have great uncertainty, making it hard to locate position accurately.</p><p>The existence of GPS allowed the alliance to know their accurate positions, and also enabled precision strike to hit Iraqi’s military facilities, oilfield, and communication network, ending the war in just six weeks. The victory of the Gulf War does not only belong to the alliance, we should also give credit to GPS.</p><p>Let’s look at another old news. In 2007, a Chinese Ph.D. candidate Xingxin Gao (now a professor at Stanford) submitted a paper and got scolded by Chinese media and treated as a traitor afterwards. In that paper, she decoded Beidou’s civil signal before it has been released by the Chinese government four years later. So, can Beidou’s military signal be hacked using the technique in the paper? And is she really a traitor, as said by some mainstream?</p><p>Before answering the questions, let’s go through some background of signal processing, and then introduce GPS signal structure to understand the civil and military signal. In the end, some interesting animations will show how to extract information for satellite signals.</p><h3><strong>Signal Processing</strong></h3><p>Signal is a function that conveys information about some measurements. In electronics, it refers to any time-varying electromagnetic wave that carries information. Signal needs to be processed so that the carried information can be extracted and used.</p><h4>Characteristics of Signals</h4><p>The three main features of signals are:</p><ul><li>Amplitude (<em>A</em>) ⇒ the peak of the signal from the center line</li><li>Frequency (<em>f</em>) ⇒ how often signal sequences repeats across time</li><li>Phase (<em>ϕ</em>) ⇒ how many degrees the signal shifts from the original point</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CX45PxRIy1grKTi8uwRTJw.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oeCX3q2G8hodbU-odND9mg.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vEYMAcmJULZZgTSJp19GjQ.gif" /><figcaption>From left to right: signal with different amplitudes, frequencies, and phases.</figcaption></figure><h4>Signal Modulation</h4><p>Modulation is the process of imposing data signal onto a carrier wave. A Carrier wave is usually a sine wave with higher frequency. It contains no information but helps the data to be correctly extracted by the user with the existence of environmental noises.</p><p>Three commonly used modulation schemes are Amplitude Shift Keying (ASK), Frequency Shift Keying (FSK), and Phase Shift Keying (PSK).</p><p>In ASK, the amplitude of the signals is modulated to represent the signal levels (0 and 1), while frequency and phase remain untouched. Similarly, FSK modulates data signal on the carrier wave’s frequency, and PSK on the phase.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*k0dU_CPnYBqJstqa1X7Cyg.png" /><figcaption>From top to bottom: ASK, FSK, and PSK.</figcaption></figure><p>For the above-mentioned modulation schemes, only one user is allowed for one segment of frequency (frequency band), or the other way around, one frequency band is allocated to one user, which is a waste on the limited band resources.</p><h4>Code-Division Multiple Access (CDMA)</h4><p>CDMA is a technique for allowing multiple users on one frequency band at the same time. Each user is assigned a pseudorandom noise (PRN) code (this will be introduced later), just like the bar codes assigned for different products in shopping malls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UDrFjc6YAj2OunEDQnLnGw.png" /><figcaption>Diagram for CDMA modulation. The transmitted signal is the XOR of the data signal and PRN code.</figcaption></figure><h4>Correlation</h4><p>Correlation measures how two signals match with each other. If two signals are highly matched, then their correlation will be high. If they differ in shape, phase, or frequency, then the correlation would be low.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NVc6XyvdIRGVTjUmBTzohQ.gif" /><figcaption>First correlation example. Signal 1 is random noise. Signal 2 is the same noise but with different phases (phase increases when signal moving rightward). The red dot is the correlation of two signals at the current time. A peak happens only when two signal matches in phase.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GSnMTT59oGXb18OTRI6p2A.gif" /><figcaption>Second correlation example. Correlation of sine waves is still a sine wave. There are multiple peaks as long as the phase matches (when signal 2 turns red).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*eV_-Xd8e_OChyasBvuUVkg.png" /><figcaption>Third correlation example. The more signal frequencies differ, the less their correlation amplitude will be.</figcaption></figure><h4>Demodulation</h4><p>The inverse process of signal modulation is demodulation, which extracts data information from the received signals.</p><p>For the CDMA system, the separation between the data for the desired user and data for others is important because all uses share a same frequency band. PRN code functions as a key for communication with the received signal and the user.</p><ul><li>Different users have different keys (PRN codes).</li><li>One door (data modulated for one user) can be only opened by one key.</li><li>Inserting the key into the door is done by correlation.</li></ul><p>The user will generate PRN code locally to correlate with the received signal. If the signal matches the local PRN code in phase, a correlation peak occurs. Sign of the correlation peak indicates if the datum modulated is 1 (positive correlation peak) or -1 (negative correlation peak).</p><h3><strong>GPS Signal Structure</strong></h3><p>GPS uses CDMA and PSK for signal modulation; thus, it’s composed of three parts: carrier wave, pseudorandom code, and data (navigation message). Pseudorandom code and data are modulated through PSK onto carrier wave, which is in the form of a sine wave. Then satellites will transmit the GPS signal out into space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EZViVpiuKwNYRoYlUuPraA.png" /><figcaption>GPS signal structure. From top to bottom, carrier wave, navigation message, PRN code, and GPS signal (XOR of the above three signals).</figcaption></figure><h4>Carrier wave</h4><p>Legacy GPS signal operates on two frequency bands, L1 band (1575.42 MHz) and L2 band (1227.6 MHz). This means there are two carriers wave used to modulate data. Such high frequencies ensure the propagation of signal would not be influenced by all weather conditions and can penetrate through clouds and other obstacles.</p><p>GPS satellites have a speed of 3.9km/s, thus due to the <em>Doppler effect</em>, the frequency of the received signal may not be the original L1 or L2 frequency. The frequency difference is then called the <em>Doppler shift</em>. Typically, the Doppler shift is within ±10kHz.</p><h4>PRN code</h4><p>PRN codes are the signatures of the GPS signals because two different PRN codes have no correlation, which helps users to distinguish GPS signals from different satellites. The minimum pulse of PRN code is commonly referred to as a <em>chip</em> (shown in GPS signal structure figure), which is used to measure the length of the PRN code. The reciprocal of the period of a chip is called chip frequency.</p><p>Two kinds of PRN codes are modulated on the GPS signals. One is called Coarse/Acquisition (C/A) code, which is public for civil use, and the other one is called Precision (P) code, which is encrypted for authorized users only such as the military.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a16c84262d57f9a03e33222e0a77fc4c/href">https://medium.com/media/a16c84262d57f9a03e33222e0a77fc4c/href</a></iframe><p>Higher code frequency leads to better precision, that’s why C/A code is called <strong>Coarse</strong>/ Acquisition code and P code <strong>Precision</strong> code.</p><p>It’s not hard to decode C/A code. After receiving the whole GPS signal lasting for 50 code periods (50 ms), the C/A code sequence can be derived using Xingxin Gao’s method. This is because in 50 ms, C/A code will repeat 50 times, and then we can use its correlation characteristics to decode the sequence.</p><p>However, it’s <strong>impossible</strong> to use the same method to hack P code. Since the period of P code lasts for 1 week, then one needs to collect the signal consistently for 50 weeks (notice that one year has about 52 weeks)! Even if assuming that P code sequence would not change during the whole time, it requires a space of at least 93877 TB to store the 50 weeks’ data, not to mention the post-processing needed afterwards.</p><h4>PRN Code Correlation</h4><p>The randomness of the PRN code can be shown by correlation. A correlation peak only happens once when the PRN code correlates with itself of zero phase difference. Random signals have the same property. But actually, PRN code is not random because the code sequence is fixed, thus it’s called <strong>pseudorandom</strong> code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*x-IzHKc3kKunOe9Sou4D1A.gif" /><figcaption>Correlation of satellite №1’s C/A code (PRN1) with a phase delayed version of itself. The blue dot marks the first chip of the PRN code, and the red dot is the correlation result at the current time. The correlation time series is similar to the first correlation example of random noise.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Pa_IigL9iH7A5sqa6gUB7A.gif" /><figcaption>The correlation of two different PRN codes doesn’t have a peak. In this way, user can’t use PRN2 to demodulate data on PRN1 because the correlation is always around 0. This makes it possible to separate the data modulated on one satellite with the other.</figcaption></figure><h4>Navigation message</h4><p>The navigation message is the data modulated on carrier waves and PRN code. The minimum pulse of the data signal is referred to as a <em>bit</em> (shown in the GPS signal structure figure), which is the smallest measurement of transmitted data. The navigation message is broadcasted by each satellite at 50 bits per second and provides essential information for positioning solutions.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c28e0ef8a1bb1e6f11246f7d335fcf50/href">https://medium.com/media/c28e0ef8a1bb1e6f11246f7d335fcf50/href</a></iframe><h3><strong>GPS Data Demodulation</strong></h3><p>Data demodulation is the process to extract navigation messages from the modulated GPS signal. As introduced before, it’s achieved by performing correlation of received signal and a copy of local signal generated by the user. The copied signal is composed of carrier wave and PRN code, without navigation message (the user doesn’t know anyway).</p><p>In order to have a correlation peak, receive and copied signals should have the same:</p><ul><li>Carrier wave frequency,</li><li>Carrier wave phase,</li><li>PRN code sequence, and</li><li>PRN code phase.</li></ul><p>This process is implemented by <strong>signal acquisition</strong> and <strong>tracking</strong>.</p><p>For different satellite signals, these attributes differ, because satellites have different distances and relative speeds w.r.t. user. Different distances lead to different signal time delays, thus different phases for carrier wave and PRN code. Different relative speeds lead to different <em>Doppler</em> shifts of the carrier frequency.</p><p>Thus, we need to acquire and track each satellite signal separately.</p><h4>Signal Acquisition</h4><p>The user knows the PRN code sequence for each satellite but doesn’t know which satellites are visible. If the received signal doesn’t have the transmitted signal of a certain satellite, then it indicates the satellite is not visible. The process to determine visible satellites is called signal acquisition.</p><p>Signal acquisition can be implemented by detecting the correlation peak of the received signal and copied signal. Before acquisition, carrier wave frequency and code phase are unknown, so the user will traverse different combinations of Doppler shifts and code phases to generate a copied signal to correlate with the received signal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vttOE5Rt8Few6OOhevhoNg.png" /><figcaption>Diagram of signal acquisition for one satellite. The horizontal axis searches all the possibilities of the C/A code phase, each bin representing one chip. The vertical axis searches the possibilities of the Doppler shift, each bin representing 500 Hz. A correlation peak is expected at the bin where the signal (circle at the upper right) locates.</figcaption></figure><p>In this way, signal acquisition is a 3D search in the following dimensions:</p><ul><li>satellite dimension (equal to total number of GPS satellites, 31)</li><li>Doppler dimension (equal to 41, if bin size = 500 𝐻𝑧 within ± 10 𝑘𝐻𝑧 range)</li><li>code phase dimension (equal to PRN code length if bin size = 1 chip)</li></ul><p>The total search space is 31 × 41 × 1023 (HUGE!) for C/A signal acquisition. For P code signal, it’s even worse given that the P code phase dimension is 6.18 × 10¹²!!</p><h4>Speedup Using Priors</h4><p>It would be very slow if searching for every possibility. If using some priors to reduce search space, signal acquisition can speed up a lot.</p><p>With almanac data including estimated satellite position, the user knows all visible satellites given the user’s rough location, reducing one dimension for satellite search. With ephemeris data, the user could estimate the Doppler shift and code phase in a narrower interval, greatly reducing the remaining 2D search space.</p><p>After using C/A signal to decode GPS information and obtain current time, the user can reduce P code phase to a few possibilities. C/A code acquisition serves as a pre-step for P code acquisition, which is why C/A code is called <strong>coarse</strong> acquisition code.</p><h4>Signal Tracking</h4><p>Doppler shift and code phase obtained in signal acquisition are only rough estimations down to the level of 500 Hz or 1 chip. Signal tracking can fine-tune the estimation to an accurate level and obtain the carrier phase accurately at the same time.</p><p>It’s called tracking because, in this step, the user will dynamically adjust the estimations which may change slowly across time.</p><p>Different modules are used to track different attributes:</p><ul><li>Frequency-locked loop (FLL) ⇒ tracking carrier frequency</li><li>Phase-locked loop (PLL) ⇒ tracking carrier phase</li><li>Delay lock loop (DLL) ⇒ tracking code phase</li></ul><p>All these lock loops are electronic control systems based on negative feedback.</p><h4>Positive / Negative Feedback System</h4><p>Feedback occurs when outputs of a system are routed back as inputs, forming a circuit or loop.</p><p>There are two types of feedback: positive feedback, and negative feedback. For a positive feedback system, its output is used to increase the input. For a negative feedback system, its output is used to decrease the input.</p><p>An example of feedback can be adjusting water temperature when bathing. If water temperature (output) is too high, then you rotate the faucet to the cold direction (negatively adjusting input), thus the water is cooler, and at the end achieving a suitable temperature at the end. No one would rotate the faucet to hot direction if feeling too hot (positively adjusting input) unless wanting to be scalded.</p><p>We can see that a positive feedback system will make things worse as it will exaggerate the difference of the system’s input and output, but a negative feedback system will negatively adjust the difference to keep it stabilized. That’s why the lock loops used in GPS signal tracking are all negative feedback systems, also known as negative feedback loops.</p><h4>Negative Feedback Loop</h4><p>A diagram of the negative feedback loop is depicted below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E-gR_CCX75kE1B65iylXEw.png" /></figure><p>It’s composed of three modules:</p><ul><li>Discriminator will calculate the discrepancy between input VI and output VO.</li><li>Loop filter will calculate output based on the history of discrimination results. Filter output is the negative of the generator’s input, hence “negative” feedback.</li><li>Generator will generate a new output signal based on its input.</li></ul><p>Lock loops (FLL, PLL, DLL) used in signal tracking share a similar structure of negative feedback loop. The main difference is how each module works.</p><h4>FLL and PLL</h4><p>FLL and PLL are used to track carrier wave frequency and phase respectively, thus the generator will generate a sine wave. For FLL, the discriminator will calculate the frequency difference to the received signal and user’s copied signal. Similarly, PLL will discriminate phase difference of the two signals.</p><p>Here is an animation showing how FLL works. Suppose after signal acquisition, the rough estimation of the Doppler shift has an error of 100 Hz compared with the true value. The phase difference is unknown and assumed to be 17.2 degrees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*58xNp_v0WMmC-6g5RaDJMA.gif" /><figcaption>The upper plot shows the received (recv) signal and copied (copy) GPS signal, and the lower plot shows the loop filter output. As we can see the frequency difference quickly drop to 0, but phase difference remains the same. After a while in the zoomed-in plot of filter output, we can see that it is slightly oscillating around the center repeatedly, achieving dynamic stability.</figcaption></figure><p>Here is an animation showing how PLL works under the same setting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6c3FWTmmDoxBwI75JonX3A.gif" /><figcaption>As we can see phase difference drops but not down to zero. And the output is not around the center of the plot (0 value), indicating constant bias. This is due to a frequency difference of 100 Hz, which makes PLL discriminator functions ill.</figcaption></figure><p>Another animation showing how to use FLL and PLL to overcome the situation occurred in the above two animations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HCvaxWrf6WHJ_Mxlsf_xNA.gif" /><figcaption>A simple solution is to use FLL first, and then switch to PLL after FLL tracks the signal for a while to have zero frequency difference. Notice that the received signal will flip for some time, this is because the navigation data will be modulated on the signal, and tracking loops are supposed to overcome this situation.</figcaption></figure><h4>DLL</h4><p>DLL is used to track code phase of the PRN signal, so it generates a code signal and discriminates code phase difference. DLL generates another two copies of early and late code signal using for discriminator, and the purpose is to make sure the present signal locates at the peak of the correlation results when stabilized, shown in the animation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bjbwuLiCwopVollcq3zmjA.gif" /></figure><h4>Demodulation after Tracking</h4><p>PLL and DLL make sure the copied signal has the maximum correlation with the received signal. Data demodulation is then indicated by correlation result. If the correlation is above 0, the data modulated on the signal is +1, otherwise it’s -1.</p><p>The previous animations are showing an ideal case, using single satellite signal without any noise. However, in reality, the received signal is a combination of signals transmitted by several satellites and environmental noise.</p><p>The animation shows an example of a received signal and how data is being demodulated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ztBg1THSd4j5wTLZLizOvQ.gif" /><figcaption>The last two plots show the results of data demodulation for satellite ID 1 and 2. Channel I and Q are the correlation results for two copied signals generated by the user. Channel I is used as an indicator of the sign of data, and Q is basically channel noise. After loop filter status changed to PLL, the data bit can be reflected by channel I output.</figcaption></figure><p>Obtaining the above result is only the first step for data demodulation, and there remains a lot of work to be done if the user wants to extract navigation messages from the GPS signal correctly and stably. However, it is beyond the interest of this story and thus will not be introduced here.</p><h4>Some Takeaways</h4><ul><li>GPS signal is a combination of carrier wave, PRN code (C/A or P code), and navigation message.</li><li>C/A code is public for civil use, military P code is encrypted and unhackable.</li><li>Users will generate a local signal matching with the received one through signal acquisition and tracking.</li><li>Correlation plays an important role in data demodulation.</li></ul><p>And also, welcome to visit <a href="https://github.com/PenroseWang/SimGPS">my repo</a> if you would like to see the code for generating the interesting animations!</p><h4>Reference</h4><p>[1] <a href="http://web.stanford.edu/~gracegao/publications//magazine//InsideGNSS%20Compass%2007.pdf">http://web.stanford.edu/~gracegao/publications//magazine//InsideGNSS%20Compass%2007.pdf</a></p><p>[2] <a href="https://en.wikipedia.org/wiki/BeiDou">https://en.wikipedia.org/wiki/BeiDou</a></p><p>[3] <a href="http://www.atlantarf.com/Downloads.php">http://www.atlantarf.com/Downloads.php</a></p><p>[4] <a href="https://en.wikipedia.org/wiki/Code-division_multiple_access">https://en.wikipedia.org/wiki/Code-division_multiple_access</a></p><p>[5] Elliott D. Kaplan. Understanding GPS: Principles and Applications. Boston: Artech House, 1996.</p><p>[6] <a href="https://en.wikipedia.org/wiki/Global_Positioning_System">https://en.wikipedia.org/wiki/Global_Positioning_System</a></p><p>[8] <a href="https://www.af.mil/News/Article-Display/Article/703894/evolution-of-gps-from-desert-storm-to-todays-users/">https://www.af.mil/News/Article-Display/Article/703894/evolution-of-gps-from-desert-storm-to-todays-users/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd9eae0bdade" width="1" height="1" alt=""><hr><p><a href="https://medium.com/voice-tech-podcast/introduction-to-gnss-ii-gps-signal-processing-dd9eae0bdade">Introduction to GNSS II: GPS Signal Processing</a> was originally published in <a href="https://medium.com/voice-tech-podcast">Voice Tech Podcast</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to GNSS: Some Basics]]></title>
            <link>https://medium.com/@penrosewang/introduction-to-gnss-some-basics-2dc8cb716589?source=rss-dacbcc3b0b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/2dc8cb716589</guid>
            <category><![CDATA[gps]]></category>
            <category><![CDATA[gnss]]></category>
            <category><![CDATA[localization]]></category>
            <dc:creator><![CDATA[Penrose Wang]]></dc:creator>
            <pubDate>Thu, 25 Jun 2020 09:18:26 GMT</pubDate>
            <atom:updated>2020-06-27T05:43:48.008Z</atom:updated>
            <content:encoded><![CDATA[<p>This past Tuesday witnessed the launch of the final satellite in the Chinese BeiDou Navigation System. It’s been 20 years since the first launch for the BeiDou-1 system, which consists only 3 satellites with limited coverage; and now BeiDou-3 has global coverage, and I am impressed that China only used 5 years to build it up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*D9fs31DRN9RqVWyYTfZYVg.jpeg" /><figcaption>On June 23, 2020, China launched the last satellite in its BeiDou-3 Navigation Satellite System (<a href="http://www.xinhuanet.com/politics/2020-06/23/c_1126149640.htm">source</a>)</figcaption></figure><p>I’ve learned some basics of GNSS during my bachelor’s degree, and for the past half-year I’ve been focusing on GNSS-based localization, thus I think it will be good for me to review some of my knowledge and share it here as a celebration for Beidou as well.</p><h4>GNSS vs. GPS</h4><p>First things first, one might already be wondering, what is GNSS? Most people should be familiar with GPS, but many may not hear of GNSS often. GNSS stands for <strong>Global Navigation Satellite System</strong>, including all navigation systems which use satellites to provide autonomous geo-spatial positioning. GPS is the first GNSS launched in 1978 and developed by the U.S., and there are many satellite navigation systems out there established by other organizations. The below figure describes the relationship between GNSS and GPS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-INPYgjd_ox2B8FuBPtGog.jpeg" /><figcaption>GNSS is a generic term describing any navigation systems which use satellites to provide positioning on a global or regional basis. Currently, there are four global GNSSs, GPS (by U.S.), BeiDou (by China), GLONASS (by Russia), and Galileo (by E.U.). QZSS (by Japan) and IRNSS (by India) only have limited coverage, thus they are regional GNSSs</figcaption></figure><h4>Yesterday and Today</h4><p>Before we go into how GNSS works, let’s first read a little bit of history which I find quite interesting. Just like many other great inventions, the first idea of satellite-based positioning originated during the Cold War, when two American scientists realized that they could pinpoint Soviet Union satellite along its orbit because of the Doppler effect. To solve the inverse problem — pinpointing the user’s location given the satellite’s location, U.S. developed TRANSIT. It was successfully tested in 1960, providing a navigational fix about <strong>once per hour</strong>, and became the first satellite navigation system in the world. Recall the fact that nowadays cellphone location can be determined in seconds, you will know how much progress we’ve made so far.</p><p>In 1978, the first experimental GPS satellite was launched. It is designed to have a low accuracy of about 100 meters for civilian users, and high accuracy only for military uses. But later on, with improved design for GPS receivers, the actual accuracy was about 20 to 30 meters, which far exceeded the expectation of the U.S. government. To avoid providing such unexpected accuracy, a technique known as “Selective Availability”, or SA, was introduced to <strong>deliberately degrade</strong> the accuracy for non-military users.</p><p>However, SA is outsmarted by outstanding scientists with the invention of Differential GPS (DGPS), and actually, it not only solved the SA problem, but also led to better accuracy within 5 meters, and even centimeter lever accuracy for best cases. Partly because of this, SA was turned off in 2000.</p><p>In 2005, GPS began transmitting its second civilian signal for enhanced user performance, and with the development of Assisted-GPS, GPS becomes an integral part of our daily life. Cost of GPS receivers has dropped dramatically throughout the time — from first commercial GPS receiver with a cost over <em>$100,000</em> and a weight of <em>53 pounds (24 kg)</em>, down to the chips that only costs <em>a couple of dollars</em> in our cellphones nowadays.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*riIe7vuiyJe6v3mTJsIQxg.jpeg" /><figcaption>Made by Texas Instruments in 1981, this is one of the first commercial GPS receivers and antennas (<a href="https://timeandnavigation.si.edu/multimedia-asset/ti-4100-navstar-navigator-gps-receiver">source</a>)</figcaption></figure><h4>Plans</h4><p>Well, that’s far enough about history and let’s look at how GNSS works. I plan to write a few articles to answer the following questions.</p><ul><li>How to determine the user’s position?</li><li>How to capture GPS signal, and why can’t we decode military signals?</li><li>How did the DGPS technique render Selective Availability ineffective?</li><li>…</li></ul><p>Although we have many GNSSs, the basic ideas are almost the same, thus I will use GPS as an example to illustrate the principles.</p><h4>Overview of GPS Positioning</h4><p>This article will answer the first question. To understand the basics only high school mathematics is needed, and it would be even better if you still remember linear regression. But if not it’s still okay, so keep reading.</p><p>First let’s look at what GPS is consisted of. The system is made up of three segments: the <em>space segment</em>, the <em>control segment</em>, and the <em>user segment</em>. The space segment consists of a constellation of 24 operating satellites that transmits one-way signals that give current GPS satellite position and time. The satellites fly in circular orbits at an altitude of about 20,200 km and with a period of 12 hours. The control segment maintains the health and status of the satellite constellation and uploads navigational data which give essential information about satellite position. The user segment consists of the GPS receiver equipment, which receives GPS signals to calculate the user’s position and time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iLUGrTRCt5MExHb1c4tBeQ.jpeg" /><figcaption>Three GPS segments.</figcaption></figure><h4>GPS Signal to Distance</h4><p>After the user successfully decodes the information of GPS signals sent by each visible satellite, it will have</p><ul><li>The three-dimensional position of each satellite <em>pˢ</em></li><li>Time <em>tˢ </em>when GPS signal is transmitted</li></ul><p>Satellites are way above the sky, thus when GPS signal is received, it would be delayed by some time <em>Δt</em>, determined by the range it traveled across space (i.e. the distance of satellite and user)</p><ul><li>Time <em>tᵣ </em>when GPS signal is received, which can be read from user clock</li><li>Distance <em>𝑅=cΔt=𝑐</em>(<em>tᵣ−tˢ</em>), where <em>𝑐</em> is the speed of light (GPS signal speed)</li></ul><h4>Trilateration</h4><p>Now let’s consider a simple case when the user has received GPS signals from three satellites and calculated the distances between each satellite <em>R₁</em>, <em>R₂</em>, <em>R₃</em> with regard to satellite <em>s₁</em>, <em>s₂</em>, <em>s₃</em>.</p><p>Then it’s able to solve the user’s three-dimensional position <em>pᵣ</em>=(<em>xᵣ</em>, <em>yᵣ</em>, <em>zᵣ</em>)<em> </em>because there are three knowns <em>R₁</em>, <em>R₂</em>, <em>R₃,</em> and three unknowns. The process of determining the location by measurements of distances is called trilateration.</p><p>If there is only one satellite, then the user’s location couldn’t be determined, but it should locate somewhere on the surface of the sphere centered at the satellite <em>s₁</em> with radius <em>R₁</em>, as shown in the left plot below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z6bYmkryCE4R6IQNKcqm9w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zSwjN8TI-lFYg6Pd0Odtzw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D7ZQuT3A27al0OkVuwC7mw.jpeg" /><figcaption>Trilateration (source: Understanding GPS: Principles and Applications. Boston: Artech House, 1996)</figcaption></figure><p>If two satellites, the user would then be somewhere on the surface of both spheres, which is the perimeter of the plane of intersection denoted by the shaded circle in the middle plot.</p><p>With three satellites, the user is at the intersection of the perimeter of the circle and the surface of the third sphere, as shown in the right plot. This third sphere intersects the shaded circle perimeter at two points. For a user on Earth’s surface, the lower point should be true position (the other one is mirrored up above the plane decided by the three satellites).</p><h4>But That’s Not All</h4><p>However, user clock time may not be accurate enough. Remember the distance is calculated by time delay multiplied by the speed of light <em>𝑐</em>? If the user clock is not accurate, let’s say it has an offset of only 1 <em>μs</em> compared with true time, then an error of 300 <em>m </em>would be introduced when calculating the distance between user and satellite (suppose satellite time is accurate).</p><p>To solve this problem, we have to know the user clock offset with regard to true time (or satellite time).</p><p>Let’s introduce a little bit of mathematics for better understanding. Consider a simple trilateration case:<br> <em>R₁</em>=<em>c</em>(<em>tᵣ</em>−<em>tˢ₁</em>)=‖<em>pᵣ</em>−<em>pˢ₁</em>‖<br> <em>R₂</em>=<em>c</em>(<em>tᵣ</em>−<em>tˢ₂</em>)=‖<em>pᵣ</em>−<em>pˢ₂</em>‖ <br> <em>R₃</em>=<em>c</em>(<em>tᵣ</em>−<em>tˢ₃</em>)=‖<em>pᵣ</em>−<em>p</em>ˢ<em>₃</em>‖<br>where ‖<em>pᵣ</em>−<em>pˢ</em> ‖ denotes the distance between <em>pᵣ</em> and <em>pˢ</em>. Signal reception time <em>tᵣ</em> is known from the reading of current user clock time, satellite position <em>pˢ₁</em>, <em>pˢ₂,</em> and <em>pˢ₃ </em>can be obtained from GPS signal, thus there are only three unknowns <em>pᵣ</em>=(<em>xᵣ, yᵣ, zᵣ</em>)<em>.</em></p><p>Add one more variable, user clock offset <em>dt</em>, into user time and rewrite as<br> <em>R=c</em>(<em>tᵣ+dt−tˢ</em>)<em>=</em>‖<em>pᵣ−pˢ</em>‖</p><p>Since there are four unknowns instead of three, then why not add one more satellite? <br> <em>R₁=c</em>(<em>tᵣ+dt−tˢ₁</em>)<em>=</em>‖<em>pᵣ−pˢ₁</em>‖<em><br> R₂=c</em>(<em>tᵣ+dt−tˢ₂</em>)<em>=</em>‖<em>pᵣ−pˢ₂</em>‖<em><br> R₃=c</em>(<em>tᵣ+dt−tˢ₃</em>)<em>=</em>‖<em>pᵣ−pˢ₃</em>‖<em><br> R₄=c</em>(<em>tᵣ+dt−tˢ₄</em>)<em>=</em>‖<em>pᵣ−pˢ₄</em>‖<br>Problem Solved!</p><p><strong>A minimum of four satellites is needed to determine the user’s location.</strong></p><p>So what if we have more satellites? Then<br> <em>R₁=c</em>(<em>tᵣ+dt−tˢ₁</em>)<em>=</em>‖<em>pᵣ−pˢ₁</em>‖<em><br> </em>…<br> <em>Rᵢ=c</em>(<em>tᵣ+dt−tˢᵢ</em>)<em>=</em>‖<em>pᵣ−pˢᵢ</em>‖<em><br></em>can be formulated as a non-linear least square problem and solved by the <em>Gauss-Newton</em> algorithm.</p><p>But do we need more satellites? Aren’t four satellites enough?</p><h4>Measurement Errors</h4><p>It’s indeed a long journey for GPS signal to travel through space, thus there are a lot of errors when measuring the distance through time delay.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G3m_CgW2BJgloO1MHymi-w.jpeg" /><figcaption>Main sources of measurement errors: atmospheric error (left), multipath (middle), satellite ephemeris and clock error (top right), signal arrival time measurement error (bottom right)</figcaption></figure><p><strong>Atmospheric effects</strong></p><ul><li>Errors would be introduced when traveling across the earth’s atmosphere.</li><li>Ionospheric delay, caused by traveling across the ionized atmosphere, and is frequency-dependent</li><li>Tropospheric delay caused by humidity at the troposphere</li><li>Atmospheric pressure delay</li></ul><p><strong>Multipath effects</strong></p><ul><li>GPS signals can be blocked by surrounding terrain: buildings, trees, bridges, etc.</li><li>GPS signals can be reflected by surrounding terrain: buildings, canyon walls, hard ground, etc.</li><li>When the direct signal is blocked but the reflected signal is received, then the calculated distance will be larger than true distance.</li></ul><p><strong>Satellite ephemeris and clock errors</strong></p><ul><li>Satellite ephemeris is used to calculate the current and predicted position of each satellite in its orbit (<em>pˢ</em> comes from here).</li><li>Satellite ephemeris may be up to two hours old, might lead to inaccurate satellite position if not updated in time.</li><li>Satellites’ atomic clocks experience noise and clock drift errors, and might not be able to be fully corrected.</li></ul><p><strong>Signal arrival time measurement</strong></p><ul><li>Typically the user can measure time delay to within about one percent of a bit pulse width, which approximately 10 nanoseconds, representing an error of about 3 meters.</li></ul><h4>Position Uncertainty</h4><p>Distance measurements would not be perfect due to these errors. If we only have four measurements, which is the bare minimum required to determine the user’s location, errors would be fully consumed in the solution. If we have more measurements, errors could be partly consumed by residuals after the least square estimation, thus rendering a solution with less error and more confidence.</p><p>Take linear regression as an example:</p><ul><li>With enough measurements, we can fit a line best describing the linear model (indicated as a red line in plot).</li><li>Residual is the difference of one measurement (blue dot) with its predicted value (red dot)</li><li>If the fitted line is 100% accurate, then measurement error = residual</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M_O6bTXcQaDnlo5WrtDM8w.png" /><figcaption>Linear regression (<a href="https://en.wikipedia.org/wiki/Regression_analysis">source</a>): blue dots are measurements, the red line is the fitted results after linear regression, the black line segment is the residual for one measurement, which is defined as the difference between measurement (the blue dot) and predicted value (the red dot)</figcaption></figure><p>As we know more measurements tend to lead to a more accurate fitted result, and the same conclusion can be drawn for non-linear cases.</p><h4>Dilution of Precision (DOP)</h4><p>We can also view the position uncertainty in another way. Considering a two-dimensional case, depicted in the plot below.</p><ul><li><strong>A:</strong> the user has measured the distance to two landmarks, so its location should be at the intersection of two circles with the measured radius.</li><li><strong>B: </strong>the measurements have some errors, thus true location will lie anywhere in the green area.</li><li><strong>C: </strong>the measurement errors are the same, but the error on their position has grown considerably due to the different arrangement of the landmarks.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6LFFyZLyxzcBSAf2GcwB0g.png" /><figcaption>Dilution of Precision (<a href="https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)">source</a>): red/blue dots represent landmarks, red/blue circle represent distance measurement, gray circles represent measurement errors, and green areas mark the possible true location. When landmarks and their intersection are on the same line, the green area becomes significantly large, indicating higher uncertainty. This effect is called the Dilution of Precision (DOP).</figcaption></figure><p>From the example, we know the arrangement of satellites makes a difference when determining the user’s location. Basically we hope the satellites can spread evenly throughout the space.</p><p>Notice that for a user located at earth’s surface, the received satellite signals can not come below the earth’s horizon. This is why the position given by GPS will always have <strong>larger vertical errors compared with horizontal ones</strong>.</p><h4>Pseudorange</h4><p>Distance <em>R</em> calculated based on time delay is not the geometric range between user and satellite but contains measurement errors, thus technically it’s called <em>pseudorange</em>, formulated as<br><em> R=c</em>[<em>tᵣ</em>(<em>T₂</em>)−<em>tˢ</em>(<em>T₁</em>)]<em><br></em>where <em>tˢ</em>(<em>T₁</em>) is signal transmission time given by satellite clock <em>s</em>; <em>tᵣ</em>(<em>T₂</em>) is signal reception time given by user clock <em>r</em>.</p><p>The equation can be re-written in another way, using geometric range <em>ρˢᵣ</em> between user and satellite plus measurement errors.<br><em> R=c</em>[<em>tᵣ</em>(<em>T₂</em>)−<em>tˢ</em>(<em>T₁</em>)]<em><br> =c</em>[(<em>tᵣ+dtᵣ)</em>−(<em>tˢ+dtˢ</em>)]<em>+ε<br> =c</em>(<em>tᵣ</em>−<em>tˢ)+c</em>(<em>dtᵣ</em>−<em>dtˢ</em>)<em>+ε<br> =</em>(<em>ρᵣˢ+Iᵣˢ+Tᵣˢ</em>)<em>+c</em>(<em>dtᵣ</em>−<em>dtˢ</em>)<em>+ε<br> =ρᵣˢ+c</em>(<em>dtᵣ</em>−<em>dtˢ</em>)<em>+Iᵣˢ+Tᵣˢ+ε</em><br>where <em>tˢ</em> and <em>tᵣ</em> are the true time of satellite and user clock, <em>dtˢ</em> and <em>dtᵣ</em> are the clock offsets, <em>ε</em> is the non-atmospheric measurement error (e.g., multipath), <em>Iᵣˢ</em> and <em>Tᵣˢ</em> are atmospheric error caused by Ionosphere and Troposphere.</p><h4>Some Takeaways</h4><ul><li><strong>The principle idea behind GPS localization is simple — trilateration.</strong></li><li><strong>Due to clock offset, a minimum of four satellites is needed to determine the user’s location.</strong></li><li><strong>Pseudorange, calculated based on a time delay, is the distance from the satellite to the user including measurement errors.</strong></li><li><strong>Horizontal accuracy is better compared with vertical due to DOP.</strong></li></ul><p>In the next story, I will introduce the basics of GPS signal structure and how the user can decode the bit information.</p><h4>Reference</h4><ol><li><a href="https://www.gps.gov/systems/gnss/">https://www.gps.gov/systems/gnss/</a></li><li><a href="https://www.gps.gov/systems/gps/">https://www.gps.gov/systems/gps/</a></li><li><a href="https://en.wikipedia.org/wiki/Global_Positioning_System">https://en.wikipedia.org/wiki/Global_Positioning_System</a></li><li><a href="https://en.wikipedia.org/wiki/Differential_GPS">https://en.wikipedia.org/wiki/Differential_GPS</a></li><li>Elliott D. Kaplan. Understanding GPS: Principles and Applications. Boston: Artech House, 1996.</li><li><a href="https://en.wikipedia.org/wiki/Error_analysis_for_the_Global_Positioning_System">https://en.wikipedia.org/wiki/Error_analysis_for_the_Global_Positioning_System</a></li><li><a href="https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)">https://en.wikipedia.org/wiki/Dilution_of_precision_(navigation)</a></li><li><a href="https://www.iconfont.cn/">https://www.iconfont.cn/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2dc8cb716589" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>