public void TestAwacNMEAParser_PNORS() { // SmsAwsPreParser parser = new SmsAwsPreParser(); var awacNmeaParser = new AwacNMEAParser(); var s = String.Empty; var measMsg = awacNmeaParser.Parse(s); Assert.True(measMsg == null); var testTime = new DateTime(2010, 1, 1, 13, 0, 0); DateTimeEx.Now = testTime; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); const string msg = "$PNORS,073010,050000,00,B0,13.4,1520.6,114.9,-0.5,1.6,22.314,18.92,1039,0*0B"; measMsg = awacNmeaParser.Parse(msg); stopWatch.Stop(); Debug.WriteLine("Time :" + stopWatch.ElapsedTicks); int count = Enum.GetValues(typeof(AwacNMEAParser.VarNameSensorMessage)).Length; Assert.True(measMsg.Count == count, "result count"); Assert.True(measMsg.Time == DateTimeEx.Now); Assert.True(measMsg.Station == String.Empty); var meas2 = new Meas(); Assert.True(measMsg.GetMeasByName(AwacNMEAParser.VarNameSensorMessage.AWAC_SENSOR_DATE.ToString(), ref meas2)); Assert.True(meas2.ObsTime == testTime); string measValue; Assert.True((measMsg.GetMeasObsValueByName(AwacNMEAParser.VarNameSensorMessage.AWAC_SENSOR_ANALOG2.ToString(), out measValue))); Assert.True(measValue == "0"); Assert.True((measMsg.GetMeasObsValueByName(AwacNMEAParser.VarNameSensorMessage.AWAC_SENSOR_ANALOG1.ToString(), out measValue))); Assert.True(measValue == "1039"); } // Test
public void TestAwacNMEAParser_PNORW() { // SmsAwsPreParser parser = new SmsAwsPreParser(); var awacNmeaParser = new AwacNMEAParser(); var s = String.Empty; var measMsg = awacNmeaParser.Parse(s); Assert.True(measMsg == null); var testTime = new DateTime(2010, 1, 1, 13, 0, 0); DateTimeEx.Now = testTime; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); const string msg = "$PNORW,073010,051001,3,4,0.55,0.51,0.63,0.82,2.76,3.33,2.97,55.06,78.91,337.62,0.48,22.35,0,1,0.27,129.11,0000*4E"; measMsg = awacNmeaParser.Parse(msg); stopWatch.Stop(); Debug.WriteLine("Time :" + stopWatch.ElapsedTicks); int count = Enum.GetValues(typeof(AwacNMEAParser.VarWaveMessage)).Length; Assert.True(measMsg.Count == count, "result count"); Assert.True(measMsg.Time == DateTimeEx.Now); Assert.True(measMsg.Station == String.Empty); var meas2 = new Meas(); Assert.True(measMsg.GetMeasByName(AwacNMEAParser.VarWaveMessage.AWAC_WAVE_NEAR_SURFACE_DIR.ToString(), ref meas2)); Assert.True(meas2.ObsTime == testTime); string measValue; Assert.True((measMsg.GetMeasObsValueByName(AwacNMEAParser.VarWaveMessage.AWAC_WAVE_NEAR_SURFACE_DIR.ToString(), out measValue))); Assert.True(measValue == "129.11"); Assert.True((measMsg.GetMeasObsValueByName(AwacNMEAParser.VarWaveMessage.AWAC_WAVE_NEAR_SURFACE_SPEED.ToString(), out measValue))); Assert.True(measValue == "0.27"); } // Test
public void TestAwacNMEAParser_PNORC() { // SmsAwsPreParser parser = new SmsAwsPreParser(); var awacNmeaParser = new AwacNMEAParser(); awacNmeaParser.CellDirectionVariables = new List <string>() { "CELL_DIR_1", "CELL_DIR_2", "CELL_DIR_3", "CELL_DIR_4" }; awacNmeaParser.CellSpeedVariables = new List <string>() { "CELL_SPEED_1", "CELL_SPEED_2", "CELL_SPEED_3", "CELL_SPEED_4" }; awacNmeaParser.CellDepthVariables = new List <string>() { "CELL_DEPTH_1", "CELL_DEPTH_2", "CELL_DEPTH_3", "CELL_DEPTH_4" }; var s = String.Empty; var measMsg = awacNmeaParser.Parse(s); Assert.True(measMsg == null); var testTime = new DateTime(2010, 1, 1, 13, 0, 0); DateTimeEx.Now = testTime; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); const string msg = "$PNORC,073010,050000,1,0.10,-0.11,-0.01,0.15,137.2,C,88,83,87,,,*37"; measMsg = awacNmeaParser.Parse(msg); stopWatch.Stop(); Debug.WriteLine("Time :" + stopWatch.ElapsedTicks); int count = 2; Assert.True(measMsg.Count == count, "result count"); Assert.True(measMsg.Time == DateTimeEx.Now); // data from cell 1 => awacNmeaParser.CellSpeedVariables[0] / .CellDirectionVariables[0] used Assert.True(measMsg.Station == String.Empty); var meas2 = new Meas(); Assert.True(measMsg.GetMeasByName(awacNmeaParser.CellSpeedVariables[0], ref meas2)); Assert.True(meas2.ObsTime == testTime); Assert.True(meas2.ObsValue == "0.15"); Assert.True(measMsg.GetMeasByName(awacNmeaParser.CellDirectionVariables[0], ref meas2)); Assert.True(meas2.ObsTime == testTime); Assert.True(meas2.ObsValue == "137.2"); //string measValue; //Assert.True((measMsg.GetMeasObsValueByName(AwacNMEAParser.VarCurrentVelocityMessage.AWAC_CURR_VELOCITY_AMPLITUDE_3.ToString(), out measValue))); //Assert.True(measValue == "87"); //Assert.True((measMsg.GetMeasObsValueByName(AwacNMEAParser.VarCurrentVelocityMessage.AWAC_CURR_VELOCITY_AMPLITUDE_2.ToString(), out measValue))); //Assert.True(measValue == "83"); } // Test
public void TestAwacNMEAParser_PNORI() { // SmsAwsPreParser parser = new SmsAwsPreParser(); var awacNmeaParser = new AwacNMEAParser(); awacNmeaParser.CellDirectionVariables = new List <string>() { "CELL_DIR_1", "CELL_DIR_2", "CELL_DIR_3", "CELL_DIR_4" }; awacNmeaParser.CellSpeedVariables = new List <string>() { "CELL_SPEED_1", "CELL_SPEED_2", "CELL_SPEED_3", "CELL_SPEED_4" }; awacNmeaParser.CellDepthVariables = new List <string>() { "CELL_DEPTH_1", "CELL_DEPTH_2", "CELL_DEPTH_3", "CELL_DEPTH_4" }; var s = String.Empty; var measMsg = awacNmeaParser.Parse(s); Assert.True(measMsg == null); var testTime = new DateTime(2010, 1, 1, 13, 0, 0); DateTimeEx.Now = testTime; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); const string msg = "$PNORI,3,WAV6103,3,20,0.51,2.00,0*16"; measMsg = awacNmeaParser.Parse(msg); stopWatch.Stop(); Debug.WriteLine("Time :" + stopWatch.ElapsedTicks); int count = Enum.GetValues(typeof(AwacNMEAParser.VarNameInfoMessage)).Length + awacNmeaParser.CellDepthVariables.Count; Assert.True(measMsg.Count == count, "result count"); Assert.True(measMsg.Time == DateTimeEx.Now); Assert.True(measMsg.Station == String.Empty); var meas2 = new Meas(); Assert.True(measMsg.GetMeasByName(AwacNMEAParser.VarNameInfoMessage.AWAC_INFO_INSTRUMENT.ToString(), ref meas2)); Assert.True(meas2.ObsTime == testTime); string measValue; Assert.True((measMsg.GetMeasObsValueByName(AwacNMEAParser.VarNameInfoMessage.AWAC_INFO_INSTRUMENT.ToString(), out measValue))); Assert.True(measValue == "AWAC"); Assert.True((measMsg.GetMeasObsValueByName(AwacNMEAParser.VarNameInfoMessage.AWAC_INFO_HEADID.ToString(), out measValue))); Assert.True(measValue == "WAV6103"); Assert.True((measMsg.GetMeasObsValueByName(AwacNMEAParser.VarNameInfoMessage.AWAC_INFO_NUMBEAMS.ToString(), out measValue))); Assert.True(measValue == "3"); Assert.True((measMsg.GetMeasObsValueByName(AwacNMEAParser.VarNameInfoMessage.AWAC_INFO_NUMCELLS.ToString(), out measValue))); Assert.True(measValue == "20"); string blanking; Assert.True((measMsg.GetMeasObsValueByName(AwacNMEAParser.VarNameInfoMessage.AWAC_INFO_BLANKING.ToString(), out blanking))); Assert.True(blanking == "0.51"); double blankingD = Double.Parse(blanking); string cellSize; Assert.True((measMsg.GetMeasObsValueByName(AwacNMEAParser.VarNameInfoMessage.AWAC_INFO_CELLSIZE.ToString(), out cellSize))); Assert.True(cellSize == "2"); double cellSizeD = Double.Parse(cellSize); Assert.True((measMsg.GetMeasObsValueByName(AwacNMEAParser.VarNameInfoMessage.AWAC_INFO_COORD.ToString(), out measValue))); Assert.True(measValue == "ENU"); for (int i = 0; i < awacNmeaParser.CellDepthVariables.Count; i++) { double dMeas; Assert.True(measMsg.GetNumericDoubleObsValueByName(awacNmeaParser.CellDepthVariables[i], out dMeas)); Assert.True(meas2.ObsTime == testTime); double tmp = (blankingD + (i + 1) * cellSizeD); Assert.True(Math.Abs(dMeas - tmp) < 0.1); } } // Test