Пример #1
0
        public void TestConstructorPrti01Sentence()
        {
            string nmea = "$PRTI01,1000,1,1468,-99999,-99999,-99999,0,,,,,0004*05";

            // Create Sentence
            Prti01Sentence sent = new Prti01Sentence(nmea);

            Assert.AreEqual(true, sent.IsValid, "NMEA sentence incorrect");

            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            // Add Sentence to data set
            adcpData.AddEnsembleData(sent);

            // Check Ensemble number
            Assert.AreEqual(1, adcpData.EnsembleData.EnsembleNumber);

            // Check number of beams
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, adcpData.EnsembleData.NumBeams, "Number of beams is Incorrect");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_NONBEAM, adcpData.EnsembleData.ElementsMultiplier, "Number of beams is Incorrect");

            // Check number of bins
            Assert.AreEqual(0, adcpData.EnsembleData.NumBins);

            // Check time
            Assert.AreEqual(1000, sent.StartTime, "NMEA start time incorrect");
            Assert.AreEqual(DateTime.Now.Hour, adcpData.EnsembleData.EnsDateTime.Hour, "Incorrect Ensemble time in Hours " + adcpData.EnsembleData.EnsDateTime.ToString());
            Assert.AreEqual(DateTime.Now.Minute, adcpData.EnsembleData.EnsDateTime.Minute, "Incorrect Ensemble time in Minutes " + adcpData.EnsembleData.EnsDateTime.ToString());
            Assert.AreEqual(DateTime.Now.Second, adcpData.EnsembleData.EnsDateTime.Second, "Incorrect Ensemble time in Seconds " + adcpData.EnsembleData.EnsDateTime.ToString());
            Assert.AreEqual(DateTime.Now.Millisecond, adcpData.EnsembleData.EnsDateTime.Millisecond, "Incorrect Ensemble time in Milliseconds " + adcpData.EnsembleData.EnsDateTime.ToString());
        }
Пример #2
0
        public void TestConstructorPrti01Sentence()
        {
            string nmea = "$PRTI01,379550,1,1468,-99999,-99999,-99999,0,,,,,0004*09";

            // Create Sentence
            Prti01Sentence sent = new Prti01Sentence(nmea);

            Assert.AreEqual(true, sent.IsValid, "NMEA sentence incorrect");

            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            // Add ancillary data
            adcpData.AddAncillaryData(sent);

            Assert.AreEqual(true, adcpData.IsAncillaryAvail, "Ancillary data not created");

            // Check temperature
            Assert.AreEqual(14.68, adcpData.AncillaryData.WaterTemp, 0.00001, "Water Temperature was incorrect");

            Assert.AreEqual(0, adcpData.AncillaryData.FirstBinRange, "First Bin Range was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.BinSize, "Bin Size was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.FirstPingTime, "First Ping Time was incorrect");
            Assert.AreEqual(3795, adcpData.AncillaryData.LastPingTime, "Last Ping Time was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.Heading, "Heading was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.Pitch, "Pitch was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.Roll, "Roll was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.SystemTemp, "System Temp was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.Salinity, "Salinity was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.Pressure, "Pressure was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.TransducerDepth, "Transducer Depth was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.SpeedOfSound, "Speed Of Sound was incorrect");
        }
Пример #3
0
        /// <summary>
        /// Create the data set using PRTI01.  Then add PRTI02 to the
        /// dataset.  Then send the dataset.
        /// </summary>
        /// <param name="prti01">PRTI01 Sentence.</param>
        /// <param name="prti02">PRTI02 Sentence.</param>
        /// <param name="prti03">PRTI03 Sentence.</param>
        /// <param name="prti30">PRTI30 Sentence.</param>
        /// <param name="prti31">PRTI31 Sentence.</param>
        /// <param name="nmeaBuffer">NMEA buffer.</param>
        /// <returns>Created ensemble.</returns>
        private DataSet.Ensemble CreateEnsemble(Prti01Sentence prti01, Prti02Sentence prti02, Prti03Sentence prti03 = null, Prti30Sentence prti30 = null, Prti31Sentence prti31 = null, List <string> nmeaBuffer = null)
        {
            // Create the dataset
            DataSet.Ensemble ensemble = CreateDataSet(prti01);

            if (prti02 != null)
            {
                ensemble.AddAdditionalBottomTrackData(prti02);
            }

            if (prti03 != null)
            {
                ensemble.AddAdditionalBottomTrackData(prti03);
            }

            if (prti30 != null)
            {
                ensemble.AddAdditionalAncillaryData(prti30);
                ensemble.AddAdditionalBottomTrackData(prti30);

                // Setup the serial number
                if (ensemble.IsEnsembleAvail)
                {
                    // Remove the temp serial number subsystem
                    ensemble.EnsembleData.SysSerialNumber.RemoveSubsystem(SerialNumber.DVL_Subsystem);

                    // Add the actual subsystem
                    ensemble.EnsembleData.SysSerialNumber.AddSubsystem(prti30.SubsystemConfig.SubSystem);
                }
            }

            if (prti31 != null)
            {
                ensemble.AddAdditionalAncillaryData(prti31);
                ensemble.AddAdditionalBottomTrackData(prti31);

                // Setup the serial number
                if (ensemble.IsEnsembleAvail)
                {
                    // Remove the temp serial number subsystem
                    ensemble.EnsembleData.SysSerialNumber.RemoveSubsystem(SerialNumber.DVL_Subsystem);

                    // Add the actual subsystem
                    ensemble.EnsembleData.SysSerialNumber.AddSubsystem(prti30.SubsystemConfig.SubSystem);
                }
            }

            if (nmeaBuffer != null)
            {
                StringBuilder sb = new StringBuilder();
                foreach (var nmea in nmeaBuffer)
                {
                    sb.Append(nmea);
                }

                ensemble.AddNmeaData(sb.ToString());
            }

            return(ensemble);
        }
Пример #4
0
        /// <summary>
        /// Create the data set using PRTI01.
        /// Then send the dataset.
        /// </summary>
        /// <param name="sentence">PRTI01 Sentence.</param>
        private void SendData(Prti01Sentence sentence)
        {
            // Create the dataset
            DataSet.Ensemble adcpData = CreateDataSet(sentence);

            // Send the data set
            SendData(adcpData, sentence.ToByteArray());
        }
