예제 #1
0
            public DvlDataSet( SubsystemConfiguration SubsystemConfig, int SampleNumber,
                        float Heading, float Pitch, float Roll,
                        int Year, int Month, int Day, int Hour, int Minute, int Second, int HSec,
                        float Salinity, float Temperature, float DepthOfTransducer, float SpeedOfSound, int BIT,
                        int RefLayerMin, int RefLayerMax,
                        float WmXVelocity, float WmYVelocity, float WmZVelocity, float WmErrorVelocity, bool WmInstrumentIsGoodVelocity,
                        float WmTransverseVelocity, float WmLongitudinalVelocity, float WmNormalVelocity, bool WmShipIsGoodVelocity,
                        float WmEastVelocity, float WmNorthVelocity, float WmUpwardVelocity, bool WmEarthIsGoodVelocity,
                        float WmEastDistance, float WmNorthDistance, float WmUpwardDistance, float WmEarthRangeToWaterMassCenter, float WmEarthTimeLastGoodVel,
                        float BtXVelocity, float BtYVelocity, float BtZVelocity, float BtErrorVelocity, bool BtInstrumentIsGoodVelocity,
                        float BtTransverseVelocity, float BtLongitudinalVelocity, float BtNormalVelocity, float BtShipErrorVelocity, bool BtShipIsGoodVelocity,
                        float BtEastVelocity, float BtNorthVelocity, float BtUpwardVelocity, bool BtEarthIsGoodVelocity,
                        float BtEastDistance, float BtNorthDistance, float BtUpwardDistance, float BtEarthRangeToWaterMassCenter, float BtEarthTimeLastGoodVel,
                        float Pressure, float RangeBeam0, float RangeBeam1, float RangeBeam2, float RangeBeam3, float AverageRange,
                        float DmgEast, float DmgNorth, float DmgUpward, float DmgError,
                        float DmgRefEast, float DmgRefNorth, float DmgRefUpward, float DmgRefError,
                        LeakDetectionOptions LeakDetection)
                : base(DataSet.Ensemble.DATATYPE_FLOAT,                   // Type of data stored (Float or Int)
                        NUM_ELEMENTS,                                   // Number of bins
                        1,                                              // Number of beams
                        DataSet.Ensemble.DEFAULT_IMAG,                  // Default Image
                        DataSet.Ensemble.DEFAULT_NAME_LENGTH,           // Default Image length
                        DataSet.Ensemble.DvlID)
            {
                this.SubsystemConfig = SubsystemConfig;
                this.SampleNumber = SampleNumber;

                this.Pitch = Pitch;
                this.Roll = Roll;
                this.Heading = Heading;
                this.DateAndTime = DateAndTime;
                this.Salinity = Salinity;
                this.WaterTemp = Temperature;
                this.TransducerDepth = DepthOfTransducer;
                this.SpeedOfSound = SpeedOfSound;
                this.BIT = BIT;

                // Set time
                this.Year = Year;
                this.Month = Month;
                this.Day = Day;
                this.Hour = Hour;
                this.Minute = Minute;
                this.Second = Second;
                this.HSec = HSec;
                ValidateDateTime(Year, Month, Day, Hour, Minute, Second, HSec / 10);

                this.RefLayerMin = RefLayerMin;
                this.RefLayerMax = RefLayerMax;

                this.WmXVelocity = WmXVelocity;
                this.WmYVelocity = WmYVelocity;
                this.WmZVelocity = WmZVelocity;
                this.WmErrorVelocity = WmErrorVelocity;
                this.WmInstrumentIsGoodVelocity = WmInstrumentIsGoodVelocity;

                this.WmTransverseVelocity = WmTransverseVelocity;
                this.WmLongitudinalVelocity = WmLongitudinalVelocity;
                this.WmNormalVelocity = WmNormalVelocity;
                this.WmShipIsGoodVelocity = WmShipIsGoodVelocity;

                this.WmEastVelocity = WmEastVelocity;
                this.WmNorthVelocity = WmNorthVelocity;
                this.WmUpwardVelocity = WmUpwardVelocity;
                this.WmEarthIsGoodVelocity = WmEarthIsGoodVelocity;

                this.WmEastDistance = WmEastDistance;
                this.WmNorthDistance = WmNorthDistance;
                this.WmUpwardDistance = WmUpwardDistance;
                this.WmEarthRangeToWaterMassCenter = WmEarthRangeToWaterMassCenter;
                this.WmEarthTimeLastGoodVel = WmEarthTimeLastGoodVel;

                this.BtXVelocity = BtXVelocity;
                this.BtYVelocity = BtYVelocity;
                this.BtZVelocity = BtZVelocity;
                this.BtErrorVelocity = BtErrorVelocity;
                this.BtInstrumentIsGoodVelocity = BtInstrumentIsGoodVelocity;

                this.BtTransverseVelocity = BtTransverseVelocity;
                this.BtLongitudinalVelocity = BtLongitudinalVelocity;
                this.BtNormalVelocity = BtNormalVelocity;
                this.BtShipErrorVelocity = BtShipErrorVelocity;
                this.BtShipIsGoodVelocity = BtShipIsGoodVelocity;

                this.BtEastVelocity = BtEastVelocity;
                this.BtNorthVelocity = BtNorthVelocity;
                this.BtUpwardVelocity = BtUpwardVelocity;
                this.BtEarthIsGoodVelocity = BtEarthIsGoodVelocity;

                this.BtEastDistance = BtEastDistance;
                this.BtNorthDistance = BtNorthDistance;
                this.BtUpwardDistance = BtUpwardDistance;
                this.BtRangeToBottom = BtEarthRangeToWaterMassCenter;
                this.BtEarthTimeLastGoodVel = BtEarthTimeLastGoodVel;

                this.Pressure = Pressure;
                this.RangeBeam0 = RangeBeam0;
                this.RangeBeam1 = RangeBeam1;
                this.RangeBeam2 = RangeBeam2;
                this.RangeBeam3 = RangeBeam3;
                this.AverageRange = AverageRange;

                this.DmgEast = DmgEast;
                this.DmgNorth = DmgNorth;
                this.DmgUpward = DmgUpward;
                this.DmgError = DmgError;

                this.DmgRefEast = DmgRefEast;
                this.DmgRefNorth = DmgRefNorth;
                this.DmgRefUpward = DmgRefUpward;
                this.DmgRefError = DmgRefError;

                this.LeakDetection = LeakDetection;
            }
