Index: trunk/BNC/src/bnchelp.html
===================================================================
--- trunk/BNC/src/bnchelp.html	(revision 10091)
+++ trunk/BNC/src/bnchelp.html	(revision 10092)
@@ -2390,62 +2390,83 @@
 </p>
 <pre><p style="font-family:Monospace">
-! SP3 File 1: Input/CNE1SSRRTS_20222410000_01D_05S_ORB.SP3
-! SP3 File 2: Input/BKG1SSRRTS_20222410000_01D_05S_ORB.SP3
+! SP3 File 1: /data/stuerze/tools/BNC/Example_Configs/Input/CNE1MGXRTS_20222410000_01D_05S_ORB.SP3
+! SP3 File 2: /data/stuerze/tools/BNC/Example_Configs/Input/BKG1MGXRTS_20222410000_01D_05S_ORB.SP3
+!
+! Clock residuals and orbit differences in [m]
+! ----------------------------------------------------------------------------
 !
 !  Epoch                PRN  radial   along   out        clk    clkRed   iPRN
 ! ----------------------------------------------------------------------------
-..
-2022-08-29_08:01:30.000 E02 -0.0023  0.1159 -0.0047     0.0187  0.0210    60
-2022-08-29_08:01:30.000 E03 -0.0567 -0.0411  0.0146    -0.0093  0.0474    61
-2022-08-29_08:01:30.000 E04  0.0695 -0.0406  0.0880    -0.0219 -0.0914    62
-2022-08-29_08:01:30.000 E05 -0.1042  0.1161 -0.0503    -0.0101  0.0942    63
-2022-08-29_08:01:30.000 E07  0.0354  0.0384 -0.0346     0.0134 -0.0219    65
-2022-08-29_08:01:30.000 E08 -0.0312  0.0312 -0.0481     0.0130  0.0442    66
-2022-08-29_08:01:30.000 E09 -0.0548  0.1941  0.0263    -0.0113  0.0436    67
-2022-08-29_08:01:30.000 E12  0.0402 -0.0023  0.0012    -0.0051 -0.0454    70
-2022-08-29_08:01:30.000 E13  0.0420 -0.0608 -0.0525    -0.0006 -0.0427    71
-2022-08-29_08:01:30.000 E15  0.0478  0.0348 -0.0353    -0.0122 -0.0600    73
-2022-08-29_08:01:30.000 E21  0.0639  0.0033  0.0292    -0.0167 -0.0806    79
-2022-08-29_08:01:30.000 E24  0.0900 -0.1113 -0.0385     0.0047 -0.0853    82
-2022-08-29_08:01:30.000 E25  0.0106  0.0340 -0.0564     0.0023 -0.0083    83
-2022-08-29_08:01:30.000 E26  0.0598  0.0506 -0.0983    -0.0011 -0.0609    84
-2022-08-29_08:01:30.000 E27  0.0763 -0.0972 -0.0480     0.0041 -0.0722    85
-2022-08-29_08:01:30.000 E30  0.0385  0.0266  0.0028     0.0092 -0.0293    88
-2022-08-29_08:01:30.000 E31  0.1017 -0.1834 -0.0211     0.0021 -0.0997    89
-2022-08-29_08:01:30.000 E33  0.0827  0.0385 -0.0741    -0.0060 -0.0887    91
-2022-08-29_08:01:30.000 E36  0.0099 -0.0769  0.0384     0.0269  0.0170    94
-
+2022-08-29_08:01:30.000 G01  0.0297 -0.0526 -0.0198    -0.0005 -0.0301     1
+2022-08-29_08:01:30.000 G02  0.0225 -0.0179  0.0055     0.0054 -0.0171     2
+2022-08-29_08:01:30.000 G03  0.0210 -0.0387 -0.0153     0.0025 -0.0185     3
+2022-08-29_08:01:30.000 G06  0.0650  0.0599 -0.0260    -0.0074 -0.0724     6
+2022-08-29_08:01:30.000 G07  0.0112  0.0774  0.0331    -0.0021 -0.0133     7
+2022-08-29_08:01:30.000 G08  0.0241  0.0725  0.0009    -0.0008 -0.0248     8
+2022-08-29_08:01:30.000 G09 -0.0145  0.0669  0.0069     0.0051  0.0196     9
+2022-08-29_08:01:30.000 G11  0.0375  0.0650 -0.0080    -0.0094 -0.0469    11
+2022-08-29_08:01:30.000 G12  0.0634  0.0229 -0.0003     0.0078 -0.0556    12
+2022-08-29_08:01:30.000 G13  0.0163  0.0551  0.0904     0.0010 -0.0153    13
+2022-08-29_08:01:30.000 G14  0.0365  0.0646 -0.0398     0.0034 -0.0332    14
+2022-08-29_08:01:30.000 G15  0.0175  0.0892  0.0512    -0.0032 -0.0207    15
+2022-08-29_08:01:30.000 G16  0.0453  0.0408  0.0346    -0.0029 -0.0483    16
+2022-08-29_08:01:30.000 G17  0.0381 -0.0064 -0.0701     0.0020 -0.0362    17
+2022-08-29_08:01:30.000 G18 -0.0886  0.0031  0.0721    -0.0055  0.0831    18
+2022-08-29_08:01:30.000 G19  0.0310 -0.0190 -0.0264    -0.0000 -0.0311    19
+2022-08-29_08:01:30.000 G20  0.0199  0.0308  0.0476     0.0106 -0.0093    20
+2022-08-29_08:01:30.000 G21  0.0163  0.0079 -0.0464     0.0047 -0.0116    21
+2022-08-29_08:01:30.000 G22  0.0471  0.0173 -0.0315    -0.0023 -0.0494    22
+2022-08-29_08:01:30.000 G23 -0.0354 -0.0042  0.0247    -0.0035  0.0319    23
+2022-08-29_08:01:30.000 G24  0.0110  0.0030 -0.0323     0.0112  0.0002    24
+2022-08-29_08:01:30.000 G25  0.0037  0.0712 -0.0175    -0.0019 -0.0056    25
+2022-08-29_08:01:30.000 G26  0.0421 -0.0002  0.0511    -0.0009 -0.0430    26
+2022-08-29_08:01:30.000 G27  0.0164  0.1203  0.0347    -0.0041 -0.0205    27
+2022-08-29_08:01:30.000 G29 -0.0093  0.0141  0.0570     0.0095  0.0188    29
+2022-08-29_08:01:30.000 G30  0.0199  0.0805  0.0529    -0.0074 -0.0273    30
+2022-08-29_08:01:30.000 G31  0.0336 -0.0079 -0.0281    -0.0132 -0.0468    31
+2022-08-29_08:01:30.000 G32 -0.0185 -0.0200 -0.0103     0.0019  0.0205    32
 ..
 !