Пример #5
0
        public void TestConstructorArg()
        {
            string nmea = "$PRTI01,379550,1,1468,-99999,-99999,-99999,0,,,,,0004,3,0*0A";
            //NmeaSentence sent = new NmeaSentence(nmea);

            Prti01Sentence nm = new Prti01Sentence("379550", "1", "1468",
                                                        Speed.BadDVL.Value.ToString(), Speed.BadDVL.Value.ToString(), Speed.BadDVL.Value.ToString(),
                                                        new Distance(0, DistanceUnit.Millimeters).Value.ToString(),
                                                        "", "", "",
                                                        "",
                                                        "0004", "3", "0");

            Assert.AreEqual(true, nm.IsValid);
            Assert.AreEqual(nmea, nm.Sentence);
            Assert.AreEqual("$PRTI01", nm.CommandWord);
            Assert.AreEqual("0A", nm.CorrectChecksum);
            Assert.AreEqual("0A", nm.ExistingChecksum);
            Assert.AreEqual(14, nm.Words.Length);

            Assert.AreEqual("379550", nm.Words[0]);
            Assert.AreEqual("1", nm.Words[1]);
            Assert.AreEqual("1468", nm.Words[2]);
            Assert.AreEqual("-99999", nm.Words[3]);
            Assert.AreEqual("-99999", nm.Words[4]);
            Assert.AreEqual("-99999", nm.Words[5]);
            Assert.AreEqual("0", nm.Words[6]);
            Assert.AreEqual("", nm.Words[7]);
            Assert.AreEqual("", nm.Words[8]);
            Assert.AreEqual("", nm.Words[9]);
            Assert.AreEqual("", nm.Words[10]);
            Assert.AreEqual("0004", nm.Words[11]);
            Assert.AreEqual("3", nm.Words[12]);
            Assert.AreEqual("0", nm.Words[13]);

            Assert.AreEqual(379550, nm.StartTime);
            Assert.AreEqual(1, nm.SampleNumber);
            Assert.AreEqual(1468, nm.Temperature);
            Assert.AreEqual(Speed.BadDVL, nm.BottomTrackVelX);
            Assert.AreEqual(Speed.BadDVL, nm.BottomTrackVelY);
            Assert.AreEqual(Speed.BadDVL, nm.BottomTrackVelZ);
            Assert.AreEqual(new Distance(0, DistanceUnit.Millimeters), nm.BottomTrackDepth);
            Assert.AreEqual(Speed.Empty, nm.WaterMassVelX);
            Assert.AreEqual(Speed.Empty, nm.WaterMassVelY);
            Assert.AreEqual(Speed.Empty, nm.WaterMassVelZ);

            Assert.AreEqual(false, nm.SystemStatus.IsBottomTrack3BeamSolution());
            Assert.AreEqual(true, nm.SystemStatus.IsBottomTrackHold());
            Assert.AreEqual(false, nm.SystemStatus.IsReceiverTimeout());
            Assert.AreEqual(false, nm.SystemStatus.IsWaterTrack3BeamSolution());
            Assert.AreEqual(false, nm.SystemStatus.IsBottomTrackSearching());
        }
Пример #6
0
        public void TestConstructorArg()
        {
            string nmea = "$PRTI01,379550,1,1468,-99999,-99999,-99999,0,,,,,0004,3,0*0A";
            //NmeaSentence sent = new NmeaSentence(nmea);

            Prti01Sentence nm = new Prti01Sentence("379550", "1", "1468",
                                                   Speed.BadDVL.Value.ToString(), Speed.BadDVL.Value.ToString(), Speed.BadDVL.Value.ToString(),
                                                   new Distance(0, DistanceUnit.Millimeters).Value.ToString(),
                                                   "", "", "",
                                                   "",
                                                   "0004", "3", "0");

            Assert.AreEqual(true, nm.IsValid);
            Assert.AreEqual(nmea, nm.Sentence);
            Assert.AreEqual("$PRTI01", nm.CommandWord);
            Assert.AreEqual("0A", nm.CorrectChecksum);
            Assert.AreEqual("0A", nm.ExistingChecksum);
            Assert.AreEqual(14, nm.Words.Length);

            Assert.AreEqual("379550", nm.Words[0]);
            Assert.AreEqual("1", nm.Words[1]);
            Assert.AreEqual("1468", nm.Words[2]);
            Assert.AreEqual("-99999", nm.Words[3]);
            Assert.AreEqual("-99999", nm.Words[4]);
            Assert.AreEqual("-99999", nm.Words[5]);
            Assert.AreEqual("0", nm.Words[6]);
            Assert.AreEqual("", nm.Words[7]);
            Assert.AreEqual("", nm.Words[8]);
            Assert.AreEqual("", nm.Words[9]);
            Assert.AreEqual("", nm.Words[10]);
            Assert.AreEqual("0004", nm.Words[11]);
            Assert.AreEqual("3", nm.Words[12]);
            Assert.AreEqual("0", nm.Words[13]);

            Assert.AreEqual(379550, nm.StartTime);
            Assert.AreEqual(1, nm.SampleNumber);
            Assert.AreEqual(1468, nm.Temperature);
            Assert.AreEqual(Speed.BadDVL, nm.BottomTrackVelX);
            Assert.AreEqual(Speed.BadDVL, nm.BottomTrackVelY);
            Assert.AreEqual(Speed.BadDVL, nm.BottomTrackVelZ);
            Assert.AreEqual(new Distance(0, DistanceUnit.Millimeters), nm.BottomTrackDepth);
            Assert.AreEqual(Speed.Empty, nm.WaterMassVelX);
            Assert.AreEqual(Speed.Empty, nm.WaterMassVelY);
            Assert.AreEqual(Speed.Empty, nm.WaterMassVelZ);

            Assert.AreEqual(false, nm.SystemStatus.IsBottomTrack3BeamSolution());
            Assert.AreEqual(true, nm.SystemStatus.IsBottomTrackHold());
            Assert.AreEqual(false, nm.SystemStatus.IsReceiverTimeout());
            Assert.AreEqual(false, nm.SystemStatus.IsWaterTrack3BeamSolution());
            Assert.AreEqual(false, nm.SystemStatus.IsBottomTrackSearching());
        }