예제 #2
0
            /// <summary>
            /// Initialize the values.
            /// </summary>
            private void Init()
            {
                // Create Subsystem Configuration based off Firmware and Serialnumber
                SubsystemConfig = new SubsystemConfiguration(new Firmware().GetSubsystem(SerialNumber.DVL), 0, 0);
                SampleNumber = 0;

                Pitch = 0.0f;
                Roll = 0.0f;
                Heading = 0.0f;
                DateAndTime = DateTime.Now;
                Year = DateAndTime.Year;
                Month = DateAndTime.Month;
                Day = DateAndTime.Day;
                Hour = DateAndTime.Hour;
                Minute = DateAndTime.Minute;
                Second = DateAndTime.Second;
                HSec = DateAndTime.Millisecond * 10;
                Salinity = 0.0f;
                WaterTemp = 0.0f;
                TransducerDepth = 0.0f;
                SpeedOfSound = 0.0f;
                BIT = 0;

                RefLayerMin = 0;
                RefLayerMax = 0;

                WmXVelocity = 0.0f;
                WmYVelocity = 0.0f;
                WmZVelocity = 0.0f;
                WmErrorVelocity = 0.0f;
                WmInstrumentIsGoodVelocity = false;

                WmTransverseVelocity = 0.0f;
                WmLongitudinalVelocity = 0.0f;
                WmNormalVelocity = 0.0f;
                WmShipIsGoodVelocity = false;

                WmEastVelocity = 0.0f;
                WmNorthVelocity = 0.0f;
                WmUpwardVelocity = 0.0f;
                WmEarthIsGoodVelocity = false;

                WmEastDistance = 0.0f;
                WmNorthDistance = 0.0f;
                WmUpwardDistance = 0.0f;
                WmEarthRangeToWaterMassCenter = 0.0f;
                WmEarthTimeLastGoodVel = 0.0f;

                BtXVelocity = 0.0f;
                BtYVelocity = 0.0f;
                BtZVelocity = 0.0f;
                BtErrorVelocity = 0.0f;
                BtInstrumentIsGoodVelocity = false;

                BtTransverseVelocity = 0.0f;
                BtLongitudinalVelocity = 0.0f;
                BtNormalVelocity = 0.0f;
                BtShipErrorVelocity = 0.0f;
                BtShipIsGoodVelocity = false;

                BtEastVelocity = 0.0f;
                BtNorthVelocity = 0.0f;
                BtUpwardVelocity = 0.0f;
                BtEarthIsGoodVelocity = false;

                BtEastDistance = 0.0f;
                BtNorthDistance = 0.0f;
                BtUpwardDistance = 0.0f;
                BtRangeToBottom = 0.0f;
                BtEarthTimeLastGoodVel = 0.0f;

                Pressure = 0.0f;
                RangeBeam0 = 0.0f;
                RangeBeam1 = 0.0f;
                RangeBeam2 = 0.0f;
                RangeBeam3 = 0.0f;
                AverageRange = 0.0f;

                DmgEast = 0.0f;
                DmgNorth = 0.0f;
                DmgUpward = 0.0f;
                DmgError = 0.0f;

                DmgRefEast = 0.0f;
                DmgRefNorth = 0.0f;
                DmgRefUpward = 0.0f;
                DmgRefError = 0.0f;

                LeakDetection = LeakDetectionOptions.NotInstalled;
            }
예제 #3
0
            /// <summary>
            /// Use this constructor if all the settings are going to be
            /// set by the user.
            /// 
            /// If this constructor is used, then none of the 
            /// frequency dependent commands will be set to anything
            /// specific.  The subsystem must be set and 
            /// SetFrequencyDefaults() must be called for the
            /// frequency dependent commands to be set to default values.
            /// </summary>
            public AdcpSubsystemCommands()
            {
                // Set empty subsystem.
                SubsystemConfig = new SubsystemConfiguration();

                // Set Default values
                SetDefaultOptions();
            }
