Example #1
0
        /// <summary>
        /// Return true if a copy of measMsg is already in internal cache.
        /// If not, add measMsg into the cache.
        /// </summary>
        /// <param name="measMsg"></param>
        /// <returns></returns>
        internal bool DuplicateMeasMsgDetected(MeasMsg measMsg)
        {
            bool duplicateFound = false;

            lock (measMsgLock)
            {
                foreach (var listItem in measMsgList)
                {
                    if (listItem.CheckForDuplicateFilter(measMsg))
                    {
                        duplicateFound = true;
                        break;
                    }
                }

                if (!duplicateFound)
                {
                    measMsgList.Add(measMsg);

                    if (measMsgList.Count > CacheSize)
                    {
                        measMsgList.RemoveAt(0);
                    }
                }
            }

            return(duplicateFound);
        }
Example #2
0
        public MeasMsg Parse(string text)
        {
            string[] data = PreProcess(text);
            if (data == null)
            {
                return(null);
            }

            if (data.GetLength(0) == 0)
            {
                return(null);
            }

            var measMsg = new MeasMsg();

            dateTime        = DateTimeEx.Now;
            measMsg.Time    = dateTime;
            measMsg.Station = ParseStation(data[0]);

            //if (CheckForWD30(data, ref measMsg))
            //    return measMsg;

            foreach (var item in data)
            {
                ParseItem(item, measMsg);
            }

            if (measMsg.Count == 0)
            {
                return(null);
            }

            return(measMsg);
        }
Example #3
0
        private MeasMsg AddCellDepths(NMEAProprietarySentence nmeaSentence, MeasMsg measMsg)
        {
            bool      cannotCompute = false;
            const int blankingIndex = 4;
            const int cellSizeIndex = 5;
            double    blanking      = 0;
            double    cellSize      = 0;

            if (!measMsg.GetNumericDoubleObsValueByName(nameDictionary["I"][blankingIndex], out blanking))
            {
                cannotCompute = true;
            }
            else if (!measMsg.GetNumericDoubleObsValueByName(nameDictionary["I"][cellSizeIndex], out cellSize))
            {
                cannotCompute = true;
            }

            for (int i = 0; i < CellDepthVariables.Count; i++)
            {
                string dataValue = "///";
                if (!cannotCompute)
                {
                    double depth = blanking + (i + 1) * cellSize;
                    dataValue = depth.ToString();
                }
                measMsg.AddMeas(CellDepthVariables[i], dataValue.ToString());
            }

            return(measMsg);
        }
Example #4
0
        public MeasMsg ParseMessageIntoMeasMsg(string data, INamedPort virtualPort = null)
        {
            this.virtualPort = virtualPort;

            IList <string> sc      = ParseMessage(data);
            var            measMsg = new MeasMsg();
            var            sb      = new StringBuilder();

            foreach (var s in sc)
            {
                sb.Append(s);
            }

            if (!measMsg.Initialise(sb.ToString()))
            {
                return(null);
            }

            if (RoundSecondsToClosestFullMinute)
            {
                var timeSpan = measMsg.Time.TimeOfDay;
                if (timeSpan.Seconds < 30)
                {
                    timeSpan = timeSpan.Add(-TimeSpan.FromSeconds(timeSpan.Seconds));
                }
                else
                {
                    timeSpan = timeSpan.Add(TimeSpan.FromSeconds(60 - timeSpan.Seconds));
                }
                measMsg.Time = measMsg.Time.Date.Add(timeSpan);
            }
            return(measMsg);
        }
Example #5
0
 private bool ParseVariables(string[] variables, string[] data, ref MeasMsg measMsg)
 {
     try
     {
         int dataLen      = data.GetLength(0);
         int varLen       = variables.GetLength(0);
         int loopMaxIndex = Math.Min(dataLen, varLen);
         //if (dataLen > varLen)
         //    return false;
         for (var i = 0; i < loopMaxIndex; i++)
         {
             if (variables[i].Length > 0)
             {
                 var meas = new Meas(variables[i], dateTime, data[i], MeasStatus.c*K);
                 measMsg.AddMeas(meas);
                 if (variables[i] == "WSAVG1M")
                 {
                     meas = new Meas("WS", dateTime, data[i], MeasStatus.c*K);
                     measMsg.AddMeas(meas);
                 }
                 else if (variables[i] == "WDAVG1M")
                 {
                     meas = new Meas("WD", dateTime, data[i], MeasStatus.c*K);
                     measMsg.AddMeas(meas);
                 }
             }
         }
         return(true);
     }
     catch (Exception ex)
     {
         ExceptionHandler.HandleException("WXT.ParseVariables", ex);
         return(false);
     }
 }
Example #6
0
        private MeasMsg ParseTime(string lineValue, string format, MeasMsg measMsg)
        {
            TimeSpan timeSpan;
            bool     ok = TimeSpan.TryParseExact(lineValue, format, CultureInfo.InvariantCulture, TimeSpanStyles.None, out timeSpan);

            if (ok)
            {
                if (RoundSecondsToClosestFullMinute)
                {
                    if (timeSpan.Seconds < 30)
                    {
                        timeSpan = timeSpan.Add(-TimeSpan.FromSeconds(timeSpan.Seconds));
                    }
                    else
                    {
                        timeSpan = timeSpan.Add(TimeSpan.FromSeconds(60 - timeSpan.Seconds));
                    }
                }
                measMsg.Time = measMsg.Time.Date.Add(timeSpan);

                return(measMsg);
            }
            ExceptionHandler.RecordException("Yourview parser is unable to parse time " + lineValue + " format " + format);
            return(measMsg);
        }