Пример #7
0
        /// <summary>
        /// Decode the buffer.  This will create all the datasets based off
        /// the sentences.
        /// </summary>
        /// <param name="buffer">Buffer to decode.</param>
        private DataSet.Ensemble DecodeSentences(List <NmeaSentence> buffer)
        {
            Prti01Sentence prti01     = null;
            Prti02Sentence prti02     = null;
            Prti03Sentence prti03     = null;
            Prti30Sentence prti30     = null;
            Prti31Sentence prti31     = null;
            var            nmeaBuffer = new List <string>();

            foreach (var sentence in buffer)
            {
                // Check for PRTI01
                if (sentence.CommandWord.EndsWith(RTI.Prti01Sentence.CMD_WORD_PRTI01, StringComparison.Ordinal))
                {
                    // Store the sentence to be combined with PRTI01
                    prti01 = new Prti01Sentence(sentence.Sentence, sentence.CommandWord, sentence.Words, sentence.ExistingChecksum);
                }
                // Check for PRTI02
                else if (sentence.CommandWord.EndsWith(RTI.Prti02Sentence.CMD_WORD_PRTI02, StringComparison.Ordinal))
                {
                    prti02 = new Prti02Sentence(sentence.Sentence, sentence.CommandWord, sentence.Words, sentence.ExistingChecksum);
                }
                // Check for PRTI03
                else if (sentence.CommandWord.EndsWith(RTI.Prti03Sentence.CMD_WORD_PRTI03, StringComparison.Ordinal))
                {
                    // Store the sentence to be combined with PRTI02
                    prti03 = new Prti03Sentence(sentence.Sentence, sentence.CommandWord, sentence.Words, sentence.ExistingChecksum);
                }
                // Check for PRTI30
                else if (sentence.CommandWord.EndsWith(RTI.Prti30Sentence.CMD_WORD_PRTI30, StringComparison.Ordinal))
                {
                    // Store the sentence to be combined with PRTI01 and PRTI02
                    prti30 = new Prti30Sentence(sentence.Sentence, sentence.CommandWord, sentence.Words, sentence.ExistingChecksum);
                }
                // Check for PRTI31
                else if (sentence.CommandWord.EndsWith(RTI.Prti31Sentence.CMD_WORD_PRTI31, StringComparison.Ordinal))
                {
                    // Store the sentence to be combined with PRTI01 and PRTI02
                    prti31 = new Prti31Sentence(sentence.Sentence, sentence.CommandWord, sentence.Words, sentence.ExistingChecksum);
                }
                else
                {
                    // If the data was nether PRTI01 or PRTI02, then it must be GPS NMEA data and add it
                    // to the NMEA buffer to be processed with a complete dataset
                    nmeaBuffer.Add(sentence.Sentence + "\r\n");
                }
            }

            return(CreateEnsemble(prti01, prti02, prti03, prti30, prti31, nmeaBuffer));
        }
Пример #8
0
        /// <summary>
        /// Create a dataset.  Set the bottom track instrument velocity and water mass velocity.
        /// </summary>
        /// <param name="sentence">Sentence containing DVL data.</param>
        /// <returns>Dataset with values set.</returns>
        private DataSet.Ensemble CreateDataSet(Prti01Sentence sentence)
        {
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            // Add the Ensemble number to EnsembleDataSet
            adcpData.AddEnsembleData(sentence);

            // Add the Temp to AncillaryDataSet
            adcpData.AddAncillaryData(sentence);

            // Add Bottom Track data
            adcpData.AddBottomTrackData(sentence);

            // Add Water Mass data
            adcpData.AddInstrumentWaterMassData(sentence);

            return(adcpData);
        }
Пример #9
0
        /// <summary>
        /// Constructor
        /// Initialize any values.
        /// </summary>
        public AdcpDvlCodec()
        {
            // Initialize values
            //_adcpData = null;
            _prti01 = null;
            _buffer = "";

            // Default to use BT Heading, Pitch and Roll
            IsUseBtHpr = true;

            _nmeaBuffer = new LinkedList <string>();

            // Initialize the thread
            _continue               = true;
            _eventWaitData          = new EventWaitHandle(false, EventResetMode.AutoReset);
            _processDataThread      = new Thread(ProcessDataThread);
            _processDataThread.Name = "DVL Codec";
            _processDataThread.Start();
        }
