示例#1
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);
        }
示例#2
0
        public void TestSerialNumber()
        {
            string nmea = "$PRTI02,379550,1,1468,-99999,-99999,-99999,0,,,,,0004*0A";

            // Create Sentence
            Prti02Sentence sent = new Prti02Sentence(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);

            // Create a serial number
            string       serialStr = "01300000000000000000000000000001";
            SerialNumber serialNum = new SerialNumber(serialStr);

            // Set the serial number
            adcpData.EnsembleData.SysSerialNumber = serialNum;

            // Test the serial number
            Assert.AreEqual(serialNum, adcpData.EnsembleData.SysSerialNumber, string.Format("Serial numbers did not match"));
            Assert.AreEqual(serialStr, adcpData.EnsembleData.SysSerialNumber.ToString(), string.Format("Serial number strings did not match {0}  {1}", serialStr, adcpData.EnsembleData.SysSerialNumber.ToString()));
            Assert.AreEqual(1, adcpData.EnsembleData.SysSerialNumber.SubSystemsList.Count, string.Format("Number of SubSystems did not match 1 {0}", adcpData.EnsembleData.SysSerialNumber.SubSystemsList.Count));
        }
示例#3
0
        public void TestConstructorPrti02Sentence()
        {
            string nmea = "$PRTI02,1000,1,1468,-99999,-99999,-99999,0,,,,,0004*06";

            // Create Sentence
            Prti02Sentence sent = new Prti02Sentence(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());
        }