-! RMS[m]
+! Summary
+! -----------------------------------------------------------------------------------------------------------------
 !
-!    PRN  radial   along   out     nOrb    clk   clkRed   nClk    Offset
-! ----------------------------------------------------------------------
-!    E02  0.0072  0.1160  0.0267    165  0.0110  0.0158    165   -0.0345
-!    E03  0.0610  0.0387  0.0151    165  0.0083  0.0617    165   -0.0376
-!    E04  0.0830  0.0619  0.0819    165  0.0112  0.0828    165    0.0649
-!    E05  0.0966  0.1193  0.0418    165  0.0058  0.0965    165   -0.0073
-!    E07  0.0296  0.0309  0.0389    165  0.0102  0.0296    165   -0.0904
-!    E08  0.0371  0.0193  0.0424    165  0.0080  0.0372    165   -0.1017
-!    E09  0.0436  0.1744  0.0422    165  0.0044  0.0433    165   -0.0300
-!    E12  0.0490  0.0033  0.0107    165  0.0042  0.0489    165   -0.1174
-!    E13  0.0336  0.0393  0.0661    165  0.0046  0.0341    165   -0.0683
-!    E15  0.0548  0.0273  0.0375    165  0.0064  0.0547    165    0.0536
-!    E21  0.0667  0.0116  0.0301    165  0.0079  0.0671    165   -0.0384
-!    E24  0.0913  0.1101  0.0332    165  0.0050  0.0913    165    0.0946
-!    E25  0.0099  0.0412  0.0628    165  0.0033  0.0101    165    0.0797
-!    E26  0.0621  0.0516  0.0946    165  0.0033  0.0622    165    0.0300
-!    E27  0.0734  0.0841  0.0522    165  0.0052  0.0733    165    0.1015
-!    E30  0.0382  0.0380  0.0072    165  0.0046  0.0384    165    0.0682
-!    E31  0.0937  0.1700  0.0234    165  0.0089  0.0943    165    0.1110
-!    E33  0.0926  0.0340  0.0654    165  0.0032  0.0926    165    0.0010
-!    E36  0.0059  0.0630  0.0456    165  0.0089  0.0073    165   -0.0790
+!     PRN   radialRMS   alongRMS    outRMS     3DRMS      nOrb    clkRMS    clkRedRMS   clkRedSig   nClk    Offset
+!              [mm]       [mm]        [mm]      [mm]      [-]      [ns]        [ns]        [ns]      [-]     [ns]
+! -----------------------------------------------------------------------------------------------------------------
 ..
