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