/// <summary> /// Change the heading source if it is not ADCP. /// It is assumed that the current heading stored in the /// ensemble is from the ADCP. If the options are set to anything /// other than ADCP, the heading will be changed. If the source /// does not exist, the value will not change. /// /// ADCP GPS is GPS data that came in through the underwater cable into the ADCP and stored in the GPS dataset. /// GPS1 is data that came in on the GPS 1 terminal port. /// GPS2 is data that came in on the GPS 2 terminal port. /// NMEA1 is data that came in on the NMEA 1 terminal port. /// NMEA2 is data that came in on the NMEA 2 terminal port. /// /// </summary> /// <param name="ensemble">Ensemble to change the value.</param> /// <param name="options">Options to know how the change the value.</param> public static void HeadingSource(ref DataSet.Ensemble ensemble, VesselMountOptions options) { switch (options.HeadingSource) { case VesselMountOptions.SRC_STR_FIXED_HEADING: HeadingSourceFixed(ref ensemble, options.FixedHeading); break; case VesselMountOptions.SRC_STR_ADCP_GPS: HeadingSourceAdcpGps(ref ensemble); break; case VesselMountOptions.SRC_STR_GPS1: HeadingSourceGps1(ref ensemble); break; case VesselMountOptions.SRC_STR_GPS2: HeadingSourceGps2(ref ensemble); break; case VesselMountOptions.SRC_STR_NMEA1: HeadingSourceNmea1(ref ensemble); break; case VesselMountOptions.SRC_STR_NMEA2: HeadingSourceNmea2(ref ensemble); break; case VesselMountOptions.SRC_STR_ADCP: default: break; } }
public void HeadingOffset() { // Clone the current ensemble RTI.DataSet.Ensemble ensemble2 = ensemble1.Clone(); // Set the Correlation Data // 4 Beams, 5 Bins for (int binNum = 0; binNum < 5; binNum++) { for (int beamNum = 0; beamNum < 4; beamNum++) { ensemble2.CorrelationData.CorrelationData[binNum, beamNum] = 25.6f; } } Assert.IsTrue(ensemble2.IsInstrumentVelocityAvail); Assert.IsTrue(ensemble2.IsCorrelationAvail); // Give a heading offset VesselMountOptions vmOptions = new VesselMountOptions(); vmOptions.HeadingOffsetMag = 10.0f; RTI.VesselMount.VmHeadingOffset.HeadingOffset(ref ensemble2, vmOptions); //float correlationThreshold = 25.0f; // Transform the data //Transform.ProfileTransform(ref ensemble2, AdcpCodec.CodecEnum.Binary, correlationThreshold, Transform.HeadingSource.ADCP, 0, 0); // Check new heading value Assert.AreEqual(20.2, ensemble2.AncillaryData.Heading, 0.01f); // Check the Instrument Velocity Data // 4 Beams, 5 Bins Assert.AreEqual(0.29238f, ensemble2.InstrumentVelocityData.InstrumentVelocityData[0, 0], 0.001); Assert.AreEqual(1.16952, ensemble2.InstrumentVelocityData.InstrumentVelocityData[0, 1], 0.001); Assert.AreEqual(-1.862311, ensemble2.InstrumentVelocityData.InstrumentVelocityData[0, 2], 0.001); Assert.AreEqual(-0.45, ensemble2.InstrumentVelocityData.InstrumentVelocityData[0, 3], 0.001); Assert.AreEqual(4.6780, ensemble2.InstrumentVelocityData.InstrumentVelocityData[1, 0], 0.001); Assert.AreEqual(18.71234, ensemble2.InstrumentVelocityData.InstrumentVelocityData[1, 1], 0.001); Assert.AreEqual(-13.8343, ensemble2.InstrumentVelocityData.InstrumentVelocityData[1, 2], 0.001); Assert.AreEqual(-7.2, ensemble2.InstrumentVelocityData.InstrumentVelocityData[1, 3], 0.001); // Check the Earth Velocity Data // 4 Beams, 5 Bins Assert.AreEqual(-1.04946, ensemble2.EarthVelocityData.EarthVelocityData[0, 0], 0.001); Assert.AreEqual(0.732099, ensemble2.EarthVelocityData.EarthVelocityData[0, 1], 0.001); Assert.AreEqual(-1.81222, ensemble2.EarthVelocityData.EarthVelocityData[0, 2], 0.001); Assert.AreEqual(-0.45, ensemble2.EarthVelocityData.EarthVelocityData[0, 3], 0.001); Assert.AreEqual(-16.334524, ensemble2.EarthVelocityData.EarthVelocityData[1, 0], 0.001); Assert.AreEqual(11.242907, ensemble2.EarthVelocityData.EarthVelocityData[1, 1], 0.001); Assert.AreEqual(-13.04626, ensemble2.EarthVelocityData.EarthVelocityData[1, 2], 0.001); Assert.AreEqual(-7.2, ensemble2.EarthVelocityData.EarthVelocityData[1, 3], 0.001); // All error velocities should be the same between instrument and earth velocity Assert.AreEqual(ensemble2.InstrumentVelocityData.InstrumentVelocityData[2, 3], ensemble2.EarthVelocityData.EarthVelocityData[2, 3], 0.001); Assert.AreEqual(ensemble2.InstrumentVelocityData.InstrumentVelocityData[3, 3], ensemble2.EarthVelocityData.EarthVelocityData[3, 3], 0.001); Assert.AreEqual(ensemble2.InstrumentVelocityData.InstrumentVelocityData[4, 3], ensemble2.EarthVelocityData.EarthVelocityData[4, 3], 0.001); }
/// <summary> /// Change the heading source if it is not ADCP. /// It is assumed that the current heading stored in the /// ensemble is from the ADCP. If the options are set to anything /// other than ADCP, the heading will be changed. If the source /// does not exist, the value will not change. /// /// ADCP GPS is GPS data that came in through the underwater cable into the ADCP and stored in the GPS dataset. /// GPS1 is data that came in on the GPS 1 terminal port. /// GPS2 is data that came in on the GPS 2 terminal port. /// NMEA1 is data that came in on the NMEA 1 terminal port. /// NMEA2 is data that came in on the NMEA 2 terminal port. /// /// </summary> /// <param name="ensemble">Ensemble to change the value.</param> /// <param name="options">Options to know how the change the value.</param> public static void HeadingSource(ref DataSet.Ensemble ensemble, VesselMountOptions options) { switch(options.HeadingSource) { case VesselMountOptions.SRC_STR_FIXED_HEADING: HeadingSourceFixed(ref ensemble, options.FixedHeading); break; case VesselMountOptions.SRC_STR_ADCP_GPS: HeadingSourceAdcpGps(ref ensemble); break; case VesselMountOptions.SRC_STR_GPS1: HeadingSourceGps1(ref ensemble); break; case VesselMountOptions.SRC_STR_GPS2: HeadingSourceGps2(ref ensemble); break; case VesselMountOptions.SRC_STR_NMEA1: HeadingSourceNmea1(ref ensemble); break; case VesselMountOptions.SRC_STR_NMEA2: HeadingSourceNmea2(ref ensemble); break; case VesselMountOptions.SRC_STR_ADCP: default: break; } }
/// <summary> /// Add the Pitch and Roll offset to the Pitch and Roll. This will take the offset and add it to the /// Pitch and Roll value in the ensemble. /// </summary> /// <param name="ensemble">Ensemble to change the value.</param> /// <param name="options">Options to know how the change the value.</param> public static void TiltOffset(ref DataSet.Ensemble ensemble, VesselMountOptions options) { // Add the offset to Ancillary Pitch and Roll AddAncillaryTiltOffset(ref ensemble, options.PitchOffset, options.RollOffset); // Add the offset to the Bottom Track Pitch and Roll AddBottomTrackTiltOffset(ref ensemble, options.PitchOffset, options.RollOffset); }
public void TiltOffsetPitchAndRoll() { // Clone the current ensemble RTI.DataSet.Ensemble ensemble2 = ensemble1.Clone(); // Set the Correlation Data // 4 Beams, 5 Bins for (int binNum = 0; binNum < 5; binNum++) { for (int beamNum = 0; beamNum < 4; beamNum++) { ensemble2.CorrelationData.CorrelationData[binNum, beamNum] = 25.6f; } } Assert.IsTrue(ensemble2.IsInstrumentVelocityAvail); Assert.IsTrue(ensemble2.IsCorrelationAvail); // Give a heading offset VesselMountOptions vmOptions = new VesselMountOptions(); vmOptions.RollOffset = 10.0f; vmOptions.PitchOffset = 10.0f; RTI.VesselMount.VmTiltOffset.TiltOffset(ref ensemble2, vmOptions, false); float correlationThreshold = 25.0f; // Transform the data Transform.ProfileTransform(ref ensemble2, AdcpCodec.CodecEnum.Binary, correlationThreshold, Transform.HeadingSource.ADCP, 0, 0); // Check new Pitch value Assert.AreEqual(12.123, ensemble2.AncillaryData.Roll, 0.01f); // Check the Instrument Velocity Data // 4 Beams, 5 Bins Assert.AreEqual(0.29238f, ensemble2.InstrumentVelocityData.InstrumentVelocityData[0, 0], 0.001); Assert.AreEqual(1.16952, ensemble2.InstrumentVelocityData.InstrumentVelocityData[0, 1], 0.001); Assert.AreEqual(-1.862311, ensemble2.InstrumentVelocityData.InstrumentVelocityData[0, 2], 0.001); Assert.AreEqual(-0.45, ensemble2.InstrumentVelocityData.InstrumentVelocityData[0, 3], 0.001); Assert.AreEqual(4.6780, ensemble2.InstrumentVelocityData.InstrumentVelocityData[1, 0], 0.001); Assert.AreEqual(18.71234, ensemble2.InstrumentVelocityData.InstrumentVelocityData[1, 1], 0.001); Assert.AreEqual(-13.8343, ensemble2.InstrumentVelocityData.InstrumentVelocityData[1, 2], 0.001); Assert.AreEqual(-7.2, ensemble2.InstrumentVelocityData.InstrumentVelocityData[1, 3], 0.001); // Check the Earth Velocity Data // 4 Beams, 5 Bins Assert.AreEqual(-1.40615, ensemble2.EarthVelocityData.EarthVelocityData[0, 0], 0.001); Assert.AreEqual(0.850535, ensemble2.EarthVelocityData.EarthVelocityData[0, 1], 0.001); Assert.AreEqual(-1.49023, ensemble2.EarthVelocityData.EarthVelocityData[0, 2], 0.001); Assert.AreEqual(-0.45, ensemble2.EarthVelocityData.EarthVelocityData[0, 3], 0.001); // All error velocities should be the same between instrument and earth velocity Assert.AreEqual(ensemble2.InstrumentVelocityData.InstrumentVelocityData[2, 3], ensemble2.EarthVelocityData.EarthVelocityData[2, 3], 0.001); Assert.AreEqual(ensemble2.InstrumentVelocityData.InstrumentVelocityData[3, 3], ensemble2.EarthVelocityData.EarthVelocityData[3, 3], 0.001); Assert.AreEqual(ensemble2.InstrumentVelocityData.InstrumentVelocityData[4, 3], ensemble2.EarthVelocityData.EarthVelocityData[4, 3], 0.001); }
/// <summary> /// Add the heading offset to the heading. This will take the magnetic offset and add it to the /// heading value in the ensemble. It will then take the alignment offset and add it to the heading value /// in the ensemble. /// </summary> /// <param name="ensemble">Ensemble to change the value.</param> /// <param name="options">Options to know how the change the value.</param> public static void HeadingOffset(ref DataSet.Ensemble ensemble, VesselMountOptions options) { // Add the magnetic to Ancillary and Bottom Track heading AddAncillaryHeadingOffset(ref ensemble, options.HeadingOffsetMag); AddBottomTrackHeadingOffset(ref ensemble, options.HeadingOffsetMag); // Add the alignment offset to the Ancillary and Bottom Track heading AddAncillaryHeadingOffset(ref ensemble, options.HeadingOffsetAlignment); AddBottomTrackHeadingOffset(ref ensemble, options.HeadingOffsetAlignment); }
public void TestProfileHeadingOffsetLargePos() { VesselMountOptions vmOptions = new VesselMountOptions(); vmOptions.HeadingOffsetMag = 370.0f; // Heading offset RTI.VesselMount.VmHeadingOffset.HeadingOffset(ref ensemble1, vmOptions, true); Assert.AreEqual(20.2f, ensemble1.AncillaryData.Heading, 0.001); }
public void TestRollOffset180() { VesselMountOptions vmOptions = new VesselMountOptions(); vmOptions.RollOffset = 180.0f; // Heading offset RTI.VesselMount.VmTiltOffset.TiltOffset(ref ensemble1, vmOptions, true); Assert.AreEqual(-177.877f, ensemble1.AncillaryData.Roll, 0.001); }
public void TestPitchOffset90() { VesselMountOptions vmOptions = new VesselMountOptions(); vmOptions.PitchOffset = 90.0f; // Heading offset RTI.VesselMount.VmTiltOffset.TiltOffset(ref ensemble1, vmOptions, true); Assert.AreEqual(-88.98f, ensemble1.AncillaryData.Pitch, 0.001); }
public void TestPitchOffsetNegVal() { ensemble1.AncillaryData.Pitch = -20.0f; VesselMountOptions vmOptions = new VesselMountOptions(); vmOptions.PitchOffset = 30.0f; // Heading offset RTI.VesselMount.VmTiltOffset.TiltOffset(ref ensemble1, vmOptions, true); Assert.AreEqual(10.0f, ensemble1.AncillaryData.Pitch, 0.001); }
public void TestRollOffsetWrap() { ensemble1.AncillaryData.Roll = 170.0f; VesselMountOptions vmOptions = new VesselMountOptions(); vmOptions.RollOffset = 30.0f; // Heading offset RTI.VesselMount.VmTiltOffset.TiltOffset(ref ensemble1, vmOptions, true); Assert.AreEqual(-160.0f, ensemble1.AncillaryData.Roll, 0.001); }
/// <summary> /// Screen the ensemble based off all the vessel mount options. /// </summary> /// <param name="ensemble">Ensemble to screen.</param> /// <param name="options">Options to screen the ensemble.</param> public static void Screen(ref DataSet.Ensemble ensemble, VesselMountOptions options) { // Heading source options VmHeadingSource.HeadingSource(ref ensemble, options); // Heading Offset VmHeadingOffset.HeadingOffset(ref ensemble, options); // Tilt Source VmTiltSource.TiltSource(ref ensemble, options); // Tilt Offset VmTiltOffset.TiltOffset(ref ensemble, options); }
/// <summary> /// Add the Pitch and Roll offset to the Pitch and Roll. This will take the offset and add it to the /// Pitch and Roll value in the ensemble. /// </summary> /// <param name="ensemble">Ensemble to change the value.</param> /// <param name="options">Options to know how the change the value.</param> /// <param name="retransformData">When the heading, pitch or roll is modified, the data should be retransfomed so the velocity matches</param> public static void TiltOffset(ref DataSet.Ensemble ensemble, VesselMountOptions options, bool retransformData = true) { // Add the offset to Ancillary Pitch and Roll AddAncillaryTiltOffset(ref ensemble, options.PitchOffset, options.RollOffset); // Add the offset to the Bottom Track Pitch and Roll AddBottomTrackTiltOffset(ref ensemble, options.PitchOffset, options.RollOffset); // Retransform the data so the velocties match the pitch and roll if (retransformData) { Transform.ProfileTransform(ref ensemble, AdcpCodec.CodecEnum.Binary); Transform.BottomTrackTransform(ref ensemble, AdcpCodec.CodecEnum.Binary); } }
/// <summary> /// Add the heading offset to the heading. This will take the magnetic offset and add it to the /// heading value in the ensemble. It will then take the alignment offset and add it to the heading value /// in the ensemble. /// </summary> /// <param name="ensemble">Ensemble to change the value.</param> /// <param name="options">Options to know how the change the value.</param> /// <param name="retransformData">When the heading, pitch or roll is modified, the data should be retransfomed so the velocity matches</param> public static void HeadingOffset(ref DataSet.Ensemble ensemble, VesselMountOptions options, bool retransformData = true) { // Add the magnetic to Ancillary and Bottom Track heading AddAncillaryHeadingOffset(ref ensemble, options.HeadingOffsetMag); AddBottomTrackHeadingOffset(ref ensemble, options.HeadingOffsetMag); // Add the alignment offset to the Ancillary and Bottom Track heading AddAncillaryHeadingOffset(ref ensemble, options.HeadingOffsetAlignment); AddBottomTrackHeadingOffset(ref ensemble, options.HeadingOffsetAlignment); // Retransform the data so the velocties match the heading if (retransformData) { Transform.ProfileTransform(ref ensemble, AdcpCodec.CodecEnum.Binary); Transform.BottomTrackTransform(ref ensemble, AdcpCodec.CodecEnum.Binary); } }
/// <summary> /// Change the heading source if it is not ADCP. /// It is assumed that the current heading stored in the /// ensemble is from the ADCP. If the options are set to anything /// other than ADCP, the heading will be changed. If the source /// does not exist, the value will not change. /// </summary> /// <param name="ensemble">Ensemble to change the value.</param> /// <param name="options">Options to know how the change the value.</param> public static void TiltSource(ref DataSet.Ensemble ensemble, VesselMountOptions options) { //switch(options.TiltSource) //{ // //case VesselMountOptions.SRC_STR_FIXED_HEADING: // // HeadingSourceFixed(ref ensemble, options.FixedHeading); // // break; // case VesselMountOptions.SRC_STR_GPS1: // HeadingSourceGps1(ref ensemble); // break; // case VesselMountOptions.SRC_STR_GPS2: // HeadingSourceGps2(ref ensemble); // break; // case VesselMountOptions.SRC_STR_NMEA1: // HeadingSourceNmea1(ref ensemble); // break; // case VesselMountOptions.SRC_STR_NMEA2: // HeadingSourceNmea2(ref ensemble); // break; // case VesselMountOptions.SRC_STR_ADCP: // default: // break; //} // Check for a fixed pitch if (options.IsPitchFixed) { SetPitch(ref ensemble, options.PitchFixed); } // Check for a fixed roll if (options.IsRollFixed) { SetRoll(ref ensemble, options.RollFixed); } }