OSDN Git Service

YUMA形式のアルマナックデータの読み込みに対応
authorkimikage <kimikage_ceo@hotmail.com>
Wed, 2 Feb 2011 15:31:10 +0000 (00:31 +0900)
committerkimikage <kimikage_ceo@hotmail.com>
Wed, 2 Feb 2011 15:31:10 +0000 (00:31 +0900)
Yubeshi/Almanac.cs [new file with mode: 0755]
Yubeshi/Yubeshi.csproj
Yubeshi/YumaAlmanacReader.cs [new file with mode: 0755]
YubeshiTest/Resources/almanac.alm [new file with mode: 0755]
YubeshiTest/YubeshiTest.csproj
YubeshiTest/YumaAlmanacReaderTest.cs [new file with mode: 0755]

diff --git a/Yubeshi/Almanac.cs b/Yubeshi/Almanac.cs
new file mode 100755 (executable)
index 0000000..898ddd4
--- /dev/null
@@ -0,0 +1,100 @@
+/*\r
+ *     Yubeshi GPS Parser\r
+ *\r
+ *     This software is distributed under a zlib-style license.\r
+ *     See license.txt for more information.\r
+ */\r
+\r
+using System;\r
+using System.Collections.Generic;\r
+using System.Text;\r
+\r
+namespace Yubeshi\r
+{\r
+    public class Almanac\r
+    {\r
+        #region properties\r
+        public int ID\r
+        {\r
+            get;\r
+            set;\r
+        }\r
+\r
+        public int Health\r
+        {\r
+            get;\r
+            set;\r
+        }\r
+\r
+        public double Eccentricity\r
+        {\r
+            get;\r
+            set;\r
+        }\r
+\r
+        public decimal TimeOfApplicability\r
+        {\r
+            get;\r
+            set;\r
+        }\r
+\r
+        public Degree OrbitalInclination\r
+        {\r
+            get;\r
+            set;\r
+        }\r
+\r
+        public double RateOfRightAscen\r
+        {\r
+            get;\r
+            set;\r
+        }\r
+\r
+        /// <summary>\r
+        ///     Square Root of Semi-Major Axis\r
+        /// </summary>\r
+        public double SqrtA\r
+        {\r
+            get;\r
+            set;\r
+        }\r
+\r
+        public Degree RightAscenAtWeek\r
+        {\r
+            get;\r
+            set;\r
+        }\r
+\r
+        public Degree ArgumentOfPerigee\r
+        {\r
+            get;\r
+            set;\r
+        }\r
+\r
+        public Degree MeanAnom\r
+        {\r
+            get;\r
+            set;\r
+        }\r
+\r
+        public double Af0\r
+        {\r
+            get;\r
+            set;\r
+        }\r
+\r
+        public double Af1\r
+        {\r
+            get;\r
+            set;\r
+        }\r
+\r
+        public int Week\r
+        {\r
+            get;\r
+            set;\r
+        }\r
+\r
+        #endregion\r
+    }\r
+}\r
index 772a402..c795212 100755 (executable)
@@ -36,6 +36,7 @@
     <Reference Include="System.Xml" />\r
   </ItemGroup>\r
   <ItemGroup>\r
+    <Compile Include="Almanac.cs" />\r
     <Compile Include="Constants.cs" />\r
     <Compile Include="Degree.cs" />\r
     <Compile Include="EnuCoordinate.cs" />\r
@@ -75,6 +76,7 @@
     <Compile Include="Ubx\CfgRst.cs" />\r
     <Compile Include="UnknownPacket.cs" />\r
     <Compile Include="EnuVelocity.cs" />\r