예제 #4
0
            /// <summary>
            /// Read the JSON object and convert to the object.  This will allow the serializer to
            /// automatically convert the object.  No special instructions need to be done and all
            /// the properties found in the JSON string need to be used.
            /// 
            /// DataSet.DvlDataSet decodedEns = Newtonsoft.Json.JsonConvert.DeserializeObject{DataSet.DvlDataSet}(encodedEns)
            /// 
            /// </summary>
            /// <param name="reader">NOT USED. JSON reader.</param>
            /// <param name="objectType">NOT USED> Type of object.</param>
            /// <param name="existingValue">NOT USED.</param>
            /// <param name="serializer">Serialize the object.</param>
            /// <returns>Serialized object.</returns>
            public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
            {
                if (reader.TokenType != JsonToken.Null)
                {
                    // Load the object
                    JObject jsonObject = JObject.Load(reader);

                    // SubsystemConfig
                    ushort index = (ushort)jsonObject[DataSet.BaseDataSet.JSON_STR_SUBSYSTEM_INDEX];
                    byte ssCode = (byte)jsonObject[DataSet.BaseDataSet.JSON_STR_SUBSYSTEM_CODE].ToObject<byte>();
                    byte cepoIndex = (byte)jsonObject[DataSet.BaseDataSet.JSON_STR_CEPOINDEX].ToObject<byte>();
                    byte configNum = (byte)jsonObject[DataSet.BaseDataSet.JSON_STR_SSCONFIG_INDEX].ToObject<byte>();
                    SubsystemConfiguration SubsystemConfig = new SubsystemConfiguration(new Subsystem(ssCode, index), cepoIndex, configNum);

                    #region System

                    // Sample Number
                    int SampleNumber = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_SAMPLENUMBER];

                    // Heading
                    float Heading = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_HEADING];

                    // Pitch
                    float Pitch = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_PITCH];

                    // Roll
                    float Roll = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_ROLL];

                    // Year
                    int Year = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_YEAR];

                    // Month
                    int Month = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_MONTH];

                    // Day
                    int Day = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_DAY];

                    // Hour
                    int Hour = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_HOUR];

                    // Minute
                    int Minute = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_MINUTE];

                    // Second
                    int Second = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_SECOND];

                    // HSec
                    int HSec = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_HSEC];

                    // Salinity
                    float Salinity = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_SALINITY];

                    // Salinity
                    float Temperature = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_TEMPERATURE];

                    // TransducerDepth
                    float TransducerDepth = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_TRANSDUCERDEPTH];

                    // SpeedOfSound
                    float SpeedOfSound = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_SPEEDOFSOUND];

                    // BIT
                    int BIT = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BIT];

                    // Ref Layer Min
                    int RefLayerMin = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_REF_LAYER_MIN];

                    // Ref Layer Max
                    int RefLayerMax = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_REF_LAYER_MAX];

                    #endregion

                    #region Water Mass Instrument Velocity

                    // WM X Vel
                    float WmXVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_X_VEL];

                    // WM Y Vel
                    float WmYVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_Y_VEL];

                    // WM Z Vel
                    float WmZVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_Z_VEL];

                    // WM Error Vel
                    float WmErrorVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_ERROR_VEL];

                    // WM Instrumment Is Good Vel
                    bool WmInstrumentIsGoodVel = (bool)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_INSTRUMENT_IS_GOOD_VEL];

                    #endregion

                    #region Water Mass Ship Velocity

                    // WM Transverse Vel
                    float WmTransverseVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_TRANSVERSE_VEL];

                    // WM Longitudinal Vel
                    float WmLongitudinalVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_LONGITUDINAL_VEL];

                    // WM Normal Vel
                    float WmNormalVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_NORMAL_VEL];

                    // WM Ship Is Good Vel
                    bool WmShipIsGoodVel = (bool)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_SHIP_IS_GOOD_VEL];

                    #endregion

                    #region Water Mass Earth Velocity

                    // WM East Vel
                    float WmEastVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_EAST_VEL];

                    // WM North Vel
                    float WmNorthVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_NORTH_VEL];

                    // WM Upward Vel
                    float WmUpwardVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_UPWARD_VEL];

                    // WM Earth Is Good Vel
                    bool WmEarthIsGoodVel = (bool)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_EARTH_IS_GOOD_VEL];

                    #endregion

                    #region Water Mass Earth Distance

                    // WM East Vel
                    float WmEastDist = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_EAST_DMG];

                    // WM North Vel
                    float WmNorthDist = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_NORTH_DMG];

                    // WM Upward Vel
                    float WmUpwardDist = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_UPWARD_DMG];

                    // WM Earth Range to WM center
                    float WmEarthRangeToWaterMassCenter = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_EARTH_RANGE_TO_WM_CENTER];

                    // WM Earth Range to WM center
                    float WmEarthTimeLastGoodVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_WM_EARTH_TIME_LAST_GOOD_VEL];

                    #endregion

                    #region Bottom Track Instrument Velocity

                    // Bottom Track X Vel
                    float BtXVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_X_VEL];

                    // Bottom Track Y Vel
                    float BtYVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_Y_VEL];

                    // Bottom Track Z Vel
                    float BtZVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_Z_VEL];

                    // Bottom Track Error Vel
                    float BtErrorVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_ERROR_VEL];

                    // Bottom Track Instrumment Is Good Vel
                    bool BtInstrumentIsGoodVel = (bool)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_INSTRUMENT_IS_GOOD_VEL];

                    #endregion

                    #region Bottom Track Ship Velocity

                    float BtTransverseVel = 0.0f;
                    float BtLongitudinalVel = 0.0f;
                    float BtNormalVel = 0.0f;
                    float BtShipErrVel = 0.0f;
                    bool BtShipIsGoodVel = false;

                    if (jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_TRANSVERSE_VEL] != null)
                    {
                        // Bottom Track Transverse Vel
                        BtTransverseVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_TRANSVERSE_VEL];
                    }

                    if (jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_LONGITUDINAL_VEL] != null)
                    {
                        // Bottom Track Longitudinal Vel
                        BtLongitudinalVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_LONGITUDINAL_VEL];
                    }

                    if (jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_NORMAL_VEL] != null)
                    {
                        // Bottom Track Normal Vel
                        BtNormalVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_NORMAL_VEL];
                    }

                    if (jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_SHIP_ERR_VEL] != null)
                    {
                        // Bottom Track Ship Error Vel
                        BtShipErrVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_SHIP_ERR_VEL];
                    }

                    if (jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_SHIP_IS_GOOD_VEL] != null)
                    {
                        // Bottom Track Ship Is Good Vel
                        BtShipIsGoodVel = (bool)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_SHIP_IS_GOOD_VEL];
                    }

                    #endregion

                    #region Bottom Track Earth Velocity

                    // Bottom Track East Vel
                    float BtEastVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_EAST_VEL];

                    // Bottom Track North Vel
                    float BtNorthVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_NORTH_VEL];

                    // Bottom Track Upward Vel
                    float BtUpwardVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_UPWARD_VEL];

                    // Bottom Track Earth Is Good Vel
                    bool BtEarthIsGoodVel = (bool)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_EARTH_IS_GOOD_VEL];

                    #endregion

                    #region Bottom Track Earth Distance

                    // Bottom Track East Distance
                    float BtEastDist = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_EAST_DMG];

                    // Bottom Track North Distance
                    float BtNorthDist = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_NORTH_DMG];

                    // Bottom Track Upward Distance
                    float BtUpwardDist = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_UPWARD_DMG];

                    // Bottom Track Earth Range to WM center
                    float BtEarthRangeToWaterMassCenter = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_EARTH_RANGE_TO_WM_CENTER];

                    // Bottom Track Earth Range to WM center
                    float BtEarthTimeLastGoodVel = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_EARTH_TIME_LAST_GOOD_VEL];

                    #endregion

                    #region Pressure and Range

                    // Pressure
                    float Pressure = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_BT_EAST_DMG];

                    // Range Beam 0
                    float RangeB0 = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_RANGE_B0];

                    // Range Beam 1
                    float RangeB1 = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_RANGE_B1];

                    // Range Beam 2
                    float RangeB2 = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_RANGE_B2];

                    // Range Beam 3
                    float RangeB3 = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_RANGE_B3];

                    // Average Range
                    float AvgRange = (float)jsonObject[DataSet.BaseDataSet.JSON_STR_DVL_AVG_RANGE];

                    #endregion

                    #region Distance Made Good

                    // Distance Made Good East
                    JToken DmgEastTkn = null;
                    float DmgEast = 0.0f;
                    if(jsonObject.TryGetValue(DataSet.BaseDataSet.JSON_STR_DVL_DMG_EAST, out DmgEastTkn))
                    {
                        DmgEast = (float)DmgEastTkn;
                    }

                    // Distance Made Good North
                    JToken DmgNorthTkn = null;
                    float DmgNorth = 0.0f;
                    if (jsonObject.TryGetValue(DataSet.BaseDataSet.JSON_STR_DVL_DMG_NORTH, out DmgNorthTkn))
                    {
                        DmgNorth = (float)DmgNorthTkn;
                    }

                    // Distance Made Good Upward
                    JToken DmgUpwardTkn = null;
                    float DmgUpward = 0.0f;
                    if (jsonObject.TryGetValue(DataSet.BaseDataSet.JSON_STR_DVL_DMG_UPWARD, out DmgUpwardTkn))
                    {
                        DmgUpward = (float)DmgUpwardTkn;
                    }

                    // Distance Made Good Error
                    JToken DmgErrorTkn = null;
                    float DmgError = 0.0f;
                    if (jsonObject.TryGetValue(DataSet.BaseDataSet.JSON_STR_DVL_DMG_ERROR, out DmgErrorTkn))
                    {
                        DmgError = (float)DmgErrorTkn;
                    }

                    #endregion

                    #region Distance Made Good Reference Layer

                    // Distance Made Good Reference Layer East
                    JToken DmgRefEastTkn = null;
                    float DmgRefEast = 0.0f;
                    if (jsonObject.TryGetValue(DataSet.BaseDataSet.JSON_STR_DVL_DMG_REF_EAST, out DmgRefEastTkn))
                    {
                        DmgRefEast = (float)DmgRefEastTkn;
                    }

                    // Distance Made Good Reference Layer North
                    JToken DmgRefNorthTkn = null;
                    float DmgRefNorth = 0.0f;
                    if (jsonObject.TryGetValue(DataSet.BaseDataSet.JSON_STR_DVL_DMG_REF_NORTH, out DmgRefNorthTkn))
                    {
                        DmgRefNorth = (float)DmgRefNorthTkn;
                    }

                    // Distance Made Good Reference Layer Upward
                    JToken DmgRefUpwardTkn = null;
                    float DmgRefUpward = 0.0f;
                    if (jsonObject.TryGetValue(DataSet.BaseDataSet.JSON_STR_DVL_DMG_REF_UPWARD, out DmgRefUpwardTkn))
                    {
                        DmgRefUpward = (float)DmgRefUpwardTkn;
                    }

                    // Distance Made Good Reference Layer Error
                    JToken DmgRefErrorTkn = null;
                    float DmgRefError = 0.0f;
                    if (jsonObject.TryGetValue(DataSet.BaseDataSet.JSON_STR_DVL_DMG_REF_ERROR, out DmgRefErrorTkn))
                    {
                        DmgRefError = (float)DmgRefErrorTkn;
                    }

                    #endregion

                    #region LeakDetection

                    // Leak Detection
                    JToken LeakDetectionTkn = null;
                    RTI.DataSet.DvlDataSet.LeakDetectionOptions LeakDetection = RTI.DataSet.DvlDataSet.LeakDetectionOptions.NotInstalled;
                    if (jsonObject.TryGetValue(DataSet.BaseDataSet.JSON_STR_DVL_LEAKDETECTION, out LeakDetectionTkn))
                    {

                        switch((string)LeakDetectionTkn)
                        {
                            case TS.LEAKDETECT_OK:
                                LeakDetection = DvlDataSet.LeakDetectionOptions.OK;
                                break;
                            case TS.LEAKDETECT_WATER:
                                LeakDetection = DvlDataSet.LeakDetectionOptions.WaterDetected;
                                break;
                            case TS.LEAKDETECT_NOT_INSTALLED:
                            default:
                                LeakDetection = DvlDataSet.LeakDetectionOptions.NotInstalled;
                                break;
                        }
                    }

                    #endregion

                    // Create the object
                    var data = new DvlDataSet(SubsystemConfig, SampleNumber, Heading, Pitch, Roll,
                                                Year, Month, Day, Hour, Minute, Second, HSec,
                                                Salinity, Temperature, TransducerDepth, SpeedOfSound, BIT,
                                                RefLayerMin, RefLayerMax,
                                                WmXVel, WmYVel, WmZVel, WmErrorVel, WmInstrumentIsGoodVel,
                                                WmTransverseVel, WmLongitudinalVel, WmNormalVel, WmShipIsGoodVel,
                                                WmEastVel, WmNorthVel, WmUpwardVel, WmEarthIsGoodVel,
                                                WmEastDist, WmNorthDist, WmUpwardDist, WmEarthRangeToWaterMassCenter, WmEarthTimeLastGoodVel,
                                                BtXVel, BtYVel, BtZVel, BtErrorVel, BtInstrumentIsGoodVel,
                                                BtTransverseVel, BtLongitudinalVel, BtNormalVel, BtShipErrVel, BtShipIsGoodVel,
                                                BtEastVel, BtNorthVel, BtUpwardVel, BtEarthIsGoodVel,
                                                BtEastDist, BtNorthDist, BtUpwardDist, BtEarthRangeToWaterMassCenter, BtEarthTimeLastGoodVel,
                                                Pressure, RangeB0, RangeB1, RangeB2, RangeB3, AvgRange,
                                                DmgEast, DmgNorth, DmgUpward, DmgError,
                                                DmgRefEast, DmgRefNorth, DmgRefUpward, DmgRefError,
                                                LeakDetection);

                    return data;
                }

                return null;
            }
