示例#1
0
        public void TestGetVelocity()
        {
            Pd0Velocity vel = new Pd0Velocity();

            // 2 Byte Header
            // 8 Bytes per depth cell
            // 4 Beams per depth cell
            // 2 Bytes per beam
            byte[] data = new byte[42];

            data[0] = Pd0Velocity.ID_LSB;
            data[1] = Pd0Velocity.ID_MSB;
            data[2] = 0xE8;                                   // DS0 Beam 0 LSB
            data[3] = 0x00;                                   // DS0 Beam 0 MSB
            data[4] = 0xBD;                                   // DS0 Beam 1 LSB
            data[5] = 0xFE;                                   // DS0 Beam 1 MSB
            data[6] = 0xC8;                                   // DS0 Beam 2 LSB
            data[7] = 0x01;                                   // DS0 Beam 2 MSB
            data[8] = 0x72;                                   // DS0 Beam 3 LSB
            data[9] = 0xFD;                                   // DS0 Beam 3 MSB

            data[(4 * 8) + 2 + 0] = 0xD0;                     // DS4 Beam 0 LSB
            data[(4 * 8) + 2 + 1] = 0x04;                     // DS4 Beam 0 MSB
            data[(4 * 8) + 2 + 2] = 0xD5;                     // DS4 Beam 1 LSB
            data[(4 * 8) + 2 + 3] = 0xFA;                     // DS4 Beam 1 MSB
            data[(4 * 8) + 2 + 4] = 0xB0;                     // DS4 Beam 2 LSB
            data[(4 * 8) + 2 + 5] = 0x05;                     // DS4 Beam 2 MSB
            data[(4 * 8) + 2 + 6] = 0x8A;                     // DS4 Beam 3 LSB
            data[(4 * 8) + 2 + 7] = 0xF9;                     // DS4 Beam 3 MSB


            vel.Decode(data);

            Assert.AreEqual(5, vel.Velocities.GetLength(0), "Number of Depth Cells is incorrect.");
            Assert.AreEqual(5, vel.GetNumDepthCells(), "GetNumDepthCells is incorrect.");
            Assert.AreEqual(232, vel.GetVelocity(0, 0), "DS 0 Beam 0 is incorrect.");
            Assert.AreEqual(-323, vel.GetVelocity(0, 1), "DS 0 Beam 1 is incorrect.");
            Assert.AreEqual(456, vel.GetVelocity(0, 2), "DS 0 Beam 2 is incorrect.");
            Assert.AreEqual(-654, vel.GetVelocity(0, 3), "DS 0 Beam 3 is incorrect.");

            Assert.AreEqual(1232, vel.GetVelocity(4, 0), "DS 4 Beam 0 is incorrect.");
            Assert.AreEqual(-1323, vel.GetVelocity(4, 1), "DS 4 Beam 1 is incorrect.");
            Assert.AreEqual(1456, vel.GetVelocity(4, 2), "DS 4 Beam 2 is incorrect.");
            Assert.AreEqual(-1654, vel.GetVelocity(4, 3), "DS 4 Beam 3 is incorrect.");
        }
示例#2
0
        public void TestGetVelocity()
        {
            Pd0Velocity vel = new Pd0Velocity();

            // 2 Byte Header
            // 8 Bytes per depth cell
            // 4 Beams per depth cell
            // 2 Bytes per beam
            byte[] data = new byte[42];

            data[0] = Pd0Velocity.ID_LSB;
            data[1] = Pd0Velocity.ID_MSB;
            data[2] = 0xE8;                                   // DS0 Beam 0 LSB
            data[3] = 0x00;                                   // DS0 Beam 0 MSB
            data[4] = 0xBD;                                   // DS0 Beam 1 LSB
            data[5] = 0xFE;                                   // DS0 Beam 1 MSB
            data[6] = 0xC8;                                   // DS0 Beam 2 LSB
            data[7] = 0x01;                                   // DS0 Beam 2 MSB
            data[8] = 0x72;                                   // DS0 Beam 3 LSB
            data[9] = 0xFD;                                   // DS0 Beam 3 MSB

            data[(4 * 8) + 2 + 0] = 0xD0;                     // DS4 Beam 0 LSB
            data[(4 * 8) + 2 + 1] = 0x04;                     // DS4 Beam 0 MSB
            data[(4 * 8) + 2 + 2] = 0xD5;                     // DS4 Beam 1 LSB
            data[(4 * 8) + 2 + 3] = 0xFA;                     // DS4 Beam 1 MSB
            data[(4 * 8) + 2 + 4] = 0xB0;                     // DS4 Beam 2 LSB
            data[(4 * 8) + 2 + 5] = 0x05;                     // DS4 Beam 2 MSB
            data[(4 * 8) + 2 + 6] = 0x8A;                     // DS4 Beam 3 LSB
            data[(4 * 8) + 2 + 7] = 0xF9;                     // DS4 Beam 3 MSB

            vel.Decode(data);

            Assert.AreEqual(5, vel.Velocities.GetLength(0), "Number of Depth Cells is incorrect.");
            Assert.AreEqual(5, vel.GetNumDepthCells(), "GetNumDepthCells is incorrect.");
            Assert.AreEqual(232, vel.GetVelocity(0, 0), "DS 0 Beam 0 is incorrect.");
            Assert.AreEqual(-323, vel.GetVelocity(0, 1), "DS 0 Beam 1 is incorrect.");
            Assert.AreEqual(456, vel.GetVelocity(0, 2), "DS 0 Beam 2 is incorrect.");
            Assert.AreEqual(-654, vel.GetVelocity(0, 3), "DS 0 Beam 3 is incorrect.");

            Assert.AreEqual(1232, vel.GetVelocity(4, 0), "DS 4 Beam 0 is incorrect.");
            Assert.AreEqual(-1323, vel.GetVelocity(4, 1), "DS 4 Beam 1 is incorrect.");
            Assert.AreEqual(1456, vel.GetVelocity(4, 2), "DS 4 Beam 2 is incorrect.");
            Assert.AreEqual(-1654, vel.GetVelocity(4, 3), "DS 4 Beam 3 is incorrect.");
        }