/// <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 TS message. /// </summary> /// <param name="sentence">Message with the TS data.</param> private void SetTS(string sentence) { _prevTS = new TS(sentence); // Add DVL DataSet _prevEns.DvlData.Salinity = _prevTS.Salinity; _prevEns.DvlData.Temperature = _prevTS.Temperature; _prevEns.DvlData.DepthOfTransducer = _prevTS.DepthOfTransducer; _prevEns.DvlData.SpeedOfSound = _prevTS.SpeedOfSound; _prevEns.DvlData.BIT = _prevTS.BIT; // Add Ancillary DataSet if (!_prevEns.IsAncillaryAvail) { _prevEns.AncillaryData = new DataSet.AncillaryDataSet(); _prevEns.IsAncillaryAvail = true; } _prevEns.AncillaryData.Salinity = _prevTS.Salinity; _prevEns.AncillaryData.WaterTemp = _prevTS.Temperature; _prevEns.AncillaryData.TransducerDepth = _prevTS.DepthOfTransducer; _prevEns.AncillaryData.SpeedOfSound = _prevTS.SpeedOfSound; // Add Bottom Track DataSet if (!_prevEns.IsBottomTrackAvail) { _prevEns.BottomTrackData = new DataSet.BottomTrackDataSet(); _prevEns.IsBottomTrackAvail = true; } _prevEns.BottomTrackData.Salinity = _prevTS.Salinity; _prevEns.BottomTrackData.WaterTemp = _prevTS.Temperature; _prevEns.BottomTrackData.TransducerDepth = _prevTS.DepthOfTransducer; _prevEns.BottomTrackData.SpeedOfSound = _prevTS.SpeedOfSound; }
/// <summary> /// Set the data sets for the TS message. /// </summary> /// <param name="sentence">Message with the TS data.</param> private void SetTS(string sentence) { // Verify byte count if (sentence.Count(x => x == ',') != TS.NUM_ELEM-1) { return; } var ts = new TS(sentence); if (ts != null) { // Add DVL dataset if (_prevEns.DvlData == null) { _prevEns.DvlData = new DataSet.DvlDataSet(); _prevEns.IsDvlDataAvail = true; } // Get the first and last date and time to determine the ping time var diffTime = ts.DateAndTime - _prevDateAndTime; float pingTime = (float)diffTime.TotalSeconds; _prevEns.DvlData.DateAndTime = ts.DateAndTime; _prevDateAndTime = ts.DateAndTime; _prevEns.DvlData.Salinity = ts.Salinity; _prevEns.DvlData.WaterTemp = ts.Temperature; _prevEns.DvlData.TransducerDepth = ts.DepthOfTransducer; _prevEns.DvlData.SpeedOfSound = ts.SpeedOfSound; _prevEns.DvlData.BIT = ts.BIT; _prevEns.DvlData.LeakDetection = ts.LeakDetection; // Add Ancillary DataSet if (!_prevEns.IsAncillaryAvail) { _prevEns.AncillaryData = new DataSet.AncillaryDataSet(); _prevEns.IsAncillaryAvail = true; } _prevEns.AncillaryData.Salinity = ts.Salinity; _prevEns.AncillaryData.WaterTemp = ts.Temperature; _prevEns.AncillaryData.TransducerDepth = ts.DepthOfTransducer; _prevEns.AncillaryData.SpeedOfSound = ts.SpeedOfSound; _prevEns.AncillaryData.FirstPingTime += pingTime; // Accumulate the time ping _prevEns.AncillaryData.LastPingTime += pingTime; // Accumulate the time ping // Add Bottom Track DataSet if (!_prevEns.IsBottomTrackAvail) { _prevEns.BottomTrackData = new DataSet.BottomTrackDataSet(); _prevEns.IsBottomTrackAvail = true; } _prevEns.BottomTrackData.Salinity = ts.Salinity; _prevEns.BottomTrackData.WaterTemp = ts.Temperature; _prevEns.BottomTrackData.TransducerDepth = ts.DepthOfTransducer; _prevEns.BottomTrackData.SpeedOfSound = ts.SpeedOfSound; _prevEns.BottomTrackData.FirstPingTime += pingTime; // Accumulate the time ping _prevEns.BottomTrackData.LastPingTime += pingTime; // Accumulate the time ping // Add Ensemble DataSet if (!_prevEns.IsEnsembleAvail) { _prevEns.EnsembleData = new DataSet.EnsembleDataSet(); _prevEns.IsEnsembleAvail = true; } _prevEns.EnsembleData.SetTime(ts.DateAndTime); _prevEns.EnsembleData.EnsembleNumber = _count++; } _prevTS = ts; }