Example #7
0
        private MeasMsg HandleSpecialField(string varname, string lineValue, MeasMsg measMsg)
        {
            if (varname.StartsWith("<DATE"))
            {
                const int dateStart = 6;
                int       dateLen   = varname.Length - dateStart - 1;
                return(ParseDate(lineValue, varname.Substring(dateStart, dateLen), measMsg));
            }

            if (varname.StartsWith("<TIME"))
            {
                const int timeStart = 6;
                int       timeLen   = varname.Length - timeStart - 1;
                string    format    = varname.Substring(timeStart, timeLen).ToLower();
                if (!format.Contains("ss"))
                {
                    format    = format + "ss";
                    lineValue = lineValue + "00";
                }
                return(ParseTime(lineValue, format, measMsg));
            }
            if (varname == "<STATION NAME>")
            {
                return(ParseStatioName(lineValue, false, measMsg));
            }
            if (varname == "<STATION ID>")
            {
                return(ParseStatioName(lineValue, true, measMsg));
            }
            return(measMsg);
        }
Example #8
0
        private MeasMsg ParseStatioName(string lineValue, bool useStationId, MeasMsg measMsg)
        {
            string sName = lineValue;

            SimpleFileWriter.WriteLineToEventFile(DirectoryName.Diag, "ParseStatioName:" + useStationId + "|" + sName);

            if (useStationId)
            {
                SimpleFileWriter.WriteLineToEventFile(DirectoryName.Diag, "ParseStatioName 2:" + this.stationMessageNames.ContainsKey(sName));

                if (this.stationMessageNames.ContainsKey(sName))
                {
                    sName = stationMessageNames[sName];
                }
                else
                {
                    var sb = new StringBuilder();
                    SimpleFileWriter.WriteLineToEventFile(DirectoryName.Diag, "YV Station list 2:");
                    foreach (var key in stationMessageNames.Keys)
                    {
                        sb.AppendLine(key + ":" + stationMessageNames[key]);
                    }
                    SimpleFileWriter.WriteLineToEventFile(DirectoryName.Diag, sb.ToString());
                }
            }
            if (sName != null)
            {
                measMsg.Station = sName;
            }

            return(measMsg);
        }
Example #9
0
        internal void ProcessObservationData(INamedPort port, MeasMsg measMsg, string text)
        {
            var e = new PortListenerEventArgs(port, measMsg, text);

            if (PortListenerMeasMsgEvent != null)
            {
                PortListenerMeasMsgEvent(this, e);
            }
        }
Example #10
0
        internal void ProcessOttParsivelData(INamedPort port, MeasMsg measMsg, string text)
        {
            var e = new PortListenerEventArgs(port, measMsg, text);

            if (OttParsivelEvent != null)
            {
                OttParsivelEvent(this, e);
            }
        }
Example #11
0
        public void ProcessLogFileData(INamedPort port, MeasMsg measMsg)
        {
            var e = new PortListenerEventArgs(port, measMsg);

            if (PortListenerLogFileEvent != null)
            {
                PortListenerLogFileEvent(this, e);
            }
        }
Example #12
0
        public void OnEndOfLogFileData(INamedPort port, MeasMsg measMsg)
        {
            var e = new PortListenerEventArgs(port, measMsg);

            if (EndOfLogFileData != null)
            {
                EndOfLogFileData(this, e);
            }
        }
Example #13
0
        private static void ProcessObservationData(INamedPort virtualPort, string text, ParserBase parser)
        {
            MeasMsg msg = parser.ParseMessageIntoMeasMsg(text, virtualPort);

            // To AwsDataReceiver && Observation Console
            if (msg != null) // msg will be null if garbage was received
            {
                portListenerEventHandler.ProcessObservationData(virtualPort, msg, text);
            }
        }
Example #14
0
        private void ProcessAwacNMEAObservationData(INamedPort virtualPort, string text)
        {
            MeasMsg msg = this.awacNmeaParser.Parse(text);

            // To AwsDataReceiver && Observation Console
            if (msg != null) // msg will be null if garbage was received
            {
                portListenerEventHandler.ProcessObservationData(virtualPort, msg, text);
            }
        }
Example #15
0
        private bool CheckForWD30(string[] data, ref MeasMsg measMsg)
        {
            const string WD30id = "$WIMWV";

            if (!data[0].StartsWith(WD30id))
            {
                return(false);
            }

            return(ParseVariables(WD30WindVars, data, ref measMsg));
        }
Example #16
0
        } // ParserTest1

        private static void ValidateResults(IEnumerable <string> results)
        {
            foreach (var s1 in results)
            {
                Assert.True(s1.Length > 0);
                Assert.True(s1.StartsWith("MEAS\t"), "Does not start with MEAS\t");
                Assert.True(s1.EndsWith(Environment.NewLine), "Does not end properly");
                var m = new MeasMsg();
                Assert.True(m.Initialise(s1), "Could not initialise measmsg");
            }
        }
