public RINEX211Sat(Sat s) { this.s = s; }
public bool ParseSBAS = true; // Parse or ignore SBAS observations //Parse a #RANGEA message. Return Epoch public Epoch Parse(string line) { if (!line.StartsWith("#RANGEA")) { return(null); } // Check CRC of message if (!CRCok(line)) { Console.Error.WriteLine("CRC failed."); return(null); } string header = line.Split(';')[0]; string[] fields = header.Split(','); Epoch e = new Epoch(int.Parse(fields[5]), double.Parse(fields[6])); string data = line.Split(new char[] { ';', '*' })[1]; fields = data.Split(','); int i = 1; // Skip "number of observations to follow" while (fields.Length - i > 9) { int prn = int.Parse(fields[i++]); int glofreq = short.Parse(fields[i++]) - 7; Obs o = new Obs { psr = double.Parse(fields[i++]), psr_std = double.Parse(fields[i++]), adr = Math.Abs(double.Parse(fields[i++])), adr_std = double.Parse(fields[i++]), dopp = double.Parse(fields[i++]), snr = double.Parse(fields[i++]), locktime = float.Parse(fields[i++]), trackstat = new TrackStat(int.Parse(fields[i++], NumberStyles.HexNumber)) }; // Accept GPS, GLONASS, SBAS if (o.trackstat.SatelliteSystem > 2) { continue; } if (!ParseGLO && o.trackstat.SatelliteSystem == 1) { continue; } if (!ParseSBAS && o.trackstat.SatelliteSystem == 2) { continue; } if (!ParseL5 && o.trackstat.SignalType == 14) { continue; } // Throw out observations where parity is unknown if (!o.trackstat.ParityKnown) { continue; } // o.trackstat.SatelliteSystem: 0 = GPS, 1 = GLONASS, 2 = WAAS, 7 = Other char system = 'G'; // Default to GPS if (o.trackstat.SatelliteSystem == 1) { prn -= 37; // GLONASS PRN's are shown +37; fix. system = 'R'; } else if (o.trackstat.SatelliteSystem == 2) { prn -= 100; // SBAS should be reported -100, according to spec system = 'S'; } // Add observation to Sat, if already exists. Else create new Sat sat = e.Find(s => (s.PRN == prn && s.System == system)); if (sat == null) { sat = new Sat(system, prn); e.Add(sat); } if (o.trackstat.PrimaryL1) { if (o.trackstat.SignalType == 14) { sat.L5 = o; } else { // If a sat is manually assigned to a channel, we might see more than one observation of each type for the same sat. if (sat.L1 != null) { Console.Error.WriteLine("Observation on L1 for PRN {0} already parsed!", prn); } sat.L1 = o; } } else { if (sat.L2 != null) { Console.Error.WriteLine("Observation on L2 for PRN {0} already parsed!", prn); } sat.L2 = o; } } return(e); }