+    <Compile Include="YumaAlmanacReader.cs" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="app.config" />\r
diff --git a/Yubeshi/YumaAlmanacReader.cs b/Yubeshi/YumaAlmanacReader.cs
new file mode 100755 (executable)
index 0000000..08c3193
--- /dev/null
@@ -0,0 +1,156 @@
+/*\r
+ *     Yubeshi GPS Parser\r
+ *\r
+ *     This software is distributed under a zlib-style license.\r
+ *     See license.txt for more information.\r
+ */\r
+\r
+using System;\r
+using System.Collections.Generic;\r
+using System.Text;\r
+using System.Text.RegularExpressions;\r
+using System.IO;\r
+\r
+namespace Yubeshi\r
+{\r
+    public class YumaAlmanacReader\r
+    {\r
+        #region type definitions\r
+        private delegate void AlmanacSetter(Almanac almanac, string value);\r
+        #endregion\r
+\r
+        #region fields\r
+        private string filePath;\r
+        private static readonly Regex yuma = \r
+            new Regex(@"^([\w\s\(\)/]+):\s*([\d.E+-]+)$", \r
+                                                    RegexOptions.Compiled);\r
+        \r
+        private static readonly Dictionary<string, AlmanacSetter> setters;\r
+        #endregion\r
+\r
+\r
+        #region constructors\r
+        public YumaAlmanacReader(string filePath)\r
+        {\r
+            this.filePath = filePath;\r
+        }\r
+\r
+        static YumaAlmanacReader()\r
+        {\r
+            setters = new Dictionary<string,AlmanacSetter>();\r
+            setters["ID"] = delegate(Almanac a, string v)\r
+                {\r
+                    a.ID = Int32.Parse(v);  \r
+                };\r
+            setters["Health"] = delegate(Almanac a, string v)\r
+                {\r
+                    a.Health = Int32.Parse(v);\r
+                };\r
+            setters["Eccentricity"] = delegate(Almanac a, string v)\r
+                {\r
+                    a.Eccentricity = Double.Parse(v);\r
+                };\r
+            setters["Time of Applicability(s)"] = delegate(Almanac a, string v)\r
+                {\r
+                    a.TimeOfApplicability = Decimal.Parse(v);\r
+                };\r
+            setters["Orbital Inclination(rad)"] = delegate(Almanac a, string v)\r
+                {\r
+                    a.OrbitalInclination = Degree.FromRadian(Double.Parse(v));\r
+                };\r
+            setters["Rate of Right Ascen(r/s)"] = delegate(Almanac a, string v)\r
+                {\r
+                    a.RateOfRightAscen = Double.Parse(v);\r
+                };\r
+            setters["SQRT(A)  (m 1/2)"] = delegate(Almanac a, string v)\r
+                {\r
+                    a.SqrtA = Double.Parse(v);\r
+                };\r
+            setters["Right Ascen at Week(rad)"] = delegate(Almanac a, string v)\r
+                {\r
+                    a.RightAscenAtWeek = Degree.FromRadian(Double.Parse(v));\r
+                };\r
+            setters["Argument of Perigee(rad)"] = delegate(Almanac a, string v)\r
+                {\r
+                    a.ArgumentOfPerigee = Degree.FromRadian(Double.Parse(v));\r
+                };\r
+            setters["Mean Anom(rad)"] = delegate(Almanac a, string v)\r
+                {\r
+                    a.MeanAnom = Degree.FromRadian(Double.Parse(v));\r
+                };\r
+            setters["Af0(s)"] = delegate(Almanac a, string v)\r
+                {\r
+                    a.Af0 = Double.Parse(v);\r
+                };\r
+            setters["Af1(s/s)"] = delegate(Almanac a, string v)\r
+                {\r
+                    a.Af1 = Double.Parse(v);\r
+                };\r
+            setters["week"] = delegate(Almanac a, string v)\r
+            {\r
+                a.Week = Int32.Parse(v);\r
+            };\r
+        }\r
+        #endregion\r
+\r
+        public Almanac[] Read()\r
+        {\r
+            Almanac[] list = null;\r
+            try\r
+            {\r
+                using (Stream s = new FileStream(filePath,\r
+                            FileMode.Open, FileAccess.Read, FileShare.Read))\r
+                {\r
+                    using (StreamReader sr = new StreamReader(s))\r
+                    {\r
+                        list = Parse(sr);\r
+                    }\r
+                }\r
+            }\r
+            catch\r
+            {\r
+                throw;\r
+            }\r
+            return list;\r
+        }\r
+\r
+        private Almanac[] Parse(StreamReader sr)\r
+        {\r
+            List<Almanac> list = new List<Almanac>();\r
+            string line = null;\r
+            Almanac a = null;\r
+            while ((line = sr.ReadLine()) != null)\r
+            {\r
+                MatchCollection m = yuma.Matches(line);\r
+                if (m.Count == 1)\r
+                {\r
+                    string key = m[0].Groups[1].Value;\r
+                    if (setters.ContainsKey(key))\r
+                    {\r
+                        if (a == null)\r
+                        {\r
+                            a = new Almanac();\r
+                        }\r
+                        setters[key](a, m[0].Groups[2].Value);\r
+                    }\r
+                    else\r
+                    {\r
+                        a = null;\r
+                    }\r
+                }\r
+                else if(a != null)\r
+                {\r
+                    list.Add(a);\r
+                    a = null;\r
+                }\r
+\r
+            }\r
+            if (a != null)\r
+            {\r
+                list.Add(a);\r
+            }\r
+            return list.ToArray();\r
+        }\r
+\r
+    }\r
+}\r
diff --git a/YubeshiTest/Resources/almanac.alm b/YubeshiTest/Resources/almanac.alm
new file mode 100755 (executable)
index 0000000..226a5b5
--- /dev/null
@@ -0,0 +1,465 @@
+******** Week 597 almanac for PRN-02 ********\r
+ID:                         02\r
+Health:                     000\r
+Eccentricity:               0.9981155396E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9390506744\r
+Rate of Right Ascen(r/s):  -0.8101778803E-008\r
+SQRT(A)  (m 1/2):           5153.645020\r
+Right Ascen at Week(rad):   0.1120424271E+001\r
+Argument of Perigee(rad):  -3.091476083\r
+Mean Anom(rad):            -0.7315391302E+000\r
+Af0(s):                     0.3185272217E-003\r
+Af1(s/s):                   0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-03 ********\r
+ID:                         03\r
+Health:                     000\r
+Eccentricity:               0.1393413544E-001\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9287567139\r
+Rate of Right Ascen(r/s):  -0.8032657206E-008\r
+SQRT(A)  (m 1/2):           5153.591797\r
+Right Ascen at Week(rad):  -0.3539276123E-001\r
+Argument of Perigee(rad):   1.071895719\r
+Mean Anom(rad):            -0.7802045345E+000\r
+Af0(s):                     0.6713867188E-003\r
+Af1(s/s):                   0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-04 ********\r
+ID:                         04\r
+Health:                     000\r
+Eccentricity:               0.9618282318E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9381332397\r
+Rate of Right Ascen(r/s):  -0.8152710507E-008\r
+SQRT(A)  (m 1/2):           5153.527832\r
+Right Ascen at Week(rad):   0.1137965083E+001\r
+Argument of Perigee(rad):   0.707530260\r
+Mean Anom(rad):             0.2255247593E+001\r
+Af0(s):                     0.2574920654E-004\r
+Af1(s/s):                   0.1091393642E-010\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-05 ********\r
+ID:                         05\r
+Health:                     000\r
+Eccentricity:               0.2256870270E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9550666809\r
+Rate of Right Ascen(r/s):  -0.8105416782E-008\r
+SQRT(A)  (m 1/2):           5153.545898\r
+Right Ascen at Week(rad):   0.2182121038E+001\r
+Argument of Perigee(rad):   0.273877025\r
+Mean Anom(rad):             0.9578915834E+000\r
+Af0(s):                    -0.1087188721E-003\r
+Af1(s/s):                  -0.7275957614E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-06 ********\r
+ID:                         06\r
+Health:                     000\r
+Eccentricity:               0.6402492523E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9359588623\r
+Rate of Right Ascen(r/s):  -0.7938069757E-008\r
+SQRT(A)  (m 1/2):           5153.607422\r
+Right Ascen at Week(rad):   0.3727996349E-001\r
+Argument of Perigee(rad):  -0.869711637\r
+Mean Anom(rad):             0.1322691441E+001\r
+Af0(s):                    -0.5531311035E-004\r
+Af1(s/s):                  -0.2546585165E-010\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-07 ********\r
+ID:                         07\r
+Health:                     000\r
+Eccentricity:               0.4164218903E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9736423492\r
+Rate of Right Ascen(r/s):  -0.7989001460E-008\r
+SQRT(A)  (m 1/2):           5153.625977\r
+Right Ascen at Week(rad):  -0.1997877717E+001\r
+Argument of Perigee(rad):  -3.099204421\r
+Mean Anom(rad):            -0.2456450820E+001\r
+Af0(s):                     0.2861022949E-005\r
+Af1(s/s):                   0.0000000000E+000\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-08 ********\r
+ID:                         08\r
+Health:                     000\r
+Eccentricity:               0.1142597198E-001\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9951839447\r
+Rate of Right Ascen(r/s):  -0.7796188584E-008\r
+SQRT(A)  (m 1/2):           5153.576172\r
+Right Ascen at Week(rad):  -0.1924704313E+001\r
+Argument of Perigee(rad):  -3.088928342\r
+Mean Anom(rad):            -0.2986244917E+001\r
+Af0(s):                     0.7629394531E-005\r
+Af1(s/s):                   0.0000000000E+000\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-09 ********\r
+ID:                         09\r
+Health:                     000\r
+Eccentricity:               0.1701211929E-001\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9826316833\r
+Rate of Right Ascen(r/s):  -0.7879862096E-008\r
+SQRT(A)  (m 1/2):           5153.635254\r
+Right Ascen at Week(rad):  -0.2027178049E+001\r
+Argument of Perigee(rad):   1.557071447\r
+Mean Anom(rad):            -0.3113306165E+001\r
+Af0(s):                     0.5912780762E-004\r
+Af1(s/s):                   0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-10 ********\r
+ID:                         10\r
+Health:                     000\r
+Eccentricity:               0.1004171371E-001\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9500522614\r
+Rate of Right Ascen(r/s):  -0.8149072528E-008\r
+SQRT(A)  (m 1/2):           5153.505859\r
+Right Ascen at Week(rad):   0.2206461310E+001\r
+Argument of Perigee(rad):   0.692496061\r
+Mean Anom(rad):             0.1217050433E+001\r
+Af0(s):                    -0.6484985352E-004\r
+Af1(s/s):                   0.0000000000E+000\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-11 ********\r
+ID:                         11\r
+Health:                     000\r
+Eccentricity:               0.1160764694E-001\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.8880634308\r
+Rate of Right Ascen(r/s):  -0.8527422324E-008\r
+SQRT(A)  (m 1/2):           5153.427246\r
+Right Ascen at Week(rad):   0.8888931274E+000\r
+Argument of Perigee(rad):   0.909221053\r
+Mean Anom(rad):            -0.2385749817E+001\r
+Af0(s):                    -0.1239776611E-003\r
+Af1(s/s):                  -0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-12 ********\r
+ID:                         12\r
+Health:                     000\r
+Eccentricity:               0.3565311432E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9737148285\r
+Rate of Right Ascen(r/s):  -0.8098140825E-008\r
+SQRT(A)  (m 1/2):           5153.759766\r
+Right Ascen at Week(rad):  -0.9427611828E+000\r
+Argument of Perigee(rad):  -0.291717052\r
+Mean Anom(rad):            -0.2330738068E+001\r
+Af0(s):                    -0.3051757812E-004\r
+Af1(s/s):                   0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-13 ********\r
+ID:                         13\r
+Health:                     000\r
+Eccentricity:               0.4450321198E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9911518097\r
+Rate of Right Ascen(r/s):  -0.7352355169E-008\r
+SQRT(A)  (m 1/2):           5153.613281\r
+Right Ascen at Week(rad):  -0.2974312305E+001\r
+Argument of Perigee(rad):   1.787841558\r
+Mean Anom(rad):             0.6812202930E-001\r
+Af0(s):                     0.2832412720E-003\r
+Af1(s/s):                   0.0000000000E+000\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-14 ********\r
+ID:                         14\r
+Health:                     000\r
+Eccentricity:               0.5637168884E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9842491150\r
+Rate of Right Ascen(r/s):  -0.7417838788E-008\r
+SQRT(A)  (m 1/2):           5153.590820\r
+Right Ascen at Week(rad):  -0.2997748971E+001\r
+Argument of Perigee(rad):  -2.078460097\r
+Mean Anom(rad):             0.2423548698E-001\r
+Af0(s):                     0.1287460327E-003\r
+Af1(s/s):                   0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-15 ********\r
+ID:                         15\r
+Health:                     000\r
+Eccentricity:               0.3317832947E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9515190125\r
+Rate of Right Ascen(r/s):  -0.7777998690E-008\r
+SQRT(A)  (m 1/2):           5153.518555\r
+Right Ascen at Week(rad):  -0.3069829226E+001\r
+Argument of Perigee(rad):  -0.135819435\r
+Mean Anom(rad):            -0.3191695213E+000\r
+Af0(s):                    -0.1544952393E-003\r
+Af1(s/s):                   0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-16 ********\r
+ID:                         16\r
+Health:                     000\r
+Eccentricity:               0.6111145020E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9748058319\r
+Rate of Right Ascen(r/s):  -0.8069036994E-008\r
+SQRT(A)  (m 1/2):           5153.691895\r
+Right Ascen at Week(rad):  -0.9250330925E+000\r
+Argument of Perigee(rad):  -0.169160008\r
+Mean Anom(rad):             0.1548160791E+001\r
+Af0(s):                    -0.1478195190E-003\r
+Af1(s/s):                  -0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-17 ********\r
+ID:                         17\r
+Health:                     000\r
+Eccentricity:               0.6045818329E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9613838196\r
+Rate of Right Ascen(r/s):  -0.7657945389E-008\r
+SQRT(A)  (m 1/2):           5153.671387\r
+Right Ascen at Week(rad):   0.1175963879E+000\r
+Argument of Perigee(rad):  -2.462290406\r
+Mean Anom(rad):             0.4805569649E+000\r
+Af0(s):                     0.1831054688E-003\r
+Af1(s/s):                   0.0000000000E+000\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-18 ********\r
+ID:                         18\r
+Health:                     000\r
+Eccentricity:               0.1187324524E-001\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9339637756\r
+Rate of Right Ascen(r/s):  -0.8360075299E-008\r
+SQRT(A)  (m 1/2):           5153.693359\r
+Right Ascen at Week(rad):   0.2202612877E+001\r
+Argument of Perigee(rad):  -2.275445104\r
+Mean Anom(rad):             0.1813470125E+001\r
+Af0(s):                     0.1192092896E-003\r
+Af1(s/s):                   0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-19 ********\r
+ID:                         19\r
+Health:                     000\r
+Eccentricity:               0.6948471069E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9589195251\r
+Rate of Right Ascen(r/s):  -0.7676135283E-008\r
+SQRT(A)  (m 1/2):           5153.576660\r
+Right Ascen at Week(rad):   0.1719129086E+000\r
+Argument of Perigee(rad):  -0.013914466\r
+Mean Anom(rad):            -0.2771254778E+000\r
+Af0(s):                    -0.1077651978E-003\r
+Af1(s/s):                  -0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-20 ********\r
+ID:                         20\r
+Health:                     000\r
+Eccentricity:               0.4683017731E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9340057373\r
+Rate of Right Ascen(r/s):  -0.8356437320E-008\r
+SQRT(A)  (m 1/2):           5153.666992\r
+Right Ascen at Week(rad):   0.2148656607E+001\r
+Argument of Perigee(rad):   1.265661478\r
+Mean Anom(rad):             0.2188432574E+001\r
+Af0(s):                     0.4863739014E-004\r
+Af1(s/s):                   0.0000000000E+000\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-21 ********\r
+ID:                         21\r
+Health:                     000\r
+Eccentricity:               0.1722764969E-001\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9317283630\r
+Rate of Right Ascen(r/s):  -0.8229108062E-008\r
+SQRT(A)  (m 1/2):           5153.525879\r
+Right Ascen at Week(rad):   0.1147058129E+001\r
+Argument of Perigee(rad):  -2.413648725\r
+Mean Anom(rad):             0.3102271318E+001\r
+Af0(s):                    -0.1211166382E-003\r
+Af1(s/s):                  -0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-22 ********\r
+ID:                         22\r
+Health:                     000\r
+Eccentricity:               0.5364894867E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9316616058\r
+Rate of Right Ascen(r/s):  -0.8367351256E-008\r
+SQRT(A)  (m 1/2):           5153.645996\r
+Right Ascen at Week(rad):   0.2206986785E+001\r
+Argument of Perigee(rad):  -1.947441459\r
+Mean Anom(rad):             0.9724266529E+000\r
+Af0(s):                     0.1535415649E-003\r
+Af1(s/s):                   0.0000000000E+000\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-23 ********\r
+ID:                         23\r
+Health:                     000\r
+Eccentricity:               0.6956577301E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9659481049\r
+Rate of Right Ascen(r/s):  -0.7617927622E-008\r
+SQRT(A)  (m 1/2):           5153.552246\r
+Right Ascen at Week(rad):  -0.3041161060E+001\r
+Argument of Perigee(rad):   3.132017612\r
+Mean Anom(rad):            -0.7284854650E+000\r
+Af0(s):                     0.3280639648E-003\r
+Af1(s/s):                  -0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-24 ********\r
+ID:                         24\r
+Health:                     000\r
+Eccentricity:               0.5812168121E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9482955933\r
+Rate of Right Ascen(r/s):  -0.8105416782E-008\r
+SQRT(A)  (m 1/2):           5153.667969\r
+Right Ascen at Week(rad):   0.1189983010E+001\r
+Argument of Perigee(rad):  -0.316323280\r
+Mean Anom(rad):            -0.1381778479E+001\r
+Af0(s):                     0.3623962402E-003\r
+Af1(s/s):                   0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-25 ********\r
+ID:                         25\r
+Health:                     000\r
+Eccentricity:               0.4076957703E-003\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9624557495\r
+Rate of Right Ascen(r/s):  -0.8243659977E-008\r
+SQRT(A)  (m 1/2):           5153.650391\r
+Right Ascen at Week(rad):  -0.9712693691E+000\r
+Argument of Perigee(rad):   1.297474384\r
+Mean Anom(rad):             0.1720767617E+001\r
+Af0(s):                    -0.6675720215E-004\r
+Af1(s/s):                   0.0000000000E+000\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-26 ********\r
+ID:                         26\r
+Health:                     000\r
+Eccentricity:               0.2016544342E-001\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9888095856\r
+Rate of Right Ascen(r/s):  -0.7406924851E-008\r
+SQRT(A)  (m 1/2):           5153.605957\r
+Right Ascen at Week(rad):  -0.2978660703E+001\r
+Argument of Perigee(rad):   1.120540023\r
+Mean Anom(rad):            -0.1020791531E+001\r
+Af0(s):                    -0.1125335693E-003\r
+Af1(s/s):                  -0.1091393642E-010\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-27 ********\r
+ID:                         27\r
+Health:                     000\r
+Eccentricity:               0.2185153961E-001\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9802589417\r
+Rate of Right Ascen(r/s):  -0.7807102520E-008\r
+SQRT(A)  (m 1/2):           5153.675293\r
+Right Ascen at Week(rad):  -0.2052826166E+001\r
+Argument of Perigee(rad):  -1.300917625\r
+Mean Anom(rad):             0.2404415607E-001\r
+Af0(s):                     0.2336502075E-003\r
+Af1(s/s):                   0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-28 ********\r
+ID:                         28\r
+Health:                     000\r
+Eccentricity:               0.1689338684E-001\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9730854034\r
+Rate of Right Ascen(r/s):  -0.8061761037E-008\r
+SQRT(A)  (m 1/2):           5153.640137\r
+Right Ascen at Week(rad):  -0.9176422358E+000\r
+Argument of Perigee(rad):  -1.912107825\r
+Mean Anom(rad):             0.1091202974E+001\r
+Af0(s):                     0.1811981201E-004\r
+Af1(s/s):                   0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-29 ********\r
+ID:                         29\r
+Health:                     000\r
+Eccentricity:               0.2589225769E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9617900848\r
+Rate of Right Ascen(r/s):  -0.7643393474E-008\r
+SQRT(A)  (m 1/2):           5153.541504\r
+Right Ascen at Week(rad):   0.1259350777E+000\r
+Argument of Perigee(rad):  -1.265166402\r
+Mean Anom(rad):            -0.3030455470E+001\r
+Af0(s):                     0.1831054688E-003\r
+Af1(s/s):                   0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-30 ********\r
+ID:                         30\r
+Health:                     000\r
+Eccentricity:               0.1256990433E-001\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9590644836\r
+Rate of Right Ascen(r/s):  -0.8283677744E-008\r
+SQRT(A)  (m 1/2):           5153.583496\r
+Right Ascen at Week(rad):  -0.1000101924E+001\r
+Argument of Perigee(rad):   1.516665459\r
+Mean Anom(rad):             0.1851544380E+000\r
+Af0(s):                     0.3185272217E-003\r
+Af1(s/s):                   0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-31 ********\r
+ID:                         31\r
+Health:                     000\r
+Eccentricity:               0.7886409760E-002\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9788265228\r
+Rate of Right Ascen(r/s):  -0.7894414011E-008\r
+SQRT(A)  (m 1/2):           5153.542969\r
+Right Ascen at Week(rad):  -0.1997130990E+001\r
+Argument of Perigee(rad):  -1.004593015\r
+Mean Anom(rad):            -0.2415897250E+001\r
+Af0(s):                     0.3719329834E-004\r
+Af1(s/s):                   0.3637978807E-011\r
+week:                        597\r
+\r
+******** Week 597 almanac for PRN-32 ********\r
+ID:                         32\r
+Health:                     000\r
+Eccentricity:               0.1230239868E-001\r
+Time of Applicability(s):  405504.0000\r
+Orbital Inclination(rad):   0.9559059143\r
+Rate of Right Ascen(r/s):  -0.8050847100E-008\r
+SQRT(A)  (m 1/2):           5153.687988\r
+Right Ascen at Week(rad):   0.2271159649E+001\r
+Argument of Perigee(rad):  -0.829349875\r
+Mean Anom(rad):            -0.1660401225E+001\r
+Af0(s):                    -0.1888275146E-003\r
+Af1(s/s):                  -0.7275957614E-011\r
+week:                        597\r
+\r
index ed88ab9..cfb9ddb 100755 (executable)
     <Compile Include="EnuCoordinateTest.cs" />\r
     <Compile Include="UbxTest\RxmPacketTest.cs" />\r
     <Compile Include="DegreeTest.cs" />\r
