Exemple #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;
 }
Exemple #2
0
        /// <summary>
        /// Set the data sets for the WI message.
        /// </summary>
        /// <param name="sentence">Message with the WI data.</param>
        private void SetWI(string sentence)
        {
            _prevWI = new WI(sentence);

            // Add DVL DataSet
            _prevEns.DvlData.WmXVelocity = _prevWI.X;
            _prevEns.DvlData.WmYVelocity = _prevWI.Y;
            _prevEns.DvlData.WmZVelocity = _prevWI.Z;
            _prevEns.DvlData.WmErrorVelocity = _prevWI.Q;
            _prevEns.DvlData.WmInstrumentIsGoodVelocity = _prevWI.IsGood;

            // Add Instrument Water Mass DataSet
            if (!_prevEns.IsInstrumentWaterMassAvail)
            {
                _prevEns.InstrumentWaterMassData = new DataSet.InstrumentWaterMassDataSet();
                _prevEns.IsInstrumentWaterMassAvail = true;
            }
            _prevEns.InstrumentWaterMassData.VelocityX = _prevWI.X;
            _prevEns.InstrumentWaterMassData.VelocityY = _prevWI.Y;
            _prevEns.InstrumentWaterMassData.VelocityZ = _prevWI.Z;
            _prevEns.InstrumentWaterMassData.VelocityQ = _prevWI.Q;
        }
Exemple #3
0
        /// <summary>
        /// Set the data sets for the WI message.
        /// </summary>
        /// <param name="sentence">Message with the WI data.</param>
        private void SetWI(string sentence)
        {
            // Verify byte count
            if (sentence.Count(x => x == ',') != WI.NUM_ELEM - 1)
            {
                return;
            }

            var wi = new WI(sentence);

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

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

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

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

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

                _prevEns.DvlData.WmInstrumentIsGoodVelocity = wi.IsGood;

                // Add Instrument Water Mass DataSet
                if (!_prevEns.IsInstrumentWaterMassAvail)
                {
                    _prevEns.InstrumentWaterMassData = new DataSet.InstrumentWaterMassDataSet();
                    _prevEns.IsInstrumentWaterMassAvail = true;
                }
                _prevEns.InstrumentWaterMassData.VelocityX = _prevEns.DvlData.WmXVelocity;
                _prevEns.InstrumentWaterMassData.VelocityY = _prevEns.DvlData.WmYVelocity;
                _prevEns.InstrumentWaterMassData.VelocityZ = _prevEns.DvlData.WmZVelocity;
                _prevEns.InstrumentWaterMassData.VelocityQ = _prevEns.DvlData.WmErrorVelocity;
            }

            _prevWI = wi;
        }