Example #17
0
        public void ParseSemicolonInTheEnd()
        {
            var     smsAwsParser = new SmsAwsParser();
            string  msg          = "(S:AWS1  ;D:070601;T:105802;TAAVG60S:12.1;)";
            MeasMsg result       = smsAwsParser.ParseMessageIntoMeasMsg(msg);

            Assert.True(result.Count == 1);

            msg    = "(S:AWS1  ;D:070601;T:105802;TAAVG60S:12.1;TA2:23.1;)";
            result = smsAwsParser.ParseMessageIntoMeasMsg(msg);
            Assert.True(result.Count == 2);
        }
Example #18
0
        private static MeasMsg ParseDate(string lineValue, string format, MeasMsg measMsg)
        {
            DateTime dateTime;
            bool     ok = DateTime.TryParseExact(lineValue, format, CultureInfo.InvariantCulture, DateTimeStyles.AllowWhiteSpaces, out dateTime);

            if (ok)
            {
                measMsg.Time = dateTime;
                return(measMsg);
            }
            ExceptionHandler.RecordException("Yourview parser is unable to parse date " + lineValue + " format " + format);
            return(measMsg);
        }
Example #19
0
        public void ToStdStringTest()
        {
            string  s1       = "MEAS\tStation01\t\t\tTAAVG60S\tNONE\t\t2006-01-02 18:08:11\t24.0\t0\t0\r\n\n";
            MeasMsg measMsg1 = new MeasMsg();

            Assert.True(measMsg1.Initialise(s1));
            string sz    = "MEAS\tStation01\t\t\tTAAVG60S\tNONE\t\t2006-01-02 18:08:11\t24.0\t0\tcOK\r\n";
            string tmp2  = MeasMsgFormatter.FormatMeasMsg(measMsg1);
            int    iSz   = sz.Length;
            int    iTmp2 = tmp2.Length;

            Assert.True(iSz == iTmp2);
            for (var i = 0; i < iSz; i++)
            {
                if (tmp2[i] != sz[i])
                {
                    Assert.True(false, "Difference in char " + i);
                }
            }

            Assert.True(tmp2 == sz);

            string s3 =
                "MEAS\tStation01\t\t\tTAAVG60S\tNONE\t\t2006-01-02 18:08:11\t24.0\t0\t0\r\n\nMEAS\tStation01\t\t\tTAAVG10M\tNONE\t\t2006-01-02 18:08:11\t24.0\t0\t0\r\n\nMEAS\tStation01\t\t\tTAMIN1H\tNONE\t\t2006-01-02 18:08:11\t24.0\t0\t0\r\n\nMEAS\tStation01\t\t\tTAMAX1H\tNONE\t\t2006-01-02 18:08:11\t24.4\t0\t0\r\n\nMEAS\tStation01\t\t\tTAAVG1H\tNONE\t\t2006-01-02 18:08:11\t24.1\t0\t0\r\n\nMEAS\tStation01\t\t\tTAMIN12H\tNONE\t\t2006-01-02 18:08:11\t23.9\t0\t0\r\n\nMEAS\tStation01\t\t\tTAMAX12H\tNONE\t\t2006-01-02 18:08:11\t24.8\t0\t0\r\n\nMEAS\tStation01\t\t\tTAAVG12H\tNONE\t\t2006-01-02 18:08:11\t24.3\t0\t0\r\n\nMEAS\tStation01\t\t\tTAMIN24H\tNONE\t\t2006-01-02 18:08:11\t23.9\t0\t0\r\n\nMEAS\tStation01\t\t\tTAMAX24H\tNONE\t\t2006-01-02 18:08:11\t24.8\t0\t0\r\n\nMEAS\tStation01\t\t\tTAAVG24H\tNONE\t\t2006-01-02 18:08:11\t24.2\t0\t0\r\n\nMEAS\tStation01\t\t\tTG1AVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG1AVG10M\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG1MIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n";

            s3 +=
                "\nMEAS\tStation01\t\t\tTG1MAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG1AVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG1MIN12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG1MAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG1AVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG1MIN24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG1MAX24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG1AVG24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG2AVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG2AVG10M\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG2MIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG2MAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG2AVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG2MIN12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tT";
            s3 +=
                "G2MAX12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG2AVG12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTGMIN24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG2MAX24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTG2AVG24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tRHAVG60S\tNONE\t\t2006-01-02 18:08:11\t18\t0\t0\r\n\nMEAS\tStation01\t\t\tRHAVG10M\tNONE\t\t2006-01-02 18:08:11\t18\t0\t0\r\n\nMEAS\tStation01\t\t\tRHMIN1H\tNONE\t\t2006-01-02 18:08:11\t18\t0\t0\r\n\nMEAS\tStation01\t\t\tRHMAX1H\tNONE\t\t2006-01-02 18:08:11\t18\t0\t0\r\n\nMEAS\tStation01\t\t\tRHAVG1H\tNONE\t\t2006-01-02 18:08:11\t18\t0\t0\r\n\nMEAS\tStation01\t\t\tRHMIN24H\tNONE\t\t2006-01-02 18:08:11\t18\t0\t0\r\n\nMEAS\tStation01\t\t\tRHMAX24H\tNONE\t\t2006-01-02 18:08:11\t22\t0\t0\r\n\nMEAS\tStation01\t\t\tRHAVG24H\tNONE\t\t2006-01-02 18:08:11\t19\t0\t0\r\n\nMEAS\tStation01\t\t\tDPAVRG60S\tNONE\t\t2006-01-02 18:08:11\t-1.9\t0\t0\r\n\nMEAS\tStation01\t\t\tDPAVG10M\tNONE\t\t";
            s3 +=
                "2006-01-02 18:08:11\t-1.8\t0\t0\r\n\nMEAS\tStation01\t\t\tDPMIN1H\tNONE\t\t2006-01-02 18:08:11\t-1.9\t0\t0\r\n\nMEAS\tStation01\t\t\tDPMAX1H\tNONE\t\t2006-01-02 18:08:11\t-1.4\t0\t0\r\n\nMEAS\tStation01\t\t\tDPAVG1H\tNONE\t\t2006-01-02 18:08:11\t-1.6\t0\t0\r\n\nMEAS\tStation01\t\t\tDPMIN24H\tNONE\t\t2006-01-02 18:08:11\t-1.8\t0\t0\r\n\nMEAS\tStation01\t\t\tDPMAX24H\tNONE\t\t2006-01-02 18:08:11\t0.7\t0\t0\r\n\nMEAS\tStation01\t\t\tDPAVG24H\tNONE\t\t2006-01-02 18:08:11\t-0.6\t0\t0\r\n\nMEAS\tStation01\t\t\tPAAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tPAAVG10M\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tPAMIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tPAMAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tPAAVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tQFEAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tQFEMIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tQFEMAX1H\tNONE\t\t2006-01-02 18:08";
            s3 +=
                ":11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tQFEAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tQFFAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tQFFMIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tQFFMAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tQFFAVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tppp\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tTENDENCY\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\nMEAS\tStation01\t\t\tSUNSTATE\tNONE\t\t2006-01-02 18:08:11\t-0.008\t0\t0\r\n\nMEAS\tStation01\t\t\tSUNDUR1H\tNONE\t\t2006-01-02 18:08:11\t0\t0\t0\r\n\nMEAS\tStation01\t\t\tSUNDUR24H\tNONE\t\t2006-01-02 18:08:11\t0\t0\t0\r\n\nMEAS\tStation01\t\t\tPREC60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\t0\r\n\n";

            MeasMsg measMsg3 = new MeasMsg();

            Assert.True(measMsg3.Initialise(s3));
            Assert.True(measMsg3.Count == 68);

            //string sExpected = "MEAS\tStation01\t\t\tPREC60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tSUNDUR24H\tNONE\t\t2006-01-02 18:08:11\t0\t0\tcOK\t\r\nMEAS\tStation01\t\t\tSUNDUR1H\tNONE\t\t2006-01-02 18:08:11\t0\t0\tcOK\t\r\nMEAS\tStation01\t\t\tSUNSTATE\tNONE\t\t2006-01-02 18:08:11\t-0.008\t0\tcOK\t\r\nMEAS\tStation01\t\t\tTENDENCY\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tppp\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tQFFAVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tQFFMAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tQFFMIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tQFFAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tQFEAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tQFEMAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tQFEMIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tQFEAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tPAAVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tPAMAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tPAMIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tPAAVG10M\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tPAAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tDPAVG24H\tNONE\t\t2006-01-02 18:08:11\t-0.6\t0\tcOK\t\r\nMEAS\tStation01\t\t\tDPMAX24H\tNONE\t\t2006-01-02 18:08:11\t0.7\t0\tcOK\t\r\nMEAS\tStation01\t\t\tDPMIN24H\tNONE\t\t2006-01-02 18:08:11\t-1.8\t0\tcOK\t\r\nMEAS\tStation01\t\t\tDPAVG1H\tNONE\t\t2006-01-02 18:08:11\t-1.6\t0\tcOK\t\r\nMEAS\tStation01\t\t\tDPMAX1H\tNONE\t\t2006-01-02 18:08:11\t-1.4\t0\tcOK\t\r\nMEAS\tStation01\t\t\tDPMIN1H\tNONE\t\t2006-01-02 18:08:11\t-1.9\t0\tcOK\t\r\nMEAS\tStation01\t\t\tDPAVG10M\tNONE\t\t2006-01-02 18:08:11\t-1.8\t0\tcOK\t\r\nMEAS\tStation01\t\t\tDPAVRG60S\tNONE\t\t2006-01-02 18:08:11\t-1.9\t0\tcOK\t\r\nMEAS\tStation01\t\t\tRHAVG24H\tNONE\t\t2006-01-02 18:08:11\t19\t0\tcOK\t\r\nMEAS\tStation01\t\t\tRHMAX24H\tNONE\t\t2006-01-02 18:08:11\t22\t0\tcOK\t\r\nMEAS\tStation01\t\t\tRHMIN24H\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\t\r\nMEAS\tStation01\t\t\tRHAVG1H\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\t\r\nMEAS\tStation01\t\t\tRHMAX1H\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\t\r\nMEAS\tStation01\t\t\tRHMIN1H\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\t\r\nMEAS\tStation01\t\t\tRHAVG10M\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\t\r\nMEAS\tStation01\t\t\tRHAVG60S\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\t\r\nMEAS\tStation01\t\t\tTG2AVG24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG2MAX24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTGMIN24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG2AVG12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG2MAX12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG2MIN12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG2AVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG2MAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG2MIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG2AVG10M\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG2AVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG1AVG24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG1MAX24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG1MIN24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG1AVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG1MAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG1MIN12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG1AVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG1MAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG1MIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG1AVG10M\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTG1AVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\t\r\nMEAS\tStation01\t\t\tTAAVG24H\tNONE\t\t2006-01-02 18:08:11\t24.2\t0\tcOK\t\r\nMEAS\tStation01\t\t\tTAMAX24H\tNONE\t\t2006-01-02 18:08:11\t24.8\t0\tcOK\t\r\nMEAS\tStation01\t\t\tTAMIN24H\tNONE\t\t2006-01-02 18:08:11\t23.9\t0\tcOK\t\r\nMEAS\tStation01\t\t\tTAAVG12H\tNONE\t\t2006-01-02 18:08:11\t24.3\t0\tcOK\t\r\nMEAS\tStation01\t\t\tTAMAX12H\tNONE\t\t2006-01-02 18:08:11\t24.8\t0\tcOK\t\r\nMEAS\tStation01\t\t\tTAMIN12H\tNONE\t\t2006-01-02 18:08:11\t23.9\t0\tcOK\t\r\nMEAS\tStation01\t\t\tTAAVG1H\tNONE\t\t2006-01-02 18:08:11\t24.1\t0\tcOK\t\r\nMEAS\tStation01\t\t\tTAMAX1H\tNONE\t\t2006-01-02 18:08:11\t24.4\t0\tcOK\t\r\nMEAS\tStation01\t\t\tTAMIN1H\tNONE\t\t2006-01-02 18:08:11\t24.0\t0\tcOK\t\r\nMEAS\tStation01\t\t\tTAAVG10M\tNONE\t\t2006-01-02 18:08:11\t24.0\t0\tcOK\t\r\nMEAS\tStation01\t\t\tTAAVG60S\tNONE\t\t2006-01-02 18:08:11\t24.0\t0\tcOK\t\r\n";
            // string sExpected = "MEAS\tStation01\t\t\tPREC60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tSUNDUR24H\tNONE\t\t2006-01-02 18:08:11\t0\t0\tcOK\r\nMEAS\tStation01\t\t\tSUNDUR1H\tNONE\t\t2006-01-02 18:08:11\t0\t0\tcOK\r\nMEAS\tStation01\t\t\tSUNSTATE\tNONE\t\t2006-01-02 18:08:11\t-0.008\t0\tcOK\r\nMEAS\tStation01\t\t\tTENDENCY\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tppp\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFFAVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFFMAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFFMIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFFAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFEAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFEMAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFEMIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFEAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tPAAVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tPAMAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tPAMIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tPAAVG10M\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tPAAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tDPAVG24H\tNONE\t\t2006-01-02 18:08:11\t-0.6\t0\tcOK\r\nMEAS\tStation01\t\t\tDPMAX24H\tNONE\t\t2006-01-02 18:08:11\t0.7\t0\tcOK\r\nMEAS\tStation01\t\t\tDPMIN24H\tNONE\t\t2006-01-02 18:08:11\t-1.8\t0\tcOK\r\nMEAS\tStation01\t\t\tDPAVG1H\tNONE\t\t2006-01-02 18:08:11\t-1.6\t0\tcOK\r\nMEAS\tStation01\t\t\tDPMAX1H\tNONE\t\t2006-01-02 18:08:11\t-1.4\t0\tcOK\r\nMEAS\tStation01\t\t\tDPMIN1H\tNONE\t\t2006-01-02 18:08:11\t-1.9\t0\tcOK\r\nMEAS\tStation01\t\t\tDPAVG10M\tNONE\t\t2006-01-02 18:08:11\t-1.8\t0\tcOK\r\nMEAS\tStation01\t\t\tDPAVRG60S\tNONE\t\t2006-01-02 18:08:11\t-1.9\t0\tcOK\r\nMEAS\tStation01\t\t\tRHAVG24H\tNONE\t\t2006-01-02 18:08:11\t19\t0\tcOK\r\nMEAS\tStation01\t\t\tRHMAX24H\tNONE\t\t2006-01-02 18:08:11\t22\t0\tcOK\r\nMEAS\tStation01\t\t\tRHMIN24H\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\r\nMEAS\tStation01\t\t\tRHAVG1H\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\r\nMEAS\tStation01\t\t\tRHMAX1H\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\r\nMEAS\tStation01\t\t\tRHMIN1H\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\r\nMEAS\tStation01\t\t\tRHAVG10M\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\r\nMEAS\tStation01\t\t\tRHAVG60S\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\r\nMEAS\tStation01\t\t\tTG2AVG24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2MAX24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTGMIN24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2AVG12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2MAX12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2MIN12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2AVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2MAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2MIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2AVG10M\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2AVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1AVG24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1MAX24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1MIN24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1AVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1MAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1MIN12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1AVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1MAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1MIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1AVG10M\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1AVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTAAVG24H\tNONE\t\t2006-01-02 18:08:11\t24.2\t0\tcOK\r\nMEAS\tStation01\t\t\tTAMAX24H\tNONE\t\t2006-01-02 18:08:11\t24.8\t0\tcOK\r\nMEAS\tStation01\t\t\tTAMIN24H\tNONE\t\t2006-01-02 18:08:11\t23.9\t0\tcOK\r\nMEAS\tStation01\t\t\tTAAVG12H\tNONE\t\t2006-01-02 18:08:11\t24.3\t0\tcOK\r\nMEAS\tStation01\t\t\tTAMAX12H\tNONE\t\t2006-01-02 18:08:11\t24.8\t0\tcOK\r\nMEAS\tStation01\t\t\tTAMIN12H\tNONE\t\t2006-01-02 18:08:11\t23.9\t0\tcOK\r\nMEAS\tStation01\t\t\tTAAVG1H\tNONE\t\t2006-01-02 18:08:11\t24.1\t0\tcOK\r\nMEAS\tStation01\t\t\tTAMAX1H\tNONE\t\t2006-01-02 18:08:11\t24.4\t0\tcOK\r\nMEAS\tStation01\t\t\tTAMIN1H\tNONE\t\t2006-01-02 18:08:11\t24.0\t0\tcOK\r\nMEAS\tStation01\t\t\tTAAVG10M\tNONE\t\t2006-01-02 18:08:11\t24.0\t0\tcOK\r\nMEAS\tStation01\t\t\tTAAVG60S\tNONE\t\t2006-01-02 18:08:11\t24.0\t0\tcOK\r\n";
            string sExpected =
                "MEAS\tStation01\t\t\tTAAVG60S\tNONE\t\t2006-01-02 18:08:11\t24.0\t0\tcOK\r\nMEAS\tStation01\t\t\tTAAVG10M\tNONE\t\t2006-01-02 18:08:11\t24.0\t0\tcOK\r\nMEAS\tStation01\t\t\tTAMIN1H\tNONE\t\t2006-01-02 18:08:11\t24.0\t0\tcOK\r\nMEAS\tStation01\t\t\tTAMAX1H\tNONE\t\t2006-01-02 18:08:11\t24.4\t0\tcOK\r\nMEAS\tStation01\t\t\tTAAVG1H\tNONE\t\t2006-01-02 18:08:11\t24.1\t0\tcOK\r\nMEAS\tStation01\t\t\tTAMIN12H\tNONE\t\t2006-01-02 18:08:11\t23.9\t0\tcOK\r\nMEAS\tStation01\t\t\tTAMAX12H\tNONE\t\t2006-01-02 18:08:11\t24.8\t0\tcOK\r\nMEAS\tStation01\t\t\tTAAVG12H\tNONE\t\t2006-01-02 18:08:11\t24.3\t0\tcOK\r\nMEAS\tStation01\t\t\tTAMIN24H\tNONE\t\t2006-01-02 18:08:11\t23.9\t0\tcOK\r\nMEAS\tStation01\t\t\tTAMAX24H\tNONE\t\t2006-01-02 18:08:11\t24.8\t0\tcOK\r\nMEAS\tStation01\t\t\tTAAVG24H\tNONE\t\t2006-01-02 18:08:11\t24.2\t0\tcOK\r\nMEAS\tStation01\t\t\tTG1AVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1AVG10M\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1MIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1MAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1AVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1MIN12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1MAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1AVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1MIN24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1MAX24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG1AVG24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2AVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2AVG10M\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2MIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2MAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2AVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2MIN12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2MAX12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2AVG12H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTGMIN24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2MAX24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTG2AVG24H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tRHAVG60S\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\r\nMEAS\tStation01\t\t\tRHAVG10M\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\r\nMEAS\tStation01\t\t\tRHMIN1H\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\r\nMEAS\tStation01\t\t\tRHMAX1H\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\r\nMEAS\tStation01\t\t\tRHAVG1H\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\r\nMEAS\tStation01\t\t\tRHMIN24H\tNONE\t\t2006-01-02 18:08:11\t18\t0\tcOK\r\nMEAS\tStation01\t\t\tRHMAX24H\tNONE\t\t2006-01-02 18:08:11\t22\t0\tcOK\r\nMEAS\tStation01\t\t\tRHAVG24H\tNONE\t\t2006-01-02 18:08:11\t19\t0\tcOK\r\nMEAS\tStation01\t\t\tDPAVRG60S\tNONE\t\t2006-01-02 18:08:11\t-1.9\t0\tcOK\r\nMEAS\tStation01\t\t\tDPAVG10M\tNONE\t\t2006-01-02 18:08:11\t-1.8\t0\tcOK\r\nMEAS\tStation01\t\t\tDPMIN1H\tNONE\t\t2006-01-02 18:08:11\t-1.9\t0\tcOK\r\nMEAS\tStation01\t\t\tDPMAX1H\tNONE\t\t2006-01-02 18:08:11\t-1.4\t0\tcOK\r\nMEAS\tStation01\t\t\tDPAVG1H\tNONE\t\t2006-01-02 18:08:11\t-1.6\t0\tcOK\r\nMEAS\tStation01\t\t\tDPMIN24H\tNONE\t\t2006-01-02 18:08:11\t-1.8\t0\tcOK\r\nMEAS\tStation01\t\t\tDPMAX24H\tNONE\t\t2006-01-02 18:08:11\t0.7\t0\tcOK\r\nMEAS\tStation01\t\t\tDPAVG24H\tNONE\t\t2006-01-02 18:08:11\t-0.6\t0\tcOK\r\nMEAS\tStation01\t\t\tPAAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tPAAVG10M\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tPAMIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tPAMAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tPAAVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFEAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFEMIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFEMAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFEAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFFAVG60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFFMIN1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFFMAX1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tQFFAVG1H\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tppp\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tTENDENCY\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\nMEAS\tStation01\t\t\tSUNSTATE\tNONE\t\t2006-01-02 18:08:11\t-0.008\t0\tcOK\r\nMEAS\tStation01\t\t\tSUNDUR1H\tNONE\t\t2006-01-02 18:08:11\t0\t0\tcOK\r\nMEAS\tStation01\t\t\tSUNDUR24H\tNONE\t\t2006-01-02 18:08:11\t0\t0\tcOK\r\nMEAS\tStation01\t\t\tPREC60S\tNONE\t\t2006-01-02 18:08:11\t/\t1\tcNOT_OK\r\n";
            string tmp = MeasMsgFormatter.FormatMeasMsg(measMsg3);

            Assert.True(tmp == sExpected);
            string tmp5 = MeasMsgFormatter.FormatMeasMsgInReverse(measMsg3);
        }
