Exemplo n.º 1
0
 /// <summary>
 /// Reinitialize the values.
 /// </summary>
 private void Clear()
 {
     // Initialize all the sentences
     _prevSA = null;
     _prevTS = null;
     _prevRA = null;
     _prevWI = null;
     _prevWS = null;
     _prevWE = null;
     _prevWD = null;
     _prevBI = null;
     _prevBS = null;
     _prevBE = null;
     _prevBD = null;
     _prevEns = new DataSet.Ensemble();
     _count = 0;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Set the data sets for the BI message.
        /// </summary>
        /// <param name="sentence">Message with the BI data.</param>
        private void SetBI(string sentence)
        {
            _prevBI = new BI(sentence);

            // Set DVL DataSet
            _prevEns.DvlData.BtXVelocity = _prevBI.X;
            _prevEns.DvlData.BtYVelocity = _prevBI.Y;
            _prevEns.DvlData.BtZVelocity = _prevBI.Z;
            _prevEns.DvlData.BtErrorVelocity = _prevBI.Q;
            _prevEns.DvlData.BtInstrumentIsGoodVelocity = _prevBI.IsGood;

            // Add Bottom Track DataSet
            if (!_prevEns.IsBottomTrackAvail)
            {
                _prevEns.BottomTrackData = new DataSet.BottomTrackDataSet();
                _prevEns.IsBottomTrackAvail = true;
            }
            _prevEns.BottomTrackData.InstrumentVelocity[DataSet.Ensemble.BEAM_X_INDEX] = _prevBI.X;
            _prevEns.BottomTrackData.InstrumentVelocity[DataSet.Ensemble.BEAM_Y_INDEX] = _prevBI.Y;
            _prevEns.BottomTrackData.InstrumentVelocity[DataSet.Ensemble.BEAM_Z_INDEX] = _prevBI.Z;
            _prevEns.BottomTrackData.InstrumentVelocity[DataSet.Ensemble.BEAM_Q_INDEX] = _prevBI.Q;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Set the data sets for the BI message.
        /// </summary>
        /// <param name="sentence">Message with the BI data.</param>
        private void SetBI(string sentence)
        {
            // Verify byte count
            if (sentence.Count(x => x == ',') != BI.NUM_ELEM - 1)
            {
                return;
            }

            var bi = new BI(sentence);

            if (bi != null)
            {
                // Add DVL dataset
                if (_prevEns.DvlData == null)
                {
                    _prevEns.DvlData = new DataSet.DvlDataSet();
                    _prevEns.IsDvlDataAvail = true;
                }

                // Check for bad velocity
                // X
                if (bi.X == DataSet.Ensemble.BAD_VELOCITY || bi.X == PD0.BAD_VELOCITY)
                {
                    _prevEns.DvlData.BtXVelocity = DataSet.Ensemble.BAD_VELOCITY;
                }
                else
                {
                    _prevEns.DvlData.BtXVelocity = bi.X * 0.001f;
                }

                // Y
                if (bi.Y == DataSet.Ensemble.BAD_VELOCITY || bi.Y == PD0.BAD_VELOCITY)
                {
                    _prevEns.DvlData.BtYVelocity = DataSet.Ensemble.BAD_VELOCITY;
                }
                else
                {
                    _prevEns.DvlData.BtYVelocity = bi.Y * 0.001f;
                }

                // Z
                if (bi.Z == DataSet.Ensemble.BAD_VELOCITY || bi.Z == PD0.BAD_VELOCITY)
                {
                    _prevEns.DvlData.BtZVelocity = DataSet.Ensemble.BAD_VELOCITY;
                }
                else
                {
                    _prevEns.DvlData.BtZVelocity = bi.Z * 0.001f;
                }

                // Q
                if (bi.Q == DataSet.Ensemble.BAD_VELOCITY || bi.Q == PD0.BAD_VELOCITY)
                {
                    _prevEns.DvlData.BtErrorVelocity = DataSet.Ensemble.BAD_VELOCITY;
                }
                else
                {
                    _prevEns.DvlData.BtErrorVelocity = bi.Q * 0.001f;
                }

                // Set good flag
                _prevEns.DvlData.BtInstrumentIsGoodVelocity = bi.IsGood;

                // Add Bottom Track DataSet
                if (!_prevEns.IsBottomTrackAvail)
                {
                    _prevEns.BottomTrackData = new DataSet.BottomTrackDataSet();
                    _prevEns.IsBottomTrackAvail = true;
                }
                _prevEns.BottomTrackData.InstrumentVelocity[DataSet.Ensemble.BEAM_X_INDEX] = _prevEns.DvlData.BtXVelocity;
                _prevEns.BottomTrackData.InstrumentVelocity[DataSet.Ensemble.BEAM_Y_INDEX] = _prevEns.DvlData.BtYVelocity;
                _prevEns.BottomTrackData.InstrumentVelocity[DataSet.Ensemble.BEAM_Z_INDEX] = _prevEns.DvlData.BtZVelocity;
                _prevEns.BottomTrackData.InstrumentVelocity[DataSet.Ensemble.BEAM_Q_INDEX] = _prevEns.DvlData.BtErrorVelocity;
            }

            _prevBI = bi;
        }