예제 #5
0
            /// <summary>
            /// Get all the information about the Ensemble.
            /// </summary>
            /// <param name="data">Byte array containing the Ensemble data type.</param>
            private void Decode(byte[] data)
            {
                EnsembleNumber = MathHelper.ByteArrayToInt32(data, GenerateIndex(0));
                NumBins = MathHelper.ByteArrayToInt32(data, GenerateIndex(1));
                NumBeams = MathHelper.ByteArrayToInt32(data, GenerateIndex(2));
                DesiredPingCount = MathHelper.ByteArrayToInt32(data, GenerateIndex(3));
                ActualPingCount = MathHelper.ByteArrayToInt32(data, GenerateIndex(4));
                Status = new Status(MathHelper.ByteArrayToInt32(data, GenerateIndex(5)));
                Year = MathHelper.ByteArrayToInt32(data, GenerateIndex(6));
                Month = MathHelper.ByteArrayToInt32(data, GenerateIndex(7));
                Day = MathHelper.ByteArrayToInt32(data, GenerateIndex(8));
                Hour = MathHelper.ByteArrayToInt32(data, GenerateIndex(9));
                Minute = MathHelper.ByteArrayToInt32(data, GenerateIndex(10));
                Second = MathHelper.ByteArrayToInt32(data, GenerateIndex(11));
                HSec = MathHelper.ByteArrayToInt32(data, GenerateIndex(12));

                // Revision D additions
                if (NumElements >= NUM_DATA_ELEMENTS_REV_D && data.Length >= NUM_DATA_ELEMENTS_REV_D * Ensemble.BYTES_IN_INT32)
                {
                    // Get the System Serial Num
                    // Start at index 13
                    byte[] serial = new byte[SERIAL_NUM_INT * Ensemble.BYTES_IN_INT32];
                    System.Buffer.BlockCopy(data, GenerateIndex(13), serial, 0, SERIAL_NUM_INT * Ensemble.BYTES_IN_INT32);
                    SysSerialNumber = new SerialNumber(serial);

                    // Get the firmware number
                    // Start at index 21
                    byte[] firmware = new byte[FIRMWARE_NUM_INT * Ensemble.BYTES_IN_INT32];
                    System.Buffer.BlockCopy(data, GenerateIndex(21), firmware, 0, FIRMWARE_NUM_INT * Ensemble.BYTES_IN_INT32);
                    SysFirmware = new Firmware(firmware);

                    // FOR BACKWARDS COMPATITBILITY
                    // Old subsystems in the ensemble were set by the Subsystem Index in Firmware.
                    // This means the that a subsystem code of 0 could be passed because
                    // the index was 0 to designate the first subsystem index.  Firmware revision 0.2.13 changed
                    // SubsystemIndex to SubsystemCode.  This will check which Firmware version this ensemble is
                    // and convert to the new type using SubsystemCode.
                    //
                    // Get the correct subsystem by getting the index found in the firmware and getting
                    // subsystem code from the serial number.
                    //if (SysFirmware.FirmwareMajor <= 0 && SysFirmware.FirmwareMinor <= 2 && SysFirmware.FirmwareRevision <= 13 && GetSubSystem().IsEmpty())
                    //{
                    //    // Set the correct subsystem based off the serial number
                    //    // Get the index for the subsystem
                    //    byte index = SysFirmware.SubsystemCode;

                    //    // Ensure the index is not out of range of the subsystem string
                    //    if (SysSerialNumber.SubSystems.Length > index)
                    //    {
                    //        // Get the Subsystem code from the serialnumber based off the index found
                    //        string code = SysSerialNumber.SubSystems.Substring(index, 1);

                    //        // Create a subsystem with the code and index
                    //        Subsystem ss = new Subsystem(Convert.ToByte(code), index);

                    //        // Set the new subsystem code to the firmware
                    //        //SysFirmware.SubsystemCode = Convert.ToByte(code);

                    //        // Remove the old subsystem and add the new one to the dictionary
                    //        SysSerialNumber.SubSystemsDict.Remove(Convert.ToByte(index));
                    //        SysSerialNumber.SubSystemsDict.Add(Convert.ToByte(index), ss);

                    //    }
                    //}

                }
                else
                {
                    SysSerialNumber = new SerialNumber();
                    SysFirmware = new Firmware();

                }

                // Revision H additions
                if (NumElements >= NUM_DATA_ELEMENTS_REV_H && data.Length >= NUM_DATA_ELEMENTS_REV_H * Ensemble.BYTES_IN_INT32)
                {
                    // Get the Subsystem Configuration
                    // Start at index 22
                    byte[] subConfig = new byte[SUBSYSTEM_CONFIG_NUM_INT * Ensemble.BYTES_IN_INT32];
                    System.Buffer.BlockCopy(data, GenerateIndex(22), subConfig, 0, SUBSYSTEM_CONFIG_NUM_INT * Ensemble.BYTES_IN_INT32);
                    SubsystemConfig = new SubsystemConfiguration(SysFirmware.GetSubsystem(SysSerialNumber), subConfig);
                }
                else
                {
                    // Create a default SubsystemConfig with a configuration of 0
                    SubsystemConfig = new SubsystemConfiguration(SysFirmware.GetSubsystem(SysSerialNumber), 0, 0);
                }

                // Set the time and date
                ValidateDateTime(Year, Month, Day, Hour, Minute, Second, HSec / 10);

                // Create UniqueId
                UniqueId = new UniqueID(EnsembleNumber, EnsDateTime);
            }