Example #20
0
 private bool ParseBody(char header, string[] data, ref MeasMsg measMsg)
 {
     if (keyToVariableList.ContainsKey(header))
     {
         return(ParseVariables(keyToVariableList[header], data, ref measMsg));
     }
     //if (header == 'A')
     //    return ParseVariables(WindVars, data, ref measMsg);
     //if (header == 'C')
     //    return ParseVariables(PTUVars,data, ref measMsg);
     //if (header == 'V')
     //    return ParseVariables(RainVars, data, ref measMsg);
     //if (header == 'U')
     //    return ParseVariables(DiagVars, data, ref measMsg);
     return(false);
 }
Example #21
0
        private static string GetParsingStatus(MeasMsg measMsg)
        {
            var sb = new StringBuilder(cVariables);

            sb.Append(":");
            sb.Append(measMsg.Count);
            sb.Append(Environment.NewLine);
            sb.Append(cTimeDiff);
            sb.Append(":");
            TimeSpan ts = DateTimeEx.Now.Subtract(measMsg.Time);

            sb.Append(String.Format("{0} h  {1} min {2} sec",
                                    (int)(Math.Floor(ts.TotalHours)),
                                    ts.Minutes,
                                    ts.Seconds));
            return(sb.ToString());
        }
Example #22
0
        private bool CheckForWMT700AndWD30(string[] data, ref MeasMsg measMsg)
        {
            const string WMT700id = "MWV";

            if (string.IsNullOrWhiteSpace(data[0]))
            {
                return(false);
            }

            if (data[0][0] != '$')
            {
                return(false);
            }

            if (!data[0].EndsWith(WMT700id))
            {
                return(false);
            }

            return(ParseVariables(WD30WindVars, data, ref measMsg));
        }