+!     G01       49.4       90.1        4.0      102.8     165       0.01       0.16       0.16       165     -2.71
+!     G02       39.8       34.2        6.2       52.8     165       0.01       0.13       0.13       165      4.13
+!     G03       27.8       57.7       12.8       65.3     165       0.01       0.09       0.09       165     -2.18
+!     G06       61.8       50.7       22.2       82.9     165       0.01       0.21       0.21       165     -2.70
+!     G07       22.2       80.3       31.7       89.2     165       0.01       0.07       0.07       165     -1.26
+!     G08       18.8      102.1       12.7      104.6     165       0.01       0.06       0.06       165      1.17
+!     G09        9.8       87.2        5.6       87.9     165       0.01       0.03       0.03       165      0.21
+!     G11       54.8       65.5        6.9       85.6     165       0.03       0.18       0.18       165     -1.93
+!     G12       64.4       48.2        7.3       80.8     165       0.02       0.21       0.21       165     -1.45
+!     G13       17.1       45.9       88.8      101.4     165       0.01       0.06       0.06       165     -0.67
+!     G14       34.9       79.4       32.6       92.7     165       0.01       0.12       0.12       165     -2.07
+!     G15       33.4       38.1       45.0       67.8     165       0.01       0.11       0.11       165     -2.19
+!     G16       50.0       67.9       51.2       98.7     165       0.01       0.17       0.17       165      3.27
+!     G17       44.1       12.0       73.8       86.8     165       0.01       0.15       0.15       165     -1.67
+!     G18       78.7       15.0       65.4      103.4     165       0.01       0.26       0.26       165     -2.37
+!     G19       29.1       12.7       38.2       49.7     165       0.01       0.10       0.10       165      6.27
+!     G20       19.0       25.2       33.4       45.9     165       0.02       0.06       0.06       165      5.58
+!     G21        8.6       13.3       44.5       47.3     165       0.01       0.03       0.03       165      5.40
+!     G22       53.5       18.3       29.0       63.5     165       0.01       0.18       0.18       165      1.54
+!     G23       29.8       35.8       16.1       49.2     165       0.01       0.10       0.10       165     -1.84
+!     G24       13.4       20.2       28.4       37.3     165       0.02       0.04       0.04       165     -2.67
+!     G25        9.2       88.4       28.0       93.2     165       0.02       0.04       0.04       165      1.68
+!     G26       45.2       33.4       60.5       82.5     165       0.02       0.15       0.15       165      0.36
+!     G27       22.4      128.4       39.9      136.3     165       0.01       0.07       0.07       165      0.59
+!     G29       17.2       42.3       59.7       75.1     165       0.02       0.06       0.06       165     -2.56
+!     G30       19.9       91.7       61.2      112.0     165       0.01       0.07       0.07       165      2.15
+!     G31       30.3       20.1       39.4       53.6     165       0.04       0.11       0.11       165     -1.97
+!     G32       16.7       28.9        8.2       34.4     165       0.01       0.06       0.06       165     -2.11
 !
-!  Total  0.0552  0.0877  0.0690  10395  0.0075  0.0551  10395
+!   Total       55.2       87.7       69.0      124.5   10395       0.02       0.18       0.18     10395
 </p>
 </pre>
 <p>
-The first part of this output uses the following abbreviations:
+The first part of this output following string 'following string' uses the following abbreviations:
 </p>
 