예제 #6
0
            /// <summary>
            /// Set the default values for the given subsystem.
            /// A default value of 0 is used for CEPO index.  If there is only
            /// 1 subsystem, then 0 should always work.
            /// </summary>
            /// <param name="ssConfig">Subsystem Configuration associated with these options.</param>
            public AdcpSubsystemCommands(SubsystemConfiguration ssConfig)
            {
                // Set the subsystem
                SubsystemConfig = ssConfig;

                // Set default values
                SetDefaults();
            }
예제 #7
0
            public EnsembleDataSet(int ValueType, int NumElements, int ElementsMultiplier, int Imag, int NameLength, string Name,
                                    int EnsembleNumber, int NumBins, int NumBeams, int DesiredPingCount, int ActualPingCount,
                                    SerialNumber SysSerialNumber, Firmware SysFirmware, SubsystemConfiguration SubsystemConfig, Status Status,
                                    int Year, int Month, int Day, int Hour, int Minute, int Second, int HSec)
                : base(ValueType, NumElements, ElementsMultiplier, Imag, NameLength, Name)
            {
                //this.UniqueId = UniqueId;
                this.EnsembleNumber = EnsembleNumber;
                this.NumBins = NumBins;
                this.NumBeams = NumBeams;
                this.DesiredPingCount = DesiredPingCount;
                this.ActualPingCount = ActualPingCount;
                this.SysSerialNumber = SysSerialNumber;
                this.SysFirmware = SysFirmware;
                this.SubsystemConfig = SubsystemConfig;
                this.Status = Status;
                this.Year = Year;
                this.Month = Month;
                this.Day = Day;
                this.Hour = Hour;
                this.Minute = Minute;
                this.Second = Second;
                this.HSec = HSec;
                //this.EnsDateTime = EnsDateTime;

                // Set the time and date
                ValidateDateTime(Year, Month, Day, Hour, Minute, Second, HSec / 10);

                // Create UniqueId
                UniqueId = new UniqueID(EnsembleNumber, EnsDateTime);
            }