Пример #10
0
        public void TestConstructorPrti01entenceData()
        {
            string nmea = "$PRTI01,379550,1,1468,-99999,-99999,-99999,0,300,-200,400,100,0004*20";

            // Create Sentence
            Prti01Sentence sent = new Prti01Sentence(nmea);

            Assert.AreEqual(true, sent.IsValid, "NMEA sentence incorrect");

            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            adcpData.AddInstrumentWaterMassData(sent);

            Assert.IsTrue(adcpData.IsInstrumentWaterMassAvail, "Instrument Water Mass not added to dataset");

            Assert.AreEqual((new DotSpatial.Positioning.Speed(300, DotSpatial.Positioning.SpeedUnit.MillimetersPerSecond)).ToMetersPerSecond().Value, adcpData.InstrumentWaterMassData.VelocityX, 0.00001, "Instrument Water Mass East not properly set.");
            Assert.AreEqual((new DotSpatial.Positioning.Speed(-200, DotSpatial.Positioning.SpeedUnit.MillimetersPerSecond)).ToMetersPerSecond().Value, adcpData.InstrumentWaterMassData.VelocityY, 0.00001, "Instrument Water Mass North not properly set.");
            Assert.AreEqual((new DotSpatial.Positioning.Speed(400, DotSpatial.Positioning.SpeedUnit.MillimetersPerSecond)).ToMetersPerSecond().Value, adcpData.InstrumentWaterMassData.VelocityZ, 0.00001, "Instrument Water Mass Vertical not properly set.");
            Assert.AreEqual((new DotSpatial.Positioning.Distance(100, DotSpatial.Positioning.DistanceUnit.Millimeters)).ToMeters().Value, adcpData.InstrumentWaterMassData.WaterMassDepthLayer, 0.00001, "Instrument Water Mass Depth Layer not properly set.");
        }
        public void TestConstructorPrti01entenceData()
        {
            string nmea = "$PRTI01,379550,1,1468,-99999,-99999,-99999,0,300,-200,400,100,0004*20";

            // Create Sentence
            Prti01Sentence sent = new Prti01Sentence(nmea);

            Assert.AreEqual(true, sent.IsValid, "NMEA sentence incorrect");

            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            adcpData.AddInstrumentWaterMassData(sent);

            Assert.IsTrue(adcpData.IsInstrumentWaterMassAvail, "Instrument Water Mass not added to dataset");

            Assert.AreEqual((new DotSpatial.Positioning.Speed(300, DotSpatial.Positioning.SpeedUnit.MillimetersPerSecond)).ToMetersPerSecond().Value, adcpData.InstrumentWaterMassData.VelocityX, 0.00001, "Instrument Water Mass East not properly set.");
            Assert.AreEqual((new DotSpatial.Positioning.Speed(-200, DotSpatial.Positioning.SpeedUnit.MillimetersPerSecond)).ToMetersPerSecond().Value, adcpData.InstrumentWaterMassData.VelocityY, 0.00001, "Instrument Water Mass North not properly set.");
            Assert.AreEqual((new DotSpatial.Positioning.Speed(400, DotSpatial.Positioning.SpeedUnit.MillimetersPerSecond)).ToMetersPerSecond().Value, adcpData.InstrumentWaterMassData.VelocityZ, 0.00001, "Instrument Water Mass Vertical not properly set.");
            Assert.AreEqual((new DotSpatial.Positioning.Distance(100, DotSpatial.Positioning.DistanceUnit.Millimeters)).ToMeters().Value, adcpData.InstrumentWaterMassData.WaterMassDepthLayer, 0.00001, "Instrument Water Mass Depth Layer not properly set.");
        }
        public void TestConstructorPrti01Sentence()
        {
            string nmea = "$PRTI01,379550,1,1468,-99999,-99999,-99999,0,,,,,0004*09";

            // Create Sentence
            Prti01Sentence sent = new Prti01Sentence(nmea);

            Assert.AreEqual(true, sent.IsValid, "NMEA sentence incorrect");

            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            adcpData.AddInstrumentWaterMassData(sent);

            Assert.IsTrue(adcpData.IsInstrumentWaterMassAvail, "Instrument Water Mass not added to dataset");

            Assert.AreEqual(adcpData.InstrumentWaterMassData.VelocityX, DataSet.Ensemble.EMPTY_VELOCITY, "Instrument Water Mass East not properly set.");
            Assert.AreEqual(adcpData.InstrumentWaterMassData.VelocityY, DataSet.Ensemble.EMPTY_VELOCITY, "Instrument Water Mass North not properly set.");
            Assert.AreEqual(adcpData.InstrumentWaterMassData.VelocityZ, DataSet.Ensemble.EMPTY_VELOCITY, "Instrument Water Mass Vertical not properly set.");
            Assert.AreEqual(adcpData.InstrumentWaterMassData.WaterMassDepthLayer, 0, "Instrument Water Mass Depth Layer not properly set.");
        }
Пример #13
0
        /// <summary>
        /// Create the data set using PRTI01.  Then add PRTI02 to the
        /// dataset.  Then send the dataset.
        /// </summary>
        /// <param name="prti01">PRTI01 Sentence.</param>
        /// <param name="prti02">PRTI02 Sentence.</param>
        /// <param name="prti30">PRTI30 Sentence.</param>
        /// <param name="prti31">PRTI31 Sentence.</param>
        private void SendData(Prti01Sentence prti01, Prti02Sentence prti02, Prti30Sentence prti30 = null, Prti31Sentence prti31 = null)
        {
            // Create the dataset
            DataSet.Ensemble adcpData = CreateDataSet(prti01);
            adcpData.AddAdditionalBottomTrackData(prti02);

            if (IsUseBtHpr)
            {
                if (prti30 != null)
                {
                    adcpData.AddAdditionalAncillaryData(prti30);
                    adcpData.AddAdditionalBottomTrackData(prti30);

                    // Setup the serial number
                    if (adcpData.IsEnsembleAvail)
                    {
                        // Remove the temp serial number subsystem
                        adcpData.EnsembleData.SysSerialNumber.RemoveSubsystem(SerialNumber.DVL_Subsystem);

                        // Add the actual subsystem
                        adcpData.EnsembleData.SysSerialNumber.AddSubsystem(prti30.SubsystemConfig.SubSystem);
                    }
                }
            }
            else
            {
                if (prti31 != null)
                {
                    adcpData.AddAdditionalAncillaryData(prti31);
                    adcpData.AddAdditionalBottomTrackData(prti31);

                    // Setup the serial number
                    if (adcpData.IsEnsembleAvail)
                    {
                        // Remove the temp serial number subsystem
                        adcpData.EnsembleData.SysSerialNumber.RemoveSubsystem(SerialNumber.DVL_Subsystem);

                        // Add the actual subsystem
                        adcpData.EnsembleData.SysSerialNumber.AddSubsystem(prti30.SubsystemConfig.SubSystem);
                    }
                }
            }

            // Combine all the messages and convert to a byte array
            string adcpMesg = "";
            if (prti01 != null)
            {
                adcpMesg += prti01.ToString();
            }
            if (prti02 != null)
            {
                adcpMesg += prti02.ToString();
            }
            if (prti30 != null)
            {
                adcpMesg += prti30.ToString();
            }
            if (prti31 != null)
            {
                adcpMesg += prti31.ToString();
            }
            byte[] adcpMesgBA = Encoding.ASCII.GetBytes(adcpMesg);

            // Send the data set
            SendData(adcpData, adcpMesgBA);
        }
