public void TestCorrelationBeam3Decode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[35] = 0x4C; bt.Decode(data); Assert.AreEqual(76, bt.BtCorrelationMagnitudeBeam3, "Correlation Beam 3 Decode is incorrect."); }
public void TestRSSIBeam3Decode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[75] = 0x4C; bt.Decode(data); Assert.AreEqual(76 * 0.45f, bt.BtRssiBeam3, "RSSI Beam 3 Decode is incorrect."); }
public void TestVelocityBeam3Decode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[30] = 0xF3; data[31] = 0x02; bt.Decode(data); Assert.AreEqual(755, bt.BtVelocityBeam3, "Velocity Beam 3 Decode is incorrect."); }
public void TestPercentGoodBeam2Decode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[42] = 0x4C; bt.Decode(data); Assert.AreEqual(76, bt.BtPercentGoodBeam2, "Percent Good Beam 2 Decode is incorrect."); }
public void TestReserved82_85Decode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[81] = 0x9B; data[82] = 0x0D; data[83] = 0x02; data[84] = 0x00; bt.Decode(data); Assert.AreEqual(134555, bt.Reserved82_85, "Reserved 82-85 Decode is incorrect."); }
public void TestErrVelMaxDecode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[10] = 0xF3; data[11] = 0x02; bt.Decode(data); Assert.AreEqual(755, bt.BtErrVelMax, "Error Velocity Max Decode is incorrect."); }
public void TestGainDecode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[76] = 0xF3; bt.Decode(data); Assert.AreEqual(243, bt.BtGain, "Gain Decode is incorrect."); }
public void TestRefLayerEchoIntensityBeam2Decode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[64] = 0x4C; bt.Decode(data); Assert.AreEqual(76, bt.BtRefLayerEchoIntensityBeam2, "Reference Layer Echo Intensity Beam 2 Decode is incorrect."); }
public void TestAmplitudeBeam2Decode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[38] = 0x4C; bt.Decode(data); Assert.AreEqual(76, bt.BtAmplitudeBeam2, "Amplitude Beam 2 Decode is incorrect."); }
public void TestRangeMsbBeam3Decode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[80] = 0x4C; bt.Decode(data); Assert.AreEqual(76, bt.BtRangeMsbBeam3, "Range MSB Beam 3 Decode is incorrect."); }
public void TestRefLayerCorrelationBeam1Decode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[59] = 0x4C; bt.Decode(data); Assert.AreEqual(76, bt.BtRefLayerCorrBeam1, "Reference Layer Correlation Beam 1 Decode is incorrect."); }
public void TestRangeLsbBeam3Decode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[22] = 0xF3; data[23] = 0x02; bt.Decode(data); Assert.AreEqual(755, bt.BtRangeLsbBeam3, "Range LSB Beam 3 Decode is incorrect."); }
public void TestPingsPerEnsembleDecode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[2] = 0xF3; data[3] = 0x02; bt.Decode(data); Assert.AreEqual(755, bt.BtPingsPerEnsemble, "Pings Per Ensemble Decode is incorrect."); }
public void TestPercentGoodMinDecode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[8] = 0xF3; bt.Decode(data); Assert.AreEqual(243, bt.BtPercentGoodMin, "Percent Good Minimum Decode is incorrect."); }
public void TestCorrMagMinDecode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[6] = 0xF3; bt.Decode(data); Assert.AreEqual(243, bt.BtCorrMagMin, "Correlation Magnitude Minimum Decode is incorrect."); }
public void TestRefLayerPercentGoodBeam3Decode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[69] = 0x4C; bt.Decode(data); Assert.AreEqual(76, bt.BtRefLayerPercentGoodBeam3, "Reference Layer Percent Good Beam 3 Decode is incorrect."); }
public void TestDelayBeforeReacquireDecode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[4] = 0xF3; data[5] = 0x02; bt.Decode(data); Assert.AreEqual(755, bt.BtDelayBeforeReacquire, "Delay Before Reacquire Decode is incorrect."); }
public void TestRefLayerVelocityBeam2Decode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[54] = 0xF3; data[55] = 0x02; bt.Decode(data); Assert.AreEqual(755, bt.BtRefLayerVelocityBeam2, "Reference Layer Velocity Beam 2 Decode is incorrect."); }
public void TestEvalAmpMinDecode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[7] = 0xF3; bt.Decode(data); Assert.AreEqual(243, bt.BtEvalAmpMin, "Evaluation Amplitude Minimum Decode is incorrect."); }
public void TestReserved13_16Decode() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[12] = 0x9B; data[13] = 0x0D; data[14] = 0x02; data[15] = 0x00; bt.Decode(data); Assert.AreEqual(134555, bt.Reserved13_16, "Reserved 13-16 Decode is incorrect."); }
public void TestGetRangeBeam0() { Pd0BottomTrack bt = new Pd0BottomTrack(); byte[] data = new byte[Pd0BottomTrack.DATATYPE_SIZE]; // Decode the data data[16] = 0x39; // LSB LSB data[17] = 0x30; // LSB MSB (12345) data[77] = 0x4C; // MSB (76) bt.Decode(data); // (76 * 65535 ) + 12345 = 4980736 + 12345 = 4993081 Assert.AreEqual(4993005, bt.GetRangeBeam0(), "GetRangeBeam0() is incorrect."); }
public void TestDecodeVelocityPgCorrEiBt() { PD0 pd0 = new PD0(); pd0.FixedLeader.NumberOfCells = 5; #region Velocity Pd0Velocity vel = new Pd0Velocity(); // 2 Byte Header // 8 Bytes per depth cell // 4 Beams per depth cell // 2 Bytes per beam byte[] velData = new byte[42]; velData[0] = Pd0Velocity.ID_LSB; velData[1] = Pd0Velocity.ID_MSB; velData[2] = 0xE8; // DS0 Beam 0 LSB velData[3] = 0x00; // DS0 Beam 0 MSB velData[4] = 0xBD; // DS0 Beam 1 LSB velData[5] = 0xFE; // DS0 Beam 1 MSB velData[6] = 0xC8; // DS0 Beam 2 LSB velData[7] = 0x01; // DS0 Beam 2 MSB velData[8] = 0x72; // DS0 Beam 3 LSB velData[9] = 0xFD; // DS0 Beam 3 MSB velData[(4 * 8) + 2 + 0] = 0xD0; // DS4 Beam 0 LSB velData[(4 * 8) + 2 + 1] = 0x04; // DS4 Beam 0 MSB velData[(4 * 8) + 2 + 2] = 0xD5; // DS4 Beam 1 LSB velData[(4 * 8) + 2 + 3] = 0xFA; // DS4 Beam 1 MSB velData[(4 * 8) + 2 + 4] = 0xB0; // DS4 Beam 2 LSB velData[(4 * 8) + 2 + 5] = 0x05; // DS4 Beam 2 MSB velData[(4 * 8) + 2 + 6] = 0x8A; // DS4 Beam 3 LSB velData[(4 * 8) + 2 + 7] = 0xF9; // DS4 Beam 3 MSB vel.Decode(velData); #endregion pd0.AddDataType(vel); // Add Velocity #region Percent Good Pd0PercentGood pg = new Pd0PercentGood(); // 2 Byte Header // 4 Bytes per depth cell // 4 Beams per depth cell // 2 Bytes per beam byte[] pgData = new byte[22]; pgData[0] = Pd0PercentGood.ID_LSB; pgData[1] = Pd0PercentGood.ID_MSB; pgData[2] = 0xE8; // DS0 Beam 0 pgData[3] = 0x7B; // DS0 Beam 1 pgData[4] = 0x7A; // DS0 Beam 2 pgData[5] = 0xDF; // DS0 Beam 3 pgData[(4 * 4) + 2 + 0] = 0x6F; // DS4 Beam 0 pgData[(4 * 4) + 2 + 1] = 0xDE; // DS4 Beam 1 pgData[(4 * 4) + 2 + 2] = 0x15; // DS4 Beam 2 pgData[(4 * 4) + 2 + 3] = 0x22; // DS4 Beam 3 pg.Decode(pgData); #endregion pd0.AddDataType(pg); // Add Percent Good #region Correlation Pd0Correlation corr = new Pd0Correlation(); // 2 Byte Header // 4 Bytes per depth cell // 4 Beams per depth cell // 2 Bytes per beam byte[] corrData = new byte[22]; corrData[0] = Pd0Velocity.ID_LSB; corrData[1] = Pd0Velocity.ID_MSB; corrData[2] = 0xE8; // DS0 Beam 0 corrData[3] = 0x7B; // DS0 Beam 1 corrData[4] = 0x7A; // DS0 Beam 2 corrData[5] = 0xDF; // DS0 Beam 3 corrData[(4 * 4) + 2 + 0] = 0x6F; // DS4 Beam 0 corrData[(4 * 4) + 2 + 1] = 0xDE; // DS4 Beam 1 corrData[(4 * 4) + 2 + 2] = 0x15; // DS4 Beam 2 corrData[(4 * 4) + 2 + 3] = 0x22; // DS4 Beam 3 corr.Decode(corrData); #endregion pd0.AddDataType(corr); // Add Correlation #region Echo Intensity Pd0EchoIntensity ei = new Pd0EchoIntensity(); // 2 Byte Header // 4 Bytes per depth cell // 4 Beams per depth cell // 2 Bytes per beam byte[] eiData = new byte[22]; eiData[0] = Pd0Velocity.ID_LSB; eiData[1] = Pd0Velocity.ID_MSB; eiData[2] = 0xE8; // DS0 Beam 0 eiData[3] = 0x7B; // DS0 Beam 1 eiData[4] = 0x7A; // DS0 Beam 2 eiData[5] = 0xDF; // DS0 Beam 3 eiData[(4 * 4) + 2 + 0] = 0x6F; // DS4 Beam 0 eiData[(4 * 4) + 2 + 1] = 0xDE; // DS4 Beam 1 eiData[(4 * 4) + 2 + 2] = 0x15; // DS4 Beam 2 eiData[(4 * 4) + 2 + 3] = 0x22; // DS4 Beam 3 ei.Decode(eiData); #endregion pd0.AddDataType(ei); // Add Echo Intensity #region Bottom Track Pd0BottomTrack bt = new Pd0BottomTrack(); // 2 Byte Header // 4 Bytes per depth cell // 4 Beams per depth cell // 2 Bytes per beam byte[] btData = new byte[Pd0BottomTrack.DATATYPE_SIZE]; bt.Decode(btData); #endregion pd0.AddDataType(bt); // Add Bottom Track byte[] data = pd0.Encode(); // Size int size = pd0.FixedLeader.GetDataTypeSize(); size += pd0.VariableLeader.GetDataTypeSize(); size += 2; // Spare size += pd0.Header.GetDataTypeSize(); size += pd0.Velocity.GetDataTypeSize(); size += pd0.PercentGood.GetDataTypeSize(); size += pd0.Correlation.GetDataTypeSize(); size += pd0.EchoIntensity.GetDataTypeSize(); size += pd0.BottomTrack.GetDataTypeSize(); Assert.AreEqual(7, pd0.Header.NumberOfDataTypes(), "Number of Data Types is incorrect."); Assert.AreEqual(5, pd0.Header.NumberOfDepthCells, "Number of depth cells is incorrect."); Assert.AreEqual(size, MathHelper.LsbMsbShort(data[2], data[3]), "Number of Bytes is incorrect."); Assert.AreEqual(7, data[5], "Number of Data Types is incorrect."); Assert.AreEqual(size + 2, data.Length, "Array Size is incorrect."); // Add 2 for the checksum int flOffset = pd0.Header.GetDataTypeSize(); Assert.AreEqual(flOffset, MathHelper.LsbMsbShort(data[6], data[7]), "Fixed Leader offset is incorrect."); int vlOffset = pd0.Header.GetDataTypeSize() + Pd0FixedLeader.DATATYPE_SIZE; Assert.AreEqual(vlOffset, MathHelper.LsbMsbShort(data[8], data[9]), "Variable Leader offset is incorrect."); int velOffset = pd0.Header.GetDataTypeSize() + Pd0FixedLeader.DATATYPE_SIZE + Pd0VariableLeader.DATATYPE_SIZE; Assert.AreEqual(velOffset, MathHelper.LsbMsbShort(data[10], data[11]), "Velocity offset is incorrect."); int pgOffset = pd0.Header.GetDataTypeSize() + Pd0FixedLeader.DATATYPE_SIZE + Pd0VariableLeader.DATATYPE_SIZE + pd0.Velocity.GetDataTypeSize(); Assert.AreEqual(pgOffset, MathHelper.LsbMsbShort(data[12], data[13]), "Percent Good offset is incorrect."); int corrOffset = pd0.Header.GetDataTypeSize() + Pd0FixedLeader.DATATYPE_SIZE + Pd0VariableLeader.DATATYPE_SIZE + pd0.Velocity.GetDataTypeSize() + pd0.PercentGood.GetDataTypeSize(); Assert.AreEqual(corrOffset, MathHelper.LsbMsbShort(data[14], data[15]), "Correlation offset is incorrect."); int eiOffset = pd0.Header.GetDataTypeSize() + Pd0FixedLeader.DATATYPE_SIZE + Pd0VariableLeader.DATATYPE_SIZE + pd0.Velocity.GetDataTypeSize() + pd0.PercentGood.GetDataTypeSize() + pd0.Correlation.GetDataTypeSize(); Assert.AreEqual(eiOffset, MathHelper.LsbMsbShort(data[16], data[17]), "Echo Intensity offset is incorrect."); int btOffset = pd0.Header.GetDataTypeSize() + Pd0FixedLeader.DATATYPE_SIZE + Pd0VariableLeader.DATATYPE_SIZE + pd0.Velocity.GetDataTypeSize() + pd0.PercentGood.GetDataTypeSize() + pd0.Correlation.GetDataTypeSize() + pd0.EchoIntensity.GetDataTypeSize(); Assert.AreEqual(btOffset, MathHelper.LsbMsbShort(data[18], data[19]), "Bottom Track offset is incorrect."); }