예제 #8
0
            /// <summary>
            /// Create an Ensemble data set.  Include all the information
            /// about the current ensemble from the sentence.  This will include
            /// the ensemble number and status.
            /// </summary>
            /// <param name="sentence">Sentence containing data.</param>
            public EnsembleDataSet(Prti03Sentence sentence)
                : base(DataSet.Ensemble.DATATYPE_INT, NUM_DATA_ELEMENTS, DataSet.Ensemble.DEFAULT_NUM_BEAMS_NONBEAM, DataSet.Ensemble.DEFAULT_IMAG, DataSet.Ensemble.DEFAULT_NAME_LENGTH, DataSet.Ensemble.EnsembleDataID)
            {
                // Set the ensemble number
                EnsembleNumber = sentence.SampleNumber;

                // Set time to now
                SetTime();

                // Create UniqueId
                UniqueId = new UniqueID(EnsembleNumber, EnsDateTime);

                // Use default value for beams
                NumBeams = DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM;

                // Use the special serial number for a DVL
                SysSerialNumber = SerialNumber.DVL;

                // Create blank firmware
                SysFirmware = new Firmware();

                // Create Subsystem Configuration based off Firmware and Serialnumber
                if (sentence.SubsystemConfig != null)
                {
                    SubsystemConfig = sentence.SubsystemConfig;
                    SysFirmware.SubsystemCode = sentence.SubsystemConfig.SubSystem.Code;
                }
                else
                {
                    // Create Subsystem Configuration based off Firmware and Serialnumber
                    SubsystemConfig = new SubsystemConfiguration(SysFirmware.GetSubsystem(SysSerialNumber), 0, 0);
                }

                // Get the status from the sentence
                Status = sentence.SystemStatus;

                // No bin data
                NumBins = 0;
            }