@@ -2461,17 +2482,21 @@
 </table>
 <p>
-The second part following string 'RMS' provides a summary of the comparison using the following
+The second part following string 'Summary' provides a summary of the comparison using the following
 abbreviations:<br>
+!     PRN   radialRMS   alongRMS     outRMS     3DRMS      nOrb    clkRMS    clkRedRMS   clkRedSig   nClk    Offset
+!              [mm]       [mm]        [mm]       [mm]      [-]      [ns]        [ns]        [ns]      [-]     [ns]
 </p>
 <table>
 <tr><td>'PRN' &nbsp;</td><td>Satellite specification</td></tr>
-<tr><td>'radial' &nbsp;</td><td>RMS of radial component of orbit coordinate differences [m]</td></tr>
-<tr><td>'along' &nbsp;</td><td>RMS of along track component of orbit coordinate differences [m]</td></tr>
-<tr><td>'out' &nbsp;</td><td>RMS of out-of-plane component of orbit coordinate differences [m]</td></tr>
+<tr><td>'radialRMS' &nbsp;</td><td>RMS of the radial component of orbit coordinate differences [mm]</td></tr>
+<tr><td>'alongRMS' &nbsp;</td><td>RMS of the along track component of orbit coordinate differences [mm]</td></tr>
+<tr><td>'outRMS' &nbsp;</td><td>RMS of the out-of-plane component of orbit coordinate differences [mm]</td></tr>
+<tr><td>'3DRMS' &nbsp;</td><td>3D RMS of the orbit coordinate differences [mm]</td></tr>
 <tr><td>'nOrb' &nbsp;</td><td>Number of epochs used in in orbit comparison</td></tr>
-<tr><td>'clk' &nbsp;</td><td>RMS of clock differences [m]</td></tr>
-<tr><td>'clkRed' &nbsp;</td><td>RMS of clock differences after reduction of radial orbit differences [m]</td></tr>
+<tr><td>'clkRMS' &nbsp;</td><td>RMS of clock differences [ns]</td></tr>
+<tr><td>'clkRedRMS' &nbsp;</td><td>RMS of The clock differences after reduction of radial orbit differences [ns]</td></tr>
+<tr><td>'clkRedSig' &nbsp;</td><td>Sigma of the clock differences after reduction of radial orbit differences [ns]</td></tr>
 <tr><td>'nClk' &nbsp;</td><td>Number of epochs use in clock comparisons</td></tr>
-<tr><td>'Offset' &nbsp;</td><td>Clock offset [m]</td></tr>
+<tr><td>'Offset' &nbsp;</td><td>Clock offset [ns]</td></tr>
 </table>
 <br>
Index: trunk/BNC/src/orbComp/sp3Comp.cpp
===================================================================
--- trunk/BNC/src/orbComp/sp3Comp.cpp	(revision 10091)
+++ trunk/BNC/src/orbComp/sp3Comp.cpp	(revision 10092)
@@ -217,13 +217,32 @@
   // Compute clock residuals
   // -----------------------
+  const string all = "ZZZ";
   for (unsigned ie = 0; ie < epochs.size(); ie++) {
-    map<t_prn, double>& dc = epochs[ie]->_dc;
+    map<t_prn, double>& dc    = epochs[ie]->_dc;
+    map<t_prn, double>& dcRed = epochs[ie]->_dcRed;
+    const map<t_prn, ColumnVector>& dr = epochs[ie]->_dr;
     for (map<t_prn, double>::iterator it = dc.begin(); it != dc.end(); it++) {
       const t_prn& prn = it->first;
       if (satIndex(clkSats, prn) != -1) {
         int  index = epochs.size() + satIndex(clkSats, prn);
-        dc[prn]                      = it->second - xx[ie] - xx[index];
+        dc[prn]    = it->second - xx[ie] - xx[index];
         stat[prn.toString()]._offset = xx[index];
-      }
+        if (dr.find(prn) != dr.end()){
+          dcRed[prn] = dc[prn] - dr.find(prn)->second[0]; // clock minus radial component
+          stat[prn.toString()]._dcRedMean += dcRed[prn];
+          stat[all           ]._dcRedMean += dcRed[prn];
+          stat[prn.toString()]._nc        += 1;
+          stat[all           ]._nc        += 1;
+        }
+      }
+    }
+  }
+
+  // Compute Clock Mean
+  // ------------------
+  for (map<string, t_stat>::iterator it = stat.begin(); it != stat.end(); it++) {
+    t_stat& stat = it->second;
+    if (stat._nc > 0) {
+      stat._dcRedMean = stat._dcRedMean / stat._nc;
     }
   }
