Ejemplo n.º 1
0
        /*标准单点定位*/
        public static int pntpos(List <obs_s> obs, nav_t nav, spp_t spp, dcb_t dcb) //obs均已按照PRN号大小排列好
        {
            /*
             * n为观测历元观测到的卫星总数,stat为解算状态
             * vsat为卫星的状态 0为error,1为正常
             * svh为卫星坐标和钟差计算的状态,-1为不正常
             * rs包括卫星坐标和速度,dts包括卫星钟差和钟漂,azel包括卫星方位角和高度角
             * var为卫星坐标和钟差的方差
             */
            int n = obs.Count, stat = 1;

            int[]      vsat = new int[32], svh = new int[32];
            double[][] rs   = new double[n][], dts = new double[n][], azel = new double[n][];
            double[]   var  = new double[n], resp = new double[n];
            for (int i = 0; i < n; i++)
            {
                rs[i]   = new double[6]; //卫星坐标和速度
                dts[i]  = new double[2]; //卫星的钟差和钟漂
                azel[i] = new double[2]; //卫星的方位角和高度角
            }
            pppcmn.satpos(obs, nav, sat, clk, pcv, rs, dts, var, svh);
            stat = estpos(spp, obs, dcb, nav, n, rs, dts, var, azel, vsat, svh);

            for (int i = 0; i < n; i++)
            {
                int sat = int.Parse(obs[i].sprn.Substring(1, 2));
                if (vsat[i] == 1)
                {
                    spp.vsat[sat - 1] = 1;
                }
            }
            return(stat);
        }
Ejemplo n.º 2
0
        public static void propos(obs_t obss, dcb_t dcb, pcv_t pcv, station sta, nav_t nav, erp_t erp, List <result> res, RichTextBox text)
        {
            int     nobs    = 0;
            rtktime solt    = new rtktime();
            string  timestr = null;
            obs_t   obs     = new obs_t();
            ppp_t   p3      = new ppp_t();
            spp_t   spp     = new spp_t();

            while ((nobs = inputobs(obs, obss)) > 0)
            {
                result re = new result();
                solt = spp.tcur;
                if (pntpos(obs.obs_b, nav, spp, dcb) == 0)
                {
                    continue;
                }
                p3.spp     = spp;
                p3.soltime = spp.tcur;
                if (solt.time_int != 0)
                {
                    p3.tt = rtklibcmn.timediff(p3.soltime, solt);
                }
                if (pppos(p3, obs.obs_b, nav, dcb, sta, erp) != 1)
                {
                    continue;
                }

                for (int j = 0; j < 3; j++)
                {
                    spp.rr[j] = p3.x[j];
                }
                spp.dtr = p3.x[4];
                re.time = obs.obs_b[0].t.calend;
                re.X    = p3.x[0]; re.Y = p3.x[1]; re.Z = p3.x[2];
                timestr = re.time[0] + "/" + re.time[1] + "/" + re.time[2] + " " + re.time[3] + ":" + re.time[4] + ":" + re.time[5];
                text.AppendText(string.Format("{0,-20}", timestr) + string.Format("{0,-20}", re.X) + string.Format("{0,-20}", re.Y) + string.Format("{0,-20}", re.Z) + "\r\n");

                res.Add(re);
            }
        }
Ejemplo n.º 3
0
        //obs均已按照PRN号大小排列好
        public static int estpos(spp_t spp, List <obs_s> obs, dcb_t dcb, nav_t nav, int n, double[][] rs, double[][] dts,
                                 double[] vare, double[][] azel, int[] vsat, int[] svh)
        {
            double[] v_ = new double[n], x = new double[4], var = new double[n];
            matrix   H_ = new matrix(n, 4), H, v, dx, Q, P;
            int      nv;
            double   sig;
            int      i, j, k, stat = 1;

            for (i = 0; i < 3; i++)
            {
                x[i] = spp.rr[i];
            }

            for (i = 0; i < 10; i++)//迭代
            {
                nv = rescod(i, obs, nav, n, rs, dts, vare, azel, vsat, dcb, x, H_, v_, var, svh);
                if (nv < 4)
                {
                    break;        //nv是参与解算的实际卫星数
                }
                H = new matrix(nv, 4); v = new matrix(nv, 1); P = new matrix(nv, nv);
                for (j = 0; j < nv; j++)
                {
                    sig         = Math.Sqrt(var[j]);
                    v[j + 1, 1] = v_[j] / sig;
                    for (k = 1; k <= 4; k++)
                    {
                        H[j + 1, k] = H_[j + 1, k] / sig;
                    }
                }
                dx = matrix.inv(matrix.transp(H) * H) * matrix.transp(H) * v;
                Q  = matrix.transp(H) * H;

                for (j = 0; j < 4; j++)
                {
                    x[j] += dx[j + 1, 1];
                }

                if (Math.Sqrt(dx[1, 1] * dx[1, 1] + dx[2, 1] * dx[2, 1] + dx[3, 1] * dx[3, 1] + dx[4, 1] * dx[4, 1]) < 1E-4)
                {
                    spp.dtr = x[3] / CLIGHT;
                    for (j = 0; j < 3; j++)
                    {
                        spp.rr[j] = x[j];
                    }
                    spp.tcurr.gpsec = obs[0].t.gpsec - spp.dtr;
                    spp.tcur        = rtklibcmn.timeadd(obs[0].rtkt, -x[3] / CLIGHT);
                    for (j = 0; j < 6; j++)
                    {
                        spp.tcurr.calend[j] = obs[0].t.calend[j];
                    }

                    stat = valsol(azel, vsat, 15.0 * D2R, n, v, nv, 4);
                    return(stat);
                }
            }


            return(1);
        }