Пример #14
0
        public void TestConstructorPrti01Sentence()
        {
            string nmea = "$PRTI01,379550,1,1468,-99999,-99999,-99999,0,,,,,0004*09";

            // Create Sentence
            Prti01Sentence sent = new Prti01Sentence(nmea);

            Assert.AreEqual(true, sent.IsValid, "NMEA sentence incorrect");

            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            // Add Bottom Track data
            adcpData.AddBottomTrackData(sent);

            Assert.AreEqual(true, adcpData.IsBottomTrackAvail);

            Assert.AreEqual(0, adcpData.BottomTrackData.Range[0], "Bottom Track Range B1 incorrect");
            Assert.AreEqual(0, adcpData.BottomTrackData.Range[1], "Bottom Track Range B2 incorrect");
            Assert.AreEqual(0, adcpData.BottomTrackData.Range[2], "Bottom Track Range B3 incorrect");
            Assert.AreEqual(0, adcpData.BottomTrackData.Range[3], "Bottom Track Range B4 incorrect");

            Assert.AreEqual(DataSet.Ensemble.BAD_VELOCITY, adcpData.BottomTrackData.InstrumentVelocity[0], "Bottom Track Instrument Velocity X incorrect");
            Assert.AreEqual(DataSet.Ensemble.BAD_VELOCITY, adcpData.BottomTrackData.InstrumentVelocity[1], "Bottom Track Instrument Velocity Y incorrect");
            Assert.AreEqual(DataSet.Ensemble.BAD_VELOCITY, adcpData.BottomTrackData.InstrumentVelocity[2], "Bottom Track Instrument Velocity Z incorrect");
            Assert.AreEqual(0, adcpData.BottomTrackData.InstrumentVelocity[3], "Bottom Track Instrument Velocity Q incorrect");

            Assert.AreEqual(0004, adcpData.BottomTrackData.Status.Value, "Bottom Track Instrument Status incorrect");
            Assert.AreEqual(sent.SystemStatus.Value, adcpData.BottomTrackData.Status.Value, "Bottom Track Instrument Status incorrect");
        }
Пример #15
0
        /// <summary>
        /// Process the valid NMEA sentence.  Check which 
        /// type of DVL message it is and create the data set.
        /// Then send the data set to the CurrentDataSetManager.
        /// </summary>
        /// <param name="sentence">Sentence to process.</param>
        private void ProcessSentence(NmeaSentence sentence)
        {
            // Check for PRTI01
            if (sentence.CommandWord.EndsWith(RTI.Prti01Sentence.CMD_WORD_PRTI01, StringComparison.Ordinal))
            {
                // Check if the previous PRTI01 was used
                // If it was not used, send the data
                if (_prti01 != null)
                {
                    SendData(_prti01);
                    _prti01 = null;
                }

                // Store the sentence to be combined with PRTI02
                _prti01 = new Prti01Sentence(sentence.Sentence, sentence.CommandWord, sentence.Words, sentence.ExistingChecksum);

            }
            // Check for PRTI02
            else if (sentence.CommandWord.EndsWith(RTI.Prti02Sentence.CMD_WORD_PRTI02, StringComparison.Ordinal))
            {
                Prti02Sentence prti02 = new Prti02Sentence(sentence.Sentence, sentence.CommandWord, sentence.Words, sentence.ExistingChecksum);

                // Check if the PRTI01 and PRTI02 match
                // If they match, combine and send
                // If they do not match, send PRTI02
                if (_prti01 != null && _prti01.SampleNumber == prti02.SampleNumber)
                {
                    SendData(_prti01, prti02, _prti30, _prti31);
                    _prti01 = null;
                }
                else
                {
                    SendData(prti02);
                }
            }
            // Check for PRTI03
            else if (sentence.CommandWord.EndsWith(RTI.Prti03Sentence.CMD_WORD_PRTI03, StringComparison.Ordinal))
            {
                // Store the sentence to be combined with PRTI02
                Prti03Sentence prti03 = new Prti03Sentence(sentence.Sentence, sentence.CommandWord, sentence.Words, sentence.ExistingChecksum);
                SendData(prti03);
            }
            // Check for PRTI30
            else if (sentence.CommandWord.EndsWith(RTI.Prti30Sentence.CMD_WORD_PRTI30, StringComparison.Ordinal))
            {
                // Store the sentence to be combined with PRTI01 and PRTI02
                _prti30 = new Prti30Sentence(sentence.Sentence, sentence.CommandWord, sentence.Words, sentence.ExistingChecksum);
            }
            // Check for PRTI31
            else if (sentence.CommandWord.EndsWith(RTI.Prti31Sentence.CMD_WORD_PRTI31, StringComparison.Ordinal))
            {
                // Store the sentence to be combined with PRTI01 and PRTI02
                _prti31 = new Prti31Sentence(sentence.Sentence, sentence.CommandWord, sentence.Words, sentence.ExistingChecksum);
            }
            else
            {
                // If the data was nether PRTI01 or PRTI02, then it must be GPS NMEA data and add it
                // to the NMEA buffer to be processed with a complete dataset
                AddNmeaData(sentence.Sentence + NMEA_END);
            }
        }
Пример #16
0
        /// <summary>
        /// Create the data set using PRTI01.
        /// Then send the dataset.
        /// </summary>
        /// <param name="sentence">PRTI01 Sentence.</param>
        private void SendData(Prti01Sentence sentence)
        {
            // Create the dataset
            DataSet.Ensemble adcpData = CreateDataSet(sentence);

            // Send the data set
            SendData(adcpData, sentence.ToByteArray());
        }
Пример #17
0
        /// <summary>
        /// Create a dataset.  Set the bottom track instrument velocity and water mass velocity.
        /// </summary>
        /// <param name="sentence">Sentence containing DVL data.</param>
        /// <returns>Dataset with values set.</returns>
        private DataSet.Ensemble CreateDataSet(Prti01Sentence sentence)
        {
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            // Add the Ensemble number to EnsembleDataSet
            adcpData.AddEnsembleData(sentence);

            // Add the Temp to AncillaryDataSet
            adcpData.AddAncillaryData(sentence);

            // Add Bottom Track data
            adcpData.AddBottomTrackData(sentence);

            // Add Water Mass data
            adcpData.AddInstrumentWaterMassData(sentence);

            return adcpData;
        }
Пример #18
0
        /// <summary>
        /// Constructor
        /// Initialize any values.
        /// </summary>
        public AdcpDvlCodec()
        {
            // Initialize values
            //_adcpData = null;
            _prti01 = null;

            // Default to use BT Heading, Pitch and Roll
            IsUseBtHpr = true;

            _nmeaBuffer = new LinkedList<string>();

            // Initialize the thread
            _continue = true;
            _eventWaitData = new EventWaitHandle(false, EventResetMode.AutoReset);
            _processDataThread = new Thread(ProcessDataThread);
            _processDataThread.Name = "DVL Codec";
            _processDataThread.Start();
        }
