/// <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; }
/// <summary> /// Set the data sets for the BS message. /// </summary> /// <param name="sentence">Message with the BS data.</param> private void SetBS(string sentence) { _prevBS = new BS(sentence); // Set DVL DataSet _prevEns.DvlData.BtTransverseVelocity = _prevBS.T; _prevEns.DvlData.BtLongitudinalVelocity = _prevBS.L; _prevEns.DvlData.BtNormalVelocity = _prevBS.N; _prevEns.DvlData.BtShipIsGoodVelocity = _prevBS.IsGood; }
/// <summary> /// Set the data sets for the BS message. /// </summary> /// <param name="sentence">Message with the BS data.</param> private void SetBS(string sentence) { // Verify byte count if (sentence.Count(x => x == ',') != BS.NUM_ELEM - 1) { return; } var bs = new BS(sentence); if (bs != null) { // Add DVL dataset if (_prevEns.DvlData == null) { _prevEns.DvlData = new DataSet.DvlDataSet(); _prevEns.IsDvlDataAvail = true; } // Check for bad velocity // BtTransverseVelocity if (bs.T == DataSet.Ensemble.BAD_VELOCITY || bs.T == PD0.BAD_VELOCITY) { _prevEns.DvlData.BtTransverseVelocity = DataSet.Ensemble.BAD_VELOCITY; } else { _prevEns.DvlData.BtTransverseVelocity = bs.T * 0.001f; } // BtLongitudinalVelocity if (bs.L == DataSet.Ensemble.BAD_VELOCITY || bs.L == PD0.BAD_VELOCITY) { _prevEns.DvlData.BtLongitudinalVelocity = DataSet.Ensemble.BAD_VELOCITY; } else { _prevEns.DvlData.BtLongitudinalVelocity = bs.L * 0.001f; } // BtNormalVelocity if (bs.N == DataSet.Ensemble.BAD_VELOCITY || bs.N == PD0.BAD_VELOCITY) { _prevEns.DvlData.BtNormalVelocity = DataSet.Ensemble.BAD_VELOCITY; } else { _prevEns.DvlData.BtNormalVelocity = bs.N * 0.001f; } _prevEns.DvlData.BtShipIsGoodVelocity = bs.IsGood; } _prevBS = bs; }