示例#4
0
        public void TestConstructorPrti02Sentence()
        {
            string nmea = "$PRTI02,379550,1,1468,-99999,-99999,-99999,0,,,,,0004*0A";

            // Create Sentence
            Prti02Sentence sent = new Prti02Sentence(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");
        }
示例#5
0
        /// <summary>
        /// Create the data set using PRTI02.
        /// Then send the dataset.
        /// </summary>
        /// <param name="sentence">PRTI02 Sentence.</param>
        private void SendData(Prti02Sentence sentence)
        {
            // Create the dataset
            DataSet.Ensemble adcpData = CreateDataSet(sentence);

            // Send the data set
            SendData(adcpData, sentence.ToByteArray());
        }
示例#6
0
        public void TestConstructorArg()
        {
            string nmea = "$PRTI02,379550,1,1468,-99999,-99999,-99999,0,,,,,0004,3,0*09";

            Prti02Sentence nm = new Prti02Sentence("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("$PRTI02", nm.CommandWord);
            Assert.AreEqual("09", nm.CorrectChecksum);
            Assert.AreEqual("09", 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.BottomTrackVelEast);
            Assert.AreEqual(Speed.BadDVL, nm.BottomTrackVelNorth);
            Assert.AreEqual(Speed.BadDVL, nm.BottomTrackVelUp);
            Assert.AreEqual(new Distance(0, DistanceUnit.Millimeters), nm.BottomTrackDepth);
            Assert.AreEqual(Speed.Empty, nm.WaterMassVelEast);
            Assert.AreEqual(Speed.Empty, nm.WaterMassVelNorth);
            Assert.AreEqual(Speed.Empty, nm.WaterMassVelUp);

            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
        public void TestConstructorArg()
        {
            string nmea = "$PRTI02,379550,1,1468,-99999,-99999,-99999,0,,,,,0004,3,0*09";

            Prti02Sentence nm = new Prti02Sentence("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("$PRTI02", nm.CommandWord);
            Assert.AreEqual("09", nm.CorrectChecksum);
            Assert.AreEqual("09", 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.BottomTrackVelEast);
            Assert.AreEqual(Speed.BadDVL, nm.BottomTrackVelNorth);
            Assert.AreEqual(Speed.BadDVL, nm.BottomTrackVelUp);
            Assert.AreEqual(new Distance(0, DistanceUnit.Millimeters), nm.BottomTrackDepth);
            Assert.AreEqual(Speed.Empty, nm.WaterMassVelEast);
            Assert.AreEqual(Speed.Empty, nm.WaterMassVelNorth);
            Assert.AreEqual(Speed.Empty, nm.WaterMassVelUp);

            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());
        }
示例#9
0
        /// <summary>
        /// Create a dataset.  Set the bottom track Earth velocity and water mass velocity.
        /// </summary>
        /// <param name="sentence">Sentence containing DVL data.</param>
        /// <returns>Dataset with values set.</returns>
        private DataSet.Ensemble CreateDataSet(Prti02Sentence 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.AddEarthWaterMassData(sentence);

            return(adcpData);
        }
示例#10
0
        public void TestConstructorPrti02Sentence()
        {
            string nmea = "$PRTI02,379550,1,1468,-99999,-99999,-99999,0,,,,,0004*0A";

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

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

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

            adcpData.AddEarthWaterMassData(sent);

            Assert.IsTrue(adcpData.IsEarthWaterMassAvail, "Earth Water Mass not added to dataset");

            Assert.AreEqual(adcpData.EarthWaterMassData.VelocityEast, DataSet.Ensemble.EMPTY_VELOCITY, "Earth Water Mass East not properly set.");
            Assert.AreEqual(adcpData.EarthWaterMassData.VelocityNorth, DataSet.Ensemble.EMPTY_VELOCITY, "Earth Water Mass North not properly set.");
            Assert.AreEqual(adcpData.EarthWaterMassData.VelocityVertical, DataSet.Ensemble.EMPTY_VELOCITY, "Earth Water Mass Vertical not properly set.");
            Assert.AreEqual(adcpData.EarthWaterMassData.WaterMassDepthLayer, 0, "Earth Water Mass Depth Layer not properly set.");
        }
示例#11
0
        public void TestConstructorPrti02Sentence()
        {
            string nmea = "$PRTI02,379550,1,1468,-99999,-99999,-99999,0,,,,,0004*0A";

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

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

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

            adcpData.AddEarthWaterMassData(sent);

            Assert.IsTrue(adcpData.IsEarthWaterMassAvail, "Earth Water Mass not added to dataset");

            Assert.AreEqual(adcpData.EarthWaterMassData.VelocityEast, DataSet.Ensemble.EMPTY_VELOCITY, "Earth Water Mass East not properly set.");
            Assert.AreEqual(adcpData.EarthWaterMassData.VelocityNorth, DataSet.Ensemble.EMPTY_VELOCITY, "Earth Water Mass North not properly set.");
            Assert.AreEqual(adcpData.EarthWaterMassData.VelocityVertical, DataSet.Ensemble.EMPTY_VELOCITY, "Earth Water Mass Vertical not properly set.");
            Assert.AreEqual(adcpData.EarthWaterMassData.WaterMassDepthLayer, 0, "Earth Water Mass Depth Layer not properly set.");
        }
示例#12
0
        public void TestConstructorPrti02SentenceData()
        {
            string nmea = "$PRTI02,379550,1,1468,-99999,-99999,-99999,0,300,-200,400,100,0004*23";

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

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

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

            adcpData.AddEarthWaterMassData(sent);

            Assert.IsTrue(adcpData.IsEarthWaterMassAvail, "Earth Water Mass not added to dataset");

            Assert.AreEqual((new DotSpatial.Positioning.Speed(300, DotSpatial.Positioning.SpeedUnit.MillimetersPerSecond)).ToMetersPerSecond().Value, adcpData.EarthWaterMassData.VelocityEast, 0.00001, "Earth Water Mass East not properly set.");
            Assert.AreEqual((new DotSpatial.Positioning.Speed(-200, DotSpatial.Positioning.SpeedUnit.MillimetersPerSecond)).ToMetersPerSecond().Value, adcpData.EarthWaterMassData.VelocityNorth, 0.00001, "Earth Water Mass North not properly set.");
            Assert.AreEqual((new DotSpatial.Positioning.Speed(400, DotSpatial.Positioning.SpeedUnit.MillimetersPerSecond)).ToMetersPerSecond().Value, adcpData.EarthWaterMassData.VelocityVertical, 0.00001, "Earth Water Mass Vertical not properly set.");
            Assert.AreEqual((new DotSpatial.Positioning.Distance(100, DotSpatial.Positioning.DistanceUnit.Millimeters)).ToMeters().Value, adcpData.EarthWaterMassData.WaterMassDepthLayer, 0.00001, "Earth Water Mass Depth Layer not properly set.");
        }
示例#13
0
        public void TestConstructorPrti02Sentence1()
        {
            string nmea = "$PRTI02,380250,8,1464,1142,323,407,79380,,,,,0000*1C";

            // Create sentence
            Prti02Sentence sent = new Prti02Sentence(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.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(sent.SystemStatus.Value, adcpData.BottomTrackData.Status.Value, "Bottom Track Instrument Status incorrect");
        }
示例#14
0
        public void TestConstructorPrti02Sentence()
        {
            string nmea = "$PRTI02,379550,1,1468,-99999,-99999,-99999,0,,,,,0004*0A";

            // Create Sentence
            Prti02Sentence sent = new Prti02Sentence(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.EarthVelocity[0], "Bottom Track Earth Velocity East incorrect");
            Assert.AreEqual(DataSet.Ensemble.BAD_VELOCITY, adcpData.BottomTrackData.EarthVelocity[1], "Bottom Track Earth Velocity North incorrect");
            Assert.AreEqual(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(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
        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");
        }
示例#16
0
        public void TestConstructorPrti02Sentence()
        {
            string nmea = "$PRTI02,379550,1,1468,-99999,-99999,-99999,0,,,,,0004*0A";

            // Create Sentence
            Prti02Sentence sent = new Prti02Sentence(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");
        }
示例#17
0
        public void TestConstructorPrti02Sentence()
        {
            string nmea = "$PRTI02,1000,1,1468,-99999,-99999,-99999,0,,,,,0004*06";

            // Create Sentence
            Prti02Sentence sent = new Prti02Sentence(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());
        }
示例#18
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);
        }
示例#19
0
        /// <summary>
        /// Create the data set using PRTI02.
        /// Then send the dataset.
        /// </summary>
        /// <param name="sentence">PRTI02 Sentence.</param>
        private void SendData(Prti02Sentence sentence)
        {
            // Create the dataset
            DataSet.Ensemble adcpData = CreateDataSet(sentence);

            // Send the data set
            SendData(adcpData, sentence.ToByteArray());
        }
示例#20
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);
            }
        }
示例#21
0
        /// <summary>
        /// Create a dataset.  Set the bottom track Earth velocity and water mass velocity.
        /// </summary>
        /// <param name="sentence">Sentence containing DVL data.</param>
        /// <returns>Dataset with values set.</returns>
        private DataSet.Ensemble CreateDataSet(Prti02Sentence 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.AddEarthWaterMassData(sentence);

            return adcpData;
        }
示例#22
0
        public void TestConstructorPrti02SentenceData()
        {
            string nmea = "$PRTI02,379550,1,1468,-99999,-99999,-99999,0,300,-200,400,100,0004*23";

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

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

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

            adcpData.AddEarthWaterMassData(sent);

            Assert.IsTrue(adcpData.IsEarthWaterMassAvail, "Earth Water Mass not added to dataset");

            Assert.AreEqual((new DotSpatial.Positioning.Speed(300, DotSpatial.Positioning.SpeedUnit.MillimetersPerSecond)).ToMetersPerSecond().Value, adcpData.EarthWaterMassData.VelocityEast, 0.00001, "Earth Water Mass East not properly set.");
            Assert.AreEqual((new DotSpatial.Positioning.Speed(-200, DotSpatial.Positioning.SpeedUnit.MillimetersPerSecond)).ToMetersPerSecond().Value, adcpData.EarthWaterMassData.VelocityNorth, 0.00001, "Earth Water Mass North not properly set.");
            Assert.AreEqual((new DotSpatial.Positioning.Speed(400, DotSpatial.Positioning.SpeedUnit.MillimetersPerSecond)).ToMetersPerSecond().Value, adcpData.EarthWaterMassData.VelocityVertical, 0.00001, "Earth Water Mass Vertical not properly set.");
            Assert.AreEqual((new DotSpatial.Positioning.Distance(100, DotSpatial.Positioning.DistanceUnit.Millimeters)).ToMeters().Value, adcpData.EarthWaterMassData.WaterMassDepthLayer, 0.00001, "Earth Water Mass Depth Layer not properly set.");
        }
示例#23
0
        public void TestSerialNumber()
        {
            string nmea = "$PRTI02,379550,1,1468,-99999,-99999,-99999,0,,,,,0004*0A";

            // Create Sentence
            Prti02Sentence sent = new Prti02Sentence(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);

            // Create a serial number
            string serialStr = "01300000000000000000000000000001";
            SerialNumber serialNum = new SerialNumber(serialStr);

            // Set the serial number
            adcpData.EnsembleData.SysSerialNumber = serialNum;

            // Test the serial number
            Assert.AreEqual(serialNum, adcpData.EnsembleData.SysSerialNumber, string.Format("Serial numbers did not match"));
            Assert.AreEqual(serialStr, adcpData.EnsembleData.SysSerialNumber.ToString(), string.Format("Serial number strings did not match {0}  {1}", serialStr, adcpData.EnsembleData.SysSerialNumber.ToString()));
            Assert.AreEqual(1, adcpData.EnsembleData.SysSerialNumber.SubSystemsList.Count, string.Format("Number of SubSystems did not match 1 {0}", adcpData.EnsembleData.SysSerialNumber.SubSystemsList.Count));
        }
示例#24
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;
        }
示例#25
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);
        }