예제 #9
0
            // Dataset ID
            /// <summary>
            /// Create a Ensemble data set.  This will create a blank dataset.  The user must fill in the data for all
            /// the important values.
            /// </summary>
            public EnsembleDataSet()
                : base(DataSet.Ensemble.DATATYPE_INT,                         // Type of data stored (Float or Int)
                            NUM_DATA_ELEMENTS,                              // Number of elements
                            DataSet.Ensemble.DEFAULT_NUM_BEAMS_NONBEAM,     // Element Multiplier
                            DataSet.Ensemble.DEFAULT_IMAG,                  // Default Image
                            DataSet.Ensemble.DEFAULT_NAME_LENGTH,           // Default Image length
                            DataSet.Ensemble.EnsembleDataID)
            {
                // Set the ensemble number to the default ensemble number
                EnsembleNumber = DEFAULT_ENS_NUM;

                // Set time to the current time
                SetTime();

                // Create UniqueId
                UniqueId = new UniqueID(EnsembleNumber, EnsDateTime);

                // Set the number of beams
                //NumBeams = numBeams;

                // Set the number of bins
                //NumBins = numElements;

                // Use a blank serial number
                SysSerialNumber = new SerialNumber();

                // Create blank firmware
                SysFirmware = new Firmware();

                // Create Blank Subsystem configuration
                SubsystemConfig = new SubsystemConfiguration();

                // Create a blank status
                Status = new Status(0);
            }
