示例#1
0
        public IActionResult Orbit(string baseFile, string roverFile)
        {
            var navFile   = baseFile.Remove(11, 1) + "n";
            var GLnavFIle = baseFile.Remove(11, 1) + "g";

            var baseRoot  = Path.Combine(_environment.WebRootPath, "base\\", baseFile);
            var roverRoot = Path.Combine(_environment.WebRootPath, "rover\\", roverFile);
            var navRoot   = Path.Combine(_environment.WebRootPath, "base\\", navFile);
            var GLnavRoot = Path.Combine(_environment.WebRootPath, "base\\", GLnavFIle);

            makeEpoch(roverRoot, "rover"); //rover o파일 업로드
            makeEpoch(baseRoot, "base");   //base o파일 업로드
            svNavigation(navRoot);         //navigation 파일 업로드
            glnNavigation(GLnavRoot);      //glonass navigation file upload;

            var year   = int.Parse(baseFile.Substring(9, 2));
            var gpsday = int.Parse(baseFile.Substring(4, 3));

            var monthDay = calculateDay(gpsday, year);

            var month = monthDay[0];
            var day   = monthDay[1];

            var weekDay = (day + Math.Floor((month + 1) * 2.6) + year + Math.Floor((double)year / 4) - 36) % 7;


            FileRepository fileRepo = new FileRepository();
            var            commonSV = fileRepo.selectEachSVG(year, month, day); //공통 위성 추출

            var navList = new List <navigation>();

            for (int i = 0; i < commonSV.Count; i++)
            {
                commonSVcoordinate common = new commonSVcoordinate();

                var SVnum       = commonSV[i].num;
                var stationTime = 86400 * weekDay + commonSV[i].hour * 3600 + commonSV[i].minute * 60 + commonSV[i].second;

                var commonSVitem = commonSV[i];

                if (i == 0)
                {
                    navList = fileRepo.commonNavList(year, month, day, SVnum);
                }
                else if (SVnum != commonSV[i - 1].num)
                {
                    navList = fileRepo.commonNavList(year, month, day, SVnum);
                }
                else
                {
                }
                if (navList.Count > 0)
                {
                    var navigationItem = navList[0];

                    //여기서 부터 반복해서 계산
                    for (int j = 0; j < navList.Count; j++)
                    {
                        if (j == navList.Count - 1)
                        {
                            if (navList[j].toe <= stationTime)
                            {
                                navigationItem = navList[j];
                            }
                        }
                        else
                        {
                            if (navList[j].toe <= stationTime)
                            {
                                navigationItem = navList[j];
                                if (j == 2)
                                {
                                }
                            }
                        }
                    }

                    var svCoordinate = orbitCalculation(commonSVitem, navigationItem, stationTime);

                    common.year   = year;
                    common.month  = month;
                    common.day    = day;
                    common.hour   = commonSVitem.hour;
                    common.minute = commonSVitem.minute;
                    common.second = commonSVitem.second;
                    common.num    = commonSVitem.num;
                    common.type   = commonSVitem.type;
                    common.x      = svCoordinate[0];
                    common.y      = svCoordinate[1];
                    common.z      = svCoordinate[2];

                    fileRepo.AddSVcoord(common);
                }
            }

            var commonSVR = fileRepo.selectEachSVR(year, month, day);

            ViewData["year"]  = year.ToString();
            ViewData["month"] = month.ToString();
            ViewData["day"]   = day.ToString();
            ViewData["base"]  = baseFile.Substring(0, 4);

            //fileRepo.DeleteAll();
            return(View());
        }