Example #23
0
        public bool Parse(string data, out MeasMsg measMsg)
        {
            measMsg = new MeasMsg();

            try
            {
                if (string.IsNullOrWhiteSpace(data))
                {
                    return(false);
                }

                measMsg = ParseMessageIntoMeasMsg(data, null);
                return(true);
            }

            catch (Exception ex)
            {
                ExceptionHandler.HandleException(ex, StringManager.DoNotTranslate("Exception while parsing message ") + data);
                return(false);
            }
        }
Example #24
0
        private void ParseDataItem(string start, string dataValue, MeasMsg measMsg)
        {
            if (!engineeringUnits.ContainsKey(start))
            {
                return;
            }
            if (!wxtNameToOcName.ContainsKey(start))
            {
                return;
            }
            int index = dataValue.IndexOf(engineeringUnits[start]);

            if (index == -1)
            {
                return;
            }
            var finalDataValue = dataValue.Substring(0, index);

            var meas = new Meas(wxtNameToOcName[start], dateTime, finalDataValue, MeasStatus.c*K);

            measMsg.AddMeas(meas);
        }
Example #25
0
        public static string Code(MeasMsg measMsg, string replaceSemicolonInData = ",")
        {
            try
            {
                if (measMsg == null)
                {
                    return(string.Empty);
                }

                var sb = new StringBuilder();
                sb.Append("(S:");
                sb.Append(measMsg.Station);
                sb.Append(";D:");
                sb.Append(measMsg.Time.ToString("yyMMdd", CultureInfo.InvariantCulture));
                sb.Append(";T:");
                sb.Append(measMsg.Time.ToString("HHmmss", CultureInfo.InvariantCulture));
                foreach (var meas in measMsg.MeasValues)
                {
                    //		measMsg.MeasList.ForEach(delegate(Meas meas)
                    //		{
                    if ((meas.Name != null) && (meas.ObsValue != null))
                    {
                        sb.Append(";");
                        sb.Append(meas.Name);
                        sb.Append(":");
                        sb.Append(meas.ObsValue.Replace(";", replaceSemicolonInData));
                    }
                    //	});
                }
                //   sb.Append(";");
                sb.Append(")");
                return(sb.ToString());
            }
            catch (Exception ex)
            {
                ExceptionRecorder.RecordException("Exception in Code(MeasMsg) " + ex.Message);
                return(string.Empty);
            }
        }