Пример #19
0
        public void TestConstructorPrti01Sentence()
        {
            string nmea = "$PRTI01,1000,1,1468,-99999,-99999,-99999,0,,,,,0004*05";

            // Create Sentence
            Prti01Sentence sent = new Prti01Sentence(nmea);

            Assert.AreEqual(true, sent.IsValid, "NMEA sentence incorrect");

            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            // Add Sentence to data set
            adcpData.AddEnsembleData(sent);

            // Check Ensemble number
            Assert.AreEqual(1, adcpData.EnsembleData.EnsembleNumber);

            // Check number of beams
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, adcpData.EnsembleData.NumBeams, "Number of beams is Incorrect");
            Assert.AreEqual(DataSet.Ensemble.DEFAULT_NUM_BEAMS_NONBEAM, adcpData.EnsembleData.ElementsMultiplier, "Number of beams is Incorrect");

            // Check number of bins
            Assert.AreEqual(0, adcpData.EnsembleData.NumBins);

            // Check time
            Assert.AreEqual(1000, sent.StartTime, "NMEA start time incorrect");
            Assert.AreEqual(DateTime.Now.Hour, adcpData.EnsembleData.EnsDateTime.Hour, "Incorrect Ensemble time in Hours " + adcpData.EnsembleData.EnsDateTime.ToString());
            Assert.AreEqual(DateTime.Now.Minute, adcpData.EnsembleData.EnsDateTime.Minute, "Incorrect Ensemble time in Minutes " + adcpData.EnsembleData.EnsDateTime.ToString());
            Assert.AreEqual(DateTime.Now.Second, adcpData.EnsembleData.EnsDateTime.Second, "Incorrect Ensemble time in Seconds " + adcpData.EnsembleData.EnsDateTime.ToString());
            Assert.AreEqual(DateTime.Now.Millisecond, adcpData.EnsembleData.EnsDateTime.Millisecond, "Incorrect Ensemble time in Milliseconds " + adcpData.EnsembleData.EnsDateTime.ToString());
        }
Пример #20
0
        public void TestConstructorPrti01Sentence()
        {
            string nmea = "$PRTI01,379550,1,1468,-99999,-99999,-99999,0,,,,,0004*09";

            // Create Sentence
            Prti01Sentence sent = new Prti01Sentence(nmea);

            Assert.AreEqual(true, sent.IsValid, "NMEA sentence incorrect");

            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            adcpData.AddInstrumentWaterMassData(sent);

            Assert.IsTrue(adcpData.IsInstrumentWaterMassAvail, "Instrument Water Mass not added to dataset");

            Assert.AreEqual(adcpData.InstrumentWaterMassData.VelocityX, DataSet.Ensemble.EMPTY_VELOCITY, "Instrument Water Mass East not properly set.");
            Assert.AreEqual(adcpData.InstrumentWaterMassData.VelocityY, DataSet.Ensemble.EMPTY_VELOCITY, "Instrument Water Mass North not properly set.");
            Assert.AreEqual(adcpData.InstrumentWaterMassData.VelocityZ, DataSet.Ensemble.EMPTY_VELOCITY, "Instrument Water Mass Vertical not properly set.");
            Assert.AreEqual(adcpData.InstrumentWaterMassData.WaterMassDepthLayer, 0, "Instrument Water Mass Depth Layer not properly set.");
        }
