How to calculate the CN0

"Dongsheng Song" <[email protected]> Fri, 9 Mar 2007 16:34:09 +0800
Newsgroups gmane.comp.hardware.gps.opensource
Message-ID <[email protected]>
--===============5143853342367001017==
Content-Type: multipart/alternative; 
	boundary="----=_Part_87409_4467966.1173429249516"

------=_Part_87409_4467966.1173429249516
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

           Hello everyone,
           I looked into the opensourcegps program, and found the formula
calculating CN0 is Chan[ch].CN0 = 10.0 * log10( Chan[ch].avg_20ms /
1395.0*Chan[ch].avg_20ms /
1395.0 * 25.0 * 1.7777 + 1.0) . I know the CN0(db) = 10 * log10(C/N),but i
can't understand that form with so many constants. Who can help me to
explain the meaning of Chan[ch].avg_20ms and the derivation of the
constants. I am also confused with the program below. What is the mean of
the pull_code_k,the pull_code_d and the carrier form.

pull_code_k =  50, pull_code_d =  7,
       pull_carr_k = -12, pull_carr_d = 28,
       phase_test  = 500, rms = 312;

//  GP2021 has two tracking arms only: prompt & dither
  i_sum = Chan[ch].i_prompt + Chan[ch].i_dith;
  q_sum = Chan[ch].q_prompt + Chan[ch].q_dith;
//  i_sum = Chan[ch].i_prompt;
//  q_sum = Chan[ch].q_prompt;

  prompt_mag   = rss( Chan[ch].i_prompt, Chan[ch].q_prompt);
  dith_mag     = rss( Chan[ch].i_dith, Chan[ch].q_dith);
  Sum[ch] += prompt_mag + dith_mag;

// code tracking loop
  if ( prompt_mag != 0 || dith_mag != 0)
  {
    Cod_Phs[ch] = RT_Ctrl->earlylate * pull_code_k *
      ((prompt_mag - 2 * dith_mag) << 14) /
       (prompt_mag + 2 * dith_mag);

    dcod_phs = pull_code_d *
      (Cod_Phs[ch] - Cod_Phs_Prv[ch]);

//  don't close the loop for 2 ms to avoid transients
    if ( Pull_In_Count[ch] > 2 )
    {
      Chan[ch].cod_frq += (Cod_Phs[ch] + dcod_phs) >> 14;
//      Chan[ch].cod_frq += ((pul_cod_c1 + pul_cod_c2) * Cod_Phs[ch] +
//                          - pul_cod_c1 * Cod_Phs_Prv[ch]) >> 14;
//      rt_printk("ch_pull_in(): ch_code -> Chan[%d].cod_frq\n", ch,
Chan[ch].cod_frq);
      ch_code( ch, Chan[ch].cod_frq);
    }
  }
  Cod_Phs_Prv[ch] = Cod_Phs[ch];

  Best Regards
  Dongsheng Song

------=_Part_87409_4467966.1173429249516
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hello everyone,</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I looked into the opensourcegps program, and found the formula calculating CN0 is&nbsp;Chan[ch].CN0 = 10.0 * log10( Chan[ch].avg_20ms / 1395.0 *Chan[ch].avg_20ms / 1395.0 * 25.0 * 1.7777 + 1.0) . I know the CN0(db) = 10 * log10(C/N),but i can&#39;t understand that form with so many constants. Who&nbsp;can help me to explain the meaning&nbsp;of Chan[ch].avg_20ms and the derivation of the constants. I am also confused with the program below. What is the mean of the pull_code_k,the pull_code_d and the carrier form. 
</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </div>
<div>pull_code_k =&nbsp; 50, pull_code_d =&nbsp; 7, <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pull_carr_k = -12, pull_carr_d = 28,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; phase_test&nbsp; = 500, rms = 312;</div>
<p>//&nbsp; GP2021 has two tracking arms only: prompt &amp; dither<br>&nbsp; i_sum = Chan[ch].i_prompt + Chan[ch].i_dith;<br>&nbsp; q_sum = Chan[ch].q_prompt + Chan[ch].q_dith;<br>//&nbsp; i_sum = Chan[ch].i_prompt;<br>//&nbsp; q_sum = Chan[ch].q_prompt;
</p>
<p>&nbsp; prompt_mag&nbsp;&nbsp; = rss( Chan[ch].i_prompt, Chan[ch].q_prompt);<br>&nbsp; dith_mag&nbsp;&nbsp;&nbsp;&nbsp; = rss( Chan[ch].i_dith, Chan[ch].q_dith);<br>&nbsp; Sum[ch] += prompt_mag + dith_mag;</p>
<p>// code tracking loop<br>&nbsp; if ( prompt_mag != 0 || dith_mag != 0)<br>&nbsp; {<br>&nbsp;&nbsp;&nbsp; Cod_Phs[ch] = RT_Ctrl-&gt;earlylate * pull_code_k * <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ((prompt_mag - 2 * dith_mag) &lt;&lt; 14) /<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (prompt_mag + 2 * dith_mag);
</p>
<p>&nbsp;&nbsp;&nbsp; dcod_phs = pull_code_d * <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Cod_Phs[ch] - Cod_Phs_Prv[ch]);</p>
<p>//&nbsp; don&#39;t close the loop for 2 ms to avoid transients<br>&nbsp;&nbsp;&nbsp; if ( Pull_In_Count[ch] &gt; 2 )<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Chan[ch].cod_frq += (Cod_Phs[ch] + dcod_phs) &gt;&gt; 14;<br>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Chan[ch].cod_frq += ((pul_cod_c1 + pul_cod_c2) * Cod_Phs[ch] + 
<br>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - pul_cod_c1 * Cod_Phs_Prv[ch]) &gt;&gt; 14;<br>//&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rt_printk(&quot;ch_pull_in(): ch_code -&gt; Chan[%d].cod_frq\n&quot;, ch, Chan[ch].cod_frq);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ch_code( ch, Chan[ch].cod_frq);
<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp; }</p>
<div>&nbsp; Cod_Phs_Prv[ch] = Cod_Phs[ch];</div>
<div>&nbsp;</div>
<div>&nbsp; Best Regards</div>
<div>&nbsp; Dongsheng Song</div>

------=_Part_87409_4467966.1173429249516--


--===============5143853342367001017==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
opensource_gps mailing list
[email protected]
http://lists.psas.pdx.edu/cgi-bin/mailman/listinfo/opensource_gps

--===============5143853342367001017==--