Example #26
0
        public MeasMsg Parse(string text)
        {
            string[] data = PreProcess(text);
            if (data == null)
            {
                return(null);
            }

            if (data.GetLength(0) == 0)
            {
                return(null);
            }

            var measMsg = new MeasMsg();

            dateTime        = DateTimeEx.Now;
            measMsg.Time    = dateTime;
            measMsg.Station = DefaultStation;

            if (CheckForWMT700AndWD30(data, ref measMsg))
            {
                return(measMsg);
            }

            char header;

            if (!ParseHeader(data, out header))
            {
                return(null);
            }

            if (ParseBody(header, data, ref measMsg))
            {
                return(measMsg);
            }

            return(null);
        }
Example #27
0
        private void ParseItem(string dataItem, MeasMsg measMsg)
        {
            //    Debug.WriteLine("Parsing: " + dataItem);
            if (string.IsNullOrWhiteSpace(dataItem))
            {
                return;
            }

            const int minVarNameLen = 2;
            int       index         = dataItem.IndexOf("=");

            if (index < minVarNameLen)
            {
                return;
            }

            string start = dataItem.Substring(0, index);

            if (string.IsNullOrWhiteSpace(start))
            {
                return;
            }

            // dataItem ends with '='
            if (dataItem.Length < index + 1)
            {
                return;
            }

            string dataValue = dataItem.Substring(index + 1);

            if (string.IsNullOrWhiteSpace(dataValue))
            {
                return;
            }

            ParseDataItem(start, dataValue, measMsg);
        }