+    <Compile Include="YumaAlmanacReaderTest.cs" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <None Include="app.config" />\r
+    <None Include="Resources\almanac.alm">\r
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\r
+    </None>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ProjectReference Include="..\Yubeshi\Yubeshi.csproj">\r
diff --git a/YubeshiTest/YumaAlmanacReaderTest.cs b/YubeshiTest/YumaAlmanacReaderTest.cs
new file mode 100755 (executable)
index 0000000..5e68f4a
--- /dev/null
@@ -0,0 +1,30 @@
+/*\r
+ *     Yubeshi GPS Parser\r
+ *\r
+ *     This software is distributed under a zlib-style license.\r
+ *     See license.txt for more information.\r
+ */\r
+\r
+using System;\r
+using System.Collections.Generic;\r
+using System.Text;\r
+using NUnit.Framework;\r
+using Yubeshi;\r
+\r
+namespace YubeshiTest\r
+{\r
+    class YumaAlmanacReaderTest\r
+    {\r
+\r
+        [Test]\r
+        public void Read()\r
+        {\r
+            YumaAlmanacReader reader = \r
+                                new YumaAlmanacReader("Resources/almanac.alm");\r
+            Almanac[] list = reader.Read();\r
+            Assert.AreEqual(31, list.Length);\r
+        }\r
+\r
+\r
+    }\r
+}\r