예제 #10
0
            /// <summary>
            /// Create a Ensemble data set.  This will create a blank dataset.  The user must fill in the data for all
            /// the important values.
            /// </summary>
            /// <param name="valueType">Whether it contains 32 bit Integers or Single precision floating point </param>
            /// <param name="numElments">Number of Elements.</param>
            /// <param name="elementMultiplier">Element Multipliers.</param>
            /// <param name="imag"></param>
            /// <param name="nameLength">Length of name</param>
            /// <param name="name">Name of data type</param>
            /// <param name="numBins">Number of Bin</param>
            /// <param name="numBeams">Number of beams</param>
            public EnsembleDataSet(int valueType, int numElments, int elementMultiplier, int imag, int nameLength, string name, int numBins, int numBeams)
                : base(valueType, numElments, elementMultiplier, imag, nameLength, name)
            {
                // Set the ensemble number to the default ensemble number
                EnsembleNumber = DEFAULT_ENS_NUM;

                // Set time to the current time
                SetTime();

                // Create UniqueId
                UniqueId = new UniqueID(EnsembleNumber, EnsDateTime);

                // Set the number of beams
                NumBeams = numBeams;

                // Set the number of bins
                NumBins = numBins;

                // Use a blank serial number
                SysSerialNumber = new SerialNumber();

                // Create blank firmware
                SysFirmware = new Firmware();

                // Create Blank Subsystem configuration
                SubsystemConfig = new SubsystemConfiguration();

                // Create a blank status
                Status = new Status(0);
            }
예제 #11
0
            /// <summary>
            /// Read the JSON object and convert to the object.  This will allow the serializer to
            /// automatically convert the object.  No special instructions need to be done and all
            /// the properties found in the JSON string need to be used.
            /// 
            /// DataSet.EnsembleDataSet decodedEns = Newtonsoft.Json.JsonConvert.DeserializeObject{DataSet.EnsembleDataSet}(encodedEns)
            /// 
            /// </summary>
            /// <param name="reader">NOT USED. JSON reader.</param>
            /// <param name="objectType">NOT USED> Type of object.</param>
            /// <param name="existingValue">NOT USED.</param>
            /// <param name="serializer">Serialize the object.</param>
            /// <returns>Serialized object.</returns>
            public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
            {
                if (reader.TokenType != JsonToken.Null)
                {
                    // Load the object
                    JObject jsonObject = JObject.Load(reader);

                    // Decode the data
                    int NumElements = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_NUMELEMENTS];
                    int ElementsMultiplier = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_ELEMENTSMULTIPLIER];

                    // EnsembleNumber
                    int EnsembleNumber = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_ENSEMBLENUMBER];

                    // NumBins
                    int NumBins = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_NUMBINS];

                    // NumBeams
                    int NumBeams = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_NUMBEAMS];

                    // DesiredPingCount
                    int DesiredPingCount = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_DESIREDPINGCOUNT];

                    // ActualPingCount
                    int ActualPingCount = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_ACTUALPINGCOUNT];

                    // SysSerialNumber
                    SerialNumber SysSerialNumber = new SerialNumber((string)jsonObject[DataSet.BaseDataSet.STR_JSON_SERIALNUMBER_SERIALNUMBERSTRING]);

                    // SysFirmware
                    ushort major = (ushort)jsonObject[DataSet.BaseDataSet.JSON_STR_FIRMWAREMAJOR];
                    ushort minor = (ushort)jsonObject[DataSet.BaseDataSet.JSON_STR_FIRMWAREMINOR];
                    ushort rev = (ushort)jsonObject[DataSet.BaseDataSet.JSON_STR_FIRMWAREREVISION];
                    byte code = (byte)jsonObject[DataSet.BaseDataSet.JSON_STR_SUBSYSTEMCODE].ToObject<byte>();
                    Firmware SysFirmware = new Firmware(code, major, minor, rev);

                    // SubsystemConfig
                    ushort index = (ushort)jsonObject[DataSet.BaseDataSet.JSON_STR_SUBSYSTEM_INDEX];
                    byte ssCode = (byte)jsonObject[DataSet.BaseDataSet.JSON_STR_SUBSYSTEM_CODE].ToObject<byte>();
                    byte cepoIndex = (byte)jsonObject[DataSet.BaseDataSet.JSON_STR_CEPOINDEX].ToObject<byte>();
                    byte configNum = (byte)jsonObject[DataSet.BaseDataSet.JSON_STR_SSCONFIG_INDEX].ToObject<byte>();
                    SubsystemConfiguration SubsystemConfig = new SubsystemConfiguration(new Subsystem(ssCode, index), cepoIndex, configNum);

                    // Status
                    Status status = new Status((int)jsonObject[DataSet.BaseDataSet.JSON_STR_STATUS]);

                    // Year
                    int Year = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_YEAR];

                    // Month
                    int Month = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_MONTH];

                    // Day
                    int Day = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_DAY];

                    // Hour
                    int Hour = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_HOUR];

                    // Minute
                    int Minute = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_MINUTE];

                    // Second
                    int Second = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_SECOND];

                    // HSec
                    int HSec = (int)jsonObject[DataSet.BaseDataSet.JSON_STR_HSEC];

                    // Create the object
                    // Need to call the constructor to create
                    // the correct EnsDateTime and UniqueID
                    var data = new EnsembleDataSet(DataSet.Ensemble.DATATYPE_INT, NumElements, ElementsMultiplier, DataSet.Ensemble.DEFAULT_IMAG, DataSet.Ensemble.DEFAULT_NAME_LENGTH, DataSet.Ensemble.EnsembleDataID,
                                                    EnsembleNumber, NumBins, NumBeams, DesiredPingCount, ActualPingCount,
                                                    SysSerialNumber, SysFirmware, SubsystemConfig, status,
                                                    Year, Month, Day, Hour, Minute, Second, HSec);

                    return data;
                }

                return null;
            }