Example #28
0
        private MeasMsg ParseMsg(NMEAProprietarySentence nmeaSentence)
        {
            MeasMsg result = new MeasMsg();

            result.Time = DateTimeEx.Now;
            var s = nmeaSentence.SentenceIDString.ToUpperInvariant();

            if (!nameDictionary.ContainsKey(s))
            {
                return(null);
            }

            if (s == "C")
            {
                return(ParseCellVelocityData(nmeaSentence, result));
            }


            int len = nmeaSentence.parameters.Length;

            for (int i = 0; i < len; i++)
            {
                string dataValue = string.Empty;
                if (null != nmeaSentence.parameters[i])
                {
                    dataValue = nmeaSentence.parameters[i].ToString();
                }

                result.AddMeas(nameDictionary[s][i], dataValue);
            }

            if (s == "I")
            {
                return(AddCellDepths(nmeaSentence, result));
            }

            return(result);
        }
Example #29
0
        private MeasMsg ParseCellVelocityData(NMEAProprietarySentence nmeaSentence, MeasMsg measMsg)
        {
            const int cellIdIndex = 2;
            const int speedIndex  = 6;
            const int dirIndex    = 7;
            int       cell;
            string    cellId = nmeaSentence.parameters[cellIdIndex].ToString();

            if (!int.TryParse(cellId, out cell))
            {
                SimpleFileWriter.WriteLineToEventFile(DirectoryName.EventLog, StringManager.GetString("Unable to parse Nortec AWAC NMEA message cell id. Received cellId was:") + cellId);
                return(measMsg);
            }

            int index = cell - 1;

            // Ignore any message from cells which do not have variables defined
            if (-1 < index && index < CellSpeedVariables.Count)
            {
                var dataValue = nmeaSentence.parameters[speedIndex].ToString();
                measMsg.AddMeas(CellSpeedVariables[index], dataValue);
            }

            if (-1 < index && index < CellDirectionVariables.Count)
            {
                var dataValue = nmeaSentence.parameters[dirIndex].ToString();
                measMsg.AddMeas(CellDirectionVariables[index], dataValue);
            }

            if (measMsg.Count == 0)
            {
                return(null);
            }


            return(measMsg);
        }
Example #30
0
        public void GetMeasByName()
        {
            var s = GetTestMeasMsg;

            var measMsg = new MeasMsg();

            Assert.True(measMsg.Initialise(s));
            Assert.True(measMsg.Count == 9);

            Meas m = new Meas();

            Assert.True(measMsg.GetMeasByName("TA", ref m));
            Assert.True(m.ObsValue == "0");
            Assert.True(measMsg.GetMeasByName("PA", ref m));
            Assert.True(m.ObsValue == "1008.42");
            Assert.False(measMsg.GetMeasByName("hafhafdghadfh", ref m));

            double paValue = -1;

            Assert.True(measMsg.GetNumericObsValueByName("PA", ref paValue));
            Assert.True(paValue == 1008.42);

            Assert.False(measMsg.GetNumericObsValueByName("XX", ref paValue));
        }