@@ -342,9 +361,11 @@
   }
 
-  // Print Residuals
-  // ---------------
+  // Print epoch-wise Clock Residuals
+  // --------------------------------
   const string all = "ZZZ";
 
   out.setf(ios::fixed);
+  out << "!\n! Clock residuals and orbit differences in [m]\n"
+         "! ----------------------------------------------------------------------------\n";
   out << "!\n!  Epoch                PRN  radial   along   out        clk    clkRed   iPRN"
           "\n! ----------------------------------------------------------------------------\n";
@@ -353,4 +374,5 @@
     const map<t_prn, ColumnVector>& dr = epochs[ii]->_dr;
     const map<t_prn, double>&       dc = epochs[ii]->_dc;
+    const map<t_prn, double>&    dcRed = epochs[ii]->_dcRed;
     for (map<t_prn, ColumnVector>::const_iterator it = dr.begin(); it != dr.end(); it++) {
       const t_prn&  prn = it->first;
@@ -362,18 +384,20 @@
             << setw(7) << setprecision(4) << rao[2] << "    ";
         stat[prn.toString()]._rao += SP(rao, rao); // Schur product
+        stat[all           ]._rao += SP(rao, rao);
         stat[prn.toString()]._nr  += 1;
-        stat[all]._rao            += SP(rao, rao);
-        stat[all]._nr             += 1;
-        if (dc.find(prn) != dc.end()) {
+        stat[all           ]._nr  += 1;
+        if (dc.find(prn) != dc.end() && dcRed.find(prn) != dc.end()) {
           double clkRes    = dc.find(prn)->second;
-          double clkResRed = clkRes - it->second[0]; // clock minus radial component
+          double clkResRed = dcRed.find(prn)->second;
           out << setw(7) << setprecision(4) << clkRes << ' '
               << setw(7) << setprecision(4) << clkResRed;
-          stat[prn.toString()]._dc    += clkRes * clkRes;
-          stat[prn.toString()]._dcRed += clkResRed * clkResRed;
-          stat[prn.toString()]._nc    += 1;
-          stat[all]._dc               += clkRes * clkRes;
-          stat[all]._dcRed            += clkResRed * clkResRed;
-          stat[all]._nc               += 1;
+          stat[prn.toString()]._dcRMS     += clkRes * clkRes;
+          stat[all           ]._dcRMS     += clkRes * clkRes;
+          stat[prn.toString()]._dcRedRMS  += clkResRed * clkResRed;
+          stat[all           ]._dcRedRMS  += clkResRed * clkResRed;
+          stat[prn.toString()]._dcRedSig  += (clkResRed - stat[prn.toString()]._dcRedMean) *
+                                             (clkResRed - stat[prn.toString()]._dcRedMean);
+          stat[all           ]._dcRedSig  += (clkResRed - stat[all           ]._dcRedMean) *
+                                             (clkResRed - stat[all           ]._dcRedMean);
         }
         else {
@@ -388,7 +412,9 @@
   // Print Summary
   // -------------
-  out << "!\n! RMS[m]\n";
-  out << "!\n!    PRN  radial   along   out     nOrb    clk   clkRed   nClk    Offset"
-           "\n! ----------------------------------------------------------------------\n";
+  out << "!\n! Summary";
+  out << "\n! -----------------------------------------------------------------------------------------------------------------\n";
+  out << "!\n!     PRN   radialRMS   alongRMS    outRMS     3DRMS      nOrb    clkRMS    clkRedRMS   clkRedSig   nClk    Offset "
+          "\n!              [mm]       [mm]        [mm]      [mm]      [-]      [ns]        [ns]        [ns]      [-]     [ns]  "
+          "\n! -----------------------------------------------------------------------------------------------------------------\n";
   for (map<string, t_stat>::iterator it = stat.begin(); it != stat.end(); it++) {
     const string& prn  = it->first;
@@ -398,22 +424,28 @@
       stat._rao[1] = sqrt(stat._rao[1] / stat._nr);
       stat._rao[2] = sqrt(stat._rao[2] / stat._nr);
+      stat._rao3DRMS = stat._rao.NormFrobenius();
       if (prn == all) {
-        out << "!\n!  Total ";
+        out << "!\n!   Total ";
       }
       else {
-        out << "!    " << prn << ' ';
-      }
-      out << setw(7) << setprecision(4) << stat._rao[0] << ' '
-          << setw(7) << setprecision(4) << stat._rao[1] << ' '
-          << setw(7) << setprecision(4) << stat._rao[2] << ' '
-          << setw(6) << stat._nr << " ";
+        out << "!     " << prn << ' ';
+      }
+      // orbit values in millimeters
+      out << setw(10) << setprecision(1) << stat._rao[0]   * 1e3 << ' '
+          << setw(10) << setprecision(1) << stat._rao[1]   * 1e3 << ' '
+          << setw(10) << setprecision(1) << stat._rao[2]   * 1e3 << ' '
+          << setw(10) << setprecision(1) << stat._rao3DRMS * 1e3 << ' '
+          << setw( 7) << stat._nr << " ";
       if (stat._nc > 0) {
-        stat._dc    = sqrt(stat._dc / stat._nc);
-        stat._dcRed = sqrt(stat._dcRed / stat._nc);
-        out << setw(7) << setprecision(4) << stat._dc << ' '
-            << setw(7) << setprecision(4) << stat._dcRed << ' '
-            << setw(6) << stat._nc << " ";
+        stat._dcRMS    = sqrt(stat._dcRMS    / stat._nc);
+        stat._dcRedRMS = sqrt(stat._dcRedRMS / stat._nc);
+        stat._dcRedSig = sqrt(stat._dcRedSig / stat._nc);
+        // clock values in nano seconds
+        out << setw(10) << setprecision(2) << stat._dcRMS    / t_CST::c * 1e9 << ' '
+            << setw(10) << setprecision(2) << stat._dcRedRMS / t_CST::c * 1e9 << ' '
+            << setw(10) << setprecision(2) << stat._dcRedSig / t_CST::c * 1e9 << ' '
+            << setw( 9) << stat._nc << " ";
         if (prn != all) {
-          out << setw(9) << setprecision(4) << stat._offset;
+          out << setw(9) << setprecision(2) << stat._offset / t_CST::c * 1e9;
         }
       }
Index: trunk/BNC/src/orbComp/sp3Comp.h
===================================================================
--- trunk/BNC/src/orbComp/sp3Comp.h	(revision 10091)
+++ trunk/BNC/src/orbComp/sp3Comp.h	(revision 10092)
@@ -38,5 +38,5 @@
 class t_sp3Comp : public QThread {
 Q_OBJECT
- 
+
  public:
   t_sp3Comp(QObject* parent);
@@ -47,10 +47,10 @@
  signals:
   void finished();
-   
+
  public slots:
 
  public:
   virtual void run();
- 
+
  private:
   class t_epoch {
@@ -60,4 +60,5 @@
     std::map<t_prn, ColumnVector> _xyz;
     std::map<t_prn, double>       _dc;
+    std::map<t_prn, double>       _dcRed;
   };
 
@@ -65,15 +66,20 @@
    public:
     t_stat() {
-      _rao.ReSize(3); 
-      _rao    = 0.0;
-      _dc     = 0.0;
-      _dcRed  = 0.0;
-      _offset = 0.0;
-      _nr     = 0;
-      _nc     = 0;
+      _rao.ReSize(3);  _rao    = 0.0;
+      _rao3DRMS   = 0.0;
+      _dcRMS      = 0.0;
+      _dcRedRMS   = 0.0;
+      _dcRedMean  = 0.0;
+      _dcRedSig   = 0.0;
+      _offset     = 0.0;
+      _nr         = 0;
+      _nc         = 0;
     }
     ColumnVector _rao;
-    double       _dc;
-    double       _dcRed;
+    double       _rao3DRMS;
+    double       _dcRMS;
+    double       _dcRedRMS;
+    double       _dcRedMean;
+    double       _dcRedSig;
     double       _offset;
     int          _nr;