Пример #21
0
        public void TestConstructorPrti01Sentence()
        {
            string nmea = "$PRTI01,379550,1,1468,-99999,-99999,-99999,0,,,,,0004*09";

            // Create Sentence
            Prti01Sentence sent = new Prti01Sentence(nmea);

            Assert.AreEqual(true, sent.IsValid, "NMEA sentence incorrect");

            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            // Add ancillary data
            adcpData.AddAncillaryData(sent);

            Assert.AreEqual(true, adcpData.IsAncillaryAvail, "Ancillary data not created");

            // Check temperature
            Assert.AreEqual(14.68, adcpData.AncillaryData.WaterTemp, 0.00001, "Water Temperature was incorrect");

            Assert.AreEqual(0, adcpData.AncillaryData.FirstBinRange, "First Bin Range was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.BinSize, "Bin Size was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.FirstPingTime, "First Ping Time was incorrect");
            Assert.AreEqual(3795, adcpData.AncillaryData.LastPingTime, "Last Ping Time was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.Heading, "Heading was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.Pitch, "Pitch was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.Roll, "Roll was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.SystemTemp, "System Temp was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.Salinity, "Salinity was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.Pressure, "Pressure was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.TransducerDepth, "Transducer Depth was incorrect");
            Assert.AreEqual(0, adcpData.AncillaryData.SpeedOfSound, "Speed Of Sound was incorrect");
        }
Пример #22
0
        public void TestAddAdditional()
        {
            string nmea1 = "$PRTI01,380250,8,1464,-1205,-24,-347,79380,,,,,0000*05";
            string nmea2 = "$PRTI02,380250,8,1464,1142,323,407,79380,,,,,0000*1C";

            // Create sentence
            Prti01Sentence sent1 = new Prti01Sentence(nmea1);
            Prti02Sentence sent2 = new Prti02Sentence(nmea2);

            Assert.AreEqual(true, sent1.IsValid, "PRTI01 NMEA sentence incorrect: " + nmea1);
            Assert.AreEqual(true, sent2.IsValid, "PRTI02 NMEA sentence incorrect: " + nmea2);

            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            // Add Bottom Track data
            adcpData.AddBottomTrackData(sent1);
            adcpData.BottomTrackData.AddAdditionalBottomTrackData(sent2);

            Assert.AreEqual(true, adcpData.IsBottomTrackAvail, "Bottom Track DataSet not added");

            Assert.AreEqual(new DotSpatial.Positioning.Distance("79380 mm").ToMeters().Value, adcpData.BottomTrackData.Range[0], 0.00001, "Bottom Track Range B1 incorrect");
            Assert.AreEqual(new DotSpatial.Positioning.Distance("79380 mm").ToMeters().Value, adcpData.BottomTrackData.Range[1], 0.00001, "Bottom Track Range B2 incorrect");
            Assert.AreEqual(new DotSpatial.Positioning.Distance("79380 mm").ToMeters().Value, adcpData.BottomTrackData.Range[2], 0.00001, "Bottom Track Range B3 incorrect");
            Assert.AreEqual(new DotSpatial.Positioning.Distance("79380 mm").ToMeters().Value, adcpData.BottomTrackData.Range[3], 0.00001, "Bottom Track Range B4 incorrect");

            // Instrument data
            Assert.AreNotEqual(DataSet.Ensemble.BAD_VELOCITY, adcpData.BottomTrackData.InstrumentVelocity[0], "Bottom Track Instrument Velocity X incorrect");
            Assert.AreNotEqual(DataSet.Ensemble.BAD_VELOCITY, adcpData.BottomTrackData.InstrumentVelocity[1], "Bottom Track Instrument Velocity Y incorrect");
            Assert.AreNotEqual(DataSet.Ensemble.BAD_VELOCITY, adcpData.BottomTrackData.InstrumentVelocity[2], "Bottom Track Instrument Velocity Z incorrect");
            Assert.AreEqual(0, adcpData.BottomTrackData.InstrumentVelocity[3], "Bottom Track Instrument Velocity Q incorrect");

            Assert.AreEqual(Convert.ToSingle(new DotSpatial.Positioning.Speed("-1205 mm/s").ToMetersPerSecond().Value), adcpData.BottomTrackData.InstrumentVelocity[0], "Bottom Track Instrument Velocity X incorrect");
            Assert.AreEqual(Convert.ToSingle(new DotSpatial.Positioning.Speed("-24 mm/s").ToMetersPerSecond().Value), adcpData.BottomTrackData.InstrumentVelocity[1], "Bottom Track Instrument Velocity Y incorrect");
            Assert.AreEqual(Convert.ToSingle(new DotSpatial.Positioning.Speed("-347 mm/s").ToMetersPerSecond().Value), adcpData.BottomTrackData.InstrumentVelocity[2], "Bottom Track Instrument Velocity Z incorrect");

            // Earth data
            Assert.AreNotEqual(DataSet.Ensemble.BAD_VELOCITY, adcpData.BottomTrackData.EarthVelocity[0], "Bottom Track Earth Velocity East incorrect");
            Assert.AreNotEqual(DataSet.Ensemble.BAD_VELOCITY, adcpData.BottomTrackData.EarthVelocity[1], "Bottom Track Earth Velocity North incorrect");
            Assert.AreNotEqual(DataSet.Ensemble.BAD_VELOCITY, adcpData.BottomTrackData.EarthVelocity[2], "Bottom Track Earth Velocity Up incorrect");
            Assert.AreEqual(0, adcpData.BottomTrackData.EarthVelocity[3], "Bottom Track Earth Velocity Q incorrect");

            Assert.AreEqual(Convert.ToSingle(new DotSpatial.Positioning.Speed("1142 mm/s").ToMetersPerSecond().Value), adcpData.BottomTrackData.EarthVelocity[0], "Bottom Track Earth Velocity East incorrect");
            Assert.AreEqual(Convert.ToSingle(new DotSpatial.Positioning.Speed("323 mm/s").ToMetersPerSecond().Value), adcpData.BottomTrackData.EarthVelocity[1], "Bottom Track Earth Velocity North incorrect");
            Assert.AreEqual(Convert.ToSingle(new DotSpatial.Positioning.Speed("407 mm/s").ToMetersPerSecond().Value), adcpData.BottomTrackData.EarthVelocity[2], "Bottom Track Earth Velocity Up incorrect");

            Assert.AreEqual(0000, adcpData.BottomTrackData.Status.Value, "Bottom Track Instrument Status incorrect");
            Assert.AreEqual(sent1.SystemStatus.Value, adcpData.BottomTrackData.Status.Value, "Bottom Track Instrument Status incorrect");
            Assert.AreEqual(sent2.SystemStatus.Value, adcpData.BottomTrackData.Status.Value, "Bottom Track Instrument Status incorrect");
        }
Пример #23
0
        /// <summary>
        /// Create the data set using PRTI01.  Then add PRTI02 to the
        /// dataset.  Then send the dataset.
        /// </summary>
        /// <param name="prti01">PRTI01 Sentence.</param>
        /// <param name="prti02">PRTI02 Sentence.</param>
        /// <param name="prti30">PRTI30 Sentence.</param>
        /// <param name="prti31">PRTI31 Sentence.</param>
        private void SendData(Prti01Sentence prti01, Prti02Sentence prti02, Prti30Sentence prti30 = null, Prti31Sentence prti31 = null)
        {
            // Create the dataset
            DataSet.Ensemble adcpData = CreateDataSet(prti01);
            adcpData.AddAdditionalBottomTrackData(prti02);

            if (IsUseBtHpr)
            {
                if (prti30 != null)
                {
                    adcpData.AddAdditionalAncillaryData(prti30);
                    adcpData.AddAdditionalBottomTrackData(prti30);

                    // Setup the serial number
                    if (adcpData.IsEnsembleAvail)
                    {
                        // Remove the temp serial number subsystem
                        adcpData.EnsembleData.SysSerialNumber.RemoveSubsystem(SerialNumber.DVL_Subsystem);

                        // Add the actual subsystem
                        adcpData.EnsembleData.SysSerialNumber.AddSubsystem(prti30.SubsystemConfig.SubSystem);
                    }
                }
            }
            else
            {
                if (prti31 != null)
                {
                    adcpData.AddAdditionalAncillaryData(prti31);
                    adcpData.AddAdditionalBottomTrackData(prti31);

                    // Setup the serial number
                    if (adcpData.IsEnsembleAvail)
                    {
                        // Remove the temp serial number subsystem
                        adcpData.EnsembleData.SysSerialNumber.RemoveSubsystem(SerialNumber.DVL_Subsystem);

                        // Add the actual subsystem
                        adcpData.EnsembleData.SysSerialNumber.AddSubsystem(prti30.SubsystemConfig.SubSystem);
                    }
                }
            }

            // Combine all the messages and convert to a byte array
            string adcpMesg = "";

            if (prti01 != null)
            {
                adcpMesg += prti01.ToString();
            }
            if (prti02 != null)
            {
                adcpMesg += prti02.ToString();
            }
            if (prti30 != null)
            {
                adcpMesg += prti30.ToString();
            }
            if (prti31 != null)
            {
                adcpMesg += prti31.ToString();
            }
            byte[] adcpMesgBA = Encoding.ASCII.GetBytes(adcpMesg);

            // Send the data set
            SendData(adcpData, adcpMesgBA);
        }
Пример #24
0
        public void TestConstructorPrti01Sentence1()
        {
            string nmea = "$PRTI01,380250,8,1464,-1205,-24,-347,79380,,,,,0000*05";

            // Create sentence
            Prti01Sentence sent = new Prti01Sentence(nmea);

            Assert.AreEqual(true, sent.IsValid, "NMEA sentence incorrect");

            // Create dataset
            DataSet.Ensemble adcpData = new DataSet.Ensemble();

            // Add Bottom Track data
            adcpData.AddBottomTrackData(sent);

            Assert.AreEqual(true, adcpData.IsBottomTrackAvail, "Bottom Track DataSet not added");

            Assert.AreEqual(new DotSpatial.Positioning.Distance("79380 mm").ToMeters().Value, adcpData.BottomTrackData.Range[0], 0.00001, "Bottom Track Range B1 incorrect");
            Assert.AreEqual(new DotSpatial.Positioning.Distance("79380 mm").ToMeters().Value, adcpData.BottomTrackData.Range[1], 0.00001, "Bottom Track Range B2 incorrect");
            Assert.AreEqual(new DotSpatial.Positioning.Distance("79380 mm").ToMeters().Value, adcpData.BottomTrackData.Range[2], 0.00001, "Bottom Track Range B3 incorrect");
            Assert.AreEqual(new DotSpatial.Positioning.Distance("79380 mm").ToMeters().Value, adcpData.BottomTrackData.Range[3], 0.00001, "Bottom Track Range B4 incorrect");

            Assert.AreNotEqual(DataSet.Ensemble.BAD_VELOCITY, adcpData.BottomTrackData.InstrumentVelocity[0], "Bottom Track Instrument Velocity X incorrect");
            Assert.AreNotEqual(DataSet.Ensemble.BAD_VELOCITY, adcpData.BottomTrackData.InstrumentVelocity[1], "Bottom Track Instrument Velocity Y incorrect");
            Assert.AreNotEqual(DataSet.Ensemble.BAD_VELOCITY, adcpData.BottomTrackData.InstrumentVelocity[2], "Bottom Track Instrument Velocity Z incorrect");
            Assert.AreEqual(0, adcpData.BottomTrackData.InstrumentVelocity[3], "Bottom Track Instrument Velocity Q incorrect");

            Assert.AreEqual(Convert.ToSingle(new DotSpatial.Positioning.Speed("-1205 mm/s").ToMetersPerSecond().Value), adcpData.BottomTrackData.InstrumentVelocity[0], "Bottom Track Instrument Velocity X incorrect");
            Assert.AreEqual(Convert.ToSingle(new DotSpatial.Positioning.Speed("-24 mm/s").ToMetersPerSecond().Value), adcpData.BottomTrackData.InstrumentVelocity[1], "Bottom Track Instrument Velocity Y incorrect");
            Assert.AreEqual(Convert.ToSingle(new DotSpatial.Positioning.Speed("-347 mm/s").ToMetersPerSecond().Value), adcpData.BottomTrackData.InstrumentVelocity[2], "Bottom Track Instrument Velocity Z incorrect");

            Assert.AreEqual(0000, adcpData.BottomTrackData.Status.Value, "Bottom Track Instrument Status incorrect");
            Assert.AreEqual(sent.SystemStatus.Value, adcpData.BottomTrackData.Status.Value, "Bottom Track Instrument Status incorrect");
        }
Пример #25
0
        /// <summary>
        /// Process the valid NMEA sentence.  Check which
        /// type of DVL message it is and create the data set.
        /// Then send the data set to the CurrentDataSetManager.
        /// </summary>
        /// <param name="sentence">Sentence to process.</param>
        private void ProcessSentence(NmeaSentence sentence)
        {
            // Check for PRTI01
            if (sentence.CommandWord.EndsWith(RTI.Prti01Sentence.CMD_WORD_PRTI01, StringComparison.Ordinal))
            {
                // Check if the previous PRTI01 was used
                // If it was not used, send the data
                if (_prti01 != null)
                {
                    SendData(_prti01);
                    _prti01 = null;
                }

                // Store the sentence to be combined with PRTI02
                _prti01 = new Prti01Sentence(sentence.Sentence, sentence.CommandWord, sentence.Words, sentence.ExistingChecksum);
            }
            // Check for PRTI02
            else if (sentence.CommandWord.EndsWith(RTI.Prti02Sentence.CMD_WORD_PRTI02, StringComparison.Ordinal))
            {
                Prti02Sentence prti02 = new Prti02Sentence(sentence.Sentence, sentence.CommandWord, sentence.Words, sentence.ExistingChecksum);

                // Check if the PRTI01 and PRTI02 match
                // If they match, combine and send
                // If they do not match, send PRTI02
                if (_prti01 != null && _prti01.SampleNumber == prti02.SampleNumber)
                {
                    SendData(_prti01, prti02, _prti30, _prti31);
                    _prti01 = null;
                }
                else
                {
                    SendData(prti02);
                }
            }
            // Check for PRTI03
            else if (sentence.CommandWord.EndsWith(RTI.Prti03Sentence.CMD_WORD_PRTI03, StringComparison.Ordinal))
            {
                // Store the sentence to be combined with PRTI02
                Prti03Sentence prti03 = new Prti03Sentence(sentence.Sentence, sentence.CommandWord, sentence.Words, sentence.ExistingChecksum);
                SendData(prti03);
            }
            // Check for PRTI30
            else if (sentence.CommandWord.EndsWith(RTI.Prti30Sentence.CMD_WORD_PRTI30, StringComparison.Ordinal))
            {
                // Store the sentence to be combined with PRTI01 and PRTI02
                _prti30 = new Prti30Sentence(sentence.Sentence, sentence.CommandWord, sentence.Words, sentence.ExistingChecksum);
            }
            // Check for PRTI31
            else if (sentence.CommandWord.EndsWith(RTI.Prti31Sentence.CMD_WORD_PRTI31, StringComparison.Ordinal))
            {
                // Store the sentence to be combined with PRTI01 and PRTI02
                _prti31 = new Prti31Sentence(sentence.Sentence, sentence.CommandWord, sentence.Words, sentence.ExistingChecksum);
            }
            else
            {
                // If the data was nether PRTI01 or PRTI02, then it must be GPS NMEA data and add it
                // to the NMEA buffer to be processed with a complete dataset
                AddNmeaData(sentence.Sentence + NMEA_END);
            }

            // Reset the incoming data timeout
            _incomingDataTimeout = 0;
        }